From 6fabf169ee373a68196d84907eed9346089af9ee Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期四, 26 三月 2026 09:05:31 +0800
Subject: [PATCH] 1.sop页面优化

---
 src/views/basicSettings/meterPrice.vue |  508 +++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 425 insertions(+), 83 deletions(-)

diff --git a/src/views/basicSettings/meterPrice.vue b/src/views/basicSettings/meterPrice.vue
index 1cbf6d9..757091e 100644
--- a/src/views/basicSettings/meterPrice.vue
+++ b/src/views/basicSettings/meterPrice.vue
@@ -16,62 +16,72 @@
           style="display: flex;"
         >
           <div class="elForm">
-            <el-form-item label="浜у搧鍚嶇О/缂栫爜" style=" display: flex;">
-              <el-select
-                v-model="form.partcode"
-                filterable
-                :popper-append-to-body="false"
-                style="width: 200px"
-                placeholder="璇烽�夋嫨"
+            <el-form-item label="浜у搧缂栫爜" style=" display: flex;">
 
-                @change="partChange"
-              >
-                <!--                @focus="getPartSelect"-->
-                <el-option
-                  v-for="item in partArr"
-                  :key="item.partcode"
-                  :label="item.partname+'/'+item.partcode"
-                  :value="item.partcode"
-                />
-              </el-select>
+              <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" />
+
+              <!--              <el-select-->
+              <!--                v-model="form.partcode"-->
+              <!--                filterable-->
+              <!--                :popper-append-to-body="false"-->
+              <!--                style="width: 200px"-->
+              <!--                placeholder="璇烽�夋嫨"-->
+              <!--                @change="partChange"-->
+              <!--              >-->
+              <!--                <el-option-->
+              <!--                  v-for="item in partArr"-->
+              <!--                  :key="item.partcode"-->
+              <!--                  :label="item.partname+'/'+item.partcode"-->
+              <!--                  :value="item.partcode"-->
+              <!--                />-->
+              <!--              </el-select>-->
+
+            </el-form-item>
+            <el-form-item label="浜у搧鍚嶇О" style=" display: flex;">
+              <el-input v-model="form.partname" placeholder="璇疯緭鍏�" style="width: 200px" />
+            </el-form-item>
+            <el-form-item label="瑙勬牸鍨嬪彿" style=" display: flex;">
+              <el-input v-model="form.partspec" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item
               v-if="mesSetting.route"
               label="宸ヨ壓璺嚎"
               style="display: flex;"
             >
-              <el-select
-                v-model="form.routecode"
-                filterable
-                :disabled="form.partcode===''"
-                :popper-append-to-body="false"
-                style="width: 200px"
-                placeholder="璇烽�夋嫨"
-                @change="routeChange"
-              >
-                <el-option
-                  v-for="item in routeArr"
-                  :key="item.route_code"
-                  :label="item.route_name"
-                  :value="item.route_code"
-                />
-              </el-select>
+              <el-input v-model="form.routename" placeholder="璇疯緭鍏�" style="width: 200px" />
+              <!--              <el-select-->
+              <!--                v-model="form.routecode"-->
+              <!--                filterable-->
+              <!--                :disabled="form.partcode===''"-->
+              <!--                :popper-append-to-body="false"-->
+              <!--                style="width: 200px"-->
+              <!--                placeholder="璇烽�夋嫨"-->
+              <!--                @change="routeChange"-->
+              <!--              >-->
+              <!--                <el-option-->
+              <!--                  v-for="item in routeArr"-->
+              <!--                  :key="item.route_code"-->
+              <!--                  :label="item.route_name"-->
+              <!--                  :value="item.route_code"-->
+              <!--                />-->
+              <!--              </el-select>-->
             </el-form-item>
-            <el-form-item label="鍏宠仈宸ュ簭" style=" display: flex;">
-              <el-select
-                v-model="form.stepcode"
-                :disabled="mesSetting.route?form.routecode==='':form.partcode===''"
-                :popper-append-to-body="false"
-                style="width: 200px"
-                placeholder="璇烽�夋嫨"
-              >
-                <el-option
-                  v-for="item in stepArr"
-                  :key="item.step_code"
-                  :label="item.step_name"
-                  :value="item.step_code"
-                />
-              </el-select>
+            <el-form-item v-show="isExpandForm" label="宸ュ簭鍚嶇О" style=" display: flex;">
+              <el-input v-model="form.stepname" placeholder="璇疯緭鍏�" style="width: 200px" />
+              <!--              <el-select-->
+              <!--                v-model="form.stepcode"-->
+              <!--                :disabled="mesSetting.route?form.routecode==='':form.partcode===''"-->
+              <!--                :popper-append-to-body="false"-->
+              <!--                style="width: 200px"-->
+              <!--                placeholder="璇烽�夋嫨"-->
+              <!--              >-->
+              <!--                <el-option-->
+              <!--                  v-for="item in stepArr"-->
+              <!--                  :key="item.step_code"-->
+              <!--                  :label="item.step_name"-->
+              <!--                  :value="item.step_code"-->
+              <!--                />-->
+              <!--              </el-select>-->
             </el-form-item>
 
             <!--鎸夊伐搴�-->
