Преглед изворни кода

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!105
黄梓星 пре 2 година
родитељ
комит
9588cc9562

+ 3 - 0
src/components/DictTag/index.vue

@@ -45,6 +45,9 @@ export default {
       }
     },
   },
+  created(){
+    console.log(this.$props.options,'options');
+  }
 };
 </script>
 <style scoped>

+ 18 - 3
src/components/popover-select/index.vue

@@ -97,9 +97,18 @@ export default {
     };
   },
   computed: {
-    innerValue() {
-      const { value, multiple } = this.$props;
-      return multiple ? "" : value;
+    // innerValue() {
+    //   const { value, multiple } = this.$props;
+    //   return multiple ? "" : value;
+    // },
+    innerValue:{
+      get(){
+        const { value, multiple } = this.$props;
+        return multiple ? "" : value;
+      },
+      set(val){
+        this.$emit("input", val);
+      }
     },
     TableColumnTemp() {
       const { type } = this.$props;
@@ -222,6 +231,11 @@ export default {
         this.selectData = prop;
       }
     },
+    handleClear(){
+      if(!this.$props.multiple){
+        this.innerValue = '';
+      }
+    }
   },
   created() {},
   mounted() {},
@@ -237,6 +251,7 @@ export default {
       :readonly="readonly"
       :clearable="clearable"
       :placeholder="placeholder"
+      @clear="handleClear"
     >
       <el-button
         :disabled="disabled"

+ 5 - 4
src/components/popover-tree-select/index.vue

@@ -97,6 +97,7 @@ export default {
   watch: {
     "$props.value": {
       handler: function (newProp) {
+        console.log("newProp", newProp);
         if (!newProp) this.lastSelectData = [];
       },
       immediate: true,
@@ -310,7 +311,7 @@ export default {
         overflow: hidden;
       "
     >
-      <div v-if="multiple && selectData.length">
+      <div v-if="multiple && lastSelectData.length">
         <el-popover
           :offset="-10"
           :width="width"
@@ -321,10 +322,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
@@ -332,7 +333,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)"
           >

+ 47 - 65
src/views/purchase/PurchaseDemandList/add.vue

@@ -162,7 +162,6 @@
           fit
           max-height="300"
           @selection-change="handleSelectionChange"
-          :key="refreshData"
         >
           <el-table-column show-overflow-tooltip type="selection"/>
           <el-table-column show-overflow-tooltip label="序号" type="index" align="center"/>
@@ -199,31 +198,6 @@
               </el-form-item>
             </template>
           </el-table-column>
-          <el-table-column show-overflow-tooltip label="预留比例" align="center" prop="reservedProportion" width="150px">
-            <template slot-scope="scope">
-              <el-form-item class="hang">
-                <el-select clearable :disabled="sonDisable" size="small" v-model="scope.row.reservedProportion" @change="getYLSL(scope.$index,scope.row.reservedProportion)">
-                  <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
-                  </el-option>
-                </el-select>
-                <!-- <el-input v-model="scope.row.reservedProportion"/> -->
-              </el-form-item>
-            </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip label="预留周期" align="center" prop="reservedPeriod" width="150px">
-            <template slot-scope="scope">
-              <el-form-item class="hang">
-                <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.reservedPeriod"/>
-              </el-form-item>
-            </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip label="预留数量" align="center"  prop="reservedQty" width="150px">
-            <template slot-scope="scope">
-              <el-form-item class="hang">
-                <el-input readonly size="small" v-model="scope.row.reservedQty"/>
-              </el-form-item>
-            </template>
-          </el-table-column>
           <el-table-column show-overflow-tooltip label="采购员名称" align="center" prop="buyerName" width="120px"/>
           <el-table-column show-overflow-tooltip label="采购员" align="center"  prop="buyer"/>
           <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="230px">
@@ -260,11 +234,36 @@
               </el-form-item>
             </template>
           </el-table-column>
+            <el-table-column show-overflow-tooltip label="预留比例" align="center" prop="reservedProportion" width="150px">
+              <template slot-scope="scope">
+                <el-form-item class="hang">
+                  <el-select clearable :disabled="sonDisable" size="small" v-model="scope.row.reservedProportion" @change="getYLSL(scope)">
+                    <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
+                    </el-option>
+                  </el-select>
+                  <!-- <el-input v-model="scope.row.reservedProportion"/> -->
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <el-table-column show-overflow-tooltip label="预留周期" align="center" prop="reservedPeriod" width="150px">
+              <template slot-scope="scope">
+                <el-form-item class="hang">
+                  <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.reservedPeriod"/>
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <el-table-column show-overflow-tooltip label="预留数量" align="center"  prop="reservedQty" width="150px">
+              <template slot-scope="scope">
+                <el-form-item class="hang">
+                  <el-input readonly size="small" v-model="scope.row.reservedQty"/>
+                </el-form-item>
+              </template>
+            </el-table-column>
           <el-table-column show-overflow-tooltip label="月均销量" align="center"  prop="averageQtyMonth" width="120px"/>
           <el-table-column show-overflow-tooltip label="实际(业务)需求量" align="center"  prop="qty" width="120px">
             <template slot-scope="scope">
               <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'qty'" :rules="{ required: true, message: '请填写实际(业务)需求量', trigger: 'blur' }">
-                <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.qty" @blur="getYL(scope.$index, scope.row.qty)"/>
+                <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.qty" @input="getYLSL(scope)"/>
               </el-form-item>
             </template>
           </el-table-column>
@@ -540,11 +539,11 @@ export default {
         isPage: true,
         title: '',
       },
-      referConditionMx: {
-        type: '',
-        isPage: true,
-        title: '',
-      },
+      // referCondition: {
+      //   type: '',
+      //   isPage: true,
+      //   title: '',
+      // },
       tableIndex: null,
       orgOptions: [],
       personOptions: [],
@@ -602,25 +601,8 @@ export default {
       }
     },
     // 获取预留数量
-    getYLSL(index,val) {
-      if (val) {
-      let newVal = val.replace('%', '')
-      newVal = newVal/100
-      this.basicForm.puDemandItemList[index].reservedQty = newVal * this.basicForm.puDemandItemList[index].qty
-      } else {
-        this.basicForm.puDemandItemList[index].reservedQty = null
-      }
-    },
-    // 实际业务需求量获取
-    getYL(index, val) {
-      if (this.basicForm.puDemandItemList[index].qty && this.basicForm.puDemandItemList[index].reservedProportion) {
-        let newVal = this.basicForm.puDemandItemList[index].reservedProportion.replace('%', '')
-        newVal = newVal/100
-        // this.$set(this.basicForm.puDemandItemList[index].reservedQty, this.basicForm.puDemandItemList[index].qty * newVal)
-        this.basicForm.puDemandItemList[index].reservedQty = this.basicForm.puDemandItemList[index].qty * newVal
-      } else {
-        this.basicForm.puDemandItemList[index].reservedQty = null
-      }
+    getYLSL(scope) {
+      scope.row.reservedQty = scope.row.reservedProportion.replace('%', '') / 100 * scope.row.qty
     },
     copy() {
       this.$modal.msgSuccess("复制成功");
@@ -902,25 +884,25 @@ export default {
         this.deptOptions = selection
         this.basicForm.demandDept = selection[0].id
       }
-      // if(this.referConditionMx.type == 'DEPT_PARAM') {
+      // if(this.referCondition.type == 'DEPT_PARAM') {
       //   this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].code
       //   this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].name
       // }
-      if(this.referConditionMx.title == '选择收货仓库') {
+      if(this.referCondition.title == '选择收货仓库') {
         this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = selection[0].id
         this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = selection[0].name
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
       }
-      if(this.referConditionMx.title == '选择收货货位') {
+      if(this.referCondition.title == '选择收货货位') {
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = selection[0].id
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = selection[0].name
       }
-      if(this.referConditionMx.title == '选择补单供应商') {
+      if(this.referCondition.title == '选择补单供应商') {
         this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = selection[0].code
         this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = selection[0].name
       }
-      if(this.referConditionMx.title == '选择收货地址') {
+      if(this.referCondition.title == '选择收货地址') {
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = selection[0].name
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = selection[0].code
         this.basicForm.puDemandItemList[this.tableIndex].contacts = selection[0].contactsName
@@ -1002,21 +984,21 @@ export default {
     // 明细行选择业务部门参照带出业务部门数据
     chooseDept(index, type, isPage, title) {
       this.tableIndex = index
-      this.referConditionMx.type = type
-      this.referConditionMx.isPage = isPage
-      this.referConditionMx.title = title
-      this.$refs.refer.init(this.referConditionMx)
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
+      this.$refs.refer.init(this.referCondition)
     },
     // 明细行选择业务部门参照带出业务部门数据
     choosehuoWei(index, type, isPage, title, stordocId) {
       this.tableIndex = index
-      this.referConditionMx.type = type
-      this.referConditionMx.isPage = isPage
-      this.referConditionMx.title = title
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
       // 选择收货货位前先选择收货仓库
       if(stordocId) {
-        this.referConditionMx.stordocId = stordocId
-        this.$refs.refer.init(this.referConditionMx)
+        this.referCondition.stordocId = stordocId
+        this.$refs.refer.init(this.referCondition)
       } else {
         this.$modal.msgWarning("请先选择收货仓库");
       }

+ 21 - 26
src/views/purchase/purchase-order/add/index.vue

@@ -215,12 +215,12 @@ export default {
     },
     // 取消
     handleCancel() {
-      this.setVisible(false);
       this.params = {
         ...initParams(this.columns),
         puOrderItemList: [],
         puOrderExecuteList: [],
       };
+      this.setVisible(false);
     },
     // 判断保存条件
     judgeSaveCondition(cb){
@@ -269,33 +269,28 @@ export default {
     },
     // 保存并新增
     async handleSubmit() {
-      this.$refs["orderAddForm"].validate(async (valid) => {
-        if (valid) {
-          try {
-            const createById = this.params.buyer;
-            const createByName = this.params.buyerName;
-            const updateById = this.$store.state.user.id;
-            const updateByName = this.$store.state.user.name;
-            const { code, msg } = await orderApi.create({
-              createById,
-              createByName,
-              updateById,
-              updateByName,
-              ...this.params,
-            });
-            if (code === 200) {
-              this.setVisible(false);
-            }
-          } catch (err) {
-            this.$notify.error({ title: "error", message: err });
-          } finally {
-            // this.setVisible(false);
+      this.judgeSaveCondition(async()=>{
+        try {
+          const createById = this.params.buyer;
+          const createByName = this.params.buyerName;
+          const updateById = this.$store.state.user.id;
+          const updateByName = this.$store.state.user.name;
+          const { code, msg } = await orderApi.create({
+            createById,
+            createByName,
+            updateById,
+            updateByName,
+            ...this.params,
+          });
+          if (code === 200) {
+            this.setVisible(false);
           }
-        } else {
-          console.log("error submit!!");
-          return false;
+        } catch (err) {
+          this.$notify.error({ title: "error", message: err });
+        } finally {
+          // this.setVisible(false);
         }
-      });
+      })
     },
     // 子表参照改变之后
     handleReferChange(val, source, type) {

+ 1 - 1
src/views/purchase/purchase-order/edit/index.vue

@@ -152,12 +152,12 @@ export default {
     },
     // 取消
     handleCancel() {
-      this.setVisible(false);
       this.params = {
         ...initParams(this.columns),
         puOrderItemList: [],
         puOrderExecuteList: [],
       }
+      this.setVisible(false);
     },
     // 判断保存条件
     judgeSaveCondition(cb){

+ 6 - 1
src/views/purchase/purchase-order/index.vue

@@ -199,7 +199,6 @@ export default {
         }
 
       } catch (error) {
-
       } finally {
       }
     },
@@ -347,6 +346,7 @@ export default {
                 <el-input v-if="column.inputType === 'Input'" 
                   v-model="params[column.key]" 
                   :placeholder="column.placeholder"
+                  @keyup.enter.native="fetchList(params, page)"
                 ></el-input>
                 <dr-popover-select v-if="column.inputType === 'PopoverSelect'"
                   v-model="params[column.key]"
@@ -359,6 +359,8 @@ export default {
                   :placeholder="column.placeholder"
                   :data-mapping="column.dataMapping"
                   :query-params="column.queryParams"
+                  :clearable="column.clearable"
+                  @keyup.enter.native="fetchList(params, page)"
                 ></dr-popover-select>
                 <!-- @keyup.enter.native="useQuery(params, page)" -->
 
@@ -370,6 +372,7 @@ export default {
                 :multiple="column.multiple"
                 :collapse-tags="column.tags"
                 style="width: 100%"
+                @keyup.enter.native="fetchList(params, page)"
                 >
                 <el-option 
                   v-for="item in dict.type[column.referName]" 
@@ -385,6 +388,7 @@ export default {
                 :clearable="column.clearable" 
                 :placeholder="column.placeholder" 
                 style="width: 100%"
+                @keyup.enter.native="fetchList(params, page)"
                 >
                 <el-option key="N" label="否" value="N"></el-option>
                 <el-option key="Y" label="是" value="Y"></el-option>
@@ -402,6 +406,7 @@ export default {
                 :start-placeholder="column.startPlaceholder"
                 :clearable="column.clearable"
                 style="width: 100%"
+                @keyup.enter.native="fetchList(params, page)"
               >
               </el-date-picker>
               </el-form-item>

+ 7 - 1
src/views/purchase/purchase-order/see/index.vue

@@ -45,11 +45,17 @@ export default {
   computed: {},
   watch: {},
   methods: {
+    
     setVisible(prop) {
+
       this.visible = prop;
+
       if(!this.visible){
+
         this.$refs['orderSeeForm'].clearValidate();
+
       }
+
     },
 
     //查询详情
@@ -68,8 +74,8 @@ export default {
     },
     // 取 消
     handleCancel() {
-      this.setVisible(false);
       this.params = initParams(Columns);
+      this.setVisible(false);
     },
     handleRefresh(){
       let {id} = this.params;

+ 1 - 1
src/views/purchase/task/first-direct/index.vue

@@ -58,7 +58,7 @@ export default {
         if (code === 200) {
           this.hide();
           this.$emit("success");
-          this.$notify.success({ title: msg });
+          this.$notify.success({ title: msg, duration: 0 });
         } else {
           this.$notify.warning({ title: msg });
         }

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

@@ -47,8 +47,6 @@ export default {
         if (code === 200) {
           this.tableData = rows;
           this.page.total = total;
-        } else {
-          this.$notify.warning({ title: msg });
         }
       } catch (err) {
         // catch
@@ -58,17 +56,23 @@ export default {
       }
     },
     // 查 询
-    useQuery(prop, page) {
+    async useQuery(prop, page) {
       const { pageNum, pageSize } = page;
-      const { date, documentsCodes } = prop;
-      prop.endDate = date[1];
-      prop.startDate = date[0];
-      prop.documentsCodes = documentsCodes
-        ? documentsCodes.split(",")
-        : undefined;
-      this.fetchList(
-        { ...prop, date: undefined },
-        { pageNum, pageSize, isAsc: "desc", orderByColumn: "createTime" }
+      const {
+        date: [startDate, endDate],
+        documentsCodes,
+      } = prop;
+      await this.fetchList(
+        {
+          ...prop,
+          endDate,
+          startDate,
+          date: undefined,
+          documentsCodes: documentsCodes
+            ? documentsCodes.replace(/\s*/g, "").replaceAll(",", ",")
+            : undefined,
+        },
+        { pageNum, pageSize, isAsc: "desc", orderByColumn: "updateTime" }
       );
     },
     // 重 置
@@ -157,7 +161,6 @@ export default {
               :clearable="column.clearable"
               :placeholder="column.placeholder"
               style="width: 100%"
-              @change="useQuery(params, page)"
               @keyup.enter.native="useQuery(params, page)"
             ></el-input>
             <el-select

+ 9 - 2
src/views/purchase/transferOrder/add.vue

@@ -254,7 +254,7 @@
           <el-table-column show-overflow-tooltip label="数量" align="center" prop="qty" width="150px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input :readonly="sonDisable" size="small" v-model="scope.row.qty"/>
+                <el-input :readonly="sonDisable" clearable size="small" v-model="scope.row.qty" @input="getSL(scope)"/>
               </el-form-item>
             </template>
           </el-table-column>
@@ -263,7 +263,7 @@
           <el-table-column show-overflow-tooltip label="主数量" align="center" prop="mainQty" width="150px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input :readonly="sonDisable" size="small" v-model="scope.row.mainQty"/>
+                <el-input :readonly="sonDisable" clearable size="small" v-model="scope.row.mainQty" @input="getZSL(scope)"/>
               </el-form-item>
             </template>
           </el-table-column>
@@ -716,6 +716,13 @@ export default {
     }
   },
   methods: {
+    // 输入数量或者主数量同步改变
+    getZSL(scope) {
+      scope.row.qty = scope.row.mainQty
+    },
+    getSL(scope) {
+      scope.row.mainQty = scope.row.qty
+    },
     copy() {
 
     },