From a660db06773007b1be690e0674829c00a57aeb7b Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 24 十二月 2025 16:21:23 +0800
Subject: [PATCH] 订单首页流程卡新增楼层编号显示

---
 north-glass-erp/northglass-erp/src/views/pp/machine/SelectMachine.vue |  307 ++++++++++++++++++++++++++++----------------------
 1 files changed, 170 insertions(+), 137 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/machine/SelectMachine.vue b/north-glass-erp/northglass-erp/src/views/pp/machine/SelectMachine.vue
index 6aa085e..fe7219d 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/machine/SelectMachine.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/machine/SelectMachine.vue
@@ -1,150 +1,181 @@
-<script lang="ts" setup>
-import {reactive, ref} from 'vue'
-import {Search} from "@element-plus/icons-vue"
-import {useRouter} from "vue-router"
-const router = useRouter()
-// do not use same name with ref
-const value = ref('')
-const options = [
-  {
-    value: 'Option1',
-    label: 'Option1',
-  },
-  {
-    value: 'Option2',
-    label: 'Option2',
-  },
-  {
-    value: 'Option3',
-    label: 'Option3',
-  },
-]
+<script setup>
+import {reactive, ref} from "vue";
+import {useRouter} from  'vue-router'
+import request from "@/utils/request";
+import deepClone from "@/utils/deepClone";
+import {ElDatePicker, ElMessage} from "element-plus";
+import { useI18n } from 'vue-i18n'
+import {changeFilterEvent, filterChanged} from "@/hook"
+import {Search} from "@element-plus/icons-vue";
+//璇█鑾峰彇
+const { t } = useI18n()
+let router=useRouter()
+//瀹氫箟鏁版嵁杩斿洖缁撴灉
+let produceList = ref([])
+
+const getBasicData = ref({
+  id: '',
+  basic_type: '',
+  basic_name: '',
+  d_basic_name: '',
+})
+
+//琛ㄥ熬姹傚拰
+const sumNum = (list, field) => {
+  let count = 0
+  list.forEach(item => {
+    count += Number(item[field])
+  })
+  return count.toFixed(2)
+}
+
+const hasDecimal = (value) => {
+  const regex = /\./; // 瀹氫箟姝e垯琛ㄨ揪寮忥紝鏌ユ壘灏忔暟鐐�
+  return regex.test(value); // 杩斿洖true/false
+}
 
 
+//棣栨鍔犺浇
+request.post(`/maintenance/selectMachine`).then((res) => {
+  if (res.code == 200) {
+    xGrid.value.loadData(res.data.data)
+    gridOptions.loading = false
+  } else {
+    ElMessage.warning(res.msg)
+  }
+})
 