@@ -109,7 +119,21 @@
         </el-form>
         <div
           class="bodyTopFormExpand"
-        />
+        >
+          <svg-icon
+            v-show="mouseHoverType==='mouseout'"
+            style="cursor: pointer"
+            :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"
+            @mouseenter="mouseHoverType=$event.type"
+          />
+          <svg-icon
+            v-show="mouseHoverType==='mouseenter'"
+            style="cursor: pointer"
+            :icon-class="!isExpandForm?'doubleDown':'doubleUp'"
+            @click="isExpandForm=!isExpandForm"
+            @mouseout="mouseHoverType=$event.type"
+          />
+        </div>
       </div>
 
       <div class="elTableDiv">
@@ -122,10 +146,10 @@
           :key="tableTimeStampArrayKey"
           class="tableFixed"
           :data="tableData"
-          :height="tableHeight"
+          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
           border
           :row-class-name="tableRowClassName"
-          :style="{width: 100+'%',height:tableHeight+'px',}"
+          :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
           highlight-current-row
           :header-cell-style="this.$headerCellStyle"
           :cell-style="this.$cellStyle"
@@ -149,6 +173,7 @@
               <div v-else-if="item.prop==='eqp_value'||item.prop==='stand_value'">
                 {{ row[item.prop] }} 绉�
               </div>
+              <div v-else-if="item.prop==='unprice'">{{ row[item.prop] }}</div>
               <div v-else>{{ row[item.prop] }}</div>
             </template>
           </el-table-column>
@@ -197,34 +222,48 @@
       @closed="handleClose"
       @close="handleClose"
     >
+
       <el-form ref="dialogForm" inline :model="dialogForm" label-width="100px">
         <div style="display: flex;align-items: center">
           <i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" style="margin-top: -20px" />
           <el-form-item prop="partcode" label="浜у搧鍚嶇О/缂栫爜">
-            <el-select
-              v-show="operation==='add'"
-              v-model="dialogForm.partcode"
-              filterable
-              style="width: 220px"
-              placeholder="璇烽�夋嫨"
-              :popper-append-to-body="false"
-              @change="partDialogChange"
-            >
-              <!--              @focus="getPartSelect2"-->
-              <el-option
-                v-for="item in partArr2"
-                :key="item.partcode"
-                :label="item.partname+'/'+item.partcode"
-                :value="item.partcode"
-              />
-            </el-select>
-            <el-input
-              v-show="operation!=='add'"
-              v-model="editPartName"
-              disabled
-              style="width: 220px"
-            />
+            <el-button
+              v-if="operation==='add'"
+              v-waves
+              type="primary"
+              style="width: 200px"
+              icon="el-icon-circle-plus-outline"
+              @click="selectSuitpart"
+            >閫夋嫨鐗╂枡
+            </el-button>
+
+            <!--            <el-select-->
+            <!--              v-show="operation==='add'"-->
+            <!--              v-model="dialogForm.partcode"-->
+            <!--              filterable-->
+            <!--              style="width: 220px"-->
+            <!--              placeholder="璇烽�夋嫨"-->
+            <!--              :popper-append-to-body="false"-->
+            <!--              @change="partDialogChange"-->
+            <!--            >-->
+            <!--              &lt;!&ndash;              @focus="getPartSelect2"&ndash;&gt;-->
+            <!--              <el-option-->
+            <!--                v-for="item in partArr2"-->
+            <!--                :key="item.partcode"-->
+            <!--                :label="item.partname+'/'+item.partcode"-->
+            <!--                :value="item.partcode"-->
+            <!--              />-->
+            <!--            </el-select>-->
+            <!--            <el-input-->
+            <!--              v-show="operation!=='add'"-->
+            <!--              v-model="editPartName"-->
+            <!--              disabled-->
+            <!--              style="width: 220px"-->
+            <!--            />-->
           </el-form-item>
