Bladeren bron

feat: 地图定位、按钮权限

zh 2 jaren geleden
bovenliggende
commit
b67018cebf

+ 1 - 1
src/api/frock.js

@@ -86,7 +86,7 @@ export function applyUpdateQuery(params) {
   return request({
     url: `/trade/login/order/apply-update/query`,
     method: 'post',
-    data: params
+    params
   })
 }
 

+ 7 - 0
src/main.js

@@ -46,6 +46,13 @@ AMap.initAMapApiLoader({
   plugins: ['AMap.Geocoder', 'AMap.AutoComplete', 'AMap.PlaceSearch', 'AMap.DistrictSearch']
 })
 
+import { getIPAdd } from '@/utils/lbs.js'
+
+getIPAdd()
+  .then(res => {
+    Vue.prototype.$IpAdd = res.data
+  })
+  .catch(() => {})
 // // 本地引用;
 // import ElementPlugins from '@packages'
 // Vue.use(ElementPlugins)

+ 166 - 56
src/views/commercialEngineering/components/base.vue

@@ -18,7 +18,7 @@
                   { label: '家装', value: 'HOME' }
                 ]"
                 :key="item.value"
-                :label="item.label"
+                :label="item.value"
               >
                 {{ item.label }}
               </el-radio>
@@ -40,7 +40,7 @@
         <el-col :xs="24" :sm="12" :lg="12" class="item">
           <div class="label">{{ ['cross'].includes(pageType) ? '业务' : '项目' }}所在区域*:</div>
           <div class="value">
-            <el-select v-model="formData.projectArea" placeholder="请选择" clearable filterable @change="handleService">
+            <el-select v-model="formData.projectArea" placeholder="请选择" clearable filterable>
               <el-option
                 v-for="item in commonData.dict['TRADE_PROJECT_AREA']"
                 :key="item.value"
@@ -123,39 +123,97 @@
             <el-input v-model="formData.followCustomerMobile" placeholder="请填写" size="mini" clearable />
           </div>
         </el-col>
-        <el-col v-if="['frock', 'cross'].includes(pageType)" :xs="24" :sm="24" :lg="8" class="item">
+        <el-col
+          v-if="['frock', 'cross'].includes(pageType) && formData.orderType !== 'HOME'"
+          :xs="24"
+          :sm="24"
+          :lg="8"
+          class="item"
+        >
           <div class="label">工程项目名称*:</div>
           <div class="value">
             <el-input v-model="formData.projectName" placeholder="请填写" size="mini" clearable />
           </div>
         </el-col>
-        <el-col :xs="24" :sm="12" :lg="['home'].includes(pageType)? 12: 8" class="item">
+        <el-col
+          :xs="24"
+          :sm="12"
+          :lg="['home'].includes(pageType) || formData.orderType === 'HOME' ? 12 : 8"
+          class="item"
+        >
           <div class="label">工程联系人*:</div>
           <div class="value">
             <el-input v-model="formData.enginLinkName" placeholder="请填写" size="mini" clearable />
           </div>
         </el-col>
-        <el-col :xs="24" :sm="12" :lg="['home'].includes(pageType)? 12: 8" class="item">
+        <el-col
+          :xs="24"
+          :sm="12"
+          :lg="['home'].includes(pageType) || formData.orderType === 'HOME' ? 12 : 8"
+          class="item"
+        >
           <div class="label">电话*:</div>
           <div class="value">
             <el-input v-model="formData.enginLinkMobile" placeholder="请填写" size="mini" clearable />
           </div>
         </el-col>
-        <el-col v-if="['home'].includes(pageType)" :xs="24" :sm="24" :lg="24" class="item">
-          <div class="label" style="height: auto;">工程项目名称*:</div>
-          <div class="value" style="height: 100%;">
-            <el-radio-group v-model="formData.homeProjectNameRadio" @change="">
+        <el-col
+          v-if="['home'].includes(pageType) || formData.orderType === 'HOME'"
+          :xs="24"
+          :sm="24"
+          :lg="24"
+          class="item"
+        >
+          <div class="label" style="height: auto">工程项目名称*:</div>
+          <div class="value" style="height: 100%">
+            <el-radio-group v-model="formData.homeProjectNameRadio">
               <el-radio label="AREA">
-                <el-input v-model="formData.homeProjectNameArea" class="my-width" placeholder="请填写" size="mini" clearable />小区
-                <el-input v-model="formData.homeProjectNameSeat" class="my-width" placeholder="请填写" size="mini" clearable />座
-                <el-input v-model="formData.homeProjectNameNumber" class="my-width" placeholder="请填写" size="mini" clearable />号
+                <el-input
+                  v-model="formData.homeProjectNameArea"
+                  class="my-width"
+                  placeholder="请填写"
+                  size="mini"
+                  clearable
+                />小区
+                <el-input
+                  v-model="formData.homeProjectNameSeat"
+                  class="my-width"
+                  placeholder="请填写"
+                  size="mini"
+                  clearable
+                />座
+                <el-input
+                  v-model="formData.homeProjectNameNumber"
+                  class="my-width"
+                  placeholder="请填写"
+                  size="mini"
+                  clearable
+                />号
               </el-radio>
               <el-radio label="SELF">
-                <el-input v-model="formData.homeProjectNameArea" class="my-width" placeholder="请填写" size="mini" clearable />小区
+                <el-input
+                  v-model="formData.homeProjectNameArea2"
+                  class="my-width"
+                  placeholder="请填写"
+                  size="mini"
+                  clearable
+                />小区
               </el-radio>
               <el-radio label="VILLA">
