002201 2 жил өмнө
parent
commit
fbda782c91

+ 0 - 7
src/components/computed-input/index.vue

@@ -1,11 +1,4 @@
 <template>
-  <!-- <el-input
-    v-model="value"
-    readonly
-    :size="size"
-    :placeholder="placeholder"
-    style="width: 100%"
-  ></el-input> -->
   <span>{{ value || "- -" }}</span>
 </template>
 

+ 8 - 0
src/components/popover-select/components/MATERIAL_PARAM.js

@@ -29,4 +29,12 @@ export default [
     type: "Input",
     search: true,
   },
+  {
+    key: "registrationNo",
+    title: "注册证号",
+    type: "ComputedInput",
+    computed: (prop) => {
+      return prop.materialMedcine.registrationNo;
+    },
+  },
 ];

+ 53 - 36
src/components/popover-select/index.vue

@@ -1,5 +1,6 @@
 <script>
 import { REFER } from "./api/index";
+import deepCopy from "@gby/deep-copy";
 export default {
   name: "PopoverSelect",
   props: {
@@ -92,6 +93,7 @@ export default {
       },
       data: [],
       selectData: [],
+      lastSelectData: [],
     };
   },
   computed: {
@@ -108,23 +110,25 @@ export default {
   watch: {
     "$props.value": {
       handler: function (newProp) {
-        if (!newProp) this.selectData = [];
+        if (!newProp) this.lastSelectData = [];
       },
       immediate: true,
     },
   },
   methods: {
+    //
+    emitChange(prop) {
+      const { type, source, multiple } = this.$props;
+      this.$emit("change", multiple ? prop : prop[0], source, type);
+    },
     // open dialog
     async open() {
       this.visible = true;
       await this.useReset();
-      console.log("open", this.selectData);
     },
     // hide dialog
     async hide() {
       this.visible = false;
-      // this.$emit("input", []);
-      console.log("hide", this.selectData);
     },
     // fetch list
     async fetchList(prop, page) {
@@ -141,11 +145,12 @@ export default {
         }
       } catch (err) {
         //
+        console.error(err);
       } finally {
         this.loading = false;
       }
     },
-    // reset list
+    // reset
     async useReset() {
       const { type, source, queryParams } = this.$props;
       this.model = {
@@ -156,53 +161,64 @@ export default {
       };
       await this.fetchList(this.model, this.page);
     },
-    // query list
+    // query
     async useQuery() {
       await this.fetchList(this.model, this.page);
     },
+    // cancel
+    useCancel(prop) {
+      const { multiple } = this.$props;
+      this.useUpdate(multiple ? prop : prop[0]);
+      this.hide();
+    },
     // confirm
-    async useConfirm(prop) {
+    useConfirm(prop) {
       const { multiple } = this.$props;
-      await this.hide();
-      await this.useUpdate(multiple ? prop : prop[0]);
+      this.useUpdate(multiple ? prop : prop[0]);
+      this.emitChange(this.selectData);
+      this.lastSelectData = deepCopy(this.selectData);
+      this.hide();
     },
-    // delete tag
+    // delete
     useDelete(prop) {
       this.selectData.splice(prop, 1);
       this.useUpdate(this.selectData);
+      this.emitChange(this.selectData);
+      this.lastSelectData = deepCopy(this.selectData);
     },
     // update
     useUpdate(prop) {
-      const { source, multiple, valueKey, dataMapping, type } = this.$props;
-      // update v-model
-      const vModel = multiple
-        ? prop.map((item) => item[valueKey])
-        : prop[valueKey];
-      this.$emit("input", vModel);
+      const { source, multiple, valueKey, dataMapping } = this.$props;
       // update data mapping
-      for (let key in dataMapping) {
-        source[key] = prop[dataMapping[key]];
+      if (multiple) {
+        const vModel = prop.map((item) => item[valueKey]);
+        this.$emit("input", vModel);
+      } else {
+        const vModel = prop[valueKey];
+        this.$emit("input", vModel);
+        for (let key in dataMapping) {
+          source[key] = prop[dataMapping[key]];
+        }
+        this.$emit("update:source", source);
       }
-      this.$emit("update:source", source);
-      // emit change
-      this.$emit("change", prop, type, source);
     },
     // row click
-    rowClick(prop) {
+    onceClick(prop) {
       const { multiple } = this.$props;
       // 单选
       if (!multiple) this.$refs.multipleTable.clearSelection();
       [prop].forEach((row) => this.$refs.multipleTable.toggleRowSelection(row));
     },
     // row double click
-    // async rowDblclick(prop) {
-    //   const { multiple } = this.$props;
-    //   if (!multiple) await this.useConfirm([prop]);
-    // },
+    doubleClick(prop) {
+      const { multiple } = this.$props;
+      if (!multiple) this.useConfirm([prop]);
+    },
     // selection change
     selectionChange(prop) {
-      this.selectData = prop;
-      console.log("selectionChange", prop);
+      if (prop && prop.length) {
+        this.selectData = prop;
+      }
     },
   },
   created() {},
@@ -234,7 +250,6 @@ export default {
       :close-on-click-modal="false"
       :close-on-press-escape="false"
       append-to-body
-      @close="hide"
     >
       <el-form
         v-loading="loading"
@@ -261,8 +276,8 @@ export default {
           height="45vh"
           highlight-current-row
           style="width: 100%; margin-bottom: 20px"
-          @row-click="rowClick"
-          @row-dblclick="useConfirm([$event])"
+          @row-click="onceClick"
+          @row-dblclick="doubleClick"
           @selection-change="selectionChange"
         >
           <el-table-column
@@ -301,7 +316,9 @@ export default {
         />
       </el-form>
       <div style="margin-top: 20px; text-align: right">
-        <el-button :size="size" @click="hide"> 取 消 </el-button>
+        <el-button :size="size" @click="useCancel(lastSelectData)">
+          取 消
+        </el-button>
         <el-button :size="size" @click="useConfirm(selectData)">
           确 定
         </el-button>
@@ -317,7 +334,7 @@ export default {
         overflow: hidden;
       "
     >
-      <div v-if="multiple && selectData.length">
+      <div v-if="multiple && lastSelectData.length">
         <el-popover
           :offset="-10"
           :width="width"
@@ -328,10 +345,10 @@ export default {
           placement="bottom-start"
         >
           <el-tag slot="reference" :size="size" style="margin-right: 10px">
-            + {{ selectData.length }}
+            + {{ lastSelectData.length }}
           </el-tag>
           <el-tag
-            v-for="(tag, index) in selectData"
+            v-for="(tag, index) in lastSelectData"
             :size="size"
             hit
             closable
@@ -339,7 +356,7 @@ export default {
               display: 'flex',
               justifyContent: 'space-between',
               alignItems: 'center',
-              margin: selectData.length - 1 === index ? '0' : '0 0 5px 0',
+              margin: lastSelectData.length - 1 === index ? '0' : '0 0 5px 0',
             }"
             @close="useDelete(index)"
           >

+ 40 - 23
src/components/popover-tree-select/index.vue

@@ -1,5 +1,6 @@
 <script>
 import { REFER } from "./api/index";
+import deepCopy from "@gby/deep-copy";
 export default {
   name: "PopoverTreeSelect",
   props: {
@@ -75,6 +76,7 @@ export default {
       },
       data: [],
       selectData: [],
+      lastSelectData: [],
       defaultProps: {
         label: "name",
         children: "children",
@@ -95,12 +97,17 @@ export default {
   watch: {
     "$props.value": {
       handler: function (newProp) {
-        if (!newProp) this.selectData = [];
+        if (!newProp) this.lastSelectData = [];
       },
       immediate: true,
     },
   },
   methods: {
+    //
+    emitChange(prop) {
+      const { type, source, multiple } = this.$props;
+      this.$emit("change", multiple ? prop : prop[0], source, type);
+    },
     // open dialog
     async open() {
       this.visible = true;
@@ -114,7 +121,7 @@ export default {
     async fetchList(prop) {
       try {
         this.loading = true;
-        const { code, rows, total } = await REFER(prop);
+        const { code, rows } = await REFER(prop);
         if (code === 200) {
           this.data = rows;
         }
@@ -141,43 +148,53 @@ export default {
     async useQuery() {
       await this.fetchList(this.model);
     },
+    // cancel
+    useCancel(prop) {
+      const { multiple } = this.$props;
+      this.useUpdate(multiple ? prop : prop[0]);
+      this.hide();
+    },
     // confirm
-    async useConfirm(prop) {
+    useConfirm(prop) {
       const { multiple } = this.$props;
-      await this.hide();
-      await this.useUpdate(multiple ? prop : prop[0]);
+      this.useUpdate(multiple ? prop : prop[0]);
+      this.emitChange(this.selectData);
+      this.lastSelectData = deepCopy(this.selectData);
+      this.hide();
     },
     // delete tag
     useDelete(prop) {
       this.selectData.splice(prop, 1);
       this.useUpdate(this.selectData);
+      this.emitChange(this.selectData);
+      this.lastSelectData = deepCopy(this.selectData);
     },
     // update
     useUpdate(prop) {
       const { source, multiple, valueKey, dataMapping, type } = this.$props;
-      // update v-model
-      const vModel = multiple
-        ? prop.map((item) => item[valueKey])
-        : prop[valueKey];
-      this.$emit("input", vModel);
       // update data mapping
-      for (let key in dataMapping) {
-        source[key] = prop[dataMapping[key]];
+      if (multiple) {
+        const vModel = prop.map((item) => item[valueKey]);
+        this.$emit("input", vModel);
+      } else {
+        const vModel = prop[valueKey];
+        this.$emit("input", vModel);
+        for (let key in dataMapping) {
+          source[key] = prop[dataMapping[key]];
+        }
+        this.$emit("update:source", source);
       }
-      this.$emit("update:source", source);
-      // emit change
-      this.$emit("change", prop, type, source);
     },
     // click select row data
-    handleSelect(data) {
-      this.selectData = [data];
+    onceSelect(prop) {
+      if (prop) this.selectData = [prop];
     },
     // double click select row data and confirm
-    handleDoubleClickSelect(row) {
-      this.useConfirm([row]);
+    doubleSelect(prop) {
+      this.useConfirm([prop]);
     },
     // multiple select row data
-    handleMultipleSelect(prop, data) {
+    selectionChange(prop, data) {
       if (prop) {
         this.selectData.push(data);
       } else {
@@ -249,7 +266,7 @@ export default {
           <el-checkbox
             v-model="data.checked"
             @click.native.stop
-            @change="handleMultipleSelect($event, data)"
+            @change="selectionChange($event, data)"
             style="margin: 0 5px 0 0"
           >
           </el-checkbox>
@@ -267,8 +284,8 @@ export default {
           <div slot-scope="{ node, data }">
             <el-radio
               :label="data.code"
-              @click.native.stop="handleSelect(data)"
-              @dblclick.native.stop="handleDoubleClickSelect(data)"
+              @click.native.stop="onceSelect(data)"
+              @dblclick.native.stop="doubleSelect(data)"
               style="margin: 0 5px 0 0"
             >
               {{ data.name }}

+ 3 - 2
src/views/purchase/task/column.js

@@ -1,5 +1,6 @@
 export const TableColumns = [
   { key: "code", title: "订单生成单号", width: 250 },
+  { key: "demandCode", title: "需求单号", width: 250 },
   { key: "materialCode", title: "物料编码" },
   { key: "materialName", title: "物料名称" },
   // { key: "material", title: "物料" },
@@ -7,10 +8,10 @@ export const TableColumns = [
   { key: "manufacturerName", title: "生产厂家" },
   { key: "puQty", title: "采购数量" },
   {
-    key: "priceinputType",
+    key: "priceType",
     title: "价格类型",
     inputType: "Select",
-    referName: "sys_price_inputType",
+    referName: "sys_price_type",
   },
   { key: "puUnitName", title: "采购单位" },
   // { key: "id", title: "主键" },

+ 2 - 0
src/views/purchase/task/first-direct/column.js

@@ -12,6 +12,8 @@ export const TableColumns = [
   { key: "tax", title: "税率" },
   { key: "taxFreePrice", title: "无税单价" },
   { key: "taxPrice", title: "主含税单价" },
+  { key: "executeQty", title: "已执行数量" },
+  { key: "residueQty", title: "未执行数量" },
   {
     key: "purchaseQuantity",
     title: "本次采购数量",

+ 16 - 16
src/views/purchase/task/index.vue

@@ -36,11 +36,7 @@ export default {
     async fetchList(prop, page) {
       try {
         this.loading = true;
-        const { pageNum, pageSize } = page;
-        const { code, rows, total } = await LIST(
-          { ...prop },
-          { pageNum, pageSize }
-        );
+        const { code, rows, total } = await LIST(prop, page);
         if (code === 200) {
           this.tableData = rows;
           this.page.total = total;
@@ -56,6 +52,7 @@ export default {
     },
     // 查 询
     useQuery(prop, page) {
+      const { pageNum, pageSize } = page;
       const { date, documentsCodes } = prop;
       prop.endDate = date[1];
       prop.startDate = date[0];
@@ -63,13 +60,8 @@ export default {
         ? documentsCodes.split(",")
         : undefined;
       this.fetchList(
-        {
-          ...prop,
-          isAsc: "desc",
-          date: undefined,
-          orderByColumn: "createTime",
-        },
-        page
+        { ...prop, date: undefined },
+        { pageNum, pageSize, isAsc: "desc", orderByColumn: "createTime" }
       );
     },
     // 重 置
@@ -80,7 +72,16 @@ export default {
     },
     // 选 择
     useSelect(prop) {
-      this.selectData = prop;
+      if (prop && prop.length) {
+        // const lastIndex = prop.length - 1;
+        // const { status } = prop[lastIndex];
+        // if (status === "1") {
+        //   this.selectData.splice(lastIndex, 1);
+        // } else {
+        this.selectData = prop;
+        // }
+      }
+      console.log(this.selectData);
     },
     // 行 关
     async useClose(prop) {
@@ -206,7 +207,6 @@ export default {
               :readonly="column.readonly"
               :value-key="column.valueKey"
               :placeholder="column.placeholder"
-              :data-mapping="column.dataMapping"
               @change="useQuery(params, page)"
               @keyup.enter.native="useQuery(params, page)"
             >
@@ -218,11 +218,11 @@ export default {
               :title="column.title"
               :type="column.referName"
               :multiple="column.multiple"
-              :show-key="column.showKey"
               :value-key="column.valueKey"
               :placeholder="column.placeholder"
-              :data-mapping="column.dataMapping"
               :query-params="column.queryParams"
+              @change="useQuery(params, page)"
+              @keyup.enter.native="useQuery(params, page)"
             >
             </dr-popover-tree-select>
           </el-form-item>