+          <div v-if="dialogForm.partcode.toString().trim().length>0" style="height: 34px;">
+            {{ operation=='add'?"宸查�夋嫨":"" }} {{ dialogForm.partcode }} {{ dialogForm.partname }}
+          </div>
           <el-form-item v-if="mesSetting.route" prop="routecode" label="宸ヨ壓璺嚎">
             <el-select
               v-show="operation==='add'"
@@ -295,6 +334,183 @@
       </span>
     </el-dialog>
 
+    <!--閫夋嫨鐗╂枡-->
+    <el-dialog
+      v-el-drag-dialog
+      :title="dialogForm.suitobject==='P'?'閫夋嫨鐗╂枡':'閫夋嫨鐗╂枡绫诲埆'"
+      :visible.sync="dialogVisibleSuitobject"
+      width="1460px"
+      :close-on-click-modal="false"
+      top="5vh"
+      @closed="handleCloseSuitobject"
+      @close="handleCloseSuitobject"
+    >
+
+      <div style="display: flex">
+        <div style="width: 300px;margin-right: 20px;background:#fff">
+
+          <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;">
+            <div style="display: flex;">
+              <div
+                style="width: 5px;height: 100%;border-radius: 5px;"
+                :style="{background:$store.state.settings.theme}"
+              />
+              <div style="margin-left: 8px;">瀛樿揣妗f</div>
+            </div>
+          </div>
+
+          <el-tree
+            ref="treeLeftRef"
+            style="padding: 10px;overflow: auto;height: 600px;"
+            :data="treeLeft"
+            node-key="code"
+            highlight-current
+            :props="defaultPropsLeft"
+            :default-expand-all="true"
+            :expand-on-click-node="false"
+            @node-click="getTMaterielData"
+          />
+        </div>
+        <div
+          style=" width:calc(100% - 300px);"
+        >
+          <div class="bodyTopFormGroup">
+            <el-form
+              ref="suitobjectForm"
+              :model="suitobjectForm"
+              label-width="80px"
+              inline
+              style="display: flex;"
+            >
+              <div class="elForm">
+                <el-form-item label="瀛樿揣缂栫爜" style=" display: flex;">
+                  <el-input
+                    v-model="suitobjectForm.partcode"
+                    placeholder="璇疯緭鍏�"
+                    :style="{minWidth:'100px',width:150+'px'}"
+                  />
+                </el-form-item>
+                <el-form-item label="瀛樿揣鍚嶇О" style=" display: flex;">
+                  <el-input
+                    v-model="suitobjectForm.partname"
+                    placeholder="璇疯緭鍏�"
+                    :style="{minWidth:'100px',width:150+'px'}"
+                  />
+                </el-form-item>
+                <el-form-item label="瀛樿揣瑙勬牸" style=" display: flex;">
+                  <el-input
+                    v-model="suitobjectForm.partspec"
+                    placeholder="璇疯緭鍏�"
+                    :style="{minWidth:'100px',width:150+'px'}"
+                  />
+                </el-form-item>
+
+              </div>
+              <div class="bodySearchReset">
+                <el-button
+                  v-waves
+                  type="primary"
+                  icon="el-icon-search"
+                  @click="getTMaterielData($refs.treeLeftRef.getCurrentNode())"
+                >鏌ヨ
+                </el-button>
+                <el-button
+                  v-waves
+                  type="info"
+                  icon="el-icon-refresh"
+                  @click="resetSuitobject"
+                >閲嶇疆
+                </el-button>
+              </div>
+            </el-form>
+          </div>
+
+          <div class="elTableDiv">
+            <el-table
+              ref="tableDataRef3"
+              class="tableFixed"
+              :data="suitobjectTableData"
+              height="520"
+              border
+              row-class-name="custom-row"
+              highlight-current-row
+              :header-cell-style="this.$headerCellStyle"
+              :cell-style="this.$cellStyle"
+              row-key="partcode"
+              @row-click="rowClick2"
+            >
+
+              <el-table-column
+                width="50"
+                fixed
+              >
+                <template slot-scope="{row}">
+                  <el-radio
+                    v-model="dialogForm.partcode"
+                    :label="row.partcode"
+                    style="color: transparent;padding-left: 10px;"
+                  />
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="rowNum"
+                width="70"
+                fixed
+                label="搴忓彿"
+              />
+              <el-table-column
+                prop="partcode"
+                label="瀛樿揣缂栫爜"
+              />
+              <el-table-column
+                prop="partname"
+                label="瀛樿揣鍚嶇О"
+                show-tooltip-when-overflow
+                min-width="200"
+              />
+              <el-table-column
+                prop="partspec"
+                label="瑙勬牸鍨嬪彿"
+              >
+                <template slot-scope="{row}">
+                  {{ row.partspec ? row.partspec : '/' }}
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="idinventoryclassname"
+                label="鎵�灞炵被鍒�"
+              />
+            </el-table>
+          </div>
+
+          <!--鍒嗛〉-->
+          <pagination
+            :total="suitobjectTotal"
+            :page.sync="suitobjectForm.page"
+            :limit.sync="suitobjectForm.rows"
+            align="right"
+            layout="total,prev, pager, next,sizes,jumper"
+            popper-class="select_bottom"
+            @pagination="getTMaterielData($refs.treeLeftRef.getCurrentNode())"
+          />
+
+        </div>
+      </div>
+
+      <span slot="footer" class="dialog-footer">
+        <div class="footerButton">
+          <el-button v-waves @click="dialogVisibleCancelSuitobject">杩� 鍥�</el-button>
+          <el-button
+            v-waves
+            :loading="$store.state.app.buttonIsDisabled"
+            :disabled="$store.state.app.buttonIsDisabled"
+            type="primary"
+            @click="dialogVisibleConfirmSuitobject"
+          >纭� 璁�</el-button>
+        </div>
+      </span>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -309,7 +525,8 @@
 import elDragDialog from '@/directive/el-drag-dialog'
 import waves from '@/directive/waves'
 import TableColumnSettings from '@/components/TableColumnSettings'