-                <el-input v-model="formData.homeProjectNameArea" class="my-width" placeholder="请填写" size="mini" clearable />小区
-                <el-input v-model="formData.homeProjectNameNumber" class="my-width" placeholder="请填写" size="mini" clearable />号别墅
+                <el-input
+                  v-model="formData.homeProjectNameArea3"
+                  class="my-width"
+                  placeholder="请填写"
+                  size="mini"
+                  clearable
+                />小区
+                <el-input
+                  v-model="formData.homeProjectNameNumber3"
+                  class="my-width"
+                  placeholder="请填写"
+                  size="mini"
+                  clearable
+                />号别墅
               </el-radio>
             </el-radio-group>
           </div>
@@ -181,22 +239,24 @@
           <div class="label">详细地址</div>
           <div class="value">
             <el-input v-model="formData.address" placeholder="请填写" size="mini" clearable />
-            <geographicalPosi v-if="module !== 'detail'" :form-data="formData" @on-select-posi="handleSelectPosi" />
-          </div>
-        </el-col>
-        <!-- <el-col :xs="24" :sm="24" :lg="24" class="item" style="height: 400px">
-          <div class="label" style="height: auto">地图位置</div>
-          <div class="value" style="height: auto; padding: 0">
-            <zj-amap-polygon
-              eid="bMap"
-              :zoom="zoom"
-              :center="center"
-              :markers="markers"
-              :electronic-fence="electronicFence"
-              @getPolygons="getPolygons"
-            />
-          </div>
-        </el-col> -->
+            <geographicalPosi v-if="module !== 'detail'" :form-data="formData" @selectPosi="handleSelectPosi" />
+          </div>
+        </el-col>
+        <template v-if="isTradeExaminer">
+          <el-col v-if="module !== 'add'" :xs="24" :sm="24" :lg="24" class="item" style="height: 400px">
+            <div class="label" style="height: auto">地图位置</div>
+            <div class="value" style="height: auto; padding: 0">
+              <zj-amap-polygon
+                eid="bMap"
+                :zoom="zoom"
+                :center="center"
+                :markers="markers"
+                :electronic-fence="electronicFence"
+                @getPolygons="getPolygons"
+              />
+            </div>
+          </el-col>
+        </template>
         <el-col :xs="24" :sm="24" :lg="24" class="item">
           <div class="label">项目类别*:</div>
           <div class="value">
@@ -210,8 +270,8 @@
         <el-col :xs="24" :sm="12" :lg="12" class="item">
           <div class="label">图纸上传:</div>
           <div class="value" style="justify-content: flex-end">
-            <FileUpload v-if="module !== 'detail'" :file-list="fileList" size="mini" :limit="1" class="file" />
-            <el-input v-model="formData.drawUpload" disabled size="mini" clearable />
+            <FileUpload :file-list="formData.fileList" size="mini" :limit="1" class="file" />
+            <!-- <el-input v-model="formData.drawUpload"  size="mini" clearable /> -->
           </div>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="12" class="item">
@@ -354,9 +414,10 @@
 import { findElem } from '@/utils/util'
 import { getRegion } from '@/api/sales'
 import { getTradeConfigList } from '@/api/basic_data/sectorAllocation'
-
 import GeographicalPosi from './geographicalPosi.vue'
 import FileUpload from '@/components/Common/file-upload.vue'
