Bläddra i källkod

修改工单池

linwenxin 1 år sedan
förälder
incheckning
201f7d3e02

+ 41 - 17
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/basicInfo.js

@@ -13,25 +13,49 @@ export default {
     // 基本信息数据模型
     basicInfo() {
       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)
+        ...(() => {
+          if (this.workOrderType == 0) {
+            // 普通工单
+            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)
+                  }
+                }
               }
-            }
+            }]
+          } else if (this.workOrderType == 1) {
+            // 维保工单
+            return [{
+              isShow: this.formOptions.userName.isShow,
+              name: 'el-select',
+              md: 6,
+              formItemAttributes: {
+                label: '客户名称',
+                prop: 'userName',
+                rules: this.formOptions.userName.isRules,
+              },
+              options: [],
+              attributes: { disabled: true, clearable: true, filterable: true, placeholder: '请选择' },
+              events: {
+                change: () => {
+
+                }
+              }
+            }]
           }
-        },
+        })(),
         {
           isShow: this.formOptions.linkName.isShow,
           name: 'el-input',

+ 134 - 77
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/serviceInfo.js

@@ -11,85 +11,129 @@ 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 = ''
+        ...(() => {
+          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,
-          options: this.orderChannels,
-          attributes: {
-            disabled: !this.formOptions.orderChannelId.isEdit,
-            placeholder: '请选择',
-            clearable: true,
-            filterable: true
-          },
-          formItemAttributes: {
-            label: '工单渠道',
-            prop: 'orderChannelId',
-            rules: this.formOptions.orderChannelId.isRules
-          },
-          events: {
-            change: (val) => {
-              if (val) {
-                this.orderInfo.orderChannelText = this.orderChannels.find(item => item.value == val).label
-              } else {
-                this.orderInfo.orderChannelText = ''
+            },
+            {
+              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,
-          options: [],
-          attributes: {
-            disabled: !this.formOptions.orderChannelId.isEdit,
-          },
-          formItemAttributes: {
-            label: '工单渠道',
-            prop: 'orderChannelText',
-            rules: this.formOptions.orderChannelId.isRules
+            }, {
+              isShow: this.formOptions.orderChannelId.isShow && !this.id,
+              name: 'el-select',
+              md: 6,
+              options: this.orderChannels,
+              attributes: {
+                disabled: !this.formOptions.orderChannelId.isEdit,
+                placeholder: '请选择',
+                clearable: true,
+                filterable: true
+              },
+              formItemAttributes: {
+                label: '工单渠道',
+                prop: 'orderChannelId',
+                rules: this.formOptions.orderChannelId.isRules
+              },
+              events: {
+                change: (val) => {
+                  if (val) {
+                    this.orderInfo.orderChannelText = this.orderChannels.find(item => item.value == val).label
+                  } else {
+                    this.orderInfo.orderChannelText = ''
+                  }
+                }
+              }
+            }]
+          } else if (this.workOrderType == 0) {
+            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,
+              attributes: {
+                disabled: !this.formOptions.orderChannelId.isEdit,
+              },
+              formItemAttributes: {
+                label: '工单渠道',
+                prop: 'orderChannelId',
+                rules: this.formOptions.orderChannelId.isRules
+              }
+            }]
           }
-        },
+        })(),
         {
           isShow: this.formOptions.appointmentTime.isShow,
           name: 'el-date-picker',
@@ -111,7 +155,6 @@ export default {
             rules: this.formOptions.appointmentTime.isRules
           }
         },
-
         {
           isShow: this.formOptions.saleCompany.isShow,
           name: 'el-input',
@@ -125,6 +168,20 @@ export default {
             prop: 'saleCompany',
             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
+          }
         }
 
       ]

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

@@ -0,0 +1,244 @@
+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
+              }
+            }
+          })
+        })
+      }
+    }
+  },
+}

+ 371 - 0
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/wb_productColumns.js

