Browse Source

Merge remote-tracking branch 'origin/master' into dev

GouGengquan 4 months ago
parent
commit
074c47d313
1 changed files with 44 additions and 5 deletions
  1. 44 5
      src/views/assets/workbench/eqpt/calculate/importInfo.vue

+ 44 - 5
src/views/assets/workbench/eqpt/calculate/importInfo.vue

@@ -87,6 +87,15 @@
             <Search />
           </el-icon>搜索
         </el-button>
+        <el-tooltip content="开启后当填写询价依据、网址和单价后,将会自动赋值给相同设备名称与型号且为空的数据" placement="top" effect="light">
+          <el-switch
+          v-model="autoSetValueStatus"
+          class="ml-2"
+          inactive-text="自动赋值:"
+          style="margin-left: 10px;--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
+          >
+          </el-switch>
+        </el-tooltip>
       </div>
       <div>
         <vxe-toolbar v-show="activeName === 'all'" ref="toolAllTableRef" custom style="padding: 0px;margin-right: 30px"></vxe-toolbar>
@@ -451,6 +460,7 @@
               <vxe-option label="询价" value="询价"></vxe-option>
               <vxe-option label="物价指数调整法" value="物价指数调整法"></vxe-option>
               <vxe-option label="二手价" value="二手价"></vxe-option>
+              <vxe-option label="其他" value="其他"></vxe-option>
             </vxe-select>
           </template>
         </vxe-column>
@@ -461,12 +471,16 @@
                 <el-option v-for="item in group.eqptPPI" :label="'(' + item.id + ')' + item.ppiName + '年:' + item.ppi" :value="'(' + item.id + ')' + item.ppiName + '年:' + item.ppi" />
               </el-option-group>
             </el-select>
-            <el-input clearable v-if="row.valuationMethod !== '物价指数调整法'" v-model="row.inquiryBasis" placeholder="可粘贴图片(生成图片链接)" @paste.native="(e) => { return imagePaste(e, row, 'inquiryBasis'); }" />
+            <el-input clearable v-if="row.valuationMethod !== '物价指数调整法'" v-model="row.inquiryBasis" placeholder="可粘贴图片(生成图片链接)" @change="autoSetValue(row.equipmentName, row.model, row.inquiryBasis, row.inquiryWeb, row.price)" @paste.native="(e) => { return imagePaste(e, row, 'inquiryBasis'); }" />
+          </template>
+        </vxe-column>
+        <vxe-column field="inquiryWeb" title="询价网址" width="160" :edit-render="{ autoFocus: true }">
+          <template #edit="{ row }">
+            <el-input clearable v-model="row.inquiryWeb" @change="autoSetValue(row.equipmentName, row.model, row.inquiryBasis, row.inquiryWeb, row.price)"/>
           </template>
         </vxe-column>
-        <vxe-column field="inquiryWeb" title="询价网址" width="160" :edit-render="{ name: 'VxeInput', props: { clearable: true } }"></vxe-column>
         <vxe-column field="inquiryLocation" title="询价地点" width="160" :edit-render="{ name: 'VxeInput' }"></vxe-column>
-        <vxe-column field="price" title="询价单价" width="160" :edit-render="{ name: 'VxeNumberInput', props: { controls: false } }">
+        <vxe-column field="price" title="询价单价" width="160" :edit-render="{ autoFocus: true }">
           <template #header>
             <span>询价单价</span>
             <span @click="getEqptTableFilter(eqptPageData, 'price'), autoSaveBatch()">
@@ -478,6 +492,9 @@
               />
             </span>
           </template>
+          <template #edit="{ row }">
+            <el-input clearable v-model="row.price" @change="autoSetValue(row.equipmentName, row.model, row.inquiryBasis, row.inquiryWeb, row.price)" />
+          </template>
         </vxe-column>
         <vxe-column field="quotation" title="报价(含税不含运费不含安装调试费)" width="160">
           <template #default="{ row }">
@@ -1172,6 +1189,8 @@ export default {
       countdownDuration: 60000, // 倒计时时间(10秒)
       //是否全屏显示,默认否
       fullBoolean: false,
+      // 是否开启自动赋值
+      autoSetValueStatus: false
     }
   },
   components: {
@@ -1769,8 +1788,8 @@ export default {
             })
           }
       })
-      if (verify) {
-        let message = '设备序号:的经济年限成新率<15%,请及时补充尚可使用年限'
+      if (!verify) {
+        let message = '经济年限成新率<15%,请及时补充尚可使用年限,设备序号:'
         for (let index = 0; index < sort.length; index++) {
           message += sort[index]
           if (index !== sort.length - 1) {
@@ -2113,10 +2132,30 @@ export default {
               message: res.message,
               type: 'success',
             })
+            this.autoSetValue(row.equipmentName, row.model, res.data, row.inquiryWeb, row.price);
           }
         })
       }
     },
+    // 给设备名称和型号一致的数据自动赋值询价依据、询价网址和询价单价
+    autoSetValue(name, model, inquiryBasis, inquiryWeb, price) {
+      // 判断是否开启了自动赋值
+      if (this.autoSetValueStatus) {
+        if (inquiryBasis && inquiryWeb && price) {
+          if (this.activeName == 'all') {
+            for (const item of this.eqptPageData) {
+              if (item.equipmentName == name && item.model == model) {
+                  if ((!item.inquiryBasis || !item.inquiryBasis === "") && (!item.inquiryWeb || !item.inquiryWeb === "") && (!item.price || !item.price === "")) {
+                    item.inquiryBasis = inquiryBasis;
+                    item.inquiryWeb = inquiryWeb;
+                    item.price = price;
+                  }
+              }
+            }
+          }
+        }
+      }
+    },
     // 指定字段名进行数组去重并统计值数量
     uniqueProperties(data, columnName) {
       const uniqueMap = new Map()