Prechádzať zdrojové kódy

新增创建工程工单入口
创建工程维保工单增加销售类型字段
工单详情增加销售类型字段
创建普通工单增加销售类型字段

linwenxin 1 rok pred
rodič
commit
61c44eac2b

+ 8 - 8
src/views/workOrder/workOrderPool/detailModule/Payment/index.vue

@@ -5,7 +5,7 @@
         <zj-form-container :formAttributes="{ 'label-position': 'top' }">
           <template v-for="(item, index) in payData">
             <zj-form-module :title="'支付费用' + (index + 1)" :form-data="payData[index]"
-              :form-items="[formItemsL1, formItems(item)][workOrderType]">
+              :form-items="[formItemsL1, formItems(item)][!!~[1,2,3].indexOf(workOrderType) ? 0 : workOrderType == 4 ? 1 : 0]">
               <div v-if="item.examineStatus === 'FAIL'" style="text-align:right">
                 <el-button size="mini" type="danger" plain @click="enginMaterialCancelFun(item)">取消申请</el-button>
               </div>
@@ -30,7 +30,7 @@ export default {
     },
     workOrderType: {
       type: Number,
-      default: 0, // 0普通工单, 1维保工单
+      default: 1, // 1普通工单, 4维保工单
     },
   },
   data() {
@@ -86,7 +86,7 @@ export default {
               <el-descriptions-item label="支付总金额">
                 {formData.totalAmount}
               </el-descriptions-item>
-              {this?.workOrderType == 0 ? (
+              {!!~[1,2,3].indexOf(this?.workOrderType) ? (
                 <el-descriptions-item label="总手续费">
                   {formData.commissionAmount}
                 </el-descriptions-item>
@@ -96,7 +96,7 @@ export default {
               </el-descriptions-item>
               <el-descriptions-item label="">
               </el-descriptions-item>
-              {this?.workOrderType == 1 ? [
+              {this?.workOrderType == 4 ? [
                 (<el-descriptions-item label=""></el-descriptions-item>),
                 (<el-descriptions-item label="审批状态">
                   {({ WAIT: "待审", OK: "审批", FAIL: "驳回", NO: "取消" })[formData.examineStatus] || ""}
@@ -143,7 +143,7 @@ export default {
                 }
               },
               ...(() => {
-                if (this?.workOrderType == 0) {
+                if (!!~[1,2,3].indexOf(this?.workOrderType)) {
                   return [{
                     columnAttributes: {
                       label: '师傅分账金额',
@@ -169,7 +169,7 @@ export default {
                 return []
               })(),
               ]}
-              table-data={[formData.workerOrderItems, formData.rpMaterialOrderItems][this?.workOrderType]}
+              table-data={[formData.workerOrderItems, formData.rpMaterialOrderItems][!!~[1,2,3].indexOf(this?.workOrderType) ? 0 : this?.workOrderType == 4 ? 1 : 0]}
             />
           )
         }
@@ -501,13 +501,13 @@ export default {
     },
     getxiangqing() {
       if (this.id) {
-        if (this?.workOrderType == 0) {
+        if (!!~[1,2,3].indexOf(this?.workOrderType)) {
           changeOrderGetOrderList({
             id: this.id
           }).then(res => {
             this.payData = res.data
           })
-        } else if (this?.workOrderType == 1) {
+        } else if (this?.workOrderType == 4) {
           enginMaterialDetailWorker({
             workerOrderId: this.id
           }).then(res => {

+ 10 - 31
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/index.vue

@@ -1,12 +1,7 @@
 <template>
   <zj-page-container v-if="orderInfo">
     <zj-page-fill class="neibuview">
-      <zj-form-container
-        ref="formRef"
-        :form-data="orderInfo"
-        :form-rules="formRules"
-        :form-attributes="{ size: 'mini' }"
-      >
+      <zj-form-container ref="formRef" :form-data="orderInfo" :form-rules="formRules" :form-attributes="{ size: 'mini' }">
         <!-- 派工信息 创建不需要 -->
         <zj-form-module v-if="id" title="派工信息" label-width="90px" :form-data="orderInfo" :form-items="dispatchInfo">
           <div slot="internal-bottom" style="text-align: right;">
@@ -14,11 +9,8 @@
           </div>
           <div slot="right" style="width: 55%; position: relative">
             <div class="pgxxTable">
-              <zj-table
-                :columns="logColumns"
-                :table-data="logList"
-                :table-attributes="{ height: '100%', border: true }"
-              />
+              <zj-table :columns="logColumns" :table-data="logList"
+                :table-attributes="{ height: '100%', border: true }" />
             </div>
           </div>
         </zj-form-module>
@@ -27,11 +19,7 @@
         <!-- 服务信息 -->
         <zj-form-module title="服务信息" label-width="110px" :form-data="orderInfo" :form-items="serviceInfo" />
         <!-- 产品信息 -->
-        <zj-form-module
-          title="产品信息"
-          :form-data="orderInfo"
-          :form-items="workOrderType == 1 ? product_wb : product"
-        />
+        <zj-form-module title="产品信息" :form-data="orderInfo" :form-items="workOrderType == 4 ? product_wb : product" />
         <!-- 其它信息 -->
         <!-- <zj-form-module title="其它信息" :form-data="orderInfo" :form-items="otherInfo" /> -->
         <!-- 派单信息 -->
@@ -46,12 +34,8 @@
         <!-- 1,保存  -->
         <commitSave v-if="~btnRestrict.indexOf(1)" :orderInfo="orderInfo" :orderType="orderType" />
         <!-- 2,过程反馈  -->
-        <processFeedback
-          v-if="~btnRestrict.indexOf(2)"
-          resultCodeName="过程反馈"
-          :orderInfo="orderInfo"
-          :orderType="orderType"
-        />
+        <processFeedback v-if="~btnRestrict.indexOf(2)" resultCodeName="过程反馈" :orderInfo="orderInfo"
+          :orderType="orderType" />
         <!-- 3,设为异常  -->
         <abnormal v-if="~btnRestrict.indexOf(3)" :orderInfo="orderInfo" :orderType="orderType" />
         <!-- 4,加急  -->
@@ -61,13 +45,8 @@
         <!-- 6,取消工单  -->
         <cancelOrder v-if="~btnRestrict.indexOf(6)" :orderInfo="orderInfo" :orderType="orderType" />
         <!-- 7,回访  -->
-        <processFeedback
-          v-if="~btnRestrict.indexOf(7)"
-          resultCodeName="回访"
-          resultCode="回访"
-          :orderInfo="orderInfo"
-          :orderType="orderType"
-        />
+        <processFeedback v-if="~btnRestrict.indexOf(7)" resultCodeName="回访" resultCode="回访" :orderInfo="orderInfo"
+          :orderType="orderType" />
         <!-- 工单驳回 -->
         <orderReject v-if="~btnRestrict.indexOf(9)" :orderInfo="orderInfo" :orderType="orderType" />
         <!-- 8,新建工单 -->
@@ -143,11 +122,11 @@ export default {
   box-sizing: border-box;
   padding-left: 16px;
 
-  ::v-deep & > .zj-page-fill-scroll {
+  ::v-deep &>.zj-page-fill-scroll {
     box-sizing: border-box;
     padding-right: 16px;
 
-    & > div:nth-child(1) {
+    &>div:nth-child(1) {
       margin-top: 20px;
     }
   }

+ 82 - 3
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/basicInfo.js

@@ -1,5 +1,6 @@
 import { lbsAmapRegion } from '@/api/common.js'
 import { listPageV2, getDetail } from "@/api/engineeringMaintenance/basicData";
+import { orderEnginbaseList } from "@/api/basicEngineeringData";
 import geographicalPosi from '@/components/geographicalPosi/index.vue'
 export default {
   data() {
@@ -8,7 +9,8 @@ export default {
       cityList: [],
       areaList: [],
       streetList: [],
-      wb_project: []
+      wb_project: [],
+      gc_project: []
     }
   },
   created() {
@@ -19,6 +21,21 @@ export default {
       var day = ('0' + currentDate.getDate()).slice(-2);
       return year + '-' + month + '-' + day + ' ' + sfm
     }
+    // 获取工程下拉
+    orderEnginbaseList({
+      "pageNum": 1,
+      "pageSize": -1,
+      "params": []
+    }).then(res => {
+      this.gc_project = res.data.records.map(item => {
+        return {
+          value: item.projectNo,
+          label: item.projectName,
+          data: item,
+        }
+      })
+    })
+    // 获取维保下拉
     listPageV2({
       "pageNum": 1,
       "pageSize": -1,
@@ -41,7 +58,7 @@ export default {
     basicInfo() {
       return [
         ...(() => {
-          if (this.workOrderType == 1) {
+          if (this.workOrderType == 4) {
             return [{
               isShow: this.formOptions.rpProjectRepairId.isShow,
               name: 'el-select',
@@ -80,6 +97,68 @@ export default {
                 return null
               }
             },]
+          } else if (this.workOrderType == 2) {
+            return [{
+              isShow: this.formOptions.projectNo.isShow,
+              name: 'el-select',
+              md: 12,
+              options: this.gc_project,
+              attributes: {
+                disabled: !this.formOptions.projectNo.isEdit,
+                placeholder: '请选择',
+                clearable: true,
+                filterable: true
+              },
+              formItemAttributes: {
+                label: '工程名称',
+                prop: 'projectNo',
+                rules: this.formOptions.projectNo.isRules
+              },
+              events: {
+                change: (val) => {
+                  this.getorderDetail(() => {
+                    if (val) {
+                      this.orderInfo.projectNo = val
+                      var item = this.gc_project.find(item => item.value == val)
+                      if (item) {
+                        this.orderInfo.projectName = item.label
+                        var data = item.data
+                        if (data) {
+                          this.orderInfo.userName = data.manger
+                          this.orderInfo.linkName = data.manger
+                          this.orderInfo.userMobile = data.mobile
+                          this.orderInfo.provinceId = data.provinceId
+                          this.orderInfo.province = data.province
+                          this.orderInfo.cityId = data.cityId
+                          this.orderInfo.city = data.city
+                          this.orderInfo.areaId = data.areaId
+                          this.orderInfo.area = data.area
+                          this.orderInfo.streetId = data.streetId
+                          this.orderInfo.street = data.street
+                          this.orderInfo.gpsAddress = data.gpsAddress || data.address
+                          this.orderInfo.lat = data.lat
+                          this.orderInfo.lng = data.lng
+                          this.orderInfo.address = data.address
+                          this.getinitlbslist()
+                        }
+                      }
+                    }
+                  })
+                }
+              }
+            }, {
+              isShow: true,
+              name: 'el-input',
+              md: 12,
+              attributes: {
+                disabled: true,
+              },
+              formItemAttributes: {
+                label: '工程编号',
+                prop: 'projectNo',
+                rules: this.formOptions.projectNo.isRules
+              }
+            }]
           }
           return []
         })(),
@@ -373,7 +452,7 @@ export default {
       lbsAmapRegion({ pid: 0 }).then(res => {
         this.provinceList = res.data
         // 创建工单时获取ip地址定位赋值
-        if (!this.id && this.workOrderType == 0 && this.$IpAdd.province) {
+        if (!this.id && !!~[1, 2, 3].indexOf(this?.workOrderType) && this.$IpAdd.province) {
           var item = this.provinceList.find(item => item.name === this.$IpAdd.province)
           if (item) {
             this.orderInfo.provinceId = item.id

+ 2 - 2
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/pandanxinxi.js

@@ -138,7 +138,7 @@ export default {
                     this.orderInfo.workerIdcard = data.workerIdcard
                     this.orderInfo.workerMobile = data.workerMobile
                     this.orderInfo.orderWorkers.unshift({ ...data, isMaster: true })
-                    if(data.slaveWorkerId){
+                    if (data.slaveWorkerId) {
                       var data2 = this.workerList.find(item => item.value == data.slaveWorkerId).data
                       this.orderInfo.orderWorkers.push({ ...data2, isMaster: false })
                       this.orderInfo.workerId_fz = ""
@@ -218,7 +218,7 @@ export default {
   },
   created() {
     // 普通工单选择网点数据
-    if (this.workOrderType == 0 || this.isAllWebsit) {
+    if (!!~[1,2,3].indexOf(this?.workOrderType) || this.isAllWebsit) {
       getWebsit({ type: "C", status: true, isAll: this.isAllWebsit || this.id ? true : false }).then(res => {
         this.websitList = res.data.map(item => ({
           label: item.name,

+ 20 - 3
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/serviceInfo.js

@@ -77,7 +77,7 @@ export default {
           }
         },
         // ...(() => {
-        //   if (this.workOrderType == 0) {
+        //   if (this.workOrderType == 1) {
         //     // 普通工单
         //     return [{
         //       isShow: this.formOptions.orderChannelId.isShow,
@@ -105,7 +105,7 @@ export default {
         //         }
         //       }
         //     }]
-        //   } else if (this.workOrderType == 1) {
+        //   } else if (this.workOrderType == 4) {
         //     this.orderInfo.orderChannelId = "工程维保"
         //     // 维保工单
         //     return [{
@@ -145,6 +145,23 @@ export default {
           }
         },
         {
+          isShow: this.formOptions.saleType.isShow,
+          name: 'el-select',
+          md: 6,
+          options: [{ value: 1, label: '零售' }, { value: 2, label: '工程' }, { value: 3, label: '延保' }, { value: 4, label: '工程维保' }],
+          attributes: {
+            disabled: !this.formOptions.saleType.isEdit,
+            placeholder: '请选择',
+            clearable: true,
+            filterable: true
+          },
+          formItemAttributes: {
+            label: '销售类型',
+            prop: 'saleType',
+            rules: this.formOptions.saleType.isRules
+          }
+        },
+        {
           isShow: this.formOptions.saleCompany.isShow,
           name: 'el-input',
           md: 6,
@@ -177,7 +194,7 @@ export default {
   },
   created() {
     // 普通工单选择网点数据
-    if (this.workOrderType == 0) {
+    if (!!~[1,2,3].indexOf(this?.workOrderType)) {
       // 获取工单类型
       listPageV2({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "true" }] }).then(res => {
         this.orderSmallTypeData = res.data.records.map(item => ({

+ 31 - 9
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/workOrderLogic.js

@@ -4,6 +4,10 @@ var initdata_ = {
   // 基础信息--------------------
   // 维保项目
   rpProjectRepairId: "",
+  // 工程编号
+  projectNo: "",
+  // 工程名称
+  projectName: "",
   // 客户名称
   userName: "",
   // 联系人
@@ -34,6 +38,7 @@ var initdata_ = {
   // 销售单位
   saleCompany: "",
   source: "",
+  saleType: "",
   // 产品信息------------------------
   orderProducts: [],
   // 其它信息------------------------
@@ -57,7 +62,7 @@ export default {
     },
     workOrderType: {
       type: Number,
-      default: 0, // 0普通工单, 1维保工单
+      default: 1, // 1普通工单, 4维保工单
     },
   },
   data() {
@@ -69,14 +74,14 @@ export default {
     id: {
       handler(newVal, oldVal) {
         this.getorderDetail((data) => {
-          if (this.workOrderType == 0) {
+          if (!!~[1, 2, 3].indexOf(this?.workOrderType)) {
             this.$nextTick(() => {
               // 获取地址信息
               this.getinitlbslist()
               // 获取可选师傅
               this.getWorkers()
             })
-          } else if (this.workOrderType == 1) {
+          } else if (this.workOrderType == 4) {
             this.$nextTick(() => {
               // 获取维保单详情
               this.getWeiBaoDetail()
@@ -150,24 +155,35 @@ export default {
         // 维保项目
         rpProjectRepairId: {
           isEdit: this.id ? false : true,
-          isShow: this.workOrderType == 1,
+          isShow: this.workOrderType == 4,
+          isRules: [...required]
+        },
+        // 工程项目
+        projectNo: {
+          isEdit: this.id ? false : true,
+          isShow: this.workOrderType == 2,
+          isRules: [...required]
+        },
+        projectName: {
+          isEdit: this.id ? false : true,
+          isShow: this.workOrderType == 2,
           isRules: [...required]
         },
         // 客户名称
         userName: {
-          isEdit: this.workOrderType == 0 && !finish,
+          isEdit: !!~[1, 3].indexOf(this?.workOrderType) && !finish,
           isShow: true,
           isRules: [...required]
         },
         // 联系人
         linkName: {
-          isEdit: this.workOrderType == 0 && !finish,
+          isEdit: !!~[1, 3].indexOf(this?.workOrderType) && !finish,
           isShow: true,
           isRules: [...required]
         },
         // 客户电话
         userMobile: {
-          isEdit: this.workOrderType == 0 && !finish,
+          isEdit: !!~[1, 3].indexOf(this?.workOrderType) && !finish,
           isShow: true,
           isRules: [...mobileRequired]
         },
@@ -179,13 +195,13 @@ export default {
         },
         // gps地址
         gpsAddress: {
-          isEdit: this.workOrderType == 0 && !finish,
+          isEdit: !!~[1, 3].indexOf(this?.workOrderType) && !finish,
           isShow: true,
           isRules: [...required]
         },
         // 详细地址
         address: {
-          isEdit: this.workOrderType == 0 && !finish,
+          isEdit: !!~[1, 3].indexOf(this?.workOrderType) && !finish,
           isShow: true,
           isRules: []
         },
@@ -207,6 +223,11 @@ export default {
           isShow: true,
           isRules: [...required]
         },
+        saleType: {
+          isEdit: false,
+          isShow: true,
+          isRules: [...required]
+        },
         saleCompany: {
           isEdit: !finish,
           isShow: true,
@@ -280,6 +301,7 @@ export default {
       } else {
         // 创建工单
         this.orderInfo = Object.assign({}, JSON.parse(JSON.stringify(initdata_)), {
+          saleType: this?.workOrderType,
           workerId_fz: ""
         })
         cb && cb(this.orderInfo)

+ 17 - 14
src/views/workOrder/workOrderPool/index.vue

@@ -80,7 +80,7 @@ export default {
       orderTypeList: [],
       orderStatusList: [],
       defaultSearchData: [],
-      workOrderType: 0
+      workOrderType: 1
     }
   },
   computed: {
@@ -121,13 +121,19 @@ export default {
             }),
             this.optionsEvensAuth("createWorkOrder", {
               click: () => {
-                this.workOrderType = 0
+                this.workOrderType = 1
+                this.createFormBool = true
+              }
+            }),
+            this.optionsEvensAuth("createGCWorkOrder", {
+              click: () => {
+                this.workOrderType = 2
                 this.createFormBool = true
               }
             }),
             this.optionsEvensAuth("createWbWorkOrder", {
               click: () => {
-                this.workOrderType = 1
+                this.workOrderType = 4
                 this.createFormBool = true
               }
             })
@@ -205,20 +211,21 @@ export default {
     initFun() {
       if (this.pageType == "detail") {
         this.id = this.pageCode
-        this.$nextTick(() => {
-          this.detailFormBool = true
+        orderBaseDetail({
+          orderBaseId: this.id
+        }).then(res => {
+          this.workOrderType = res?.data?.saleType
+          this.$nextTick(() => {
+            this.detailFormBool = true
+          })
         })
       }
-
       if (this.pageType == "saleOrderId") {
         this.defaultSearchData = [{ "param": "a.sale_order_id", "compare": "=", "value": this.pageCode, label: "销售订单号" }]
       }
-
-
       if (this.pageType == "pgIncreItemId") {
         this.defaultSearchData = [{ "param": "a.pg_incre_order_id", "compare": "=", "value": this.pageCode, label: "增置服务明细ID" }]
       }
-
       if (this.pageType == "rpProjectRepairId") {
         this.defaultSearchData = [{ "param": "a.rp_project_repair_id", "compare": "=", "value": this.pageCode, label: "维保配置ID" }]
       }
@@ -325,11 +332,7 @@ export default {
         edit: {
           click: ({ row, index, column }) => {
             this.id = row.id
-            if (row.rpProjectRepairId) {
-              this.workOrderType = 1
-            } else {
-              this.workOrderType = 0
-            }
+            this.workOrderType = Object.entries(row.selectMapData.saleType).find(([key, val]) => val == row.saleType)?.[0]
             this.$nextTick(() => {
               this.detailFormBool = true
             })