@@ -0,0 +1,371 @@
+import { getClassifyList } from '@/api/goods'
+import { getDataDictionary } from '@/api/dataDictionary.js'
+import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
+import { orderBaseProductList, orderBaseProductAdd, orderBaseProductUpdate, orderBaseProductDelete } from "@/api/workOrderPool.js"
+export default {
+  data() {
+    return {
+      isEditIndex: -1,
+      orderBrands: [],
+      classifyList: [],
+      classifyListLv2: []
+    }
+  },
+  computed: {
+    productColumns() {
+      return [
+        {
+          columnAttributes: {
+            label: '产品品牌',
+            prop: 'brandId'
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? <div class="redbordererr">
+              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`} rules={required}>
+                <el-select
+                  disabled={!this.formOptions.orderProducts.isEdit}
+                  value={row[column.columnAttributes.prop]}
+                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
+                  onChange={(val) => {
+                    if (val) {
+                      var data = this.orderBrands.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>)}
+                </el-select>
+              </el-form-item>
+            </div> : <div style="padding-left:10px">{row.brandName}</div>
+          }
+        },
+        {
+          columnAttributes: {
+            label: '产品大类',
+            prop: 'mainId'
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? <div class="redbordererr">
+              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`} rules={required}>
+                <el-select
+                  disabled={!this.formOptions.orderProducts.isEdit}
+                  value={row[column.columnAttributes.prop]}
+                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
+                  onChange={(val) => {
+                    row.smallId = ""
+                    row.smallName = ""
+                    if (val) {
+                      var data = this.classifyList.find(item => item.categoryId == val)
+                      row.mainName = data.name
+                    } else {
+                      row.mainName = ""
+                    }
+                  }}
+                  placeholder="请选择">
+                  {this.classifyList.map((item, index_) => <el-option key={index_} label={item.name} value={item.categoryId}></el-option>)}
+                </el-select>
+              </el-form-item>
+            </div> : <div style="padding-left:10px">{row.mainName}</div>
+          }
+        },
+        {
+          columnAttributes: {
+            label: '产品小类',
+            prop: 'smallId'
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? <div class="redbordererr">
+              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`} rules={required}>
+                <el-select
+                  disabled={!this.formOptions.orderProducts.isEdit}
+                  value={row[column.columnAttributes.prop]}
+                  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
+                    } 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>)}
+                </el-select>
+              </el-form-item>
+            </div> : <div style="padding-left:10px">{row.smallName}</div>
+          }
+        },
+        {
+          columnAttributes: {
+            label: '产品机型',
+            prop: 'productName'
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? <div class="redbordererr">
+              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`}>
+                <el-input
+                  disabled={!this.formOptions.orderProducts.isEdit}
+                  value={row[column.columnAttributes.prop]}
+                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
+                  placeholder="请输入内容"
+                >
+                </el-input>
+              </el-form-item>
+            </div> : <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+          }
+        },
+        {
+          columnAttributes: {
+            label: '内机条码',
+            prop: 'insideCode'
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? <div class="redbordererr">
+              <el-form-item label="" label-width="0px">
+                <el-input
+                  disabled={!this.formOptions.orderProducts.isEdit}
+                  value={row[column.columnAttributes.prop]}
+                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
+                  placeholder="请输入内容"
+                >
+                </el-input>
+              </el-form-item>
+            </div> : <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+          }
+        },
+        {
+          columnAttributes: {
+            label: '数量',
+            prop: 'num'
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? <div class="redbordererr">
+              <el-form-item label="" label-width="0px" prop={`orderProducts.${index}.${column.columnAttributes.prop}`} rules={required}>
+                <el-input
+                  disabled={!this.formOptions.orderProducts.isEdit}
+                  value={row[column.columnAttributes.prop]}
+                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
+                  placeholder="请输入内容"
+                >
+                </el-input>
+              </el-form-item>
+            </div> : <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+          }
+        },
+        {
+          columnAttributes: {
+            label: '备注',
+            prop: 'remark'
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? <div class="redbordererr">
+              <el-form-item label="" label-width="0px">
+                <el-input
+                  disabled={!this.formOptions.orderProducts.isEdit}
+                  value={row[column.columnAttributes.prop]}
+                  onInput={(val) => { row[column.columnAttributes.prop] = val }}
+                  placeholder="请输入内容"
+                >
+                </el-input>
+              </el-form-item>
+            </div> : <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
+          }
+        },
+        ...(() => {
+          if (this.formOptions.orderProducts.isEdit) {
+            return [
+              {
+                columnAttributes: {
+                  label: '操作',
+                },
+                render: (h, { row, column, index }) => {
+                  return <div style="padding-left:10px">
+                    <el-button type="text" onClick={() => {
+                      this.delProduct(row, index)
+                    }}>删除</el-button>
+                    {this.isEditIndex == index && <el-button type="text" onClick={() => {
+                      this.eidtProduct(row, index)
+                    }}>确定</el-button>}
+                    {this.isEditIndex == -1 && <el-button type="text" onClick={() => {
+                      this.isEditIndex = index
+                    }}>编辑</el-button>}
+                  </div>
+                }
+              },
+            ]
+          }
+          return []
+        })()
+      ]
+    },
+    product() {
+      return [{
+        isShow: this.formOptions.orderProducts.isShow,
+        name: 'slot-component',
+        md: 24,
+        formItemAttributes: {
+          label: '',
+          'label-width': '0px',
+          prop: 'orderProducts',
+          errLabel: '产品信息',
+          rules: this.formOptions.orderProducts.isRules
+        },
+        render: (h, { props }) => {
+          return (
+            <div>
+              {this.formOptions.orderProducts.isEdit ? <div>
+                <el-button size="mini" type="primary" onClick={() => {
+                  this.appointVerify(this.getVfyKey(this.isEditIndex, false), (v) => {
+                    if (v) {
+                      try {
+                        this.orderInfo.orderProducts.map((item, index_) => {
+                          var row = this.orderInfo.orderProducts[index_ + 1]
+                          if (row) {
+                            if (
+                              `${row.brandId}_${row.mainId}_${row.smallId}_${row.productName}` == `${item.brandId}_${item.mainId}_${item.smallId}_${item.productName}`
+                            ) {
+                              throw new Error('');
+                            }
+                          }
+                        })
+                      } catch (error) {
+                        this.$message.warning('产品机型重复')
+                        return
+                      }
+                      this.isEditIndex = 0
+                      this.orderInfo.orderProducts.unshift({
+                        "brandId": "",
+                        "brandName": "",
+                        "createBy": "",
+                        "createTime": "",
+                        "mainId": "",
+                        "mainName": "",
+                        "num": "",
+                        "orderBaseId": this.id || '',
+                        "productId": "",
+                        "productName": "",
+                        "remark": "",
+                        "smallId": "",
+                        "smallName": "",
+                        "imgUrl": ""
+                      })
+                    }
+                  })
+                }}>新增</el-button>
+              </div> : null}
+              <zj-table
+                columns={this.productColumns}
+                table-data={this.orderInfo.orderProducts}
+              />
+            </div>
+          )
+        }
+      }]
+    },
+  },
+  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 || []))
+        return {
+          ...data
+        }
+      });
+      this.classifyListLv2 = classifyListLv2
+    })
+  },
+  methods: {
+    getVfyKey(index, bool = true) {
+      return [
+        ...(() => {
+          if (bool) {
+            return [
+              `orderProducts`,
+            ]
+          }
+          return []
+        })(),
+        ...(() => {
+          if (index > -1) {
+            return [
+              `orderProducts.${index}.brandId`,
+              `orderProducts.${index}.mainId`,
+              `orderProducts.${index}.smallId`,
+              `orderProducts.${index}.productName`,
+              `orderProducts.${index}.num`,
+              `orderProducts.${index}.remark`,
+            ]
+          }
+          return []
+        })()
+      ]
+    },
+    // 重新获取赋值
+    getOrderBaseProduct() {
+      if (this.id) {
+        orderBaseProductList({
+          orderBaseId: this.id
+        }).then((res) => {
+          this.orderInfo.orderProducts = res.data || []
+        })
+      }
+    },
+    eidtProduct(row, index) {
+      try {
+        this.orderInfo.orderProducts.map((item, index_) => {
+          if (
+            `${row.brandId}_${row.mainId}_${row.smallId}_${row.productName}` == `${item.brandId}_${item.mainId}_${item.smallId}_${item.productName}` &&
+            index_ != index
+          ) {
+            throw new Error('');
+          }
+        })
+      } catch (error) {
+        this.$message.warning('产品机型重复')
+        return
+      }
+      this.appointVerify(this.getVfyKey(this.isEditIndex), (v) => {
+        if (v) {
+          if (this.id) {
+            [orderBaseProductAdd, orderBaseProductUpdate][row.id ? 1 : 0](row).then(res => {
+              this.isEditIndex = -1
+              this.getOrderBaseProduct()
+              this.getOrderBaseLogList()
+            })
+          } else {
+            this.isEditIndex = -1
+          }
+        }
+      })
+    },
+    delProduct(row, index) {
+      this.appointVerify(this.getVfyKey(this.isEditIndex), (v) => {
+        if (v && this.id) {
+          orderBaseProductDelete({
+            orderProductId: row.id
+          }).then(res => {
+            this.getOrderBaseProduct()
+            this.getOrderBaseLogList()
+          })
+        } else {
+          this.orderInfo.orderProducts.splice(index, 1)
+        }
+      })
+    }
+  },
+}

