Browse Source

Merge branch 'lin_yb' of ssh://gogs.zfire.top:2222/zfire-front/zfire-newmall-admin into develop

linwenxin 1 year ago
parent
commit
5623c9cb42

+ 62 - 69
src/views/mallManagement/goods/goods_add/index.vue

@@ -13,32 +13,24 @@
     <div class="form-container" v-show="step == 0">
       <div class="title">基础信息</div>
       <el-form ref="step1Form" :model="step1Form" :rules="step1FormRules" label-width="120px">
-		<el-form-item label="品牌:" prop="brand">
-			<el-select v-model="step1Form.brand" value-key="id" placeholder="请选择">
-			    <el-option
-			      v-for="item in brandList"
-			      :key="item.id"
-			      :label="item.brandName"
-			      :value="item">
-			    </el-option>
-			</el-select>
-		</el-form-item>
-		<el-form-item label="工单类型:" prop="orderSmallType">
-			<el-select v-model="step1Form.orderSmallType" placeholder="请选择">
-			    <el-option
-			      v-for="item in orderTypeList"
-			      :key="item.id"
-			      :label="item.orderSmallTypeText"
-			      :value="item.id">
-			    </el-option>
-			</el-select>
-		</el-form-item>
-		<el-form-item label="是否虚拟商品:" prop="isVr">
-			 <el-radio-group v-model="step1Form.isVr">
-			    <el-radio :label="true">是</el-radio>
-			    <el-radio :label="false">否</el-radio>
-			  </el-radio-group>
-		</el-form-item>
+        <el-form-item label="品牌:" prop="brand">
+          <el-select v-model="step1Form.brand" value-key="id" placeholder="请选择">
+            <el-option v-for="item in brandList" :key="item.id" :label="item.brandName" :value="item">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="工单类型:" prop="orderSmallType">
+          <el-select v-model="step1Form.orderSmallType" placeholder="请选择">
+            <el-option v-for="item in orderTypeList" :key="item.id" :label="item.orderSmallTypeText" :value="item.id">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="是否虚拟商品:" prop="isVr">
+          <el-radio-group v-model="step1Form.isVr">
+            <el-radio :label="true">是</el-radio>
+            <el-radio :label="false">否</el-radio>
+          </el-radio-group>
+        </el-form-item>
         <el-form-item label="商品名称:" prop="goodsName">
           <el-input v-model="step1Form.goodsName" placeholder="请输入商品名称" maxlength="200" show-word-limit></el-input>
         </el-form-item>
@@ -57,10 +49,10 @@
           </div>
         </el-form-item>
         <el-form-item label="轮播图:" prop="images">
-          <el-upload v-if="showImageListUpload2" multiple :limit="6" ref="imageListUpload2" class="avatar-uploader2 imageListUpload2"
-            style="height: 0;" :action="baseURL + 'common/upload'" :headers="myHeaders" name="file"
-            :show-file-list="false" :on-success="uploadSuccess2" :on-exceed="uploadExceed2"
-            :before-upload="beforeUpload2">
+          <el-upload v-if="showImageListUpload2" multiple :limit="6" ref="imageListUpload2"
+            class="avatar-uploader2 imageListUpload2" style="height: 0;" :action="baseURL + 'common/upload'"
+            :headers="myHeaders" name="file" :show-file-list="false" :on-success="uploadSuccess2"
+            :on-exceed="uploadExceed2" :before-upload="beforeUpload2">
           </el-upload>
           <div class="images">
             <div class="item" v-for="(item, index) in step1Form.images" :key="index">
@@ -411,7 +403,7 @@ import { quillEditor } from 'vue-quill-editor'
 import 'quill/dist/quill.core.css'
 import 'quill/dist/quill.snow.css'
 import 'quill/dist/quill.bubble.css'
