Browse Source

Merge remote-tracking branch 'origin/dev' into dev

001295 1 year ago
parent
commit
2798155b82

+ 7 - 0
src/api/classify/basic.js

@@ -49,3 +49,10 @@ export function downLoadClassify(data) {
     responseType: 'blob'
   })
 }
+export function getProductLineList(data) {
+  return request({
+    url: `/system/classify/getProductLineList`,
+    method: 'post',
+    data: data
+  })
+}

+ 14 - 33
src/views/material/classify/index.vue

@@ -194,6 +194,7 @@ import {
   delClassify,
   edit,
   downLoadClassify,
+  getProductLineList,
 } from "@/api/classify/basic";
 import Treeselect from '@riophae/vue-treeselect';
 import '@riophae/vue-treeselect/dist/vue-treeselect.css';
@@ -267,38 +268,8 @@ export default {
       //   componentsName: '', //组件名称
       //   componentsCode: '', //组件编码
       // },
-      productOptions: [{
-        id: 1,
-        label: "介入产品线"
-      },{
-        id: 2,
-        label: "骨科产品线"
-      },{
-        id :3,
-        label: "检验产品线"
-      },{
-        id: 4,
-        label: "综合耗材产品线",
-        children: [{
-          id: 5,
-          label: "消毒管控"
-        },{
-          id: 6,
-          label: "血统"
-        },{
-          id: 7,
-          label: "麻醉"
-        },{
-          id: 8,
-          label: "护理"
-        },{
-          id: 9,
-          label: "外科"
-        }]
-      },{
-        id: 10,
-        label: "设备产品线"
-      }],
+      // 产品线参照
+      productOptions: [],
     };
   },
   watch: {
@@ -308,7 +279,7 @@ export default {
   },
   created() {
     this.getTreeData();
-    //
+    this.getProductLine({});
   },
   mounted() {},
   methods: {
@@ -550,6 +521,16 @@ export default {
     submitFile() {
       this.$refs.upload.submit();
     },
+    // 获取产品线参照
+    getProductLine(data) {
+      getProductLineList(data).then(res => {
+        if (res.code === 200) {
+          this.productOptions = res.data;
+        } else {
+          this.$modal.error("获取产品线参照失败!");
+        }
+      })
+    }
   },
 };
 </script>

+ 70 - 80
src/views/purchase/PurchaseDemandList/add.vue

@@ -25,7 +25,7 @@
                 v-model="basicForm.billType"
                 @change="changeBillType(basicForm.billType)"
                 :disabled="sonDisable"
-                size="mini"
+                :size="size"
                 style="width: 200px"
               >
                 <el-option
@@ -43,7 +43,7 @@
             <el-form-item label="需求客户">
               <el-select
                 clearable
-                size="mini"
+                :size="size"
                 v-model="basicForm.customer"
                 :disabled="sonDisable"
                 @clear="cleanCustomer"
@@ -64,7 +64,7 @@
             <el-form-item label="需求人员">
               <el-select
                 clearable
-                size="mini"
+                :size="size"
                 v-model="basicForm.demandPersonal"
                 :disabled="sonDisable"
                 @focus="chooseOrg('CONTACTS_PARAM', true, '需求人员')"
@@ -93,7 +93,7 @@
               <el-select
                 clearable
                 v-model="basicForm.demandDept"
-                size="mini"
+                :size="size"
                 :disabled="sonDisable"
                 @focus="chooseOrg('DEPT_PARAM', true, '需求部门')"
                 style="width: 200px"
@@ -122,7 +122,7 @@
               <el-select
                 :disabled="sonDisable"
                 v-model="basicForm.planType"
-                size="mini"
+                :size="size"
                 style="width: 200px"
                 @change="changeplanType(basicForm.planType)"
               >
@@ -154,7 +154,7 @@
                 type="date"
                 value-format="yyyy-MM-dd"
                 @change="changeDemandDate"
-                size="mini"
+                :size="size"
                 style="width: 200px"
               >
               </el-date-picker>
@@ -169,7 +169,7 @@
                 clearable
                 type="date"
                 value-format="yyyy-MM-dd"
-                size="mini"
+                :size="size"
                 style="width: 200px"
               >
               </el-date-picker>
@@ -183,7 +183,7 @@
                 @change="isCustomer"
                 v-model="basicForm.isCustomerSpecified"
                 :disabled="sonDisable"
-                size="mini"
+                :size="size"
                 style="width: 200px"
               >
                 <el-option
@@ -201,7 +201,7 @@
             <el-form-item label="备注">
               <el-input
                 v-model.trim="basicForm.remark"
-                size="mini"
+                :size="size"
                 :disabled="sonDisable"
                 clearable
                 style="width: 200px"
@@ -210,16 +210,16 @@
           </el-col>
 
           <!-- <el-col :span="1.5">
-          <el-form-item label="需求客户名称">
-            <el-input disabled v-model="basicForm.customerName" size="mini" style="width: 200px"></el-input>
-          </el-form-item>
-        </el-col> -->
+            <el-form-item label="需求客户名称">
+              <el-input disabled v-model="basicForm.customerName" :size="size" style="width: 200px"></el-input>
+            </el-form-item>
+          </el-col> -->
 
           <el-col :span="1.5">
             <el-form-item label="需求单号">
               <el-input
                 v-model="basicForm.code"
-                size="mini"
+                :size="size"
                 disabled
                 style="width: 200px"
               />
@@ -228,7 +228,7 @@
 
           <!-- <el-col :span="1.5">
             <el-form-item label="组织" prop="org" :rules="{ required: true, message: '请选择组织', trigger: 'blur' }">
-              <el-select clearable size="mini" v-model="basicForm.org" :disabled="sonDisable" @focus="chooseOrg('ORG_PARAM', true, '选择组织')" style="width: 200px">
+              <el-select clearable :size="size" v-model="basicForm.org" :disabled="sonDisable" @focus="chooseOrg('ORG_PARAM', true, '选择组织')" style="width: 200px">
                 <el-option v-for="item in orgOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
@@ -239,7 +239,7 @@
               <el-select
                 disabled
                 v-model="basicForm.status"
-                size="mini"
+                :size="size"
                 style="width: 200px"
               >
                 <el-option
@@ -257,7 +257,7 @@
             <el-form-item label="客户负责人">
               <el-select
                 disabled
-                size="mini"
+                :size="size"
                 v-model="basicForm.customerPrincipal"
                 style="width: 200px"
               >
@@ -276,7 +276,7 @@
               <el-select
                 v-model="basicForm.source"
                 disabled
-                size="mini"
+                :size="size"
                 style="width: 200px"
               >
                 <el-option
@@ -295,7 +295,7 @@
               <el-select
                 v-model="basicForm.isBeyondRap"
                 disabled
-                size="mini"
+                :size="size"
                 style="width: 200px"
               >
                 <el-option
@@ -315,28 +315,28 @@
           <div>
             <el-button
               type="primary"
-              size="mini"
+              :size="size"
               @click="addLine"
               v-if="!sonDisable"
               >增行</el-button
             >
             <el-button
               type="primary"
-              size="mini"
+              :size="size"
               @click="delLines"
               v-if="!sonDisable"
               >删行</el-button
             >
             <el-button
               type="primary"
-              size="mini"
+              :size="size"
               v-if="!sonDisable"
               @click.stop="adjustPl"
               >批量调整</el-button
             >
             <el-button
               type="primary"
-              size="mini"
+              :size="size"
               v-if="sonPageStu == 'check' || sonPageStu == 'edit'"
               @click="showReserved"
               >货权预留单</el-button
@@ -417,12 +417,12 @@
               <el-input
                 clearable
                 :disabled="sonDisable"
-                size="mini"
+                :size="size"
                 v-model="scope.row.materialCode"
                 @paste.native="pasteMe($event, scope, scope.rowIndex)"
               >
                 <el-button
-                  size="mini"
+                  :size="size"
                   :disabled="sonDisable"
                   slot="append"
                   icon="el-icon-more"
@@ -502,7 +502,7 @@
                 min="0"
                 clearable
                 :disabled="sonDisable"
-                size="mini"
+                :size="size"
                 v-model="scope.row.qty"
                 @paste.native="pasteMe($event, scope, scope.rowIndex)"
               />
@@ -543,12 +543,12 @@
               <el-input
                 clearable
                 :disabled="sonDisable"
-                size="mini"
+                :size="size"
                 v-model="scope.row.deliveryWarehouseName"
                 @clear="clearHang(scope.rowIndex, '选择收货仓库')"
               >
                 <el-button
-                  size="mini"
+                  :size="size"
                   :disabled="sonDisable"
                   slot="append"
                   icon="el-icon-more"
@@ -577,12 +577,12 @@
               <el-input
                 clearable
                 :disabled="sonDisable"
-                size="mini"
+                :size="size"
                 v-model="scope.row.deliveryAllocationName"
                 @clear="clearHang(scope.rowIndex, '选择收货货位')"
               >
                 <el-button
-                  size="mini"
+                  :size="size"
                   :disabled="sonDisable"
                   slot="append"
                   icon="el-icon-more"
@@ -611,7 +611,7 @@
               <el-input
                 clearable
                 :disabled="sonDisable"
-                size="mini"
+                :size="size"
                 v-model="scope.row.remark"
               />
             </template>
@@ -687,7 +687,7 @@
                 :disabled="sonDisable"
                 clearable
                 type="date"
-                size="mini"
+                :size="size"
                 value-format="yyyy-MM-dd"
                 :picker-options="pickerOptionsEnd"
                 placeholder="选择日期"
@@ -719,7 +719,7 @@
           />
           <!-- <ux-table-column resizable title="预留比例" align="center" field="reservedProportion" width="120px" edit-render>
             <template v-slot:edit="scope">
-                <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedProportion" @clear="cleanYLSL(scope)">
+                <el-select clearable :disabled="sonDisable" :size="size" v-model="scope.row.reservedProportion" @clear="cleanYLSL(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>
@@ -727,12 +727,12 @@
           </ux-table-column> -->
           <!-- <ux-table-column resizable title="预留周期" align="center" field="reservedPeriod" width="120px" edit-render>
             <template v-slot:edit="scope">
-                <el-input type="number" min="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedPeriod"></el-input>
+                <el-input type="number" min="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" clearable :disabled="sonDisable" :size="size" v-model="scope.row.reservedPeriod"></el-input>
             </template>
           </ux-table-column>
           <ux-table-column resizable title="预留数量" align="center"  field="reservedQty" width="120px" edit-render>
             <template v-slot:edit="scope">
-                <el-input type="number" min="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"  @input="scope.row.reservedQty=Math.ceil(scope.row.reservedQty)" clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedQty"></el-input>
+                <el-input type="number" min="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"  @input="scope.row.reservedQty=Math.ceil(scope.row.reservedQty)" clearable :disabled="sonDisable" :size="size" v-model="scope.row.reservedQty"></el-input>
             </template>
           </ux-table-column> -->
           <ux-table-column
@@ -799,13 +799,13 @@
               <el-input
                 clearable
                 :disabled="sonDisable || BDZT"
-                size="mini"
+                :size="size"
                 v-model="scope.row.additionalSupplierName"
                 @clear="clearHang(scope.rowIndex, '选择补单供应商')"
                 @paste.native="pasteMe($event, scope, scope.rowIndex)"
               >
                 <el-button
-                  size="mini"
+                  :size="size"
                   :disabled="sonDisable || BDZT"
                   slot="append"
                   icon="el-icon-more"
@@ -922,13 +922,13 @@
               <el-input
                 clearable
                 :disabled="sonDisable"
-                size="mini"
+                :size="size"
                 v-model="scope.row.deliveryAddressName"
                 @clear="clearHang(scope.rowIndex, '选择收货地址')"
                 @paste.native="pasteMe($event, scope, scope.rowIndex)"
               >
                 <el-button
-                  size="mini"
+                  :size="size"
                   :disabled="sonDisable"
                   slot="append"
                   icon="el-icon-more"
@@ -977,7 +977,7 @@
               <el-select
                 clearable
                 :disabled="sonDisable"
-                size="mini"
+                :size="size"
                 v-model="scope.row.priceType"
               >
                 <el-option
@@ -1060,7 +1060,7 @@
             <template slot-scope="scope">
               <el-button
                 type="text"
-                size="mini"
+                :size="size"
                 :disabled="sonDisable"
                 @click="delLine(scope.rowIndex, scope.row)"
                 >删除</el-button
@@ -1072,7 +1072,7 @@
       <div class="btn_group">
         <el-button
           type="primary"
-          size="mini"
+          :size="size"
           @click="jumpOA"
           v-if="
             sonPageStu == 'check' &&
@@ -1083,35 +1083,35 @@
         >
         <el-button
           type="primary"
-          size="mini"
+          :size="size"
           @click="copy"
           v-if="sonPageStu == 'check'"
           >复制</el-button
         >
         <el-button
           type="primary"
-          size="mini"
+          :size="size"
           @click="editPage"
           v-if="sonPageStu == 'check' && row.status == '0'"
           >编辑</el-button
         >
         <el-button
           type="primary"
-          size="mini"
+          :size="size"
           @click="save"
           v-if="sonPageStu == 'add' || sonPageStu == 'edit'"
           >保存</el-button
         >
         <el-button
           type="primary"
-          size="mini"
+          :size="size"
           @click="submit"
           v-if="
             sonPageStu == 'check' && (row.status == '0' || row.status == '3')
           "
           >提交</el-button
         >
-        <el-button size="mini" plain @click="back">返回</el-button>
+        <el-button :size="size" plain @click="back">返回</el-button>
       </div>
     </el-card>
 
@@ -1139,13 +1139,13 @@
           <el-input
             class="pltzIpt"
             clearable
-            size="mini"
+            :size="size"
             v-model="adjust.purOrgName"
             @clear="clearHang(0, 'cgzz')"
             @focus="chooseOrg('ORG_PARAM', true, '采购组织')"
           >
             <el-button
-              size="mini"
+              :size="size"
               slot="append"
               icon="el-icon-more"
               @click="chooseOrg('ORG_PARAM', true, '采购组织')"
@@ -1159,7 +1159,7 @@
           <el-select
             class="pltzIpt"
             clearable
-            size="mini"
+            :size="size"
             v-model="adjust.priceType"
           >
             <el-option
@@ -1178,7 +1178,7 @@
           <el-select
             class="pltzIpt"
             clearable
-            size="mini"
+            :size="size"
             v-model="adjust.purchaseMan"
             @focus="chooseOrg('CONTACTS_PARAM', true, '采购员')"
           >
@@ -1197,7 +1197,7 @@
           <el-input
             class="pltzIpt"
             clearable
-            size="mini"
+            :size="size"
             v-model="adjust.warehouseName"
             @clear="clearHang(0, 'shck')"
             @focus="
@@ -1205,7 +1205,7 @@
             "
           >
             <el-button
-              size="mini"
+              :size="size"
               slot="append"
               icon="el-icon-more"
               @click="
@@ -1221,7 +1221,7 @@
           <el-input
             class="pltzIpt"
             clearable
-            size="mini"
+            :size="size"
             v-model="adjust.allocationName"
             @clear="clearHang(0, 'shhw')"
             @focus="
@@ -1234,7 +1234,7 @@
             "
           >
             <el-button
-              size="mini"
+              :size="size"
               slot="append"
               icon="el-icon-more"
               @click="
@@ -1256,13 +1256,13 @@
             class="pltzIpt"
             clearable
             :disabled="sonDisable || BDZT"
-            size="mini"
+            :size="size"
             @clear="clearHang(0, 'bdgys')"
             v-model="adjust.additionalSupplierName"
             @focus="chooseOrg('SUPPLIER_PARAM', true, '补单供应商')"
           >
             <el-button
-              size="mini"
+              :size="size"
               :disabled="sonDisable || BDZT"
               slot="append"
               icon="el-icon-more"
@@ -1277,7 +1277,7 @@
           <el-input
             class="pltzIpt"
             clearable
-            size="mini"
+            :size="size"
             v-model="adjust.remark"
           />
         </el-col>
@@ -1288,12 +1288,12 @@
           <el-input
             class="pltzIpt"
             clearable
-            size="mini"
+            :size="size"
             @clear="clearHang(0, 'shdz')"
             v-model="adjust.deliveryAddressName"
           >
             <el-button
-              size="mini"
+              :size="size"
               slot="append"
               icon="el-icon-more"
               @click="chooseOrg('ADDRESS_PARAM', true, '收货地址')"
@@ -1308,7 +1308,7 @@
             class="pltzIpt"
             disabled
             clearable
-            size="mini"
+            :size="size"
             v-model="adjust.deliveryAddress"
           />
         </el-col>
@@ -1320,7 +1320,7 @@
             class="pltzIpt"
             disabled
             clearable
-            size="mini"
+            :size="size"
             v-model="adjust.contacts"
           />
         </el-col>
@@ -1332,7 +1332,7 @@
             class="pltzIpt"
             disabled
             clearable
-            size="mini"
+            :size="size"
             v-model="adjust.contactsPhone"
           />
         </el-col>
@@ -1344,16 +1344,16 @@
             class="pltzIpt"
             disabled
             clearable
-            size="mini"
+            :size="size"
             v-model="adjust.address"
           />
         </el-col>
       </el-row>
       <div slot="footer">
-        <el-button size="mini" type="primary" @click="confirmAdjust"
+        <el-button :size="size" type="primary" @click="confirmAdjust"
           >确 认</el-button
         >
-        <el-button size="mini" @click="adjust.open = false">取 消</el-button>
+        <el-button :size="size" @click="adjust.open = false">取 消</el-button>
       </div>
     </el-dialog>
   </div>
@@ -1392,7 +1392,7 @@ export default {
     "sys_price_type",
   ],
   components: {
-    Reserved: () => import("./reserved.vue"),
+    Reserved: () => import("./reserved/index.vue"),
     Refers: () => import("@/components/Refers/refers.vue"),
     popDialog: () => import("@/components/PopDialog/index.vue"),
   },
@@ -1402,6 +1402,7 @@ export default {
   },
   data() {
     return {
+      size: "mini",
       loading: true,
       // 不能直接改变props传来的值
       sonPageStu: this.pageStu,
@@ -1611,7 +1612,6 @@ export default {
   },
   created() {
     if (this.pageStu == "check") {
-      console.log("数据", this.row);
       this.getDetails(this.row);
     } else if (this.pageStu == "edit") {
       this.getDetails(this.row);
@@ -1653,9 +1653,9 @@ export default {
           ? "0" + date.getDate().toString()
           : date.getDate().toString(); //'12'
       let today = year + "-" + month + "-" + da;
-      console.log("今天日期", today);
+      // console.log("今天日期", today);
       let weekDay = date.getDay();
-      console.log("今天星期几", weekDay);
+      // console.log("今天星期几", weekDay);
       // 改变需求计划的判断写这里面了
       if (this.basicForm.planType == "JJXQ") {
         this.basicForm.demandDate = today;
@@ -1878,7 +1878,6 @@ export default {
       this.sonDisable = false;
     },
     handleData() {
-      console.log("222");
       // 复制新增把id,需求单号,创建人置为空,子表去掉id
       this.basicForm.id = "";
       this.basicForm.code = "";
@@ -1933,7 +1932,6 @@ export default {
                   );
                   // 深拷贝一下参数对象
                   let param = JSON.parse(JSON.stringify(this.basicForm));
-                  console.log("深拷贝对象", param);
                   param.puDemandItemList = list;
                   // this.basicForm.puDemandItemList.push(...this.delDemandItemList)
                   editDemand(param)
@@ -1957,8 +1955,6 @@ export default {
               } else {
                 let masStr = "";
                 Object.values(data).forEach((errList) => {
-                  console.log("data", data);
-                  console.log(errList);
                   // 将子表下标加入进入标识字段
                   this.basicForm.puDemandItemList.forEach((item, index) => {
                     item.rightIndex = index;
@@ -1972,7 +1968,6 @@ export default {
                       });
                     }
                   );
-                  console.log("xxx", rightList);
                   rightList.forEach((items) => {
                     if (
                       this.$refs.table.$el.querySelector(
@@ -2031,7 +2026,6 @@ export default {
           return item2.rowIndex !== item.rightIndex;
         });
       });
-      console.log("xxx", rightList);
       rightList.forEach((items) => {
         if (
           this.$refs.table.$el.querySelector(
@@ -2136,7 +2130,6 @@ export default {
         delArr.forEach((item) => {
           item.delFlag = "2";
         });
-        console.log("kk", this.basicForm.puDemandItemList);
         let delList = [];
         delList = this.basicForm.puDemandItemList.filter((item) => {
           return item.delFlag == "2";
@@ -2151,7 +2144,6 @@ export default {
       }
     },
     back() {
-      console.log("打印人员信息看看", this.$store.state);
       this.$emit("jugislist", true);
       this.$emit("refresh");
     },
@@ -2795,7 +2787,6 @@ export default {
           selection[0].storageCondition;
         // 选中骨科耗材时候的物料,需求客户不必填
       } else {
-        console.log("xxxxx", selection);
         let newLine = [];
         for (let i = 0; i < selection.length; i++) {
           let line = { ...this.sonModel };
@@ -3127,7 +3118,6 @@ export default {
       });
     },
     jisuan({ columns, data }) {
-      // console.log('生效了吗', {columns, data})
       const means = []; // 合计
       columns.forEach((column, columnIndex) => {
         if (columnIndex === 0) {

+ 2 - 0
src/views/purchase/PurchaseDemandList/columns.js

@@ -189,5 +189,7 @@ export default function useColumns() {
     },
   ];
 
+
+
   return { TableColumns, SearchColumns }
 }

+ 53 - 0
src/views/purchase/PurchaseDemandList/demand/columns.js

@@ -0,0 +1,53 @@
+export default function useColumns() {
+  const DemandColumns = [
+    {
+      item: {
+        key: "ways",
+        title: "方案",
+      },
+      attr: {
+        is: "el-select",
+        dictName: "sys_plan_type",
+        disabled: true,
+      }
+    },
+    {
+      item: {
+        key: "category",
+        title: "类型",
+      },
+      attr: {
+        is: "el-select",
+        dictName: "sys_plan_type",
+        disabled: true,
+      }
+    },
+    {
+      item: {
+        key: "deadline",
+        title: "截止星期",
+      },
+      attr: {
+        is: "el-input-number",
+        clearable: true,
+        min: 1,
+        max: (prop) => {
+          let { ways } = prop;
+          return ways === 'ZJH' ? 7 : 12
+        },
+      }
+    },
+    {
+      item: {
+        key: "remark",
+        title: "备注",
+      },
+      attr: {
+        is: "el-input",
+        clearable: true,
+      }
+    },
+  ];
+
+  return { DemandColumns }
+}

+ 109 - 0
src/views/purchase/PurchaseDemandList/demand/index.vue

@@ -0,0 +1,109 @@
+<script>
+import useColumns from "./columns";
+import {
+  getDemandWindowList,
+  saveDemandWindow,
+} from "@/api/purchase/purchaseDemand.js";
+export default {
+  name: "Demand",
+  props: {
+    dict: {
+      type: [Array, Object],
+      default: () => [],
+    },
+  },
+  components: {
+    ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
+  },
+  data() {
+    const { DemandColumns } = useColumns();
+    return {
+      title: "需求窗口期",
+      visible: false,
+      loading: false,
+      DemandColumns: DemandColumns,
+      innerValue: [],
+    };
+  },
+  methods: {
+    async open() {
+      // 需求窗口期配置
+      this.visible = true;
+      try {
+        this.loading = true;
+        let { code, rows } = await getDemandWindowList();
+        if (code === 200) {
+          this.innerValue = rows;
+        }
+      } catch (error) {
+      } finally {
+        this.loading = false;
+      }
+    },
+    close() {
+      this.visible = false;
+      this.innerValue = [];
+    },
+
+    async saveDemand() {
+      try {
+        let params = this.innerValue;
+        let { code } = await saveDemandWindow(params);
+        if (code === 200) {
+          this.$modal.notifySuccess("保存成功");
+          this.close();
+        }
+      } catch (error) {}
+    },
+
+    changeDeadline(row) {
+      row.delFlag = "2";
+    },
+  },
+  created() {},
+};
+</script>
+
+<template>
+  <el-button type="primary" :size="$attrs.size" @click="open">
+    {{ title }}
+
+    <el-dialog
+      :title="title"
+      :visible.sync="visible"
+      width="800px"
+      append-to-body
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
+      <div slot="footer">
+        <el-button :size="$attrs.size" @click="close">取 消</el-button>
+        <el-button type="primary" :size="$attrs.size" @click="saveDemand"
+          >保 存</el-button
+        >
+      </div>
+
+      <el-super-ux-table
+        v-loading="loading"
+        v-model="innerValue"
+        :columns="DemandColumns"
+        :size="$attrs.size"
+        :dict="dict"
+        height="450"
+      >
+        <template slot="deadline" slot-scope="scope">
+          <component
+            v-bind="scope.attr"
+            v-model="scope.row[scope.item.key]"
+            :size="$attrs.size"
+            :source.sync="scope.row"
+            :max="scope.attr.max(scope.row)"
+            @input="changeDeadline(scope.row)"
+          >
+          </component>
+        </template>
+      </el-super-ux-table>
+      <!-- <span style="color: red">注:周计划星期填写范围1-7,月计划填写范围1-12</span> -->
+    </el-dialog>
+  </el-button>
+</template>

+ 34 - 33
src/views/purchase/PurchaseDemandList/index.vue

@@ -12,9 +12,10 @@
         ></el-super-search>
 
         <div class="btn_grooup">
-          <el-button type="primary" :size="size" @click="demandWindow"
+          <!-- <el-button type="primary" :size="size" @click="demandWindow"
             >需求窗口期</el-button
-          >
+          > -->
+          <DemandButton :size="size" :dict="dict"></DemandButton>
           <el-button type="primary" :size="size" @click="addDivision"
             >新增</el-button
           >
@@ -250,7 +251,7 @@
     </el-dialog>
 
     <!-- 需求窗口期 -->
-    <el-dialog title="需求窗口期" :visible.sync="setDemand.open" width="800px">
+    <!-- <el-dialog title="需求窗口期" :visible.sync="setDemand.open" width="800px">
       <div slot="footer">
         <el-button :size="size" @click="setDemand.open = false"
           >取 消</el-button
@@ -308,8 +309,7 @@
           </template>
         </el-table-column>
       </el-table>
-      <!-- <span style="color: red">注:周计划星期填写范围1-7,月计划填写范围1-12</span> -->
-    </el-dialog>
+    </el-dialog> -->
 
     <Add
       v-model="isList"
@@ -340,8 +340,8 @@ import {
   exportDemand,
   submitDemand,
   confirmSubmit,
-  getDemandWindowList,
-  saveDemandWindow,
+  // getDemandWindowList,
+  // saveDemandWindow,
 } from "@/api/purchase/purchaseDemand.js";
 export default {
   name: "PurchaseDemandList",
@@ -352,6 +352,7 @@ export default {
     ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
     BatchImport: () => import("@/components/BatchImport/index.vue"),
     ElSuperSearch: () => import("@/components/super-search/index.vue"),
+    DemandButton: () => import("./demand/index.vue"),
   },
   dicts: [
     ...dicts,
@@ -424,10 +425,10 @@ export default {
       rowDetail: {},
       disable: false,
       ids: [],
-      setDemand: {
-        open: false,
-        gridData: [],
-      },
+      // setDemand: {
+      //   open: false,
+      //   gridData: [],
+      // },
     };
   },
   created() {
@@ -797,28 +798,28 @@ export default {
       this.download.category = selection.code;
     },
     // 需求窗口期配置
-    demandWindow() {
-      this.setDemand.open = true;
-      this.$nextTick(() => {
-        getDemandWindowList().then((res) => {
-          if (res.code === 200) {
-            this.setDemand.gridData = res.rows;
-          }
-        });
-      });
-    },
-    saveDemand() {
-      let params = this.setDemand.gridData;
-      saveDemandWindow(params).then((res) => {
-        if (res.code === 200) {
-          this.$modal.notifySuccess("保存成功");
-          this.setDemand.open = false;
-        }
-      });
-    },
-    changeDeadline(row) {
-      row.delFlag = "2";
-    },
+    // demandWindow() {
+    //   this.setDemand.open = true;
+    //   this.$nextTick(() => {
+    //     getDemandWindowList().then((res) => {
+    //       if (res.code === 200) {
+    //         this.setDemand.gridData = res.rows;
+    //       }
+    //     });
+    //   });
+    // },
+    // saveDemand() {
+    //   let params = this.setDemand.gridData;
+    //   saveDemandWindow(params).then((res) => {
+    //     if (res.code === 200) {
+    //       this.$modal.notifySuccess("保存成功");
+    //       this.setDemand.open = false;
+    //     }
+    //   });
+    // },
+    // changeDeadline(row) {
+    //   row.delFlag = "2";
+    // },
   },
 };
 </script>

+ 0 - 127
src/views/purchase/PurchaseDemandList/reserved.vue

@@ -1,127 +0,0 @@
-<template>
-  <div class="reserved">
-    <el-dialog
-      :visible.sync="visible"
-      :before-close="handleClose"
-      width="70%"
-    >
-      <el-descriptions class="margin-top" title="货权预留单" :column="3" size="small" border>
-        <el-descriptions-item>
-          <template slot="label">
-            预留单据号
-          </template>
-          {{ resData.code }}
-        </el-descriptions-item>
-        <el-descriptions-item>
-          <template slot="label">
-            来源单据号
-          </template>
-          {{ resData.source }}
-        </el-descriptions-item>
-        <el-descriptions-item>
-          <template slot="label">
-            客户名称
-          </template>
-          {{ resData.customerName }}
-        </el-descriptions-item>
-        <el-descriptions-item>
-          <template slot="label">
-            创建人
-          </template>
-          {{ resData.createByName }}
-        </el-descriptions-item>
-        <el-descriptions-item>
-          <template slot="label">
-            创建人编码
-          </template>
-          {{ resData.createBy }}
-        </el-descriptions-item>
-        <el-descriptions-item>
-          <template slot="label">
-            创建时间
-          </template>
-          {{ resData.createTime }}
-        </el-descriptions-item>
-      </el-descriptions>
-      <el-table style="margin-top: 50px" :data="items" @row-click="rowClick" height="300px">
-        <el-table-column show-overflow-tooltip prop="materialCode" label="物料编码" width="150"></el-table-column>
-        <el-table-column show-overflow-tooltip prop="materialName" label="物料名称" width="150"></el-table-column>
-        <el-table-column show-overflow-tooltip prop="unitName" label="单位名称" width="150"></el-table-column>
-        <el-table-column show-overflow-tooltip prop="reservedQty" label="预留数量" width="150"></el-table-column>
-        <el-table-column show-overflow-tooltip prop="totalIn" label="累计入库数量" width="150"></el-table-column>
-        <el-table-column show-overflow-tooltip prop="qty" label="可用量" width="150"></el-table-column>
-        <el-table-column show-overflow-tooltip prop="usedQty" label="已用量" width="150"></el-table-column>
-        <el-table-column show-overflow-tooltip prop="warehouseName" label="仓库名称" width="150"></el-table-column>
-        <el-table-column show-overflow-tooltip prop="allocationName" label="货位名称" width="150"></el-table-column>
-        <el-table-column show-overflow-tooltip prop="createTime" label="创建时间" width="200"></el-table-column>
-      </el-table>
-      <el-table style="margin-top: 50px" :data="showHistoryItems" height="300px">
-        <el-table-column prop="materialCode" label="物料编码" width="150"></el-table-column>
-        <el-table-column show-overflow-tooltip prop="materialName" label="物料名称" width="200"></el-table-column>
-        <el-table-column prop="unitName" label="单位" width="100"></el-table-column>
-        <el-table-column prop="productBatchNum" label="批号" width="100"></el-table-column>
-        <el-table-column label="操作单据" align="center" prop="operateBill"  width="100">
-          <template slot-scope="scope">
-            <dict-tag :options="dict.type.ow_operatetype" :value="scope.row.operateBill"/>
-          </template>
-        </el-table-column>
-        <el-table-column show-overflow-tooltip prop="operateBillcode" label="操作单据编码" width="200"></el-table-column>
-        <el-table-column prop="operateBillitem" label="操作明细行号" width="150"></el-table-column>
-        <el-table-column prop="allotQty" label="操作数量" width="150">
-          <template slot-scope="scope">
-            {{scope.row.allotQty > 0 ? "+" + scope.row.allotQty : scope.row.allotQty}}
-          </template>
-        </el-table-column>
-        <el-table-column prop="createTime" label="操作时间" width="200"></el-table-column>
-      </el-table>
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-import {getDetailBySource} from '@/api/purchase/ownership.js'
-
-export default {
-  dicts: ['ow_operatetype'],
-  props: {
-    isVisible: {
-      type: Boolean,
-      default: false
-    },
-    info: {
-      type: Object,
-      default: null
-    }
-  },
-  mounted() {
-    this.getDetails(this.info)
-  },
-  data() {
-    return {
-      visible:this.isVisible,
-      resData: {},
-      items: [],
-      historyItems: [],
-      showHistoryItems: [],
-    }
-  },
-  methods: {
-    getDetails(row) {
-      getDetailBySource(row.code).then(res => {
-        if (res.code === 200) {
-          this.resData = res.data;
-          this.items = res.data.stMaterialOwnershipItemList;
-          this.historyItems = res.data.stMaterialOwnershipHistoryList;
-          this.showHistoryItems = this.historyItems.filter(ele => ele.ownerId == this.items[0].id);
-        }
-      })
-    },
-    handleClose() {
-      this.$emit('updateReserved', false)
-    },
-    rowClick(row){
-      this.showHistoryItems = this.historyItems.filter(ele => ele.ownerId == row.id);
-    }
-  }
-}
-</script>

+ 212 - 0
src/views/purchase/PurchaseDemandList/reserved/columns.js

@@ -0,0 +1,212 @@
+export default function useColumns() {
+
+  const desColumns = [
+    {
+      item: {
+        key: "code",
+        title: "预留单据号",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "source",
+        title: "来源单据号",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "customerName",
+        title: "客户名称",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "createByName",
+        title: "创建人",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "createBy",
+        title: "创建人编码",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "createTime",
+        title: "创建时间",
+      },
+      attr: {}
+    },
+  ];
+
+  const itemsColumns = [
+    {
+      item: {
+        key: "materialCode",
+        title: "物料编码",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "materialName",
+        title: "物料名称",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "unitName",
+        title: "单位名称",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "reservedQty",
+        title: "预留数量",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "totalIn",
+        title: "累计入库数量",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "qty",
+        title: "可用量",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "usedQty",
+        title: "已用量",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "warehouseName",
+        title: "仓库名称",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "allocationName",
+        title: "货位名称",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "createTime",
+        title: "创建时间",
+        width: 200,
+      },
+      attr: {}
+    },
+  ].map(({ item, attr }) => ({
+    item: {
+      ...item,
+      width: item.width || 150
+    },
+    attr,
+  }));
+
+  const historyColumns = [
+    {
+      item: {
+        key: "materialCode",
+        title: "物料编码",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "materialName",
+        title: "物料名称",
+        width: 200,
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "unitName",
+        title: "单位",
+        width: 100,
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "productBatchNum",
+        title: "批号",
+        width: 100,
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "operateBill",
+        title: "操作单据",
+        width: 100,
+      },
+      attr: {
+        is: "el-dict-tag",
+        dictName: "ow_operatetype",
+      }
+    },
+    {
+      item: {
+        key: "operateBillcode",
+        title: "操作单据编码",
+        width: 200,
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "operateBillitem",
+        title: "操作明细行号",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "allotQty",
+        title: "操作数量",
+      },
+      attr: {}
+    },
+    {
+      item: {
+        key: "createTime",
+        title: "操作时间",
+        width: 200,
+      },
+      attr: {}
+    },
+
+  ].map(({ item, attr }) => ({
+    item: {
+      ...item,
+      width: item.width || 150
+    },
+    attr,
+  }));
+
+
+  return { desColumns, itemsColumns, historyColumns }
+}

+ 112 - 0
src/views/purchase/PurchaseDemandList/reserved/index.vue

@@ -0,0 +1,112 @@
+<template>
+  <div class="reserved">
+    <el-dialog :visible.sync="visible" :before-close="handleClose" width="70%">
+      <el-descriptions
+        class="margin-top"
+        title="货权预留单"
+        :column="3"
+        size="small"
+        border
+      >
+        <el-descriptions-item v-for="({ item }, index) in desColumns">
+          <template slot="label"> {{ item.title }} </template>
+          {{ resData[item.key] }}
+        </el-descriptions-item>
+      </el-descriptions>
+
+      <el-super-ux-table
+        v-model="items"
+        :size="size"
+        :columns="itemsColumns"
+        @row-click="rowClick"
+        height="300px"
+        style="margin-top: 20px"
+      ></el-super-ux-table>
+      <el-super-ux-table
+        v-model="showHistoryItems"
+        :size="size"
+        :dict="dict"
+        :columns="historyColumns"
+        height="300px"
+        style="margin-top: 20px"
+      >
+        <template slot="allotQty" slot-scope="scope">
+          {{
+            scope.row.allotQty > 0
+              ? "+" + scope.row.allotQty
+              : scope.row.allotQty
+          }}
+        </template>
+      </el-super-ux-table>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getDetailBySource } from "@/api/purchase/ownership.js";
+import useColumns from "./columns";
+import { dicts } from "../dicts";
+export default {
+  dicts: [...dicts],
+  components: {
+    ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
+  },
+  props: {
+    isVisible: {
+      type: Boolean,
+      default: false,
+    },
+    info: {
+      type: Object,
+      default: null,
+    },
+  },
+  mounted() {
+    this.getDetails(this.info);
+  },
+  data() {
+    const { desColumns, itemsColumns, historyColumns } = useColumns();
+    return {
+      size: "mini",
+      desColumns: desColumns,
+      itemsColumns: itemsColumns,
+      historyColumns: historyColumns,
+      visible: this.isVisible,
+      resData: {},
+      items: [],
+      historyItems: [],
+      showHistoryItems: [],
+    };
+  },
+  methods: {
+    getDetails(row) {
+      getDetailBySource(row.code).then((res) => {
+        if (res.code === 200) {
+          this.resData = res.data || [];
+          this.items = res.data ? res.data.stMaterialOwnershipItemList : [];
+          this.historyItems = res.data
+            ? res.data.stMaterialOwnershipHistoryList
+            : [];
+          this.showHistoryItems = this.historyItems.filter(
+            (ele) => ele.ownerId == this.items[0].id
+          );
+        }
+      });
+    },
+    handleClose() {
+      this.$emit("updateReserved", false);
+    },
+    rowClick(row) {
+      this.showHistoryItems = this.historyItems.filter(
+        (ele) => ele.ownerId == row.id
+      );
+    },
+  },
+};
+</script>
+
+<style scoped>
+>>> .el-dialog__body {
+  padding: 5px 15px;
+}
+</style>