Преглед на файлове

🐞 fix([drp-采购员上级采购经理匹配]): 导出、列表、一级分类调整

1.导出处理 2.一级分类详情反显3.树型多选分类

20240508362、20240507271、
002390 преди 1 година
родител
ревизия
2360f71c77

+ 33 - 3
src/components/popover-tree-select/multiple.vue

@@ -46,10 +46,21 @@ export default {
         };
       },
     },
+    // 是否只选择一级
     isFirst: {
       type: Boolean,
       default: false,
     },
+    // 标签是否可移除
+    closable: {
+      type: Boolean,
+      default: true,
+    },
+    // 支持详情编辑
+    isEdit: {
+      type: Boolean,
+      default: false,
+    },
   },
   components: {},
   data() {
@@ -80,10 +91,27 @@ export default {
         this.$emit("input", value);
       },
     },
+    defaultChecked: {
+      get() {
+        let {
+          $props: { isEdit },
+          lastSelectData,
+        } = this;
+        if (isEdit) {
+          return lastSelectData.map((item) => item.id);
+        }
+        return [];
+      },
+      set() {},
+    },
   },
   watch: {
     innerValue: {
       handler: function (newValue) {
+        if (this.$props.isEdit) {
+          this.lastSelectData = newValue;
+          return;
+        }
         if (!newValue) this.lastSelectData = [];
       },
     },
@@ -186,7 +214,7 @@ export default {
 </script>
 <template>
   <div class="popover-tree-select popover-tree-select--multiple">
-    <el-input v-bind="$attrs" @focus="open">
+    <el-input v-bind="$attrs" @focus="open" style="width: 100%">
       <i class="el-icon-search" slot="suffix" @click="open"> </i>
       <template slot-scope="{ item }">
         <p
@@ -248,7 +276,8 @@ export default {
           </el-input>
         </el-form-item>
         <el-form-item>
-          <el-button icon="el-icon-refresh" @click="useReset"></el-button>
+          <el-button icon="el-icon-search" @click="useQuery">搜索</el-button>
+          <el-button icon="el-icon-refresh" @click="useReset">重置</el-button>
         </el-form-item>
         <el-tree
           v-loading="loading"
@@ -260,6 +289,7 @@ export default {
           highlight-current
           ref="tree"
           node-key="id"
+          :default-checked-keys="defaultChecked"
           @check="useSelect($refs.tree.getCheckedNodes())"
         >
         </el-tree>
@@ -278,7 +308,7 @@ export default {
         v-for="(tag, index) in lastSelectData"
         :size="size"
         hit
-        closable
+        :closable="closable"
         @close="useDelete(index)"
         style="margin-right: 5px"
       >

+ 8 - 4
src/views/purchase/pu-match/columns.js

@@ -21,12 +21,12 @@ export default function useColumns() {
       }
     },
     {
-      item: { key: "classOneNameList", title: "一级分类", },
+      item: { key: "classOneObjectList", title: "一级分类", },
       attr: {
         is: "el-popover-multiple-tree-select",
         referName: "MATERIALCLASSIFY_PARAM",
-        placeholder: "请输入一级分类",
-        valueKey: "name",
+        // placeholder: "请输入一级分类",
+        // valueKey: "name",
         isFirst: true,
         defaultProps: {
           label: function (data, node) {
@@ -36,7 +36,11 @@ export default function useColumns() {
         },
         dataMapping: {
           classOneList: "code",
+          classOneNameList: "name"
         },
+        queryParams: (params) => ({
+          // id: 1
+        }),
         clearable: true,
       }
     },
@@ -64,7 +68,7 @@ export default function useColumns() {
       attr: {}
     },
     {
-      item: { key: "classOneName", title: "一级分类", },
+      item: { key: "classOneName", title: "一级分类", width: "auto" },
       attr: {
 
       }

+ 5 - 3
src/views/purchase/pu-match/details/columns.js

@@ -36,12 +36,12 @@ export default function useColumns() {
       }
     },
     {
-      item: { key: "classOneNameList", title: "一级分类", required: true, },
+      item: { key: "classOneObjectList", title: "一级分类", required: true, },
       attr: {
         is: "el-popover-multiple-tree-select",
         referName: "MATERIALCLASSIFY_PARAM",
-        placeholder: "请输入一级分类",
-        valueKey: "name",
+        // placeholder: "请输入一级分类",
+        // valueKey: "name",
         isFirst: true,
         defaultProps: {
           label: function (data, node) {
@@ -51,8 +51,10 @@ export default function useColumns() {
         },
         dataMapping: {
           classOneList: "code",
+          classOneNameList: "name"
         },
         clearable: true,
+        isEdit: true,
       }
     },
     {

+ 6 - 2
src/views/purchase/pu-match/details/index.vue

@@ -19,6 +19,8 @@ export default {
   },
   components: {
     ElSuperForm: () => import("@/components/super-form/index.vue"),
+    ElPopoverMultipleTreeSelect: () =>
+      import("@/components/popover-tree-select/multiple.vue"),
   },
   data() {
     const { FormColumns } = useColumns();
@@ -90,6 +92,7 @@ export default {
       this.$emit("refresh");
     },
     useSave(prop) {
+      console.log(this.params,"params");
       this.$refs[prop].$refs[prop].validate(async (valid) => {
         if (valid) {
           try {
@@ -163,15 +166,16 @@ export default {
       style="padding: 20px"
       :disabled="addType === 'see'"
     >
-      <!-- <template slot="puOrgName" slot-scope="scope">
+      <template slot="classOneObjectList" slot-scope="scope">
         <component
           v-bind="scope.attr"
           v-model="scope.row[scope.item.key]"
           :size="$attrs.size"
           :source.sync="scope.row"
+          :closable="addType !== 'see'"
         >
         </component
-      ></template> -->
+      ></template>
     </el-super-form>
   </el-drawer>
 </template>

+ 29 - 22
src/views/purchase/pu-match/fun-button/daochu/index.vue

@@ -29,29 +29,36 @@ export default {
   },
   methods: {
     async useClick() {
-      try {
-        this.$modal.loading("正在导出数据,请稍后...");
-        let { selectData, params } = this.$props;
+      let { selectData, params } = this.$props;
+      console.log(params, "params");
+      this.download(
+        "/pu/match/export",
+        { ...params },
+        `采购员上级采购经理匹配表${new Date().getTime()}.xlsx`
+      );
+      // try {
+      //   this.$modal.loading("正在导出数据,请稍后...");
+      //   let { selectData, params } = this.$props;
 
-        let res = await EXPORT({ ...params });
-        if (res) {
-          const blob = new Blob([res], {
-            type: "application/vnd.ms-excel;charset=UTF-8",
-          }); // 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
-          const downloadElement = document.createElement("a"); //创建a标签
-          const href = window.URL.createObjectURL(blob); // 创建下载的链接
-          downloadElement.href = href; //下载地址
-          downloadElement.download =
-            "采购员上级采购经理匹配表" + new Date().getTime() + ".xlsx"; // 下载后文件名
-          document.body.appendChild(downloadElement);
-          downloadElement.click(); // 点击下载
-          document.body.removeChild(downloadElement); // 下载完成移除元素
-          window.URL.revokeObjectURL(href); // 释放blob对象s
-        }
-      } catch (error) {
-      } finally {
-        this.$modal.closeLoading();
-      }
+      //   let res = await EXPORT({ ...params });
+      //   if (res) {
+      //     const blob = new Blob([res], {
+      //       type: "application/vnd.ms-excel;charset=UTF-8",
+      //     }); // 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
+      //     const downloadElement = document.createElement("a"); //创建a标签
+      //     const href = window.URL.createObjectURL(blob); // 创建下载的链接
+      //     downloadElement.href = href; //下载地址
+      //     downloadElement.download =
+      //       "采购员上级采购经理匹配表" + new Date().getTime() + ".xlsx"; // 下载后文件名
+      //     document.body.appendChild(downloadElement);
+      //     downloadElement.click(); // 点击下载
+      //     document.body.removeChild(downloadElement); // 下载完成移除元素
+      //     window.URL.revokeObjectURL(href); // 释放blob对象s
+      //   }
+      // } catch (error) {
+      // } finally {
+      //   this.$modal.closeLoading();
+      // }
     },
   },
   created() {},