-
+import { EventBus } from '@/utils/eventBus'
 // 工具栏配置
 const toolbarOptions = [
   ['bold', 'italic', 'underline', 'strike'],
@@ -452,9 +444,9 @@ export default {
         marketing: '',
         attrs: [],
         tags: [],
-		isVr: false,
-		orderSmallType: '',
-		brand: {},
+        isVr: false,
+        orderSmallType: '',
+        brand: {},
         // logoUrl: '',
         // showDate: [],
       },
@@ -471,23 +463,23 @@ export default {
         classify: [
           { required: true, message: '请选择商品分类', trigger: 'change' }
         ],
-		brand: [
+        brand: [
           { required: true, message: '请选择品牌', trigger: 'change' }
         ],
-		orderSmallType: [
-		  { required: true, message: '请选择工单类型', trigger: 'change' }
-		],
-		isVr: [
-		  { required: true, message: '请选择是否虚拟商品', trigger: 'change' }
-		]
+        orderSmallType: [
+          { required: true, message: '请选择工单类型', trigger: 'change' }
+        ],
+        isVr: [
+          { required: true, message: '请选择是否虚拟商品', trigger: 'change' }
+        ]
       },
       imagesList: [], // 图片墙展示列表
 
       classifyList: [],
       freightList: [],
       moduleList: [],
-			orderTypeList: [],
-			brandList: [],
+      orderTypeList: [],
+      brandList: [],
 
       step2Form: {
         specType: true,
@@ -612,8 +604,8 @@ export default {
 
     this.getFreightList();
     this.getModuleList();
-	this.getTypeList()
-	this.getBrand()
+    this.getTypeList()
+    this.getBrand()
 
     if (this.isEdit) {
       this.canCompute = false;
@@ -640,18 +632,18 @@ export default {
         })
       })
     },
-		
-		getTypeList(){
-			getTypeList({pageNum: 1,pageSize: -1,params: [{param: 'a.order_type',compare: '=',value: 'INSTALL'},{param: 'a.status',compare: '=',value: true}]}).then(res => {
-				this.orderTypeList = res.data.records
-			})
-		},
-	getBrand(){
-		getBrand().then(res => {
-			this.brandList = res.data
-		})
-	},
-		
+
+    getTypeList() {
+      getTypeList({ pageNum: 1, pageSize: -1, params: [{ param: 'a.order_type', compare: '=', value: 'INSTALL' }, { param: 'a.status', compare: '=', value: true }] }).then(res => {
+        this.orderTypeList = res.data.records
+      })
+    },
+    getBrand() {
+      getBrand().then(res => {
+        this.brandList = res.data
+      })
+    },
+
     // getMarketingList() {
     //   let classifyList = this.classifyList;
     //   let categoryId = '';
@@ -733,9 +725,9 @@ export default {
           marketing: data.marketingId,
           attrs: data.tags,
           tags: data.tagsLabel,
-		  brand: {id: data.brandId,brandName: data.brandName},
-		  isVr: data.isVr,
-		  orderSmallType: data.orderSmallType
+          brand: { id: data.brandId, brandName: data.brandName },
+          isVr: data.isVr,
+          orderSmallType: data.orderSmallType
           // logoUrl: data.logo,
           // showDate: data.logoStartTime ? [data.logoStartTime.slice(0, 10), data.logoEndTime.slice(0, 10)] : [],
         }
@@ -1018,11 +1010,11 @@ export default {
 
         templateId: this.step3Form.moduleId,
         content: this.step3Form.detailContent,
-		
-		isVr: this.step1Form.isVr,
-		orderSmallType: this.step1Form.orderSmallType,
-		brandId: this.step1Form.brand.id,
-		brandName: this.step1Form.brand.brandName,
+
+        isVr: this.step1Form.isVr,
+        orderSmallType: this.step1Form.orderSmallType,
+        brandId: this.step1Form.brand.id,
+        brandName: this.step1Form.brand.brandName,
       }
       console.log(params);
 
@@ -1054,6 +1046,7 @@ export default {
 
     goBack() {
       this.$router.go(-1);
+      EventBus.$emit("updateGoodsListPage")
       // this.$store.dispatch("tagsView/delView", this.$route);
     },
 
@@ -1182,15 +1175,15 @@ export default {
 
     // 轮播图 - 点击上传图片
     uploadImage(id) {
-      if(this.step1Form.images.length>=6){
+      if (this.step1Form.images.length >= 6) {
         this.$errorMsg('最多上传6张轮播图');
-        return 
+        return
       }
 
       this.showImageListUpload2 = false
-      this.$nextTick(()=>{
+      this.$nextTick(() => {
         this.showImageListUpload2 = true
-        this.$nextTick(()=>{
+        this.$nextTick(() => {
           this.uploadImageId = id;
           document.querySelector('.imageListUpload2 input').click();
         })

+ 5 - 2
src/views/mallManagement/goods/goods_index/index.vue

@@ -289,7 +289,7 @@
 <script>
 import { getGoodsList, deleteGoods, getClassifyList, getGoodsStateCount, cloneGoods, editGoods, goodsPutOn, goodsPutOff, checkSeckill, getGoodsDetail, getModuleList, setCommomModule, setFreight, getFreightList } from '@/api/goods'
 import Clipboard from 'clipboard'
-
+import { EventBus } from '@/utils/eventBus'
 export default {
   data() {
     return {
@@ -354,8 +354,11 @@ export default {
   },
   created() {
     this.getList();
-
+    
     this.getClassifyList();
+    EventBus.$on("updateGoodsListPage",()=>{
+      this.getList();
+    })
   },
   methods: {
 

+ 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,
   ],

+ 98 - 1
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,12 +8,67 @@ 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 == 1) {
+            return [{
+              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: 'rpProjectRepairId',
+                rules: this.formOptions.rpProjectRepairId.isRules
+              },
+              events: {
+                change: (val) => {
+                  this.getorderDetail(()=>{
+                    if (val) {
+                      this.orderInfo.rpProjectRepairId = val
+                      this.orderInfo.rpProjectRepairName = this.wb_project.find(item => item.value == val).label
+                      this.getWeiBaoDetail()
+                    }
+                  })
+                }
+              }
+            }, {
+              name: 'slot-component',
+              md: 12,
+              formItemAttributes: {
+                'label-width': '0px',
+                prop: '',
+              },
+              render: (h, { props }) => {
+                return null
+              }
+            },]
+          }
+          return []
+        })(),
         {
           isShow: this.formOptions.userName.isShow,
           name: 'el-input',
@@ -236,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": "",

+ 49 - 41
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/serviceInfo.js

@@ -50,46 +50,53 @@ export default {
             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 = ''
+        ...(() => {
+          if (this.workOrderType == 0) {
+            // 普通工单
+            return [{
+              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.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
+            }]
+          } else if (this.workOrderType == 1) {
+            this.orderInfo.orderChannelId = "工程维保"
+            // 维保工单
+            return [{
+              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 +118,6 @@ export default {
             rules: this.formOptions.appointmentTime.isRules
           }
         },
-
         {
           isShow: this.formOptions.saleCompany.isShow,
           name: 'el-input',
@@ -125,12 +131,13 @@ export default {
             prop: 'saleCompany',
             rules: this.formOptions.saleCompany.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 => ({
@@ -145,5 +152,6 @@ export default {
         label: item.dictValue
       }))
     })
+  }
   },
 }

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

@@ -0,0 +1,377 @@
+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,
+      productList_wb: []
+    }
+  },
+  computed: {
+    productColumns_wb() {
+      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.huoquweiyi('brandId', 'brandName').find(item => item.value == val)
+                      row.brandName = data.label
+                    } else {
+                      row.brandName = ""
+                    }
+                  }}
+                  placeholder="请选择">
+                  {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>
+          }
+        },
+        {
+          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.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.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>
+          }
+        },
+        {
+          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.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.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>
+          }
+        },
+        {
+          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_wb(row, index)
+                    }}>删除</el-button>
+                    {this.isEditIndex == index && <el-button type="text" onClick={() => {
+                      this.eidtProduct_wb(row, index)
+                    }}>确定</el-button>}
+                    {this.isEditIndex == -1 && <el-button type="text" onClick={() => {
+                      this.isEditIndex = index
+                    }}>编辑</el-button>}
+                  </div>
+                }
+              },
+            ]
+          }
+          return []
+        })()
+      ]
+    },
+    product_wb() {
+      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_wb(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": "",
+                        "insideCode":"",
+                        "orderBaseId": this.id || '',
+                        "productId": "",
+                        "productName": "",
+                        "remark": "",
+                        "smallId": "",
+                        "smallName": "",
+                        "imgUrl": ""
+                      })
+                    }
+                  })
+                }}>新增</el-button>
+              </div> : null}
+              <zj-table
+                columns={this.productColumns_wb}
+                table-data={this.orderInfo.orderProducts}
+              />
+            </div>
+          )
+        }
+      }]
+    },
+  },
+  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 {
+          value: value,
+          ...obj[value]
+        }
+      })
+    },
+    getVfyKey_wb(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_wb() {
+      if (this.id) {
+        orderBaseProductList({
+          orderBaseId: this.id
+        }).then((res) => {
+          this.orderInfo.orderProducts = res.data || []
+        })
+      }
+    },
+    eidtProduct_wb(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_wb(this.isEditIndex), (v) => {
+        if (v) {
+          if (this.id) {
+            [orderBaseProductAdd, orderBaseProductUpdate][row.id ? 1 : 0](row).then(res => {
+              this.isEditIndex = -1
+              this.getOrderBaseProduct_wb()
+              this.getOrderBaseLogList()
+            })
+          } else {
+            this.isEditIndex = -1
+          }
+        }
+      })
+    },
+    delProduct_wb(row, index) {
+      this.appointVerify(this.getVfyKey_wb(this.isEditIndex), (v) => {
+        if (v && this.id) {
+          orderBaseProductDelete({
+            orderProductId: row.id
+          }).then(res => {
+            this.getOrderBaseProduct_wb()
+            this.getOrderBaseLogList()
+          })
+        } else {
+          this.orderInfo.orderProducts.splice(index, 1)
+        }
+      })
+    }
+  },
+}

