Эх сурвалжийг харах

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!45
黄梓星 2 жил өмнө
parent
commit
c0b2533188

+ 20 - 2
src/api/business/purchase/task.js

@@ -1,7 +1,7 @@
 import request from "@/utils/request";
 
 // 查询任务列表
-export function list(data) {
+export function LIST(data) {
   return request({
     url: "/pu/order/generate/list",
     method: "POST",
@@ -18,10 +18,28 @@ export function item(data) {
 }
 
 // 查询任务列表
-export function FirstDirect(data) {
+export function FIRSTDIRECT(data) {
   return request({
     url: "/pu/order/generate/manualAgreement",
     method: "POST",
     data: data,
   });
 }
+
+// 查询任务列表
+export function ADD(data) {
+  return request({
+    url: "/pu/order/create",
+    method: "POST",
+    data: data,
+  });
+}
+
+// 查询任务列表
+export function SHUTDOWN(data) {
+  return request({
+    url: `/pu/demand/item/summary/shutDown/${data}`,
+    method: "PUT",
+    data: data,
+  });
+}

+ 1 - 0
src/components/input-dialog/components/index.vue

@@ -54,6 +54,7 @@ export default {
             ...prop,
             ...queryParams,
           },
+          
           { pageNum, pageSize }
         );
         if (code === 200) {

+ 0 - 11
src/utils/init/page.js

@@ -1,11 +0,0 @@
-const pageSizes = [25, 50, 100];
-
-const layout = "total, prev, pager, next, sizes, jumper";
-
-const page = { pageNum: 1, pageSize: 25, total: 0 };
-
-export const initPageSizes = () => pageSizes;
-
-export const initLayout = () => layout;
-
-export const initPage = () => page;

+ 2 - 0
src/views/purchase/DemandSummary/index.vue

@@ -274,6 +274,8 @@
           <el-table-column label="单位" align="center" prop="unit"/>
           <el-table-column label="生产厂家/代理人" align="center" prop="manufacturer" width="180px"/>
           <el-table-column label="需求单位数" align="center" prop="demandNum" width="120px"/>
+          <el-table-column label="近1月月均需求" align="center" prop="evensalesforyear" width="120px"/>
+          <el-table-column label="近3月月均需求" align="center" prop="evensalesforthrmonth" width="120px"/>
           <el-table-column label="总最终净需求量" align="center" prop="netDemandNum" width="120px"/>
           <el-table-column label="总月销量" align="center" prop="totalMonthlySales"/>
           <el-table-column label="需求可用周期" align="center" prop="demandCycle" width="180px"/>

+ 73 - 56
src/views/purchase/MaterialClassDivision/add.vue

@@ -124,12 +124,12 @@
                     style="width: 200px"
                     :disabled="disable"
                     clearable
-                    @focus="chooseOrganizations"
+                    @focus="chooseRefer('ORG_PARAM', true, '选择所属组织')"
                   >
                     <el-option
                       v-for="item in organizationsOptions"
                       :key="item.id"
-                      :label="item.label"
+                      :label="item.name"
                       :value="item.id"
                     />
                 </el-select>
@@ -145,7 +145,7 @@
                   :disabled="disable"
                   v-model="basicForm.orderPersonal"
                   clearable
-                  @focus="chooseStaff"
+                  @focus="chooseRefer('CONTACTS_PARAM', true, '订单员')"
                 >
                   <el-option
                     v-for="item in staffOptions"
@@ -177,7 +177,7 @@
                   :disabled="disable"
                   v-model="basicForm.buyer"
                   clearable
-                  @focus="chooseStaff2"
+                  @focus="chooseRefer('CONTACTS_PARAM', true, '采购员')"
                 >
                   <el-option
                     v-for="item in staff2Options"
@@ -249,17 +249,7 @@
       :single="true"
     />
 
-    <orgs
-      ref="orgs"
-      @doSubmit="acceptOrgs"
-      :single="true"
-    />
-
-    <staff
-      ref="staff"
-      @doSubmit="acceptStaff"
-      :single="true"
-    />
+    <Refers ref="refer" @doSubmit="selectionsRefer" :single="true"/>
 
     <staff2
       ref="staff2"
@@ -278,8 +268,9 @@ import { getDetail } from '@/api/classify/basic';
 // 物料编码
 import popDialog from '@/components/PopDialog/index.vue'
 // 公用一个树形(组织部门传值不同)
-import orgs from '@/components/PopDialog/organization.vue'
-import staff from '@/components/PopDialog/staff.vue'
+import Refers from '@/components/Refers/refers.vue'
+// 用于回显参照框数据
+import { getRefer } from '@/api/purchase/basic.js'
 import staff2 from '@/components/PopDialog/staff.vue'
 // 所属组织,订单员用于回显
 import { getOrgs, getStaff} from '@/api/requisition/basic'
@@ -288,8 +279,7 @@ export default {
   components: {
     fourClass,
     popDialog,
-    orgs,
-    staff,
+    Refers,
     staff2
   },
   props: ['pageStu','row', 'disable'],
@@ -327,6 +317,11 @@ export default {
       options: [{
         value: 0, label: '仓库1'
       }],
+      referCondition: {
+        type: '',
+        isPage: true,
+        title: ''
+      },
       organizationsOptions: [],
       staffOptions: [],
       staff2Options: [],
@@ -362,7 +357,7 @@ export default {
       this.$emit('jugislist', true)
       let queryParams = {
         pageNum: 1,
-        pageSize: 10
+        pageSize: 5
       }
       this.$emit('refresh', queryParams)
     },
@@ -371,9 +366,12 @@ export default {
       getDivisions(row.id).then(res => {
         if (res.code === 200) {
           this.basicForm = res.data
-          this.getOrgDetails(res.data.org)
-          this.getStaffDetails(res.data.orderPersonal)
-          this.getStaffDetails2(res.data.buyer)
+          if (this.basicForm.org) { this.reBackRefer('ORG_PARAM', this.basicForm.org) }
+          if (this.basicForm.orderPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.orderPersonal, '订单员') }
+          if (this.basicForm.buyer) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.buyer, '采购员') }
+          // this.getOrgDetails(res.data.org)
+          // this.getStaffDetails(res.data.orderPersonal)
+          // this.getStaffDetails2(res.data.buyer)
         }
       })
     },
@@ -412,45 +410,64 @@ export default {
       this.$refs.contractSelect.init()
     },
     // 选择默认采购组织
-    acceptOrgs (selections) {
-      console.log('接收的采购组织', selections)
-      this.basicForm.org = selections.id
-      this.getOrgDetails(selections.id)
+    chooseRefer(type, isPage, title) {
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
+      this.$refs.refer.init(this.referCondition)
     },
-    // 默认采购组织显示列表
-    chooseOrganizations () {
-      this.$refs.organizations.blur()
-      this.$refs.orgs.init('1')
+    selectionsRefer(selection) {
+      if (this.referCondition.title == '选择所属组织') {
+        this.organizationsOptions = selection
+        this.basicForm.org = selection[0].id
+        this.basicForm.orgName = selection[0].name
+      }
+      if (this.referCondition.title == '订单员') {
+        this.staffOptions = selection
+        this.basicForm.orderPersonal = selection[0].code
+        this.basicForm.orderPersonalName = selection[0].name
+      }
+      if (this.referCondition.title == '采购员') {
+        this.staff2Options = selection
+        this.basicForm.buyer = selection[0].code
+        this.basicForm.buyerName = selection[0].name
+      }
     },
-    // 采购组织回显
-    getOrgDetails(id) {
-      getOrgs({deptId: id}).then(res => {
-        if (res.code === 200) {
-          this.organizationsOptions = res.data
+    // 回显参照框
+    reBackRefer(type, id, title) {
+      getRefer({ type: type, id: id }).then(res => {
+        if (type == 'ORG_PARAM') {
+          this.organizationsOptions = res.rows
         }
-      })
-    },
-    // 选择订单员
-    acceptStaff (selections) {
-      this.staffOptions = selections
-      this.basicForm.orderPersonal = selections[0].code
-      this.basicForm.orderPersonalName = selections[0].name
-      this.getStaffDetails(selections[0].id)
-    },
-    // 订单员显示列表
-    chooseStaff () {
-      this.$refs.staffs.blur()
-      this.$refs.staff.init()
-    },
-    // 订单员回显
-    getStaffDetails(id) {
-      getStaff({id:id}).then(res => {
-        console.log('订单员', res)
-        if (res.code === 200 ) {
-          this.staffOptions = res.data.tableBody
+        if (type == 'CONTACTS_PARAM' && title == '订单员') {
+          this.staffOptions = res.rows
+        }
+        if (type == 'CONTACTS_PARAM' && title == '采购员') {
+          this.staff2Options = res.rows
         }
       })
     },
+    // 选择订单员
+    // acceptStaff (selections) {
+    //   this.staffOptions = selections
+    //   this.basicForm.orderPersonal = selections[0].code
+    //   this.basicForm.orderPersonalName = selections[0].name
+    //   this.getStaffDetails(selections[0].id)
+    // },
+    // // 订单员显示列表
+    // chooseStaff () {
+    //   this.$refs.staffs.blur()
+    //   this.$refs.staff.init()
+    // },
+    // // 订单员回显
+    // getStaffDetails(id) {
+    //   getStaff({id:id}).then(res => {
+    //     console.log('订单员', res)
+    //     if (res.code === 200 ) {
+    //       this.staffOptions = res.data.tableBody
+    //     }
+    //   })
+    // },
     // 选择采购员
     acceptStaff2 (selections) {
       this.staff2Options = selections

+ 44 - 58
src/views/purchase/MaterialClassDivision/index.vue

@@ -5,50 +5,42 @@
         <el-row :gutter="10">
           <el-col :span="1.5">
             <el-form-item label="物料一级大类编码">
-              <el-select v-model="queryParams.materialClassifyOne" size="small" style="width: 200px" clearable placeholder="请选择">
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value">
-                </el-option>
-              </el-select>
+              <el-input
+                v-model="queryParams.materialClassifyOne"
+                clearable
+                size="small"
+                style="width: 200px"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="1.5">
             <el-form-item label="物料一级大类名称">
-              <el-select v-model="queryParams.materialClassifyOneName" size="small" style="width: 200px" clearable placeholder="请选择">
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value">
-                </el-option>
-              </el-select>
+              <el-input
+                v-model="queryParams.materialClassifyOneName"
+                clearable
+                size="small"
+                style="width: 200px"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="1.5">
             <el-form-item label="物料二级大类编码">
-              <el-select v-model="queryParams.materialClassifyTwo" size="small" style="width: 200px" clearable placeholder="请选择">
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value">
-                </el-option>
-              </el-select>
+              <el-input
+                v-model="queryParams.materialClassifyTwo"
+                clearable
+                size="small"
+                style="width: 200px"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="1.5">
             <el-form-item label="物料二级大类名称">
-              <el-select v-model="queryParams.materialClassifyTwoName" size="small" style="width: 200px" clearable placeholder="请选择">
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value">
-                </el-option>
-              </el-select>
+              <el-input
+                v-model="queryParams.materialClassifyTwoName"
+                clearable
+                size="small"
+                style="width: 200px"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="1.5">
@@ -64,26 +56,22 @@
         <el-row :gutter="10">
           <el-col :span="1.5">
             <el-form-item label="物料三级大类编码">
-              <el-select v-model="queryParams.materialClassifyThree" size="small" style="width: 200px" clearable placeholder="请选择">
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value">
-                </el-option>
-              </el-select>
+              <el-input
+                v-model="queryParams.materialClassifyThree"
+                clearable
+                size="small"
+                style="width: 200px"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="1.5">
             <el-form-item label="物料三级大类名称">
-              <el-select v-model="queryParams.materialClassifyThreeName" size="small" style="width: 200px" clearable placeholder="请选择">
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value">
-                </el-option>
-              </el-select>
+              <el-input
+                v-model="queryParams.materialClassifyThreeName"
+                clearable
+                size="small"
+                style="width: 200px"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="1.5">
@@ -100,14 +88,12 @@
           </el-col>
           <el-col :span="1.5">
             <el-form-item label="物料四级大类名称">
-              <el-select v-model="queryParams.materialClassifyFourName" size="small" style="width: 200px" clearable placeholder="请选择">
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value">
-                </el-option>
-              </el-select>
+              <el-input
+                v-model="queryParams.materialClassifyFourName"
+                clearable
+                size="small"
+                style="width: 200px"
+              />
             </el-form-item>
           </el-col>
         </el-row>
@@ -235,7 +221,7 @@
           <el-table-column label="物料编码" align="center" width="150" prop="material" />
           <el-table-column label="物料名称" align="center" prop="materialName" />
           <el-table-column label="生产厂商" align="center" width="150" prop="manufacturer" />
-          <el-table-column label="所属组织" align="center" width="120" prop="orgName" />
+          <el-table-column label="所属组织" align="center" width="120" prop="orgName"/>
           <el-table-column label="订单员" align="center" width="150" prop="orderPersonalName" />
           <el-table-column label="采购员" align="center" width="150" prop="buyerName" />
           <el-table-column label="订单部门" align="center" width="150" prop="orderDeptName" />
@@ -307,7 +293,7 @@ export default {
         manufacturer: '',
         remark: '',
         pageNum: 1,
-        pageSize: 10
+        pageSize: 5
       },
       options: [{
         value: 0, label: '仓库1'

+ 2 - 0
src/views/purchase/PurchaseDemandList/add.vue

@@ -704,6 +704,7 @@ export default {
         materialCode: null,
         material: null,
         materialName: null,
+        classifyId: null,
         specification: null,
         unit: null,
         unitName: null,
@@ -942,6 +943,7 @@ export default {
       this.basicForm.puDemandItemList[this.tableIndex].materialCode = selection[0].code
       this.basicForm.puDemandItemList[this.tableIndex].material = selection[0].id
       this.basicForm.puDemandItemList[this.tableIndex].materialName = selection[0].name
+      this.basicForm.puDemandItemList[this.tableIndex].classifyId = selection[0].classifyId
       this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOneName = selection[0].oneClass
       this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwoName = selection[0].twoClass
       this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThreeName = selection[0].threeClass

+ 59 - 23
src/views/purchase/deliveryAddress/add.vue

@@ -28,24 +28,16 @@
 
         <el-col :span="1.5">
             <el-form-item label="仓库档案名称">
-              <el-input
-                v-model="basicForm.warehouseCode"
-                size="small"
-                :disabled="disable"
-                clearable
-                style="width: 200px"
-              />
+              <el-select size="small" v-model="basicForm.warehouseCode" :disabled="disable" @focus="chooseRefer('WAREHOUSE_PARAM', true, '仓库档案名称')" style="width: 200px">
+                <el-option v-for="item in houseOptions" :key="item.id" :label="item.name" :value="item.id" />
+              </el-select>
             </el-form-item>
          </el-col>
 
          <el-col :span="1.5">
-            <el-form-item label="仓库属性">
-              <el-select v-model="basicForm.warehouseProperty" size="small" style="width: 200px" clearable :disabled="disable">
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value">
+          <el-form-item label="仓库属性">
+              <el-select :disabled="disable" v-model="basicForm.warehouseProperty" size="small" style="width: 200px">
+                <el-option v-for="dict in dict.type.sys_warehouse_attribute" :key="dict.value" :label="dict.label" :value="dict.value">
                 </el-option>
               </el-select>
             </el-form-item>
@@ -65,13 +57,9 @@
 
           <el-col :span="1.5">
             <el-form-item label="联系人">
-              <el-input
-                v-model="basicForm.contactsName"
-                size="small"
-                :disabled="disable"
-                clearable
-                style="width: 200px"
-              />
+              <el-select size="small" v-model="basicForm.contactsName" :disabled="disable" @focus="chooseRefer('CONTACTS_PARAM', true, '联系人')" style="width: 200px">
+                <el-option v-for="item in contactsOptions" :key="item.id" :label="item.name" :value="item.id" />
+              </el-select>
             </el-form-item>
          </el-col>
 
@@ -89,13 +77,16 @@
 
           <el-col :span="1.5">
             <el-form-item label="物料分类">
-              <el-input
+              <el-select
                 v-model="basicForm.materialClassify"
                 size="small"
                 :disabled="disable"
                 clearable
+                @focus="chooseTreeRefer('MATERIALCLASSIFY_PARAM', false, '物料分类')"
                 style="width: 200px"
-              />
+                >
+                <el-option v-for="item in classOptions" :key="item.id" :label="item.name" :value="item.id" />
+              </el-select>
             </el-form-item>
          </el-col>
 
@@ -151,14 +142,25 @@
         <el-button size="small" plain @click="back">返回</el-button>
       </el-col>
     </div>
+
+    <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
+
+    <TreeRefers ref="tree" @doSubmit="selectionsToInput2" :single="true"/>
   </div>
 </template>
 
 <script>
+import Refers from '@/components/Refers/refers.vue'
+import TreeRefers from '@/components/Refers/treeRefer.vue'
 import {addAddress, getAddressDetail, editAddress} from '@/api/purchase/deliveryAddress.js'
 export default {
   name: 'addAddress',
+  dicts: ['sys_warehouse_attribute'],
   props: ['pageStu','row', 'disable'],
+  components: {
+    Refers,
+    TreeRefers
+  },
   model: {
     prop: 'isList',
     event: 'jugislist'
@@ -181,11 +183,19 @@ export default {
         sendStatus: '',
         remark: '',
       },
+      referCondition: {
+        type: '',
+        isPage: true,
+        title: ''
+      },
       options: [{
         value: '1', label: '是',
       }, {
         value: '0', label: '否'
       }],
+      houseOptions: [],
+      contactsOptions: [],
+      classOptions: [],
       basicRules: {}
     }
   },
@@ -232,6 +242,32 @@ export default {
         }
       })
     },
+    chooseRefer(type, isPage, title) {
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
+      this.$refs.refer.init(this.referCondition)
+    },
+    selectionsToInput(selection) {
+      if (this.referCondition.type == 'WAREHOUSE_PARAM') {
+        this.houseOptions = selection
+        this.basicForm.warehouseCode = selection[0].id
+      }
+      if (this.referCondition.type == 'CONTACTS_PARAM') {
+        this.contactsOptions = selection
+        this.basicForm.contactsName = selection[0].id
+      }
+    },
+    chooseTreeRefer(type, isPage, title) {
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
+      this.$refs.tree.init(this.referCondition)
+    },
+    selectionsToInput2(selection) {
+      this.classOptions.push(selection)
+      this.basicForm.materialClassify = selection.id
+    },
   }
 }
 </script>

+ 12 - 7
src/views/purchase/purchase-order/add/column.js

@@ -178,7 +178,7 @@ export const Columns = [
     width: 200,
   },
   { key: "isSendSrm", title: "是否同步SRM", type: "Checkbox", },
-  { key: "isInvoice", title: "发票标识", type: "Input", },
+  { key: "isInvoice", title: "发票标识", type: "Checkbox", },
   { key: "supplierOrderNo", title: "供应商订单号", type: "Input", },
   { key: "rebateMoney", title: "订单使用返利金额", type: "Input", },
   { key: "deductionMoney", title: "订单抵扣余款金额", type: "Input", },
@@ -210,7 +210,7 @@ export const Columns = [
     },
     width: 200,
   },
-  { key: "isUrgency", title: "紧急程度", type: "Input", },
+  { key: "isUrgency", title: "紧急程度", type: "Checkbox", },
   { key: "isSendWms", title: "已同步WMS", type: "Checkbox", },
   // { key: "agent", title: "代理人", type: "Input", }, // 建议删除
   // { key: "agentName", title: "代理人名称", },
@@ -226,7 +226,7 @@ export const Columns = [
   //   // type: "InputDialog",
   // },
   { key: "supplierPersonalName", title: "供应商业务员名称", type: "Input", },
-  { key: "isDeliver", title: "是否发货", type: "Input", },
+  { key: "isDeliver", title: "是否发货", type: "Checkbox", },
   {
     key: "retReason",
     title: "退换原因",
@@ -240,14 +240,14 @@ export const Columns = [
     },
   },
   {
-    key: "processType",
+    key: "processTypeName",
     title: "处理方式",
     type: "InputDialog",
     config: {
       componentName: "PROCESSTYPE_PARAM",
       dataMapping: {
         processType: "code",
-        // processTypeName: "name",
+        processTypeName: "name",
       },
     },
   },
@@ -279,7 +279,7 @@ export const Columns = [
   { key: "isArrivalReson", title: "到货超期原因", type: "Input", },
   { key: "midOrderNo", title: "中台采购订单号", type: "Input", },
   { key: "marketingCode", title: "销售订单号", type: "Input", },
-  { key: "isArrival", title: "到货超期", type: "Input", },
+  { key: "isArrival", title: "到货超期", type: "Checkbox", },
   { key: "createByName", title: "创建人名称", type: "Input", },
   { key: "updateByName", title: "更新人名称", type: "Input", },
   { key: "flowId", title: "OA流程ID", type: "Input", },
@@ -290,7 +290,12 @@ export const Columns = [
     type: "DatePicker",
     config: { type: "date" },
   },
-  { key: "approveTime", title: "提交时间", },
+  {
+    key: "approveTime",
+    title: "提交时间",
+    type: "DatePicker",
+    config: { type: "date" },
+  },
 
 ];
 

+ 8 - 3
src/views/purchase/purchase-order/add/index.vue

@@ -9,9 +9,15 @@ const NewTabColumns = TabColumns.map((element) => ({
   tableColumns: initColumns(element.tableColumns),
 }));
 
+const SelectColumns = NewColumns.filter(column => column.type === 'Select')
+NewTabColumns.forEach(column => {
+  SelectColumns.push(...column.tableColumns.filter(cColumn => cColumn.type === 'Select'))
+});
+
+
 export default {
   name: "AddPurchaseOrderDrawer",
-  dicts: initDicts(NewColumns),
+  dicts: initDicts(SelectColumns),
   components: {
     DrInputDialog: () => import("@/components/input-dialog/index.vue"),
   },
@@ -219,8 +225,7 @@ export default {
                   </dr-input-dialog>
                   <el-input-number v-if="cColumn.type === 'InputNumber'" v-model="scope.row[cColumn.key]"
                     :controls-position="cColumn.config.controlsPosition" :placeholder="cColumn.placeholder"
-                    :clearable="cColumn.clearable" :disabled="cColumn.disabled" size="mini"
-                    style="width: 100%">
+                    :clearable="cColumn.clearable" :disabled="cColumn.disabled" size="mini" style="width: 100%">
                   </el-input-number>
                   <el-select v-if="cColumn.type === 'Select'" v-model="params[cColumn.key]"
                     :placeholder="column.placeholder" :clearable="cColumn.clearable" :disabled="cColumn.disabled"

+ 12 - 6
src/views/purchase/purchase-order/edit/index.vue

@@ -8,10 +8,15 @@ const NewTabColumns = TabColumns.map((element) => ({
   ...element,
   tableColumns: initColumns(element.tableColumns),
 }));
+// 
+const SelectColumns = NewColumns.filter(column => column.type === 'Select')
+NewTabColumns.forEach(column => {
+  SelectColumns.push(...column.tableColumns.filter(cColumn => cColumn.type === 'Select'))
+});
 
 export default {
   name: "EditPurchaseOrderDrawer",
-  dicts: initDicts(NewColumns),
+  dicts: initDicts(SelectColumns),
   components: {
     DrInputDialog: () => import("@/components/input-dialog/index.vue"),
   },
@@ -55,7 +60,8 @@ export default {
         this.loading = true;
         const { code, msg, data } = await orderApi.details(prop);
         if (code === 200) {
-          this.params = data;
+          this.params = { ...this.params, ...data };
+          console.log(this.params, 'this.params----------');
           this.$notify.success({ title: msg });
         } else {
           this.$notify.warning({ title: msg });
@@ -130,6 +136,7 @@ export default {
   },
   created() {
     console.log("ADD CREATED");
+    console.log(this.params, 'this.params');
   },
   mounted() { },
   destroyed() { },
@@ -163,8 +170,8 @@ export default {
               </el-input>
               <dr-input-dialog v-if="column.type === 'InputDialog'" v-model="params[column.key]"
                 :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
-                :readonly="column.readonly" :title="column.title" :type="column.config.componentName"
-                :data-mapping="column.config.dataMapping" :source.sync="params">
+                :readonly="column.readonly" :query-params="column.config.queryParams" :title="column.title"
+                :type="column.config.componentName" :data-mapping="column.config.dataMapping" :source.sync="params">
               </dr-input-dialog>
               <el-input v-if="column.type === 'Textarea'" v-model="params[column.key]" type="textarea"
                 :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
@@ -250,8 +257,7 @@ export default {
                   </el-checkbox>
                   <el-input-number v-if="cColumn.type === 'InputNumber'" v-model="scope.row[cColumn.key]"
                     :controls-position="cColumn.config.controlsPosition" :placeholder="cColumn.placeholder"
-                    :clearable="cColumn.clearable" :disabled="cColumn.disabled" :size="size"
-                    style="width: 100%">
+                    :clearable="cColumn.clearable" :disabled="cColumn.disabled" :size="size" style="width: 100%">
                   </el-input-number>
                 </template>
               </el-table-column>

+ 23 - 10
src/views/purchase/task/column.js

@@ -1,18 +1,26 @@
 export const TableColumns = [
   { key: "id", title: "主键" },
-  { key: "material", title: "物料", search: true },
-  { key: "materialName", title: "物料名称", search: true },
-  { key: "status", title: "状态", search: true },
-  { key: "materialDesc", title: "物料/物料描述", search: true },
+  { key: "material", title: "物料", search: true, type: "Input" },
+  { key: "materialName", title: "物料名称", search: true, type: "Input" },
+  {
+    key: "status",
+    title: "状态",
+    search: true,
+    type: "Select",
+    config: {
+      optionsName: "purchase_task_status",
+    },
+  },
+  { key: "materialDesc", title: "物料/物料描述", search: true, type: "Input" },
   { key: "manufacturer", title: "生产厂家" },
   { key: "manufacturerName", title: "生产厂家名称" },
   { key: "priceType", title: "价格类型" },
   { key: "buyer", title: "采购员" },
-  { key: "buyerName", title: "采购员名称", search: true },
+  { key: "buyerName", title: "采购员名称", search: true, type: "Input" },
   { key: "supplier", title: "建议供应商" },
   { key: "supplierName", title: "建议供应商名称" },
   { key: "puOrg", title: "采购组织" },
-  { key: "puOrgName", title: "采购组织名称", search: true },
+  { key: "puOrgName", title: "采购组织名称", search: true, type: "Input" },
   { key: "currency", title: "币种" },
   { key: "currencyName", title: "币种名称" },
   { key: "billYpe", title: "交易类型" },
@@ -22,14 +30,19 @@ export const TableColumns = [
   { key: "puUnit", title: "采购单位" },
   { key: "puUnitName", title: "采购单位名称" },
   { key: "puQty", title: "采购数量" },
-  { key: "demandDate", title: "需求时间", search: true },
+  { key: "demandDate", title: "需求时间", search: true, type: "Input" },
   { key: "projectName", title: "项目名称" },
   { key: "demandPersonal", title: "需求人" },
-  { key: "demandPersonalName", title: "需求人名称", search: true },
-  { key: "demandOrg", title: "需求组织", search: true },
+  {
+    key: "demandPersonalName",
+    title: "需求人名称",
+    search: true,
+    type: "Input",
+  },
+  { key: "demandOrg", title: "需求组织", search: true, type: "Input" },
   { key: "demandOrgName", title: "需求组织名称" },
   { key: "demandDept", title: "需求部门" },
-  { key: "demandDeptName", title: "需求部门名称", search: true },
+  { key: "demandDeptName", title: "需求部门名称", search: true, type: "Input" },
   { key: "isBack", title: "是否退回" },
   { key: "baskCause", title: "退回原因" },
   { key: "backDate", title: "退回日期" },

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

@@ -1,6 +1,6 @@
 <script>
 import { TableColumns } from "./column";
-import { FirstDirect } from "@/api/business/purchase/task";
+import { FIRSTDIRECT, ADD } from "@/api/business/purchase/task";
 import { initColumns } from "@/utils/init";
 export default {
   name: "FirstDirectPurchaseDrawer",
@@ -28,7 +28,7 @@ export default {
     async fetchItem(prop) {
       try {
         this.loading = true;
-        const { code, msg, data } = await FirstDirect(prop);
+        const { code, msg, data } = await FIRSTDIRECT(prop);
         if (code === 200) {
           this.data = data;
           this.$notify.success({ title: msg });
@@ -45,8 +45,34 @@ export default {
     handleCancel() {
       this.setVisible(false);
     },
+    // 保存并新增
+    async handleSubmit() {
+      const params = this.data
+        .map((item) => ({
+          ...item,
+          orderPriceVos: item.orderPriceVos.filter(
+            (citem) => citem.purchaseQuantity
+          ),
+        }))
+        .filter((item) => item.orderPriceVos.length);
+      try {
+        const { code, msg } = await ADD(params);
+        if (code === 200) {
+          this.$notify.success({ title: msg });
+          this.setVisible(false);
+        } else {
+          this.$notify.warning({ title: msg });
+        }
+      } catch (err) {
+        this.$notify.error({ title: "error", message: err });
+      } finally {
+        // this.setVisible(false);
+      }
+    },
+  },
+  created() {
+    console.log("initColumns(TableColumns)", initColumns(TableColumns));
   },
-  created() {},
   mounted() {},
   destroyed() {},
 };
@@ -78,6 +104,9 @@ export default {
         <h3>首次协议直采</h3>
         <div style="text-align: right">
           <el-button :size="size" @click="handleCancel">取 消</el-button>
+          <el-button :size="size" type="info" @click="handleSubmit">
+            新 增
+          </el-button>
         </div>
       </div>
       <div
@@ -107,46 +136,156 @@ export default {
           style="width: 100%"
         >
           <el-table-column
-            v-for="(column, index) in tableColumns"
-            :key="index"
-            :prop="column.key"
-            :label="column.title"
-            :width="column.width || 180"
-            :show-overflow-tooltip="column.showOverflowTooltip || true"
+            prop="supplier"
+            label="供应商"
+            width="125"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="supplierName"
+            label="供应商名称"
+            width="125"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="puOrg"
+            label="采购组织"
+            width="125"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="puOrgName"
+            label="采购组织名称"
+            width="150"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="customer"
+            label="客户"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="customerName"
+            label="客户名称"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="priceType"
+            label="价格类型"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="isDistribution"
+            label="配送价"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="effectiveDate"
+            label="价格生效日期"
+            width="150"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="endDate"
+            label="价格失效日期"
+            width="150"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="tax"
+            label="税率"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="taxFreePrice"
+            label="无税单价"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="taxPrice"
+            label="主含税单价"
+            width="125"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            prop="purchaseQuantity"
+            label="本次采购数量"
+            width="175"
+          >
+            <template slot-scope="scope">
+              <el-input-number
+                v-model="scope.row.purchaseQuantity"
+                :min="0"
+                :max="item.puQty - (item.executeQty || 0)"
+                size="mini"
+                controls-position="right"
+                style="width: 100%"
+              ></el-input-number>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="arrivalDatePlan"
+            label="计划到货日期"
+            width="175"
+          >
+            <template slot-scope="scope">
+              <el-date-picker
+                v-model="scope.row.arrivalDatePlan"
+                size="mini"
+                style="width: 100%"
+              ></el-date-picker>
+            </template>
+          </el-table-column>
+          <el-table-column prop="note" label="备注" width="250">
+            <template slot-scope="scope">
+              <el-input
+                v-model="scope.row.note"
+                autosize
+                size="mini"
+                type="textarea"
+                style="width: 100%"
+              ></el-input>
+            </template>
+          </el-table-column>
+          <!-- <el-table-column
+            v-for="(cItem, cIndex) in tableColumns"
+            :key="cIndex"
+            :prop="cItem.key"
+            :label="cItem.title"
+            :width="cItem.width || 180"
+            :show-overflow-tooltip="cItem.showOverflowTooltip || true"
           >
             <template slot-scope="scope">
               <el-input-number
-                v-if="column.edit && column.editConfig.type === 'InputNumber'"
-                v-model="scope.row[column.key]"
-                :controls-position="column.editConfig.controlsPosition"
-                :min="column.editConfig.min"
-                :max="column.editConfig.max"
-                :size="column.editConfig.size || 'mini'"
-                :placeholder="column.editConfig.placeholder"
+                v-if="cItem.edit && cItem.editConfig.type === 'InputNumber'"
+                v-model="scope.row[cItem.key]"
+                :controls-position="cItem.editConfig.controlsPosition"
+                :min="cItem.editConfig.min"
+                :max="cItem.editConfig.max"
+                :size="cItem.editConfig.size || 'mini'"
+                :placeholder="cItem.editConfig.placeholder"
                 style="width: 90%"
               ></el-input-number>
               <el-date-picker
-                v-else-if="
-                  column.edit && column.editConfig.type === 'DatePicker'
-                "
-                v-model="scope.row[column.key]"
-                :type="column.editConfig.showType"
-                :picker-options="column.editConfig.pickerOptions"
-                :size="column.editConfig.size || 'mini'"
-                :placeholder="column.editConfig.placeholder"
+                v-else-if="cItem.edit && cItem.editConfig.type === 'DatePicker'"
+                v-model="scope.row[cItem.key]"
+                :type="cItem.editConfig.showType"
+                :picker-options="cItem.editConfig.pickerOptions"
+                :size="cItem.editConfig.size || 'mini'"
+                :placeholder="cItem.editConfig.placeholder"
                 style="width: 90%"
               ></el-date-picker>
               <el-input
-                v-else-if="column.edit && column.editConfig.type === 'Textarea'"
-                v-model="scope.row[column.key]"
+                v-else-if="cItem.edit && cItem.editConfig.type === 'Textarea'"
+                v-model="scope.row[cItem.key]"
                 type="textarea"
-                :autosize="column.editConfig.autosize || true"
-                :size="column.editConfig.size || 'mini'"
+                :autosize="cItem.editConfig.autosize || true"
+                :size="cItem.editConfig.size || 'mini'"
                 style="width: 90%"
               ></el-input>
-              <span v-else>{{ scope.row[column.key] }}</span>
+              <span v-else>{{ scope.row[cItem.key] }}</span>
             </template>
-          </el-table-column>
+          </el-table-column> -->
         </el-table>
       </div>
       <!-- <el-pagination

+ 77 - 6
src/views/purchase/task/index.vue

@@ -1,9 +1,17 @@
 <script>
 import { TableColumns, SearchColumns } from "./column";
-import { list } from "@/api/business/purchase/task";
-import { initPage, initLayout, initPageSizes, initParams } from "@/utils/init";
+import { LIST, SHUTDOWN } from "@/api/business/purchase/task";
+import {
+  initPage,
+  initLayout,
+  initPageSizes,
+  initParams,
+  initColumns,
+  initDicts,
+} from "@/utils/init";
 export default {
   name: "PuchaseTask",
+  dicts: initDicts(TableColumns),
   components: {
     SeeDrawer: () => import("./see/index.vue"),
     FirstDirectDrawer: () => import("./first-direct/index.vue"),
@@ -14,7 +22,7 @@ export default {
 
       loading: false,
 
-      searchColumns: SearchColumns,
+      searchColumns: initColumns(SearchColumns),
       params: {
         isAsc: "",
         reasonable: "",
@@ -41,7 +49,7 @@ export default {
       try {
         this.loading = true;
         const { pageNum, pageSize } = page;
-        const { code, msg, rows, total } = await list({
+        const { code, msg, rows, total } = await LIST({
           pageNum,
           pageSize,
           ...params,
@@ -79,10 +87,27 @@ export default {
       this.page.pageNum = prop;
       this.fetchList(this.params, this.page);
     },
-    //
+    // 选择行
     handleSelectionChange(prop) {
       this.selectData = prop;
     },
+    // 行删除
+    async handleShutDown(prop) {
+      try {
+        this.loading = true;
+        const { demandItemId } = prop;
+        const { code, msg } = await SHUTDOWN(demandItemId);
+        if (code === 200) {
+          this.$notify.success({ title: msg });
+        } else {
+          this.$notify.warning({ title: msg });
+        }
+      } catch (err) {
+        this.$notify.error({ title: "error", message: err });
+      } finally {
+        this.loading = false;
+      }
+    },
     // 打开查看drawer
     async handleOpenSeeDrawer(prop) {
       const { id } = prop;
@@ -119,12 +144,37 @@ export default {
           :sm="12"
           :xs="24"
         >
-          <el-form-item :prop="column.key" :label="column.title">
+          <el-form-item
+            v-if="column.type === 'Input'"
+            :prop="column.key"
+            :label="column.title"
+          >
             <el-input
               v-model="params[column.key]"
               :placeholder="column.placeholder"
             ></el-input>
           </el-form-item>
+          <el-form-item
+            v-if="column.type === 'Select'"
+            :prop="column.key"
+            :label="column.title"
+          >
+            <el-select
+              v-model="params[column.key]"
+              :disabled="column.disabled"
+              :clearable="column.clearable"
+              :placeholder="column.placeholder"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in dict.type[column.config.optionsName]"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
         </el-col>
       </el-row>
     </el-form>
@@ -140,6 +190,27 @@ export default {
       <el-col :span="18" style="text-align: right">
         <el-button
           :size="size"
+          :disabled="selectData.length !== 1"
+          @click="handleShutDown(selectData[0])"
+        >
+          分配
+        </el-button>
+        <el-button
+          :size="size"
+          :disabled="selectData.length !== 1"
+          @click="handleShutDown(selectData[0])"
+        >
+          退回需求
+        </el-button>
+        <el-button
+          :size="size"
+          :disabled="selectData.length !== 1"
+          @click="handleShutDown(selectData[0])"
+        >
+          行删除
+        </el-button>
+        <el-button
+          :size="size"
           :disabled="!selectData.length"
           @click="handleOpenFristDirectDrawer(selectData)"
         >