-
+import { TMaterielClassTree, TMaterielData } from '@/api/ProductModel'
+import arrayToTree from 'array-to-tree'
 export default {
   name: 'MeterPrice',
   components: {
@@ -318,13 +535,17 @@
   directives: { elDragDialog, waves },
   data() {
     return {
+      mouseHoverType: 'mouseout',
+      isExpandForm: false,
       mesSetting: JSON.parse(localStorage.getItem('mesSetting')),
       mainHeight: 0,
       tableHeight: 0,
       form: {
         partcode: '', // 浜у搧缂栫爜
-        routecode: '', // 宸ヨ壓璺嚎缂栫爜
-        stepcode: '', // 宸ュ簭缂栫爜
+        partname: '',
+        partspec: '',
+        routename: '', // 宸ヨ壓璺嚎缂栫爜
+        stepname: '', // 宸ュ簭缂栫爜
 
         prop: 'partcode', // 鎺掑簭瀛楁
         order: 'desc', // 鎺掑簭瀛楁
@@ -479,7 +700,33 @@
       editPartName: '', // 缂栬緫鏃朵骇鍝佸悕绉�
       editRouteName: '', // 缂栬緫鏃跺伐鑹鸿矾绾垮悕绉�
       editStepName: '', // 缂栬緫鏃跺姞宸ュ伐搴忓悕绉�
-      operation: ''
+      operation: '',
+
+      dialogVisibleSuitobject: false,
+      treeLeft: [
+        {
+          code: '-1',
+          name: '鍏ㄩ儴'
+        }
+      ], // 宸︿晶鏍�
+      treeLeftArr: [],
+      defaultPropsLeft: {
+        children: 'children',
+        label: 'name'
+      },
+
+      suitobjectTableData: [],
+      suitobjectForm: {
+        inventoryclasscode: '',
+        partcode: '',
+        partname: '',
+        partspec: '',
+        page: 1,
+        rows: 20,
+        prop: 'lm_date', // 鎺掑簭瀛楁
+        order: 'desc' // 鎺掑簭瀛楁
+      },
+      suitobjectTotal: 0
 
     }
   },
@@ -501,6 +748,89 @@
     }
   },
   methods: {
+    selectSuitpart() {
+      this.dialogVisibleSuitobject = true
+      this.$nextTick(() => {
+        this.$refs.treeLeftRef.setCurrentKey('-1')
+        this.getTMaterielData(this.$refs.treeLeftRef.getCurrentNode())
+      })
+    },
+    handleCloseSuitobject() {
+      this.suitobjectForm = {
+        inventoryclasscode: '',
+        partcode: '',
+        partname: '',
+        partspec: '',
+        page: 1,
+        rows: 20,
+        prop: 'lm_date', // 鎺掑簭瀛楁
+        order: 'desc' // 鎺掑簭瀛楁
+      }
+    },
+    dialogVisibleCancelSuitobject() {
+      this.dialogVisibleSuitobject = false
+    },
+
+    async  dialogVisibleConfirmSuitobject() {
+      await this.partDialogChange(this.dialogForm.partcode)
+      this.dialogVisibleSuitobject = false
+    },
+
+    rowClick2(row, event, column) {
+      this.dialogForm.partcode = row.partcode
+      this.dialogForm.partname = this.suitobjectTableData.find(i => i.partcode === row.partcode).partname
+      // this.dialogForm.partspec = this.partcodeArr.find(i => i.partcode === row.partcode).partspec
+    },
+
+    resetSuitobject() {
+      this.suitobjectForm.inventoryclasscode = ''
+      this.suitobjectForm.partcode = ''
+      this.suitobjectForm.partname = ''
+      this.suitobjectForm.partspec = ''
+      this.$refs.treeLeftRef.setCurrentKey('-1')
+      this.getTMaterielData(this.$refs.treeLeftRef.getCurrentNode())
+    },
+    async getTMaterielClassTree() {
+      const res = await TMaterielClassTree()
+      res.data.forEach(i => {
+        i.idparent = i.idparent ? i.idparent : '-1'
+      })
+      this.treeLeftArr = res.data
+      this.treeLeftArr.forEach(e => {
+        e.name = e.code + ' ' + e.name
+      })
+      this.treeLeft = arrayToTree(this.treeLeft.concat(res.data), {
+        parentProperty: 'idparent',
+        customID: 'code',
+        childrenProperty: 'children'
+      })
+    },
+    async getTMaterielData(node) {
+      const result = this.getChildrenCodeMethod(node, [])
+      if (result.includes('-1')) {
+        result.shift()
+      }
+      this.suitobjectForm.inventoryclasscode = result.join(',')
+      const res = await TMaterielData(this.suitobjectForm)
+
+      this.suitobjectTableData = res.data
+      this.suitobjectTotal = res.count
+
+      this.$nextTick(() => {
+        this.$refs.tableDataRef3.doLayout()
+      })
+    },
+    // 閫掑綊鍙栧瓙闆嗙殑鎵�鏈塩ode
+    getChildrenCodeMethod(node, result) {
+      result.push(node.code)
+      if (node.children && node.children.length > 0) {
+        node.children.forEach(i => {
+          this.getChildrenCodeMethod(i, result)
+        })
+      }
+      return result
+    },
+
     tableColumnUpdate(val, isCopyTrue) {
       if (isCopyTrue) {
         this.tableColumnSettingsArray = val
@@ -515,6 +845,7 @@
       this.getBeatRateSearch().then(res => {
         if (res.code === '200') {
           this.getPartSelect()
+          this.getTMaterielClassTree()
         }
       })
     },
@@ -569,8 +900,11 @@
     // 閲嶇疆
     reset() {
       this.form.partcode = ''
-      this.form.routecode = ''
-      this.form.stepcode = ''
+      this.form.partname = ''
+      this.form.partspec = ''
+      this.form.routename = ''
+      this.form.stepname = ''
+
       this.getBeatRateSearch()
     },
     async partDialogChange(val) {
@@ -599,7 +933,7 @@
       this.operation = operation
       this.dialogVisible = true
 
-      this.editPartName = row.partname
+      this.dialogForm.partname = row.partname
       this.editRouteName = row.route_name
       this.editStepName = row.stepname
 
@@ -648,7 +982,7 @@
       this.stepDialogArr = []
 
       this.$refs.dialogForm.clearValidate()
-      this.getBeatRateSearch()
+      // this.getBeatRateSearch()
     },
     // 瀵硅瘽妗嗗彇娑�
     dialogVisibleCancel() {
@@ -694,7 +1028,7 @@
     getHeight() {
       this.$nextTick(() => {
         this.mainHeight = window.innerHeight - 85
-        this.tableHeight = this.mainHeight - 195
+        this.tableHeight = this.mainHeight - 255
         if (window.innerHeight < 769) {
           this.tableHeight = this.tableHeight - 40
         }
@@ -705,6 +1039,14 @@
 }
 </script>
 
+<style lang="scss" scoped>
+.elTableDiv {
+  ::v-deep .el-radio__label {
+    display: none !important;
+  }
+}
+</style>
+
 <style>
 .el-table .custom-row {
   background: #f8f8fa;

--
Gitblit v1.9.3