-const tableData = [
-  {
-    1: 'SB2209211',
-    2: '閽㈠寲鐐�(22E)',
-    3: '閽㈠寲鐐�(22E)',
-    4: '2022-03-16',
-    5:'2022-03-16',
-    6:'313',
-    7:'浣跨敤涓�',
-    8:'0',
-    9:'0',
-    10:'',
-    11:'',
-    12:'',
-    13:'',
-    14:'閽㈠寲',
-    15:'姝e父',
 
+//瀛愮粍浠舵帴鏀跺弬鏁�
+const xGrid = ref()
+const gridOptions = reactive({
+  border:  "full",//琛ㄦ牸鍔犺竟妗�
+  keepSource: true,//淇濇寔婧愭暟鎹�
+  align: 'center',//鏂囧瓧灞呬腑
+  stripe:true,//鏂戦┈绾�
+  rowConfig: {isCurrent: true, isHover: true,height: 30},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
+  id: 'CustomerList',
+  showFooter: true,//鏄剧ず鑴�
+  printConfig: {},
+  importConfig: {},
+  exportConfig: {},
+  scrollY:{ enabled: true },//寮�鍚櫄鎷熸粴鍔�
+  showOverflow:true,
+  columnConfig: {
+    resizable: true,
+    useKey: true
   },
-  {
-    1: 'SB2209211',
-    2: '閽㈠寲鐐�(22E)',
-    3: '閽㈠寲鐐�(22E)',
-    4: '2022-03-16',
-    5:'2022-03-16',
-    6:'313',
-    7:'浣跨敤涓�',
-    8:'0',
-    9:'0',
-    10:'',
-    11:'',
-    12:'',
-    13:'',
-    14:'閽㈠寲',
-    15:'姝e父',
-
+  filterConfig: {   //绛涢�夐厤缃」
+    // remote: true
   },
-  {
-    1: 'SB2209211',
-    2: '閽㈠寲鐐�(22E)',
-    3: '閽㈠寲鐐�(22E)',
-    4: '2022-03-16',
-    5:'2022-03-16',
-    6:'313',
-    7:'浣跨敤涓�',
-    8:'0',
-    9:'0',
-    10:'',
-    11:'',
-    12:'',
-    13:'',
-    14:'閽㈠寲',
-    15:'姝e父',
-
+  customConfig: {
+    storage: true
   },
-]
+  editConfig: {
+    trigger: 'click',
+    mode: 'row',
+    showStatus: true
+  },//琛ㄥご鍙傛暟
+  columns:[
+    {type:'expand',fixed:"left",slots: { content:'content' },width: 50},
+    { type: 'seq',fixed:"left", title: t('basicData.Number'), width: 50 },
+    {field: 'deviceId', width: 120, title: t('machine.basicId'),filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod: filterChanged },
+    {field: 'deviceName', width: 130,title: t('machine.basicName') ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod: filterChanged},
+    {field: 'type',width: 100, title:  t('machine.type'),filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod: filterChanged },
+    {field: 'faultCount',width: 120, title: t('machine.faultCount') ,showOverflow:"ellipsis"},
+    {field: 'maintenanceCount', width: 120,title: t('machine.maintenanceCount'), },
+    {field: 'faultLastTime',width: 120, title: t('machine.faultLastTime'), },
+    {field: 'maintenanceLastTime',width: 120, title: t('machine.maintenanceLastTime'), },
+    {field: 'faultCost',width: 120, title: t('machine.faultCost'), },
+    {field: 'maintenanceCost',width: 120, title: t('machine.maintenanceCost'), },
+    {field: 'process',width: 120, title: t('machine.basicCategory'),filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod: filterChanged }
+  ],
+  //琛ㄥご鎸夐挳
+  toolbarConfig: {
+    // buttons: [{
+    //
+    // }],
+    import: false,
+    export: true,
+    print: true,
+    zoom: true,
+    custom: true
+  },
+  data:  [
+  ],//table body瀹為檯鏁版嵁
+  //鑴氶儴姹傚拰
+  footerMethod ({ columns, data }) {//椤佃剼鍑芥暟
+    let footList=['','','','']
+    return[
+      columns.map((column, columnIndex) => {
+        if (columnIndex === 0) {
+          return t('basicData.total')
+        }
+        if (footList.includes(column.field)) {
+          return sumNum(data, column.field)
+        }
+        return ''
+      })
+    ]
+  }
+
+})
+
 const size = ref<'default' | 'large' | 'small'>('default')
 
 const value1 = ref('')
 const dialogFormVisible = ref(false)
 const formLabelWidth = '140px'
 
-const form = reactive({
-  name: '',
-  region: '',
-  date1: '',
-  date2: '',
-  delivery: false,
-  type: [],
-  resource: '',
-  desc: '',
-})
+
+
 </script>
 
 <template>
-  <div>
-<!--    <div id="selectForm">-->
-<!--      <el-row :gutter="0">-->
-<!--        <el-select v-model="value" class="m-2" placeholder="鎵�鍦ㄥ伐鑹�">-->
-<!--          <el-option-->
-<!--              v-for="item in options"-->
-<!--              :key="item.value"-->
-<!--              :label="item.label"-->
-<!--              :value="item.value"-->
-<!--          />-->
-<!--        </el-select>-->
-<!--        &nbsp;&nbsp;-->
-<!--        <el-button type="primary">鏌ヨ</el-button>-->
-<!--      </el-row>-->
+  <div  style="width: 100%;height: 100%">
+    <div class="main-table">
+      <vxe-grid
+          height="100%"
+          class="mytable-scrollbar"
+          ref="xGrid"
+          v-bind="gridOptions"
 
-<!--    </div>-->
-    <el-table :data="tableData" border style="width: 100%" height="100%">
-      <el-table-column fixed label="鎿嶄綔" width="100"  >
-        <el-button link type="primary" size="small" @click="dialogFormVisible = true">缂栬緫</el-button>
-        <el-button link type="primary" size="small">鍒犻櫎</el-button>
+      >
+        <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
+        <!--      涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�-->
+        <template #content="{ row}">
+          <ul class="expand-wrapper">
+            <li  v-for="(item,key,index) in row">
+              <span style="font-weight: bold">{{key+':  '}}</span>
+              <span>{{ item }}</span>
+            </li>
+          </ul>
+        </template>
 
-      </el-table-column>
-      <el-table-column prop="1" label="璁惧缂栧彿" width="95" />
-      <el-table-column prop="2" label="鏍囧噯鍚嶇О" width="105" />
-      <el-table-column prop="3" label="璁惧鍚嶇О" width="105" />
-      <el-table-column prop="4" label="璐拱鏃堕棿" :show-overflow-tooltip='true' width="115" />
-      <el-table-column prop="5" label="瀹夎鏃堕棿" :show-overflow-tooltip='true' width="115" />
-      <el-table-column prop="6" label="浣跨敤鍛ㄦ湡(骞�)" width="105" />
-      <el-table-column prop="7" label="浣跨敤鐘舵��" width="85" />
-      <el-table-column prop="8" label="缁翠慨娆℃暟" width="85" />
-      <el-table-column prop="9" label="淇濆吇娆℃暟" width="85" />
-      <el-table-column prop="10" label="鏈�鍚庣淮淇椂闂�" :show-overflow-tooltip='true' width="115" />
-      <el-table-column prop="11" label="鏈�鍚庝繚鍏绘椂闂�" width="115" />
-      <el-table-column prop="12" label="缁翠慨璐圭敤" width="105" />
-      <el-table-column prop="13" label="淇濆吇璐圭敤" width="85" />
-      <el-table-column prop="14" label="鎵�鍦ㄥ伐鑹�" width="85" />
-      <el-table-column prop="15" label="浣滃簾鐘舵��" width="85" />
-    </el-table><!-- <h1>{{msg}}</h1> -->
 
-    <el-dialog v-model="dialogFormVisible" title="璁惧缂栬緫">
+        <template #num1_filter="{ column, $panel }">
+          <div>
+            <div v-for="(option, index) in column.filters" :key="index">
+              <input type="text" v-model="option.data"
+                     @keyup.enter.native="$panel.confirmFilter()"
+                     @input="changeFilterEvent($event, option, $panel)"/>
+            </div>
+          </div>
+        </template>
+
+
+      </vxe-grid>
+    </div>
+
+    <el-dialog v-model="dialogFormVisible" :title="$t('machine.deviceEditing')">
       <el-form :model="form">
-        <el-form-item label="鏍囧噯鍚嶇О" :label-width="formLabelWidth">
+        <el-form-item :label="$t('machine.standardName')" :label-width="formLabelWidth">
           <el-input v-model="form.name"  autocomplete="off"  style="width: 220px"/>
         </el-form-item>
-        <el-form-item label="璁惧鍚嶇О" :label-width="formLabelWidth">
+        <el-form-item :label="$t('machine.basicName')" :label-width="formLabelWidth">
           <el-input v-model="form.name"  autocomplete="off"  style="width: 220px"/>
         </el-form-item>
-        <el-form-item label="璐拱鏃堕棿" :label-width="formLabelWidth">
+        <el-form-item :label="$t('machine.purchaseTime')" :label-width="formLabelWidth">
           <el-date-picker
               v-model="value1"
               type="date"
@@ -152,7 +183,7 @@
               :size="size"
           />
         </el-form-item>
-        <el-form-item label="瀹夎鏃堕棿" :label-width="formLabelWidth">
+        <el-form-item :label="$t('machine.installationTime')" :label-width="formLabelWidth">
           <el-date-picker
               v-model="value1"
               type="date"
@@ -160,22 +191,22 @@
               :size="size"
           />
         </el-form-item>
-        <el-form-item label="淇濆吇鍛ㄦ湡" :label-width="formLabelWidth">
+        <el-form-item :label="$t('machine.maintenanceCycle')" :label-width="formLabelWidth">
           <el-input v-model="form.name"  autocomplete="off"  style="width: 220px"/>
         </el-form-item>
-        <el-form-item label="鎵�鍦ㄥ伐鑹�" :label-width="formLabelWidth">
-          <el-select v-model="form.region" placeholder="閽㈠寲" style="width: 220px">
-            <el-option label="鍒囧壊" value="shanghai" />
-            <el-option label="纾ㄨ竟" value="mobian" />
-            <el-option label="閽㈠寲" value="ganghua" />
+        <el-form-item :label="$t('machine.standardName')" :label-width="formLabelWidth">
+          <el-select v-model="form.region" :placeholder="$t('machine.tempering')" style="width: 220px">
+            <el-option :label="$t('machine.cutting')" value="shanghai" />
+            <el-option :label="$t('machine.edgeGrinding')" value="mobian" />
+            <el-option :label="$t('machine.tempering')" value="ganghua" />
           </el-select>
         </el-form-item>
       </el-form>
       <template #footer>
       <span class="dialog-footer">
-        <el-button @click="dialogFormVisible = false">鍙栨秷</el-button>
+        <el-button @click="dialogFormVisible = false">{{$t('basicData.cancelButtonText')}}</el-button>
         <el-button type="primary" @click="dialogFormVisible = false">
-          纭
+          {{$t('basicData.confirmButtonText')}}
         </el-button>
       </span>
       </template>
@@ -184,11 +215,13 @@
 </template>
 
 <style scoped>
-#selectForm {
-  width: 40%;
-  height: 100%;
-  text-align: center;
+.head{
+  width: 100%;
+  height: 35px;
 }
 
-
+.main-table{
+  width: 100%;
+  height: calc(100% - 0px);
+}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0