Browse Source

feature(*): 1、硬件交付工单需求调整,调整完成、部署等相关逻辑
2、经销商、代理商所属区域进行数据权限限制
3、合同时间查询逻辑调整,将签订时间改为结束时间
4、回款页面默认查询前30天、后30天数据,调整部分字段显示宽度

lk 2 years ago
parent
commit
54537741b4

+ 3 - 0
src/api/work/deliver.js

@@ -29,4 +29,7 @@ export default {
   start(query) {
     return micro_request.postRequest(basePath, 'DeliverOrder', 'Start', query)
   },
+  getHardwareUserInfo(query) {
+    return micro_request.postRequest(basePath, 'DeliverOrder', 'GetHardwareUserInfo', query)
+  },
 }

+ 2 - 2
src/views/base/agent/index.vue

@@ -271,7 +271,7 @@
     created() {
       this.fetchData()
       this.getRegionTree()
-      this.getUserSalesProvince()
+      // this.getUserSalesProvince()
     },
     methods: {
       // 转经销商
@@ -299,7 +299,7 @@
           })
       },
       async getRegionTree() {
-        const { data: data } = await regionApi.getRegionTree({})
+        const { data: data } = await regionApi.getRegionTree({ isPermission: '1' })
         this.regionOptions.push(...data.list)
       },
       async getUserSalesProvince() {

+ 2 - 2
src/views/base/distributor/index.vue

@@ -271,11 +271,11 @@
     created() {
       this.fetchData()
       this.getRegionTree()
-      this.getUserSalesProvince()
+      // this.getUserSalesProvince()
     },
     methods: {
       async getRegionTree() {
-        const { data: data } = await regionApi.getRegionTree({})
+        const { data: data } = await regionApi.getRegionTree({ isPermission: '1' })
         this.regionOptions.push(...data.list)
       },
       async getUserSalesProvince() {

+ 7 - 1
src/views/collection/index.vue

@@ -235,7 +235,7 @@
           },
           {
             label: '所在省',
-            width: '100px',
+            width: '200px',
             prop: 'custProvince',
             sortable: false,
             disableCheck: false,
@@ -281,6 +281,12 @@
     },
     async mounted() {
       await this.getOptions()
+      let date1 = new Date()
+      let date2 = new Date()
+      date1 = date1.setDate(date1.getDate() - 30)
+      date2 = date2.setDate(date2.getDate() + 30)
+      this.queryForm.filterDate = [this.parseTime(date1, '{y}-{m}-{d}'), this.parseTime(date2, '{y}-{m}-{d}')]
+      console.info(this.queryForm.filterDate)
       this.queryData()
     },
     methods: {

+ 5 - 5
src/views/contract/index.vue

@@ -60,9 +60,9 @@
           <el-form-item prop="filterDate">
             <el-date-picker
               v-model="queryForm.filterDate"
-              end-placeholder="合同签订结束时间"
+              end-placeholder="合同结束时间开始"
               range-separator="至"
-              start-placeholder="合同签订开始时间"
+              start-placeholder="合同结束时间结束"
               style="width: 100%"
               type="daterange"
               value-format="yyyy-MM-dd" />
@@ -280,7 +280,7 @@
           },
           {
             label: '所在省',
-            width: '100px',
+            width: '200px',
             prop: 'custProvince',
             sortable: false,
             disableCheck: false,
@@ -404,8 +404,8 @@
         params.custProvinceId = params.custProvince ? params.custProvince.id : 0
         params.custCityId = params.custCity ? params.custCity.id : 0
         if (this.queryForm.filterDate && this.queryForm.filterDate.length === 2) {
-          params.contractSignTimeStart = this.queryForm.filterDate[0]
-          params.contractSignTimeEnd = this.queryForm.filterDate[1]
+          params.contractEndTimeStart = this.queryForm.filterDate[0]
+          params.contractEndTimeEnd = this.queryForm.filterDate[1]
         }
         const [err, res] = await to(contractApi.getList(params))
         if (err) return (this.listLoading = false)

+ 1 - 1
src/views/work/deliver/components/Edit.vue

@@ -234,7 +234,7 @@
         this.$refs['dingTalkFrom'].resetForm()
         this.$refs['form'].resetFields()
         this.form = this.$options.data().form
-        if (this.dingtalkForm.items) {
+        if (this.dingtalkForm && this.dingtalkForm.items) {
           this.dingtalkForm.items.splice(0, this.dingtalkForm.items.length)
         }
         this.dialogFormVisible = false

+ 1 - 1
src/views/work/deliver/components/completeProgress.vue

@@ -31,7 +31,7 @@
         </el-col>
         <el-col :span="24">
           <el-form-item label="备注" prop="remark">
-            <el-input v-model="form.remark" placeholder="请输入备注" />
+            <el-input v-model="form.remark" placeholder="请输入备注" :rows="5" show-word-limit type="textarea" />
           </el-form-item>
         </el-col>
       </el-row>

+ 18 - 1
src/views/work/deliver/components/deliver.vue

@@ -100,7 +100,24 @@
     mounted() {},
     methods: {
       // 打开弹窗
-      open(row) {
+      async open(row) {
+        let flag = false
+        await deliverWorkApi
+          .list({ deliverProgressId: row.id })
+          .then((res) => {
+            if (res.data.list && res.data.list.length > 0) {
+              if (res.data.list[0].progressStatus != '30') {
+                flag = true
+              }
+            }
+          })
+          .catch((err) => {
+            console.error(err)
+          })
+        if (flag) {
+          this.$message.warning('组装任务单未完成,不可发货')
+          return
+        }
         this.title = '发货'
         this.progress = row
         this.form.date = ''

+ 60 - 16
src/views/work/deliver/components/editWork.vue

@@ -48,7 +48,7 @@
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item label="开始/截止时间" prop="date">
+          <el-form-item label="开始/截止日期" prop="date">
             <el-date-picker
               v-model="form.date"
               :disabled="!editable"
@@ -56,16 +56,27 @@
               range-separator="至"
               start-placeholder="开始时间"
               style="width: 100%"
-              type="datetimerange"
-              value-format="yyyy-MM-dd HH:mm:ss" />
+              type="daterange"
+              value-format="yyyy-MM-dd" />
           </el-form-item>
         </el-col>
         <el-col :span="24">
           <el-table ref="productTable" :data="products" style="width: 100%">
-            <el-table-column type="selection" width="55" />
+            <el-table-column :selectable="selectable" type="selection" width="55" />
             <el-table-column label="产品名称" prop="productName" />
             <el-table-column label="产品编号" prop="productCode" />
-            <el-table-column label="数量" prop="productNum" />
+            <el-table-column v-if="!workId" label="数量" prop="num" />
+            <el-table-column v-if="form.progressType == '10'" label="组装/采购数量" prop="productNum">
+              <template slot-scope="scope">
+                <el-input-number
+                  v-model="scope.row.productNum"
+                  controls-position="right"
+                  :disabled="!productEditable"
+                  :max="scope.row.max"
+                  :min="1" />
+              </template>
+            </el-table-column>
+            <el-table-column v-if="form.progressType != '10'" label="数量" prop="productNum" />
             <el-table-column v-if="form.progressType == '10'" label="获取方式">
               <template slot-scope="scope">
                 <el-select
@@ -223,11 +234,15 @@
         } else {
           this.title = '新建工作项'
           this.form.progressType = type
+          this.form.progressTitle = ''
           this.workId = 0
         }
         this.getOrderDetails()
         this.dialogFormVisible = true
       },
+      selectable(row, index) {
+        return row.max > 0 && !this.workId
+      },
       close() {
         this.$refs['form'].resetFields()
         this.form = this.$options.data().form
@@ -330,6 +345,7 @@
       async getOrderDetails() {
         this.products = []
         this.allProducts = []
+        let progressProducts = []
         this.deliverProducts = []
         this.installProducts = []
         this.selfProducts = []
@@ -338,23 +354,50 @@
         if (err) return
         if (res.code == 200 && res.data) {
           this.allProducts = res.data.product
+          progressProducts = res.data.progressProducts ? res.data.progressProducts : []
+        }
+        if (this.form.progressType == '10') {
+          orderWorkApi
+            .getHardwareUserInfo({ name: '丁岳嵩' })
+            .then((res) => {
+              if (res.data) {
+                this.form.principalPersonId = res.data.id
+                this.form.principalPerson = res.data.nickName
+              }
+            })
+            .catch((err) => {
+              console.error(err)
+            })
+          if (!this.form.progressTitle) {
+            this.form.progressTitle =
+              '[' + res.data.contractCode + '][' + res.data.projectName + ']发货任务单-' + res.data.number
+          }
         }
         for (let p of this.allProducts) {
-          p = JSON.parse(JSON.stringify(p))
-          if (p.isDeliver != '20') {
-            this.deliverProducts.push(p)
+          p.max = p.productNum - p.completeNum
+          p.num = p.completeNum + '/' + p.productNum
+          if (p.max > 0) {
+            p.productNum = 1
+          } else {
+            p.productNum = 0
           }
+          p.productId = p.id
+          p = JSON.parse(JSON.stringify(p))
+          this.deliverProducts.push(p)
+        }
+        for (let p of progressProducts) {
+          p = JSON.parse(JSON.stringify(p))
           // 10发货任务单/20组装任务单/30部署安装单
           if (
-            (p.deliverProgressId && p.deliverProgressId != 0 && this.form.progressType == '10') ||
-            (p.assembleProgressId && p.assembleProgressId != 0 && this.form.progressType == '20') ||
-            (p.installProgressId && p.installProgressId != 0 && this.form.progressType == '30')
+            (p.deliverProgressId == this.workId && this.form.progressType == '10') ||
+            (p.assembleProgressId == this.workId && this.form.progressType == '20') ||
+            (p.installProgressId == this.workId && this.form.progressType == '30')
           ) {
             this.selfProducts.push(p)
           }
-          if (p.isComplete == '20') {
-            this.installProducts.push(p)
-          }
+          // if (p.isComplete == '20') {
+          //   this.installProducts.push(p)
+          // }
         }
         this.$forceUpdate()
         if (this.workId != 0) {
@@ -363,9 +406,10 @@
           if (this.form.progressType == '10') {
             this.productEditable = true
             this.products = this.deliverProducts
-          } else if (this.form.progressType == '30') {
-            this.products = this.installProducts
           }
+          //  else if (this.form.progressType == '30') {
+          //   this.products = this.installProducts
+          // }
         }
       },
     },

+ 6 - 3
src/views/work/deliver/index.vue

@@ -88,7 +88,10 @@
           <el-button v-if="row.orderType != '20' && !row.deliverManName" type="text" @click="handleUpdateUser(row)">
             成员
           </el-button>
-          <el-button v-if="row.orderStatus == 10 || row.orderStatus == 15" type="text" @click="handleFinish(row)">
+          <el-button
+            v-if="(row.orderStatus == 10 || row.orderStatus == 15) && row.orderType != '20'"
+            type="text"
+            @click="handleFinish(row)">
             完成
           </el-button>
         </template>
@@ -207,12 +210,12 @@
           },
           {
             label: '收货信息',
-            width: '120px',
+            width: '280px',
             prop: 'receivingInfo',
           },
           {
             label: '特殊要求说明',
-            width: '120px',
+            width: '280px',
             prop: 'specialRequirements',
           },
           {

+ 4 - 4
src/views/work/deliver/plan.vue

@@ -93,21 +93,21 @@
               新建工作项
             </el-button>
             <el-button
-              v-show="workOrderStatus != 20 && curPlanStatus != 30 && orderType == '20'"
+              v-show="workOrderStatus == 15 && curPlanStatus != 30 && orderType == '20'"
               v-permissions="['order:delivery:work:adddeliver']"
               icon="el-icon-plus"
               type="primary"
               @click="openAddWork('10')">
               生成发货任务单
             </el-button>
-            <el-button
-              v-show="workOrderStatus != 20 && curPlanStatus != 30 && orderType == '20'"
+            <!-- <el-button
+              v-show="workOrderStatus == 15 && curPlanStatus != 30 && orderType == '20'"
               v-permissions="['order:delivery:work:addinstall']"
               icon="el-icon-plus"
               type="primary"
               @click="openAddWork('30')">
               生成部署安装单
-            </el-button>
+            </el-button> -->
           </vab-query-form-left-panel>
           <vab-query-form-right-panel>
             <table-tool :columns="columns" :show-columns.sync="showColumns" table-type="deliveryPlanTable" />