Просмотр исходного кода

工单 - 创建,编辑维保工单,需增加维保标识

linwenxin 1 год назад
Родитель
Сommit
49f9959894

+ 5 - 1
src/views/workOrder/workOrderPool/detail.vue

@@ -13,7 +13,7 @@
         height: activeName === 'workOrderInfo' ? '100%' : '0px',
         overflow: activeName === 'workOrderInfo' ? '' : 'hidden'
       }">
-        <workOrderInfo :id="id" ref="workOrderInfo" />
+        <workOrderInfo :id="id" ref="workOrderInfo" :workOrderType="workOrderType" />
       </div>
       <OperationDetail v-if="activeName == 'operationDetails'" :id="id" ref="operationDetails" />
       <CompletionDetails v-if="activeName == 'detailsCompletion'" :id="id" ref="detailsCompletion" />
@@ -46,6 +46,10 @@ export default {
       type: [String, Number],
       default: null
     },
+    workOrderType: {
+      type: [Number],
+      default: null
+    },
   },
   data() {
     return {

+ 5 - 2
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/index.vue

@@ -9,7 +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>
@@ -18,7 +19,7 @@
         <!-- 服务信息 -->
         <zj-form-module title="服务信息" label-width="110px" :form-data="orderInfo" :form-items="serviceInfo" />
         <!-- 产品信息 -->
-        <zj-form-module title="产品信息" :form-data="orderInfo" :form-items="product" />
+        <zj-form-module title="产品信息" :form-data="orderInfo" :form-items="workOrderType == 1 ? product_wb : product" />
         <!-- 其它信息 -->
         <zj-form-module title="其它信息" :form-data="orderInfo" :form-items="otherInfo" />
         <!-- 派单信息 -->
@@ -64,6 +65,7 @@ import basicInfo from './mixins/basicInfo.js'
 import dispatchInfo from './mixins/dispatchInfo.js'
 import otherInfo from './mixins/otherInfo.js'
 import productColumns from './mixins/productColumns.js'
+import wb_productColumns from './mixins/wb_productColumns.js'
 import serviceInfo from './mixins/serviceInfo.js'
 import pandanxinxi from './mixins/pandanxinxi.js'
 import copyInfo from './buttons/copyInfo.vue'
@@ -92,6 +94,7 @@ export default {
     dispatchInfo,
     otherInfo,
     productColumns,
+    wb_productColumns,
     serviceInfo,
     pandanxinxi,
   ],

+ 105 - 32
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/basicInfo.js

@@ -1,4 +1,5 @@
 import { lbsAmapRegion } from '@/api/common.js'
+import { listPageV2, getDetail } from "@/api/engineeringMaintenance/basicData";
 import geographicalPosi from '@/components/geographicalPosi/index.vue'
 export default {
   data() {
@@ -7,56 +8,87 @@ export default {
       cityList: [],
       areaList: [],
       streetList: [],
+      wb_project: []
     }
   },
+  created() {
+    listPageV2({ "pageNum": 1, "pageSize": -1, "params": [] }).then(res => {
+      this.wb_project = res.data.records.map(item => {
+        return {
+          value: item.id,
+          label: item.projectName,
+          data: item,
+        }
+      })
+    })
+  },
   computed: {
     // 基本信息数据模型
     basicInfo() {
       return [
         ...(() => {
-          if (this.workOrderType == 0) {
-            // 普通工单
+          if (this.workOrderType == 1) {
             return [{
-              isShow: this.formOptions.userName.isShow,
-              name: 'el-input',
-              md: 6,
-              attributes: { disabled: !this.formOptions.userName.isEdit, placeholder: '请输入' },
+              isShow: this.formOptions.rpProjectRepairId.isShow,
+              name: 'el-select',
+              md: 12,
+              options: this.wb_project,
+              attributes: {
+                disabled: !this.formOptions.rpProjectRepairId.isEdit,
+                placeholder: '请选择',
+                clearable: true,
+                filterable: true
+              },
               formItemAttributes: {
-                label: '客户名称',
-                prop: 'userName',
-                rules: this.formOptions.userName.isRules
+                label: '维保项目',
+                prop: 'rpProjectRepairId',
+                rules: this.formOptions.rpProjectRepairId.isRules
               },
               events: {
-                input: (v) => {
-                  this.orderInfo.linkName = v
-                  if (v) {
-                    this.appointVerify(["linkName"], () => { }, false)
-                  }
+                change: (val) => {
+                  this.getorderDetail(()=>{
+                    if (val) {
+                      this.orderInfo.rpProjectRepairId = val
+                      this.orderInfo.rpProjectRepairName = this.wb_project.find(item => item.value == val).label
+                      this.getWeiBaoDetail()
+                    }
+                  })
                 }
               }
-            }]
-          } else if (this.workOrderType == 1) {
-            // 维保工单
-            return [{
-              isShow: this.formOptions.userName.isShow,
-              name: 'el-select',
-              md: 6,
+            }, {
+              name: 'slot-component',
+              md: 12,
               formItemAttributes: {
-                label: '客户名称',
-                prop: 'userName',
-                rules: this.formOptions.userName.isRules,
+                'label-width': '0px',
+                prop: '',
               },
-              options: [],
-              attributes: { disabled: true, clearable: true, filterable: true, placeholder: '请选择' },
-              events: {
-                change: () => {
-
-                }
+              render: (h, { props }) => {
+                return null
               }
-            }]
+            },]
           }
+          return []
         })(),
         {
+          isShow: this.formOptions.userName.isShow,
+          name: 'el-input',
+          md: 6,
+          attributes: { disabled: !this.formOptions.userName.isEdit, placeholder: '请输入' },
+          formItemAttributes: {
+            label: '客户名称',
+            prop: 'userName',
+            rules: this.formOptions.userName.isRules
+          },
+          events: {
+            input: (v) => {
+              this.orderInfo.linkName = v
+              if (v) {
+                this.appointVerify(["linkName"], () => { }, false)
+              }
+            }
+          }
+        },
+        {
           isShow: this.formOptions.linkName.isShow,
           name: 'el-input',
           md: 6,
@@ -260,12 +292,53 @@ export default {
     }
   },
   methods: {
+    getWeiBaoDetail(){
+      if(this.orderInfo.rpProjectRepairId){
+        getDetail({
+          id:this.orderInfo.rpProjectRepairId
+        }).then(res=>{
+
+          this.orderInfo.userName = res.data.manger
+          this.orderInfo.linkName = res.data.manger
+          this.orderInfo.userMobile = res.data.mobile
+          this.orderInfo.provinceId = res.data.provinceId
+          this.orderInfo.province = res.data.province
+          this.orderInfo.cityId = res.data.cityId
+          this.orderInfo.city = res.data.city
+          this.orderInfo.areaId = res.data.areaId
+          this.orderInfo.area = res.data.area
+          this.orderInfo.streetId = res.data.streetId
+          this.orderInfo.street = res.data.street
+          this.orderInfo.gpsAddress = res.data.gpsAddress||res.data.address
+          this.orderInfo.lat = res.data.lat
+          this.orderInfo.lng = res.data.lng
+          this.orderInfo.address = res.data.address
+
+          // 工单小类下拉
+          this.orderSmallTypeData = res.data.typeList.map(item => ({
+            value: item.id,
+            label: item.orderSmallTypeText
+          }))
+
+          // 网点下拉数据
+          this.websitList = (res.data.websitList||[]).map(item => ({
+            label: item.websitName,
+            value: item.websitId
+          }))
+
+          // 产品信息可选项
+          this.productList_wb = (res.data.productList||[])
+
+          this.getinitlbslist()
+        })
+      }
+    },
     getinitlbslist() {
       // 初始化请求省市区街道下拉选项数据
       lbsAmapRegion({ pid: 0 }).then(res => {
         this.provinceList = res.data
         // 创建工单时获取ip地址定位赋值
-        if (!this.id && this.$IpAdd.province) {
+        if (!this.id && this.workOrderType == 0 && this.$IpAdd.province) {
           var item = this.provinceList.find(item => item.name === this.$IpAdd.province)
           if (item) {
             this.orderInfo.provinceId = item.id

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

@@ -212,12 +212,15 @@ export default {
     }
   },
   created() {
-    getWebsit({ type: "C", status: true, isAll: this.isAllWebsit || this.id ? true : false }).then(res => {
-      this.websitList = res.data.map(item => ({
-        label: item.name,
-        value: item.websitId
-      }))
-    })
+    // 普通工单选择网点数据
+    if(this.workOrderType == 0){
+      getWebsit({ type: "C", status: true, isAll: this.isAllWebsit || this.id ? true : false }).then(res => {
+        this.websitList = res.data.map(item => ({
+          label: item.name,
+          value: item.websitId
+        }))
+      })
+    }
   },
   methods: {
     getWorkers() {

+ 1 - 0
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/productColumns.js

@@ -246,6 +246,7 @@ export default {
                         "mainId": "",
                         "mainName": "",
                         "num": "",
+                        "insideCode":"",
                         "orderBaseId": this.id || '',
                         "productId": "",
                         "productName": "",

+ 43 - 92
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/serviceInfo.js

@@ -11,48 +11,49 @@ export default {
   computed: {
     serviceInfo() {
       return [
+        {
+          isShow: this.formOptions.orderSmallType.isShow && !this.id,
+          name: 'el-select',
+          md: 6,
+          options: this.orderSmallTypeData,
+          attributes: {
+            disabled: !this.formOptions.orderSmallType.isEdit,
+            placeholder: '请选择',
+            clearable: true,
+            filterable: true
+          },
+          formItemAttributes: {
+            label: '工单类型',
+            prop: 'orderSmallType',
+            rules: this.formOptions.orderSmallType.isRules
+          },
+          events: {
+            change: (val) => {
+              if (val) {
+                this.orderInfo.orderSmallTypeText = this.orderSmallTypeData.find(item => item.value == val).label
+              } else {
+                this.orderInfo.orderSmallTypeText = ''
+              }
+            }
+          }
+        },
+        {
+          isShow: this.formOptions.orderSmallType.isShow && this.id,
+          name: 'el-input',
+          md: 6,
+          attributes: {
+            disabled: !this.formOptions.orderSmallType.isEdit,
+          },
+          formItemAttributes: {
+            label: '工单类型',
+            prop: 'orderSmallTypeText',
+            rules: this.formOptions.orderSmallType.isRules
+          }
+        },
         ...(() => {
           if (this.workOrderType == 0) {
             // 普通工单
             return [{
-              isShow: this.formOptions.orderSmallType.isShow && !this.id,
-              name: 'el-select',
-              md: 6,
-              options: this.orderSmallTypeData,
-              attributes: {
-                disabled: !this.formOptions.orderSmallType.isEdit,
-                placeholder: '请选择',
-                clearable: true,
-                filterable: true
-              },
-              formItemAttributes: {
-                label: '工单类型',
-                prop: 'orderSmallType',
-                rules: this.formOptions.orderSmallType.isRules
-              },
-              events: {
-                change: (val) => {
-                  if (val) {
-                    this.orderInfo.orderSmallTypeText = this.orderSmallTypeData.find(item => item.value == val).label
-                  } else {
-                    this.orderInfo.orderSmallTypeText = ''
-                  }
-                }
-              }
-            },
-            {
-              isShow: this.formOptions.orderSmallType.isShow && this.id,
-              name: 'el-input',
-              md: 6,
-              attributes: {
-                disabled: !this.formOptions.orderSmallType.isEdit,
-              },
-              formItemAttributes: {
-                label: '工单类型',
-                prop: 'orderSmallTypeText',
-                rules: this.formOptions.orderSmallType.isRules
-              }
-            }, {
               isShow: this.formOptions.orderChannelId.isShow && !this.id,
               name: 'el-select',
               md: 6,
@@ -78,48 +79,10 @@ export default {
                 }
               }
             }]
-          } else if (this.workOrderType == 0) {
+          } else if (this.workOrderType == 1) {
             this.orderInfo.orderChannelId = "工程维保"
             // 维保工单
             return [{
-              isShow: this.formOptions.orderSmallType.isShow && !this.id,
-              name: 'el-select',
-              md: 6,
-              options: [],
-              attributes: {
-                disabled: !this.formOptions.orderSmallType.isEdit,
-                placeholder: '请选择',
-                clearable: true,
-                filterable: true
-              },
-              formItemAttributes: {
-                label: '工单类型',
-                prop: 'orderSmallType',
-                rules: this.formOptions.orderSmallType.isRules
-              },
-              events: {
-                change: (val) => {
-                  if (val) {
-                    this.orderInfo.orderSmallTypeText = this.orderSmallTypeData.find(item => item.value == val).label
-                  } else {
-                    this.orderInfo.orderSmallTypeText = ''
-                  }
-                }
-              }
-            },
-            {
-              isShow: this.formOptions.orderSmallType.isShow && this.id,
-              name: 'el-input',
-              md: 6,
-              attributes: {
-                disabled: !this.formOptions.orderSmallType.isEdit,
-              },
-              formItemAttributes: {
-                label: '工单类型',
-                prop: 'orderSmallTypeText',
-                rules: this.formOptions.orderSmallType.isRules
-              }
-            },{
               isShow: this.formOptions.orderChannelId.isShow && !this.id,
               name: 'el-input',
               md: 6,
@@ -169,25 +132,12 @@ export default {
             rules: this.formOptions.saleCompany.isRules
           }
         },
-        {
-          isShow: this.formOptions.rpProjectRepairName.isShow,
-          name: 'el-input',
-          md: 12,
-          attributes: {
-            disabled: !this.formOptions.rpProjectRepairName.isEdit,
-            placeholder: '请输入'
-          },
-          formItemAttributes: {
-            label: '工程维保名称',
-            prop: 'rpProjectRepairName',
-            rules: this.formOptions.rpProjectRepairName.isRules
-          }
-        }
-
       ]
     }
   },
   created() {
+    // 普通工单选择网点数据
+    if(this.workOrderType == 0){
     // 获取工单类型
     listPageV2({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "true" }] }).then(res => {
       this.orderSmallTypeData = res.data.records.map(item => ({
@@ -202,5 +152,6 @@ export default {
         label: item.dictValue
       }))
     })
+  }
   },
 }

+ 0 - 244
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/wb_pandanxinxi.js

@@ -1,244 +0,0 @@
-import { getWebsit } from "@/api/customerManagement.js"
-import { memberListPageV2 } from "@/api/masterManagement";
-
-export default {
-  data() {
-    return {
-      websitList: [],
-      workerList: []
-    }
-  },
-  computed: {
-    workersColumns() {
-      return [
-        {
-          columnAttributes: {
-            label: '工程师信息',
-            prop: 'workerName'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '工程师类型',
-            prop: 'isMaster'
-          },
-          render: (h, { row, column, index }) => {
-            return (
-              <div style="padding-left:10px">
-                {row.isMaster ? '主要工程师' : '辅助工程师'}
-              </div>
-            )
-          }
-        },
-        {
-          columnAttributes: {
-            label: '联系电话',
-            prop: 'workerMobile'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '身份证',
-            prop: 'workerIdcard'
-          }
-        },
-        ...(() => {
-          if (this.formOptions.orderWorkers.isEdit) {
-            return [
-              {
-                columnAttributes: {
-                  label: '操作',
-                },
-                render: (h, { row, column, index }) => {
-                  return !row.isMaster ? (
-                    <div style="padding-left:10px">
-                      <el-button type="text" onClick={() => {
-                        this.orderInfo.orderWorkers.splice(index, 1)
-                      }}>删除</el-button>
-                    </div>
-                  ) : null
-                }
-              },
-            ]
-          }
-          return []
-        })()
-      ]
-    },
-    pandanxinxi() {
-      return [
-        {
-          isShow: this.formOptions.websitId.isShow,
-          name: 'el-select',
-          options: this.websitList,
-          md: 8,
-          attributes: {
-            disabled: !this.formOptions.websitId.isEdit,
-            placeholder: '请选择',
-            clearable: true,
-            filterable: true
-          },
-          formItemAttributes: {
-            label: '网点名称',
-            prop: 'websitId',
-            rules: this.formOptions.websitId.isRules,
-          },
-          events: {
-            change: (val) => {
-              this.orderInfo.workerId = ""
-              this.orderInfo.workerName = ""
-              this.orderInfo.workerIdcard = ""
-              this.orderInfo.workerMobile = ""
-              this.workerList = []
-              this.orderInfo.orderWorkers = []
-              this.getWorkers()
-              if (val) {
-                this.orderInfo['websitName'] = this.websitList.find(item => item.value == val).label
-              } else {
-                this.orderInfo['websitName'] = ''
-              }
-            }
-          }
-        },
-        {
-          name: 'slot-component',
-          md: 16,
-          formItemAttributes: { label: '', prop: '' },
-          render: (h, { props }) => {
-            return null
-          }
-        },
-        ...(() => {
-          if (this.formOptions.workerId.isEdit) {
-            return [{
-              isShow: this.formOptions.workerId.isShow,
-              name: 'el-select',
-              options: this.workerList.filter(item => this.orderInfo.workerId == item.value || !~this.orderInfo.orderWorkers.map(item => item.workerId).indexOf(item.value)),
-              md: 8,
-              attributes: {
-                disabled: !this.formOptions.workerId.isEdit,
-                placeholder: '请选择',
-                clearable: true,
-                filterable: true
-              },
-              formItemAttributes: {
-                label: '主要工程师',
-                prop: 'workerId',
-                rules: this.formOptions.workerId.isRules,
-              },
-              events: {
-                change: (val) => {
-                  var index = this.orderInfo.orderWorkers.map(item => item.isMaster).indexOf(true)
-                  if (!!~index) {
-                    this.orderInfo.orderWorkers.splice(index, 1)
-                  }
-                  if (val) {
-                    var data = this.workerList.find(item => item.value == val).data
-                    this.orderInfo.workerName = data.workerName
-                    this.orderInfo.workerIdcard = data.workerIdcard
-                    this.orderInfo.workerMobile = data.workerMobile
-                    this.orderInfo.orderWorkers.unshift({ ...data, isMaster: true })
-                    if (this.orderInfo.orderWorkers.length > 1) {
-                      this.orderInfo.orderWorkers.map((item, index) => {
-                        if (index > 0) {
-                          item.isMaster = false
-                        }
-                      })
-                    }
-                  } else {
-                    this.orderInfo.workerName = ""
-                    this.orderInfo.workerIdcard = ""
-                    this.orderInfo.workerMobile = ""
-                  }
-                }
-              }
-            }]
-          }
-          return []
-        })(),
-        ...(() => {
-          if (this.formOptions.orderWorkers.isEdit) {
-            return [{
-              isShow: this.formOptions.orderWorkers.isEdit,
-              name: 'el-select',
-              options: this.workerList.filter(item => !~this.orderInfo.orderWorkers.map(item => item.workerId).indexOf(item.value)),
-              md: 8,
-              attributes: {
-                disabled: !this.formOptions.orderWorkers.isEdit,
-                placeholder: '请选择',
-                clearable: true,
-                filterable: true
-              },
-              formItemAttributes: {
-                label: '辅助工程师',
-                prop: 'workerId_fz',
-              },
-              events: {
-                change: (val) => {
-                  if (val) {
-                    var data = this.workerList.find(item => item.value == val).data
-                    this.orderInfo.orderWorkers.push({ ...data, isMaster: false })
-                    this.orderInfo.workerId_fz = ""
-                  }
-                }
-              }
-            }]
-          }
-          return []
-        })(),
-        {
-          isShow: this.formOptions.orderWorkers.isShow,
-          name: 'slot-component',
-          md: 24,
-          formItemAttributes: {
-            label: '已选工程师',
-            prop: 'orderWorkers',
-            rules: this.formOptions.orderWorkers.isRules,
-          },
-          render: (h, { props }) => {
-            var { formData } = props
-            return (
-              <div>
-                <zj-table
-                  isDrop={true}
-                  columns={this.workersColumns}
-                  tableData={this.orderInfo.orderWorkers}
-                ></zj-table>
-              </div>
-            )
-          }
-        }
-      ]
-    }
-  },
-  created() {
-    getWebsit({ type: "C", status: true, isAll: this.isAllWebsit || this.id ? true : false }).then(res => {
-      this.websitList = res.data.map(item => ({
-        label: item.name,
-        value: item.websitId
-      }))
-    })
-  },
-  methods: {
-    getWorkers() {
-      if (this.orderInfo.websitId) {
-        memberListPageV2({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "b.examine_status", "compare": "=", "value": "OK" }, { "param": "b.websit_id", "compare": "=", "value": this.orderInfo.websitId }] }).then(res => {
-          this.workerList = res.data.records.map(item => {
-            var { id, userId, ...data } = item
-            return {
-              value: userId,
-              label: data.nickName,
-              data: {
-                workerId: userId,
-                workerName: data.nickName,
-                workerIdcard: data.idCard,
-                workerMobile: data.mobile,
-                ...data
-              }
-            }
-          })
-        })
-      }
-    }
-  },
-}

+ 53 - 47
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/wb_productColumns.js

@@ -6,13 +6,11 @@ export default {
   data() {
     return {
       isEditIndex: -1,
-      orderBrands: [],
-      classifyList: [],
-      classifyListLv2: []
+      productList_wb: []
     }
   },
   computed: {
-    productColumns() {
+    productColumns_wb() {
       return [
         {
           columnAttributes: {
@@ -28,14 +26,14 @@ export default {
                   onInput={(val) => { row[column.columnAttributes.prop] = val }}
                   onChange={(val) => {
                     if (val) {
-                      var data = this.orderBrands.find(item => item.value == val)
+                      var data = this.huoquweiyi('brandId', 'brandName').find(item => item.value == val)
                       row.brandName = data.label
                     } else {
                       row.brandName = ""
                     }
                   }}
                   placeholder="请选择">
-                  {this.orderBrands.map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
+                  {this.huoquweiyi('brandId', 'brandName').map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
                 </el-select>
               </el-form-item>
             </div> : <div style="padding-left:10px">{row.brandName}</div>
@@ -57,14 +55,20 @@ export default {
                     row.smallId = ""
                     row.smallName = ""
                     if (val) {
-                      var data = this.classifyList.find(item => item.categoryId == val)
-                      row.mainName = data.name
+                      var data = this.huoquweiyi('mainId', 'mainName').filter(item => {
+                        return !!this.productList_wb.filter(v => v.mainId == item.value).find(v2 => v2.brandId == row.brandId)
+                      }).find(item => item.value == val)
+                      row.mainName = data.label
                     } else {
                       row.mainName = ""
                     }
                   }}
                   placeholder="请选择">
-                  {this.classifyList.map((item, index_) => <el-option key={index_} label={item.name} value={item.categoryId}></el-option>)}
+                  {
+                    this.huoquweiyi('mainId', 'mainName').filter(item => {
+                      return !!this.productList_wb.filter(v => v.mainId == item.value).find(v2 => v2.brandId == row.brandId)
+                    }).map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)
+                  }
                 </el-select>
               </el-form-item>
             </div> : <div style="padding-left:10px">{row.mainName}</div>
@@ -84,17 +88,22 @@ export default {
                   onInput={(val) => { row[column.columnAttributes.prop] = val }}
                   onChange={(val) => {
                     if (val) {
-                      var data = this.classifyListLv2.find(item => item.categoryId == val)
-                      console.log(data)
-                      row.smallName = data.name
-                      row.imgUrl = data.imgUrl
+                      var data = this.huoquweiyi('smallId', 'smallName', "smallImg").filter(item => {
+                        return !!this.productList_wb.filter(v => v.smallId == item.value).find(v2 => v2.brandId == row.brandId && v2.mainId == row.mainId)
+                      }).find(item => item.value == val)
+                      row.smallName = data.label
+                      row.imgUrl = data.smallImg
                     } else {
                       row.smallName = ""
                       row.imgUrl = ""
                     }
                   }}
                   placeholder="请选择">
-                  {this.classifyListLv2.filter(item => item.parentId === row.mainId).map((item, index_) => <el-option key={index_} label={item.name} value={item.categoryId}></el-option>)}
+                  {
+                    this.huoquweiyi('smallId', 'smallName', "smallImg").filter(item => {
+                      return !!this.productList_wb.filter(v => v.smallId == item.value).find(v2 => v2.brandId == row.brandId && v2.mainId == row.mainId)
+                    }).map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)
+                  }
                 </el-select>
               </el-form-item>
             </div> : <div style="padding-left:10px">{row.smallName}</div>
@@ -186,10 +195,10 @@ export default {
                 render: (h, { row, column, index }) => {
                   return <div style="padding-left:10px">
                     <el-button type="text" onClick={() => {
-                      this.delProduct(row, index)
+                      this.delProduct_wb(row, index)
                     }}>删除</el-button>
                     {this.isEditIndex == index && <el-button type="text" onClick={() => {
-                      this.eidtProduct(row, index)
+                      this.eidtProduct_wb(row, index)
                     }}>确定</el-button>}
                     {this.isEditIndex == -1 && <el-button type="text" onClick={() => {
                       this.isEditIndex = index
@@ -203,7 +212,7 @@ export default {
         })()
       ]
     },
-    product() {
+    product_wb() {
       return [{
         isShow: this.formOptions.orderProducts.isShow,
         name: 'slot-component',
@@ -220,7 +229,7 @@ export default {
             <div>
               {this.formOptions.orderProducts.isEdit ? <div>
                 <el-button size="mini" type="primary" onClick={() => {
-                  this.appointVerify(this.getVfyKey(this.isEditIndex, false), (v) => {
+                  this.appointVerify(this.getVfyKey_wb(this.isEditIndex, false), (v) => {
                     if (v) {
                       try {
                         this.orderInfo.orderProducts.map((item, index_) => {
@@ -246,6 +255,7 @@ export default {
                         "mainId": "",
                         "mainName": "",
                         "num": "",
+                        "insideCode":"",
                         "orderBaseId": this.id || '',
                         "productId": "",
                         "productName": "",
@@ -259,7 +269,7 @@ export default {
                 }}>新增</el-button>
               </div> : null}
               <zj-table
-                columns={this.productColumns}
+                columns={this.productColumns_wb}
                 table-data={this.orderInfo.orderProducts}
               />
             </div>
@@ -268,29 +278,25 @@ export default {
       }]
     },
   },
-  created() {
-    // 获取品牌
-    getDataDictionary({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "ON" }, { "param": "a.dict_type", "compare": "=", "value": "BRAND" }] }).then(res => {
-      this.orderBrands = res.data.records.map(item => ({
-        value: item.dictCode,
-        label: item.dictValue
-      }))
-    })
-    // 获取产品大类小类
-    getClassifyList({ type: 2, status: true }).then(res => {
-      var classifyListLv2 = []
-      this.classifyList = res.data.map(item => {
-        var { children, ...data } = item
-        classifyListLv2.push(...(children || []))
+  methods: {
+    huoquweiyi(value, label, ...keys) {
+      var obj = {}
+      this.productList_wb.map(item => {
+        obj[item[value]] = {
+          label: item[label]
+        }
+        for (var key of keys) {
+          obj[item[value]][key] = item[key]
+        }
+      })
+      return Object.keys(obj).map(value => {
         return {
-          ...data
+          value: value,
+          ...obj[value]
         }
-      });
-      this.classifyListLv2 = classifyListLv2
-    })
-  },
-  methods: {
-    getVfyKey(index, bool = true) {
+      })
+    },
+    getVfyKey_wb(index, bool = true) {
       return [
         ...(() => {
           if (bool) {
@@ -316,7 +322,7 @@ export default {
       ]
     },
     // 重新获取赋值
-    getOrderBaseProduct() {
+    getOrderBaseProduct_wb() {
       if (this.id) {
         orderBaseProductList({
           orderBaseId: this.id
@@ -325,7 +331,7 @@ export default {
         })
       }
     },
-    eidtProduct(row, index) {
+    eidtProduct_wb(row, index) {
       try {
         this.orderInfo.orderProducts.map((item, index_) => {
           if (
@@ -339,12 +345,12 @@ export default {
         this.$message.warning('产品机型重复')
         return
       }
-      this.appointVerify(this.getVfyKey(this.isEditIndex), (v) => {
+      this.appointVerify(this.getVfyKey_wb(this.isEditIndex), (v) => {
         if (v) {
           if (this.id) {
             [orderBaseProductAdd, orderBaseProductUpdate][row.id ? 1 : 0](row).then(res => {
               this.isEditIndex = -1
-              this.getOrderBaseProduct()
+              this.getOrderBaseProduct_wb()
               this.getOrderBaseLogList()
             })
           } else {
@@ -353,13 +359,13 @@ export default {
         }
       })
     },
-    delProduct(row, index) {
-      this.appointVerify(this.getVfyKey(this.isEditIndex), (v) => {
+    delProduct_wb(row, index) {
+      this.appointVerify(this.getVfyKey_wb(this.isEditIndex), (v) => {
         if (v && this.id) {
           orderBaseProductDelete({
             orderProductId: row.id
           }).then(res => {
-            this.getOrderBaseProduct()
+            this.getOrderBaseProduct_wb()
             this.getOrderBaseLogList()
           })
         } else {

+ 26 - 21
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/workOrderLogic.js

@@ -2,6 +2,8 @@ import { required, mobileRequired, mobile, httpUrl, email } from '@/components/t
 import { orderBaseDetail, orderBaseProductList } from "@/api/workOrderPool.js"
 var initdata_ = {
   // 基础信息--------------------
+  // 维保项目
+  rpProjectRepairId: "",
   // 客户名称
   userName: "",
   // 联系人
@@ -31,8 +33,6 @@ var initdata_ = {
   appointmentTime: "",
   // 销售单位
   saleCompany: "",
-  rpProjectRepairName: "",
-  rpProjectRepairId: "",
   // 产品信息------------------------
   orderProducts: [],
   // 其它信息------------------------
@@ -68,12 +68,21 @@ export default {
     id: {
       handler(newVal, oldVal) {
         this.getorderDetail((data) => {
-          this.$nextTick(() => {
-            // 获取地址信息
-            this.getinitlbslist()
-            // 获取可选师傅
-            this.getWorkers()
-          })
+          if(this.workOrderType==0){
+            this.$nextTick(() => {
+              // 获取地址信息
+              this.getinitlbslist()
+              // 获取可选师傅
+              this.getWorkers()
+            })
+          }else if(this.workOrderType==1){
+            this.$nextTick(() => {
+              // 获取地址信息
+              this.getinitlbslist()
+              // 获取维保单详情
+              this.getWeiBaoDetail()
+            })
+          }
         })
         this.getOrderBaseLogList()
       },
@@ -139,9 +148,15 @@ export default {
       var finish = !!~['YWG', 'YJS', 'YQX'].indexOf(this.orderInfo.orderStatus)
       return {
         // 基础信息--------------------
+        // 维保项目
+        rpProjectRepairId: {
+          isEdit: this.id ? false : true,
+          isShow: this.workOrderType == 1,
+          isRules: []
+        },
         // 客户名称
         userName: {
-          isEdit: !finish,
+          isEdit: this.workOrderType == 0 &&  !finish,
           isShow: true,
           isRules: [...required]
         },
@@ -165,13 +180,13 @@ export default {
         },
         // gps地址
         gpsAddress: {
-          isEdit: !finish,
+          isEdit:  this.workOrderType == 0 && !finish,
           isShow: true,
           isRules: [...required]
         },
         // 详细地址
         address: {
-          isEdit: !finish,
+          isEdit: this.workOrderType == 0 &&  !finish,
           isShow: true,
           isRules: []
         },
@@ -198,16 +213,6 @@ export default {
           isShow: true,
           isRules: []
         },
-        rpProjectRepairName: {
-          isEdit: false,
-          isShow: this.workOrderType == 1,
-          isRules: []
-        },
-        rpProjectRepairId: {
-          isEdit: false,
-          isShow: this.workOrderType == 1,
-          isRules: []
-        },
         // 产品信息------------------------
         orderProducts: {
           isEdit: !finish,

+ 6 - 1
src/views/workOrder/workOrderPool/index.vue

@@ -14,7 +14,7 @@
     <div class="cartographer_big">
       <el-dialog :title="'工单详情-' + id" width="100%" :modal="false" :visible.sync="detailFormBool"
         :before-close="handleClose">
-        <Detail v-if="detailFormBool" :id="id" />
+        <Detail v-if="detailFormBool" :id="id" :workOrderType="workOrderType" />
       </el-dialog>
     </div>
     <!-- 批量预约/改约 -->
@@ -380,6 +380,11 @@ export default {
         edit: {
           click: ({ row, index, column }) => {
             this.id = row.id
+            if (row.rpProjectRepairId) {
+              this.workOrderType = 1
+            } else {
+              this.workOrderType = 0
+            }
             this.$nextTick(() => {
               this.detailFormBool = true
             })