+ 20 - 4
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/workOrderLogic.js

@@ -31,6 +31,8 @@ var initdata_ = {
   appointmentTime: "",
   // 销售单位
   saleCompany: "",
+  rpProjectRepairName: "",
+  rpProjectRepairId: "",
   // 产品信息------------------------
   orderProducts: [],
   // 其它信息------------------------
@@ -51,7 +53,11 @@ export default {
     id: {
       type: [String, Number],
       default: null,
-    }
+    },
+    workOrderType: {
+      type: Number,
+      default: 0, // 0普通工单, 1维保工单
+    },
   },
   data() {
     return {
@@ -141,13 +147,13 @@ export default {
         },
         // 联系人
         linkName: {
-          isEdit: !finish,
+          isEdit: this.workOrderType == 0 && !finish,
           isShow: true,
           isRules: [...required]
         },
         // 客户电话
         userMobile: {
-          isEdit: !finish,
+          isEdit: this.workOrderType == 0 && !finish,
           isShow: true,
           isRules: [...mobileRequired]
         },
@@ -177,7 +183,7 @@ export default {
           isRules: [...required]
         },
         orderChannelId: {
-          isEdit: this.id ? false : true,
+          isEdit: this.id ? false : this.workOrderType == 0 && true,
           isShow: true,
           isRules: [...required]
         },
@@ -192,6 +198,16 @@ export default {
           isShow: true,
           isRules: []
         },
+        rpProjectRepairName: {
+          isEdit: false,
+          isShow: this.workOrderType == 1,
+          isRules: []
+        },
+        rpProjectRepairId: {
+          isEdit: false,
+          isShow: this.workOrderType == 1,
+          isRules: []
+        },
         // 产品信息------------------------
         orderProducts: {
           isEdit: !finish,

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

@@ -7,7 +7,7 @@
     <!-- 创建工单 -->
     <div class="cartographer_big">
       <el-dialog title="创建工单" width="100%" :modal="false" :visible.sync="createFormBool" :before-close="handleClose">
-        <workOrderInfo v-if="createFormBool" />
+        <workOrderInfo :workOrderType="workOrderType" v-if="createFormBool" />
       </el-dialog>
     </div>
     <!-- 工单详情 -->
@@ -81,6 +81,7 @@ export default {
       orderTypeList: [],
       orderStatusList: [],
       defaultSearchData: [],
+      workOrderType: 0
     }
   },
   computed: {
@@ -115,8 +116,19 @@ export default {
       return [
         [
           [
+            this.optionsEvensAuth(["createWorkOrder", "createWbWorkOrder"], {
+              name: "创建工单",
+              click: () => { }
+            }),
             this.optionsEvensAuth("createWorkOrder", {
               click: () => {
+                this.workOrderType = 0
+                this.createFormBool = true
+              }
+            }),
+            this.optionsEvensAuth("createWbWorkOrder", {
+              click: () => {
+                this.workOrderType = 1
                 this.createFormBool = true
               }
             })
@@ -230,11 +242,11 @@ export default {
         }
       }
     },
-    
+
     selectable(row, index) {
       return !["YWG", "YJS", "YQX"].includes(Object.entries(row.selectMapData.orderStatus).find(([key, val]) => val == row.orderStatus)?.[0])
     },
-    
+
     screeningAnalysis(jname, val) {
       if (jname == 'orderFlags') {
         return (val || []).map(item => item.tagName).join(',')
@@ -242,14 +254,14 @@ export default {
         return val
       }
     },
-    
+
     filterMethod(value, row, column) {
       if (column['property'] == 'orderFlags') {
         return (row[column['property']] || []).map(item => item.tagName).join(',') === value
       }
       return row[column['property']] === value
     },
-    
+
     // 获取统计
     getOrderBaseStatusCount(...p) {
       orderBaseStatusCount(...p).then(res => {