+import { mapGetters } from 'vuex'
+
 export default {
   components: {
     FileUpload,
@@ -395,13 +456,7 @@ export default {
       zoom: 16,
       // 地图默认中心
       center: [113.36242, 23.1368425],
-      markers: [
-        {
-          id: '',
-          name: '',
-          center: ['', ''] // [row.workerLng, row.workerLat]
-        }
-      ],
+      markers: [],
       // 是否启用电子围栏
       electronicFence: false,
       provinceList: [],
@@ -412,9 +467,34 @@ export default {
       tradeList: []
     }
   },
+  computed: {
+    ...mapGetters(['isTradeExaminer'])
+  },
+  watch: {
+    async 'formData.id'(newValue, oldValue) {
+      if (newValue) {
+        if (this.commonData.vicinityMarkers.length) {
+          this.markers = this.commonData.vicinityMarkers.map(k => {
+            return {
+              id: '',
+              name: k.projectName,
+              center: [k.lnt, k.lat]
+            }
+          })
+        }
+        this.getTradeConfigList(this.formData.tradeParentId)
+        await this.getCallbackPosition(0, this.formData.provinceId, 'province', 'id')
+        await this.getCallbackPosition(this.formData.provinceId, this.formData.cityId, 'city', 'id')
+        await this.getCallbackPosition(this.formData.cityId, this.formData.areaId, 'area', 'id')
+        await this.getCallbackPosition(this.formData.areaId, this.formData.streetId, 'street', 'id')
+      }
+    }
+  },
   created() {
-    this.getRegion()
     this.getTradeConfigList()
+    if (this.module === 'add') {
+      this.getRegion()
+    }
   },
   methods: {
     // 获取省市区街道
@@ -422,8 +502,10 @@ export default {
       getRegion({ pid: id }).then(res => {
         if (level === 0) {
           this.provinceList = res.data
+          this.getPosition(res.data, 'provinceId', 'province')
         } else if (level === 1) {
           this.cityList = res.data
+          this.getPosition(res.data, 'cityId', 'city')
         } else if (level === 2) {
           this.areaList = res.data
         } else if (level === 3) {
@@ -431,6 +513,18 @@ export default {
         }
       })
     },
+    getPosition(data, id, name) {
+      if (this.module === 'add') {
+        const item = data.find(k => k.name === this.$IpAdd[name])
+        this.formData[id] = item.id
+        this.formData[name] = item.name
+        if (name === 'province') {
+          this.getRegion(1, item.id)
+        } else {
+          this.getRegion(2, item.id)
+        }
+      }
+    },
     handleArea(value, type) {
       this.formData[type] = this[type + 'List'].find(k => k.id === value).name
     },
@@ -556,15 +650,31 @@ export default {
     getPolygons(data) {
       console.log(data)
     },
-    handleSelectPosi(data) {
-      this.formData.lng = data.center[0]
+    async handleSelectPosi(data) {
+      this.formData.lnt = data.center[0]
       this.formData.lat = data.center[1]
-      console.log(this.formData, 9999)
-
+      this.formData.positionAddress = data.name
       var { province, city, district, township } = data.data.addressComponent
-      var { lbsId, name } = this.sheng.find(item => item.name === province)
-      this.formData.provinceId = lbsId
-      this.formData.province = name
+      const area = district
+      const street = township
+      await this.getCallbackPosition(0, province, 'province')
+      await this.getCallbackPosition(this.formData.provinceId, city, 'city')
+      await this.getCallbackPosition(this.formData.cityId, area, 'area')
+      await this.getCallbackPosition(this.formData.areaId, street, 'street')
+    },
+
+    /**
+     * @param {*} id // 父级id
+     * @param {*} value // 值
+     * @param {*} name // 字段名称
+     * @param {*} way // 筛选属性,默认name
+     */
+    async getCallbackPosition(id = 0, value = '', name, way = 'name') {
+      const { data } = await getRegion({ pid: id })
+      this[name + 'List'] = data
+      const temp = data.find(k => k[way] == value)
+      this.formData[name] = temp && temp.name
+      this.formData[name + 'Id'] = temp && temp.id
     }
   }
 }
@@ -595,15 +705,15 @@ export default {
 ::v-deep .file .is-success {
   margin-top: 0;
 }
-.my-width{
+.my-width {
   width: 150px;
 }
-.title{
+.title {
   display: flex;
-    justify-content: space-between;
-    .title-right{
-      font-size: 16px;
-      font-weight: 300;
-    }
+  justify-content: space-between;
+  .title-right {
+    font-size: 16px;
+    font-weight: 300;
+  }
 }
 </style>

+ 4 - 4
src/views/commercialEngineering/components/examine.vue

@@ -43,7 +43,7 @@
           <div class="label">审核备注</div>
           <div class="value">
             <el-select v-model="formData.note" placeholder="请选择" size="mini" clearable style="width: 100%">
-              <el-option v-for="item in []" :key="item.value" :label="item.label" :value="item.value" />
+              <el-option v-for="item in commonData.dict['TRADE_EXAMINE_NOTE']" :key="item.value" :label="item.label" :value="item.value" />
             </el-select>
           </div>
         </el-col>
@@ -98,9 +98,9 @@ export default {
   data() {
     return {
       engType: [
-        { label: '登录成功', value: 1 },
-        { label: '登录不成功', value: 2 },
-        { label: '驳回', value: 3 }
+        { label: '登录成功', value: 'OK' },
+        { label: '登录不成功', value: 'FAIL' },
+        { label: '驳回', value: 'REJECT' }
       ]
     }
   },

+ 9 - 9
src/views/commercialEngineering/components/geographicalPosi.vue

@@ -102,8 +102,8 @@ export default {
     }
   },
   watch: {
-    'formData.gpsAddress'() {
-      if (this.markers[0] && this.markers[0].name !== this.formData.gpsAddress) {
+    'formData.positionAddress'() {
+      if (this.markers[0] && this.markers[0].name !== this.formData.positionAddress) {
         Object.assign(this.$data, this.$options.data())
       }
     }
@@ -118,23 +118,23 @@ export default {
     },
     async open() {
       this.dialogVisible = true
-      if (this.formData.lng && this.formData.lat && this.formData.gpsAddress) {
-        this.changeSearchMapFn(`${this.formData.lng}//${this.formData.lat}//${this.formData.gpsAddress}`)
+      if (this.formData.lng && this.formData.lat && this.formData.positionAddress) {
+        this.changeSearchMapFn(`${this.formData.lng}//${this.formData.lat}//${this.formData.positionAddress}`)
       } else {
         var str = ''
-        if (!~(this.formData.gpsAddress || '').indexOf(this.formData.province)) {
+        if (!~(this.formData.positionAddress || '').indexOf(this.formData.province)) {
           str += this.formData.province || ''
         }
-        if (!~(this.formData.gpsAddress || '').indexOf(this.formData.city)) {
+        if (!~(this.formData.positionAddress || '').indexOf(this.formData.city)) {
           str += this.formData.city || ''
         }
-        if (!~(this.formData.gpsAddress || '').indexOf(this.formData.area)) {
+        if (!~(this.formData.positionAddress || '').indexOf(this.formData.area)) {
           str += this.formData.area || ''
         }
-        if (!~(this.formData.gpsAddress || '').indexOf(this.formData.street)) {
+        if (!~(this.formData.positionAddress || '').indexOf(this.formData.street)) {
           str += this.formData.street || ''
         }
-        str += this.formData.gpsAddress || ''
+        str += this.formData.positionAddress || ''
         await this.remoteMethod(str)
         if (this.mapSearchList.length) {
           var v = this.mapSearchList[0]

+ 2 - 2
src/views/commercialEngineering/components/model.vue

@@ -11,7 +11,7 @@
         border: true
       }"
     />
-    <el-button v-if="module !=='detail'" style="width: 100%" type="primary" size="small" @click="handleAdd">添加</el-button>
+    <el-button v-if="!['detail', 'examine'].includes(module)" style="width: 100%" type="primary" size="small" @click="handleAdd">添加</el-button>
   </div>
 </template>
 
@@ -53,7 +53,7 @@ export default {
     columns() {
       return [
         ...(() => {
-          return this.module !== 'detail' ? [{
+          return !['detail', 'examine'].includes(this.module) ? [{
             hidden: '',
             columnAttributes: {
               fixed: 'left',

+ 12 - 7
src/views/commercialEngineering/crossDistrict/crossDistrictForm.vue

@@ -24,14 +24,19 @@ export default {
   methods: {
     onSbumit(type) {
       const params = {
-        ...this.formData
+        ...this.formData,
+        isSpan: true
+      }
+      if (params.orderType === 'HOME' && params.orderType === 'HOME' && params.homeProjectNameRadio) {
+        params.projectName = {
+          'AREA': params.homeProjectNameArea + params.homeProjectNameSeat + params.homeProjectNameNumber,
+          'SELF': params.homeProjectNameArea2,
+          'VILLA': params.homeProjectNameArea3 + params.homeProjectNameNumber3
+        }[params.homeProjectNameRadio]
+      }
+      if (params.fileList.length) {
+        params.drawUpload = params.fileList[0].url
       }
-      params.address = params.projectName
-      params.positionAddress = params.address
-      const item = [113.36242, 23.1368425]
-      params.lat = item[0]
-      params.lnt = item[1]
-      params.isSpan = true
 
       if (type === 1) {
         submitLoginHomeDecoration(params).then(res => {

+ 44 - 21
src/views/commercialEngineering/crossDistrict/crossDistrictkList.vue

@@ -69,6 +69,12 @@ export default {
                         this.$message.error('请选择需要更新的数据')
                         return
                       }
+                      for (let index = 0; index < this.recordSelected.length.length; index++) {
+                        if (this.recordSelected[index].orderStatus !== 'OK') {
+                          this.$message.error('请选择审核通过的数据')
+                          return
+                        }
+                      }
                       this.operateType = 'update'
                       this.operateTitle = '更新'
                       this.operateVisible = true
@@ -85,6 +91,12 @@ export default {
                         this.$message.error('请选择需要替换业务员的数据')
                         return
                       }
+                      for (let index = 0; index < this.recordSelected.length.length; index++) {
+                        if (this.recordSelected[index].orderStatus !== 'OK') {
+                          this.$message.error('请选择审核通过的数据')
+                          return
+                        }
+                      }
                       this.operateType = 'replace'
                       this.operateTitle = '替换业务员'
                       this.operateVisible = true
@@ -101,6 +113,12 @@ export default {
                         this.$message.error('请选择需要删除的数据')
                         return
                       }
+                      for (let index = 0; index < this.recordSelected.length.length; index++) {
+                        if (this.recordSelected[index].orderStatus !== 'OK') {
+                          this.$message.error('请选择审核通过的数据')
+                          return
+                        }
+                      }
                       this.operateType = 'delete'
                       this.operateTitle = '删除'
                       this.operateVisible = true
@@ -152,9 +170,10 @@ export default {
     },
     operation() {
       return (h, { row, index, column }) => {
+        console.log(row.orderStatus)
         return (
           <div class='operation-btns'>
-            {this.isTradeExaminer ? (
+            {this.isTradeExaminer && row.orderStatus === 'WAIT' ? (
               <el-button
                 size='mini'
                 type='text'
@@ -180,27 +199,31 @@ export default {
             >
               详情
             </el-button>
-            <el-button
-              size='mini'
-              type='text'
-              onClick={() => {
-                this.content = '编辑'
-                this.module = 'edit'
-                this.detailId = row.id
-                this.visible = true
-              }}
-            >
+            {(row.orderStatus === 'SAVE' || row.orderStatus === 'RETURN')
+              ? <el-button
+                size='mini'
+                type='text'
+                onClick={() => {
+                  this.content = '编辑'
+                  this.module = 'edit'
+                  this.detailId = row.id
+                  this.visible = true
+                }}
+              >
               编辑
-            </el-button>
-            <el-button size='mini' type='text' onClick={() => {
-              this.operateType = 'update'
-              this.operateTitle = '更新'
-              this.recordSelected = [row]
-              this.operateVisible = true
-            }}>
+              </el-button> : null
+            }
+            {row.orderStatus === 'OK'
+              ? <el-button size='mini' type='text' onClick={() => {
+                this.operateType = 'update'
+                this.operateTitle = '更新'
+                this.recordSelected = [row]
+                this.operateVisible = true
+              }}>
               更新
-            </el-button>
-            {!this.isTradeExaminer ? (
+              </el-button> : null
+            }
+            {!this.isTradeExaminer && (row.orderStatus === 'OK' || row.orderStatus === 'FAIL' && !row.isApplyUpdate) ? (
               <el-button
                 size='mini'
                 type='text'
@@ -214,7 +237,7 @@ export default {
                 申请修改
               </el-button>
             ) : null}
-            {this.isTradeExaminer ? (
+            {this.isTradeExaminer && (row.orderStatus === 'OK' || row.orderStatus === 'FAIL' && row.isApplyUpdate) ? (
               <el-button
                 size='mini'
                 type='text'

+ 3 - 4
src/views/commercialEngineering/crossDistrict/detail.vue

@@ -4,14 +4,13 @@
       <el-radio-button class="my-width" label="detail">详情</el-radio-button>
       <el-radio-button class="my-width" label="record">操作记录</el-radio-button>
     </el-radio-group>
-    <el-form v-if="current === 'detail'" disabled>
+    <el-form v-show="current === 'detail'" disabled>
       <Base :form-data="formData" page-type="cross" :module="module" :common-data="commonData" />
       <Model :form-data="formData" page-type="cross" :module="module" :common-data="commonData" />
       <Examine v-if="formData.confirmBy && formData.confirmTime" :form-data="formData" page-type="cross" :module="module" :common-data="commonData" />
     </el-form>
-    <template v-else>
-      <OperationRecords :detail-id="detailId" />
-    </template>
+    <OperationRecords v-show="current === 'record'" :detail-id="detailId" />
+
   </div>
 </template>
 

+ 27 - 10
src/views/commercialEngineering/crossDistrict/examine.vue

@@ -1,10 +1,13 @@
 <template>
   <div>
-    <Base :form-data="formData" page-type="cross" :module="module" :common-data="commonData" />
-    <Model :form-data="formData" page-type="cross" :module="module" :common-data="commonData" />
+    <el-form disabled>
+      <Base :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
+      <Model :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
+    </el-form>
+    <Examine :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
     <div style="margin: 20px 0">
-      <el-button type="primary" size="small" @click="onSbumit(1)">提交</el-button>
-      <el-button size="small">返回</el-button>
+      <el-button type="primary" size="small" @click="onSbumit">提交</el-button>
+      <el-button size="small" @click="handleBack">返回</el-button>
     </div>
   </div>
 </template>
@@ -12,23 +15,34 @@
 <script>
 import Base from '../components/base.vue'
 import Model from '../components/model.vue'
+import Examine from '../components/examine.vue'
+
 import Mixin from '../mixin'
 import { examineLoginHomeDecoration } from '@/api/crossDistrict'
 export default {
   components: {
     Base,
-    Model
+    Model,
+    Examine
   },
   mixins: [Mixin],
   methods: {
     onSbumit(type) {
-      const item = [113.36242, 23.1368425]
       const params = {
         ...this.formData,
-        lat: item[0],
-        lnt: item[1],
-        positionAddress: this.formData.address,
-        orderStatus: 'OK'
+        orderStatus: 'OK',
+        isSpan: true
+
+      }
+      if (params.orderType === 'HOME' && params.orderType === 'HOME' && params.homeProjectNameRadio) {
+        params.projectName = {
+          'AREA': params.homeProjectNameArea + params.homeProjectNameSeat + params.homeProjectNameNumber,
+          'SELF': params.homeProjectNameArea2,
+          'VILLA': params.homeProjectNameArea3 + params.homeProjectNameNumber3
+        }[params.homeProjectNameRadio]
+      }
+      if (params.fileList.length) {
+        params.drawUpload = params.fileList[0].url
       }
 
       examineLoginHomeDecoration(params).then(res => {
@@ -37,6 +51,9 @@ export default {
     },
     commonFn(name) {
       this.$successMsg(name)
+      this.handleBack()
+    },
+    handleBack() {
       this.$emit('updateList')
     }
   }

+ 2 - 4
src/views/commercialEngineering/frock/detail.vue

@@ -4,14 +4,12 @@
       <el-radio-button class="my-width" label="detail">详情</el-radio-button>
       <el-radio-button class="my-width" label="record">操作记录</el-radio-button>
     </el-radio-group>
-    <el-form v-if="current === 'detail'" disabled>
+    <el-form v-show="current === 'detail'" disabled>
       <Base :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
       <Model :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
       <Examine v-if="formData.confirmBy && formData.confirmTime" :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
     </el-form>
-    <template v-else>
-      <OperationRecords :detail-id="detailId" />
-    </template>
+    <OperationRecords v-show="current === 'record'" :detail-id="detailId" />
   </div>
 </template>
 

+ 12 - 9
src/views/commercialEngineering/frock/examine.vue

@@ -1,10 +1,13 @@
 <template>
   <div>
-    <Base :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
-    <Model :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
+    <el-form disabled>
+      <Base :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
+      <Model :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
+    </el-form>
+    <Examine :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
     <div style="margin: 20px 0">
       <el-button type="primary" size="small" @click="onSbumit">提交</el-button>
-      <el-button size="small">返回</el-button>
+      <el-button size="small" @click="handleBack">返回</el-button>
     </div>
   </div>
 </template>
@@ -12,32 +15,32 @@
 <script>
 import Base from '../components/base.vue'
 import Model from '../components/model.vue'
+import Examine from '../components/examine.vue'
 import Mixin from '../mixin'
 import { examineLoginFrock } from '@/api/frock'
 export default {
   components: {
     Base,
-    Model
+    Model,
+    Examine
   },
   mixins: [Mixin],
   methods: {
     onSbumit() {
-      const item = [113.36242, 23.1368425]
       const params = {
         ...this.formData,
-        lat: item[0],
-        lnt: item[1],
-        positionAddress: this.formData.address,
         orderStatus: 'OK'
 
       }
-
       examineLoginFrock(params).then(res => {
         this.commonFn('审核成功')
       })
     },
     commonFn(name) {
       this.$successMsg(name)
+      this.handleBack()
+    },
+    handleBack() {
       this.$emit('updateList')
     }
   }

+ 4 - 4
src/views/commercialEngineering/frock/frockForm.vue

@@ -26,10 +26,10 @@ export default {
       const params = {
         ...this.formData
       }
-      params.positionAddress = this.formData.address
-      const item = [113.36242, 23.1368425]
-      params.lat = item[0]
-      params.lnt = item[1]
+      if (params.fileList.length) {
+        params.drawUpload = params.fileList[0].url
+      }
+
       if (type === 1) {
         submitLoginFrock(params).then(res => {
           this.commonFn('提交成功')

+ 44 - 21
src/views/commercialEngineering/frock/frockList.vue

@@ -66,6 +66,12 @@ export default {
                         this.$message.error('请选择需要更新的数据')
                         return
                       }
+                      for (let index = 0; index < this.recordSelected.length.length; index++) {
+                        if (this.recordSelected[index].orderStatus !== 'OK') {
+                          this.$message.error('请选择审核通过的数据')
+                          return
+                        }
+                      }
                       this.operateType = 'update'
                       this.operateTitle = '更新'
                       this.operateVisible = true
@@ -82,6 +88,12 @@ export default {
                         this.$message.error('请选择需要替换业务员的数据')
                         return
                       }
+                      for (let index = 0; index < this.recordSelected.length.length; index++) {
+                        if (this.recordSelected[index].orderStatus !== 'OK') {
+                          this.$message.error('请选择审核通过的数据')
+                          return
+                        }
+                      }
                       this.operateType = 'replace'
                       this.operateTitle = '替换业务员'
                       this.operateVisible = true
@@ -98,6 +110,12 @@ export default {
                         this.$message.error('请选择需要删除的数据')
                         return
                       }
+                      for (let index = 0; index < this.recordSelected.length.length; index++) {
+                        if (this.recordSelected[index].orderStatus !== 'OK') {
+                          this.$message.error('请选择审核通过的数据')
+                          return
+                        }
+                      }
                       this.operateType = 'delete'
                       this.operateTitle = '删除'
                       this.operateVisible = true
@@ -149,9 +167,10 @@ export default {
     },
     operation() {
       return (h, { row, index, column }) => {
+        console.log(row.orderStatus)
         return (
           <div class='operation-btns'>
-            {this.isTradeExaminer ? (
+            {this.isTradeExaminer && row.orderStatus === 'WAIT' ? (
               <el-button
                 size='mini'
                 type='text'
@@ -177,27 +196,31 @@ export default {
             >
               详情
             </el-button>
-            <el-button
-              size='mini'
-              type='text'
-              onClick={() => {
-                this.content = '编辑'
-                this.module = 'edit'
-                this.detailId = row.id
-                this.visible = true
-              }}
-            >
+            {(row.orderStatus === 'SAVE' || row.orderStatus === 'RETURN')
+              ? <el-button
+                size='mini'
+                type='text'
+                onClick={() => {
+                  this.content = '编辑'
+                  this.module = 'edit'
+                  this.detailId = row.id
+                  this.visible = true
+                }}
+              >
               编辑
-            </el-button>
-            <el-button size='mini' type='text' onClick={() => {
-              this.operateType = 'update'
-              this.operateTitle = '更新'
-              this.recordSelected = [row]
-              this.operateVisible = true
-            }}>
+              </el-button> : null
+            }
+            {row.orderStatus === 'OK'
+              ? <el-button size='mini' type='text' onClick={() => {
+                this.operateType = 'update'
+                this.operateTitle = '更新'
+                this.recordSelected = [row]
+                this.operateVisible = true
+              }}>
               更新
-            </el-button>
-            {!this.isTradeExaminer ? (
+              </el-button> : null
+            }
+            {!this.isTradeExaminer && (row.orderStatus === 'OK' || row.orderStatus === 'FAIL' && !row.isApplyUpdate) ? (
               <el-button
                 size='mini'
                 type='text'
@@ -211,7 +234,7 @@ export default {
                 申请修改
               </el-button>
             ) : null}
-            {this.isTradeExaminer ? (
+            {this.isTradeExaminer && (row.orderStatus === 'OK' || row.orderStatus === 'FAIL' && row.isApplyUpdate) ? (
               <el-button
                 size='mini'
                 type='text'

+ 2 - 4
src/views/commercialEngineering/homeDecoration/detail.vue

@@ -4,14 +4,12 @@
       <el-radio-button class="my-width" label="detail">详情</el-radio-button>
       <el-radio-button class="my-width" label="record">操作记录</el-radio-button>
     </el-radio-group>
-    <el-form v-if="current === 'detail'" disabled>
+    <el-form v-show="current === 'detail'" disabled>
       <Base :form-data="formData" page-type="home" :module="module" :common-data="commonData" />
       <Model :form-data="formData" page-type="home" :module="module" :common-data="commonData" />
       <Examine v-if="formData.confirmBy && formData.confirmTime" :form-data="formData" page-type="home" :module="module" :common-data="commonData" />
     </el-form>
-    <template v-else>
-      <OperationRecords :detail-id="detailId" />
-    </template>
+    <OperationRecords v-show="current === 'record'" :detail-id="detailId" />
   </div>
 </template>
 

+ 24 - 10
src/views/commercialEngineering/homeDecoration/examine.vue

@@ -1,10 +1,13 @@
 <template>
   <div>
-    <Base :form-data="formData" page-type="home" :module="module" :common-data="commonData" />
-    <Model :form-data="formData" page-type="home" :module="module" :common-data="commonData" />
+    <el-form disabled>
+      <Base :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
+      <Model :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
+    </el-form>
+    <Examine :form-data="formData" page-type="frock" :module="module" :common-data="commonData" />
     <div style="margin: 20px 0">
-      <el-button type="primary" size="small" @click="onSbumit(1)">提交</el-button>
-      <el-button size="small">返回</el-button>
+      <el-button type="primary" size="small" @click="onSbumit">提交</el-button>
+      <el-button size="small" @click="handleBack">返回</el-button>
     </div>
   </div>
 </template>
@@ -12,24 +15,32 @@
 <script>
 import Base from '../components/base.vue'
 import Model from '../components/model.vue'
+import Examine from '../components/examine.vue'
+
 import Mixin from '../mixin'
 import { examineLoginFrock } from '@/api/homeDecoration'
 export default {
   components: {
     Base,
-    Model
+    Model,
+    Examine
   },
   mixins: [Mixin],
   methods: {
     onSbumit(type) {
-      const item = [113.36242, 23.1368425]
       const params = {
         ...this.formData,
-        lat: item[0],
-        lnt: item[1],
-        positionAddress: this.formData.address,
         orderStatus: 'OK'
-
+      }
+      if (params.orderType === 'HOME' && params.homeProjectNameRadio) {
+        params.projectName = {
+          'AREA': params.homeProjectNameArea + params.homeProjectNameSeat + params.homeProjectNameNumber,
+          'SELF': params.homeProjectNameArea2,
+          'VILLA': params.homeProjectNameArea3 + params.homeProjectNameNumber3
+        }[params.homeProjectNameRadio]
+      }
+      if (params.fileList.length) {
+        params.drawUpload = params.fileList[0].url
       }
 
       examineLoginFrock(params).then(res => {
@@ -39,6 +50,9 @@ export default {
     commonFn(name) {
       this.$successMsg(name)
       this.$emit('updateList')
+    },
+    handleBack() {
+      this.$emit('updateList')
     }
   }
 }

+ 12 - 7
src/views/commercialEngineering/homeDecoration/homeDecorationForm.vue

@@ -24,14 +24,19 @@ export default {
   methods: {
     onSbumit(type) {
       const params = {
-        ...this.formData
+        ...this.formData,
+        orderType: 'HOME'
+      }
+      if (params.orderType === 'HOME' && params.orderType === 'HOME' && params.homeProjectNameRadio) {
+        params.projectName = {
+          'AREA': params.homeProjectNameArea + params.homeProjectNameSeat + params.homeProjectNameNumber,
+          'SELF': params.homeProjectNameArea2,
+          'VILLA': params.homeProjectNameArea3 + params.homeProjectNameNumber3
+        }[params.homeProjectNameRadio]
+      }
+      if (params.fileList.length) {
+        params.drawUpload = params.fileList[0].url
       }
-      params.projectName = params.homeProjectNameArea + params.homeProjectNameSeat + params.homeProjectNameNumber
-      params.address = params.projectName
-      params.positionAddress = params.address
-      const item = [113.36242, 23.1368425]
-      params.lat = item[0]
-      params.lnt = item[1]
 
       if (type === 1) {
         submitLoginHomeDecoration(params).then(res => {

+ 54 - 23
src/views/commercialEngineering/homeDecoration/homeDecorationList.vue

@@ -14,7 +14,7 @@
     <Popu v-if="visible">
       <el-page-header slot="head" :content="content" @back="handleClose" />
       <HomeDecorationForm
-        v-if="['add', 'edit','apply'].includes(module)"
+        v-if="['add', 'edit', 'apply'].includes(module)"
         :detail-id="detailId"
         :module="module"
         @updateList="handleClose"
@@ -22,7 +22,15 @@
       <Detail v-if="['detail'].includes(module)" :detail-id="detailId" :module="module" @updateList="handleClose" />
       <Examine v-if="['examine'].includes(module)" :detail-id="detailId" :module="module" @updateList="handleClose" />
     </Popu>
-    <Operate v-if="operateVisible" :operate-visible="operateVisible" :operate-type="operateType" :operate-title="operateTitle" :detail-id="detailId" :record-selected="recordSelected" @close="handleClose" />
+    <Operate
+      v-if="operateVisible"
+      :operate-visible="operateVisible"
+      :operate-type="operateType"
+      :operate-title="operateTitle"
+      :detail-id="detailId"
+      :record-selected="recordSelected"
+      @close="handleClose"
+    />
   </template-page>
 </template>
 
@@ -68,6 +76,12 @@ export default {
                         this.$message.error('请选择需要更新的数据')
                         return
                       }
+                      for (let index = 0; index < this.recordSelected.length.length; index++) {
+                        if (this.recordSelected[index].orderStatus !== 'OK') {
+                          this.$message.error('请选择审核通过的数据')
+                          return
+                        }
+                      }
                       this.operateType = 'update'
                       this.operateTitle = '更新'
                       this.operateVisible = true
@@ -84,6 +98,12 @@ export default {
                         this.$message.error('请选择需要替换业务员的数据')
                         return
                       }
+                      for (let index = 0; index < this.recordSelected.length.length; index++) {
+                        if (this.recordSelected[index].orderStatus !== 'OK') {
+                          this.$message.error('请选择审核通过的数据')
+                          return
+                        }
+                      }
                       this.operateType = 'replace'
                       this.operateTitle = '替换业务员'
                       this.operateVisible = true
@@ -100,6 +120,12 @@ export default {
                         this.$message.error('请选择需要删除的数据')
                         return
                       }
+                      for (let index = 0; index < this.recordSelected.length.length; index++) {
+                        if (this.recordSelected[index].orderStatus !== 'OK') {
+                          this.$message.error('请选择审核通过的数据')
+                          return
+                        }
+                      }
                       this.operateType = 'delete'
                       this.operateTitle = '删除'
                       this.operateVisible = true
@@ -151,9 +177,10 @@ export default {
     },
     operation() {
       return (h, { row, index, column }) => {
+        console.log(row.orderStatus)
         return (
           <div class='operation-btns'>
-            {this.isTradeExaminer ? (
+            {this.isTradeExaminer && row.orderStatus === 'WAIT' ? (
               <el-button
                 size='mini'
                 type='text'
@@ -179,27 +206,31 @@ export default {
             >
               详情
             </el-button>
-            <el-button
-              size='mini'
-              type='text'
-              onClick={() => {
-                this.content = '编辑'
-                this.module = 'edit'
-                this.detailId = row.id
-                this.visible = true
-              }}
-            >
+            {(row.orderStatus === 'SAVE' || row.orderStatus === 'RETURN')
+              ? <el-button
+                size='mini'
+                type='text'
+                onClick={() => {
+                  this.content = '编辑'
+                  this.module = 'edit'
+                  this.detailId = row.id
+                  this.visible = true
+                }}
+              >
               编辑
-            </el-button>
-            <el-button size='mini' type='text' onClick={() => {
-              this.operateType = 'update'
-              this.operateTitle = '更新'
-              this.recordSelected = [row]
-              this.operateVisible = true
-            }}>
+              </el-button> : null
+            }
+            {row.orderStatus === 'OK'
+              ? <el-button size='mini' type='text' onClick={() => {
+                this.operateType = 'update'
+                this.operateTitle = '更新'
+                this.recordSelected = [row]
+                this.operateVisible = true
+              }}>
               更新
-            </el-button>
-            {!this.isTradeExaminer ? (
+              </el-button> : null
+            }
+            {!this.isTradeExaminer && (row.orderStatus === 'OK' || row.orderStatus === 'FAIL' && !row.isApplyUpdate) ? (
               <el-button
                 size='mini'
                 type='text'
@@ -213,7 +244,7 @@ export default {
                 申请修改
               </el-button>
             ) : null}
-            {this.isTradeExaminer ? (
+            {this.isTradeExaminer && (row.orderStatus === 'OK' || row.orderStatus === 'FAIL' && row.isApplyUpdate) ? (
               <el-button
                 size='mini'
                 type='text'

+ 33 - 9
src/views/commercialEngineering/mixin/index.js

@@ -1,9 +1,9 @@
 import { getCommercialEngineeringDetail, getPositionProject } from '@/api/frock'
 import { getDictList, getSalesmanList } from '@/api/common'
 import { getDealerListV2 } from '@/api/basic_data/dealer'
-import {
-  getFirstPartyCustomerManagementList
-} from '@/api/basic_data/partya'
+import { getFirstPartyCustomerManagementList } from '@/api/basic_data/partya'
+import { mapGetters } from 'vuex'
+
 export default {
   props: {
     detailId: {
@@ -28,7 +28,9 @@ export default {
         applyUpdateCompanyName: '',
         applyUpdateName: '',
         areaId: '',
+        area: '',
         cityId: '',
+        city: '',
         commonFollowProject: '',
         confirmBy: '',
         confirmName: '',
@@ -51,6 +53,9 @@ export default {
         followCustomer: '',
         followCustomerMobile: '',
         homeProjectNameArea: '',
+        homeProjectNameArea2: '',
+        homeProjectNameArea3: '',
+        homeProjectNameNumber3: '',
         homeProjectNameNumber: '',
         homeProjectNameRadio: '',
         homeProjectNameSeat: '',
@@ -64,7 +69,7 @@ export default {
         machineType: '',
         note: '',
         orderStatus: '',
-        orderType: '',
+        orderType: 'WORK',
         otherInfo: '',
         partyA: '',
         partyAId: '',
@@ -77,6 +82,7 @@ export default {
         projectName: '',
         projectNo: '',
         provinceId: '',
+        province: '',
         refCustomerId: '',
         remark: '',
         salesCompanyName: '',
@@ -84,6 +90,7 @@ export default {
         serviceName: '',
         status: '',
         streetId: '',
+        street: '',
         submitBy: '',
         submitName: '',
         submitTime: '',
@@ -92,7 +99,8 @@ export default {
         tradeId: '',
         tradeParentId: '',
         type: '',
-        useExtent: ''
+        useExtent: '',
+        fileList: []
       },
       commonData: {
         dict: {
@@ -111,6 +119,9 @@ export default {
       }
     }
   },
+  computed: {
+    ...mapGetters(['isTradeExaminer'])
+  },
   created() {
     this.resetData = {
       ...this.formData
@@ -121,7 +132,10 @@ export default {
     this.getFirstPartyCustomerManagementList()
     if (this.detailId) {
       this.getCommercialEngineeringDetail()
-      this.getPositionProject()
+      // 审核员可查看附近项目
+      if (this.isTradeExaminer) {
+        this.getPositionProject()
+      }
     }
   },
   methods: {
@@ -152,8 +166,7 @@ export default {
       })
     },
     getFirstPartyCustomerManagementList() {
-      getFirstPartyCustomerManagementList({ pageNum: 1,
-        pageSize: -1 }).then(res => {
+      getFirstPartyCustomerManagementList({ pageNum: 1, pageSize: -1 }).then(res => {
         this.commonData.PartyAList = res.data.records.map(k => {
           return {
             label: k.name,
@@ -186,7 +199,18 @@ export default {
     getCommercialEngineeringDetail() {
       getCommercialEngineeringDetail({ id: this.detailId }).then(res => {
         this.formData = {
-          ...res.data
+          ...res.data,
+          fileList: []
+        }
+        if (res.data.drawUpload) {
+          this.formData.fileList = [
+            {
+              name: '图纸文件.xlsx',
+              status: 'success',
+              url: res.data.drawUpload,
+              uid: '111'
+            }
+          ]
         }
       })
     },