+ 34 - 13
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: "",
   // 联系人
@@ -51,7 +53,11 @@ export default {
     id: {
       type: [String, Number],
       default: null,
-    }
+    },
+    workOrderType: {
+      type: Number,
+      default: 0, // 0普通工单, 1维保工单
+    },
   },
   data() {
     return {
@@ -62,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()
       },
@@ -133,21 +148,27 @@ export default {
       var finish = !!~['YWG', 'YJS', 'YQX'].indexOf(this.orderInfo.orderStatus)
       return {
         // 基础信息--------------------
+        // 维保项目
+        rpProjectRepairId: {
+          isEdit: this.id ? false : true,
+          isShow: this.workOrderType == 1,
+          isRules: [...required]
+        },
         // 客户名称
         userName: {
-          isEdit: !finish,
+          isEdit: this.workOrderType == 0 &&  !finish,
           isShow: true,
           isRules: [...required]
         },
         // 联系人
         linkName: {
-          isEdit: !finish,
+          isEdit: this.workOrderType == 0 && !finish,
           isShow: true,
           isRules: [...required]
         },
         // 客户电话
         userMobile: {
-          isEdit: !finish,
+          isEdit: this.workOrderType == 0 && !finish,
           isShow: true,
           isRules: [...mobileRequired]
         },
@@ -159,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: []
         },
@@ -177,7 +198,7 @@ export default {
           isRules: [...required]
         },
         orderChannelId: {
-          isEdit: this.id ? false : true,
+          isEdit: this.id ? false : this.workOrderType == 0 && true,
           isShow: true,
           isRules: [...required]
         },

+ 11 - 3
src/views/workOrder/workOrderPool/index.vue

@@ -7,14 +7,14 @@
     <!-- 创建工单 -->
     <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>
     <!-- 工单详情 -->
     <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>
     <!-- 批量预约/改约 -->
@@ -81,6 +81,7 @@ export default {
       orderTypeList: [],
       orderStatusList: [],
       defaultSearchData: [],
+      workOrderType: 0
     }
   },
   computed: {
@@ -116,16 +117,18 @@ export default {
         [
           [
             this.optionsEvensAuth(["createWorkOrder", "createWbWorkOrder"], {
-              name: '创建工单',
+              name: "创建工单",
               click: () => { }
             }),
             this.optionsEvensAuth("createWorkOrder", {
               click: () => {
+                this.workOrderType = 0
                 this.createFormBool = true
               }
             }),
             this.optionsEvensAuth("createWbWorkOrder", {
               click: () => {
+                this.workOrderType = 1
                 this.createFormBool = true
               }
             })
@@ -377,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
             })