From 1f6c97aa5f23d09a04152038c7d53ce95721cf50 Mon Sep 17 00:00:00 2001
From: clll <1320612696@qq.com>
Date: 星期五, 22 十二月 2023 16:29:51 +0800
Subject: [PATCH] pp、sd模块界面调整,添加vxetable组件和对应界面跳转

---
 north-glass-erp/northglass-erp/src/views/pp/machine/MaintenanceAndRepair.vue |  252 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 166 insertions(+), 86 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/machine/MaintenanceAndRepair.vue b/north-glass-erp/northglass-erp/src/views/pp/machine/MaintenanceAndRepair.vue
index 8085b0b..cb80956 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/machine/MaintenanceAndRepair.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/machine/MaintenanceAndRepair.vue
@@ -1,62 +1,143 @@
-<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'
+let router=useRouter()
+const getTableRow = (row,type) =>{
+  switch (type) {
+    case 'edit' :{
+      //alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑缂栬緫淇℃伅')
+      router.push({path: '/main/reportingWorks/ReportingWorkDetail', query: { id: row.id }})
+      break
+    }
+    case 'delete':{
+      alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅')
+      break
+    }
+    case  'setType':{
+      alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍙嶅鐘舵��')
+      break
+    }
+  }
+}
 
+//琛ㄥ熬姹傚拰
+const sumNum = (list, field) => {
+  let count = 0
+  list.forEach(item => {
+    count += Number(item[field])
+  })
+  return count.toFixed(2)
+}
 
-const tableData = [
-  {
-    1: '閽㈠寲鐐�(22E)',
-    2: '缁翠慨',
-    3: '2022-03-16',
-    4: '鍧忎簡',
-    5:'',
-    6:'',
-    7:'2022-03-16',
-    8:'2022-03-16',
-    9:'閽㈠寲',
-    10:'SSS',
-    11:'112',
+//瀛愮粍浠舵帴鏀跺弬鏁�
 
+const gridOptions = reactive({
+  border:  "full",//琛ㄦ牸鍔犺竟妗�
+  keepSource: true,//淇濇寔婧愭暟鎹�
+  align: 'center',//鏂囧瓧灞呬腑
+  stripe:true,//鏂戦┈绾�
+  rowConfig: {isCurrent: true, isHover: true,height: 50},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
+  id: 'CustomerList',
+  showFooter: true,//鏄剧ず鑴�
+  printConfig: {},
+  importConfig: {},
+  exportConfig: {},
+  scrollY:{ enabled: true },//寮�鍚櫄鎷熸粴鍔�
+  showOverflow:true,
+  columnConfig: {
+    resizable: true,
+    useKey: true
   },
-  {
-    1: '閽㈠寲鐐�(22E)',
-    2: '淇濆吇',
-    3: '',
-    4: '',
-    5:'2022-03-16',
-    6:'淇濆吇',
-    7:'2022-03-16',
-    8:'2022-03-16',
-    9:'閽㈠寲',
-    10:'SSS',
-    11:'112',
-
+  filterConfig: {   //绛涢�夐厤缃」
+    remote: true
   },
-]
+  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: '鑷簭', width: 50 },
+    {title: '鎿嶄綔', width: 140, slots: { default: 'button_slot' },fixed:"left"},
+    {field: 'deviceName', width: 130,title: '璁惧鍚嶇О', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'types',width: 120, title: '绫诲瀷',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
+    {field: 'faultDate', width: 100,title: '鏁呴殰鏃ユ湡', sortable: true,showOverflow:"ellipsis"},
+    {field: 'failureCause', width: 100,title: '鏁呴殰鍘熷洜', sortable: true},
+    {field: 'maintenanceDate',width: 100, title: '淇濆吇鏃ユ湡', sortable: true},
+    {field: 'maintenanceInstructions',width: 120, title: '淇濆吇璇存槑', sortable: true,showOverflow:"ellipsis"},
+    {field: 'RepairMaintenanceStartTime', width: 160,title: '缁翠慨/淇濆吇寮�濮嬫椂闂�', sortable: true},
+    {field: 'RepairMaintenanceEndTime',width: 160, title: '缁翠慨/淇濆吇缁撴潫鏃堕棿', sortable: true},
+    {field: 'process',width: 120, title: '鎵�鍦ㄥ伐鑹�', sortable: true},
+    {field: 'RepairMaintenancePersonnel',width: 150, title: '缁翠慨/淇濆吇浜哄憳', sortable: true},
+    {field: 'cost',width: 120, title: '璐圭敤', sortable: true},
+  ],//琛ㄥご鎸夐挳
+
+  toolbarConfig: {
+    // buttons: [{
+    //
+    // }],
+    import: false,
+    export: true,
+    print: true,
+    zoom: true,
+    custom: true
+  },
+  data:  [
+    {
+      deviceName: '閽㈠寲鐐�(22E)',
+      types: '缁翠慨',
+      faultDate: '2022-03-16',
+      failureCause: '鍧忎簡',
+      maintenanceDate:'',
+      maintenanceInstructions:'',
+      RepairMaintenanceStartTime:'2022-03-16',
+      RepairMaintenanceEndTime:'2022-03-16',
+      process:'閽㈠寲',
+      RepairMaintenancePersonnel:'SSS',
+      cost:'112',
+    },
+    {
+      deviceName: '閽㈠寲鐐�(22E)',
+      types: '淇濆吇',
+      faultDate: '',
+      failureCause: '',
+      maintenanceDate:'2022-03-16',
+      maintenanceInstructions:'淇濆吇',
+      RepairMaintenanceStartTime:'2022-03-16',
+      RepairMaintenanceEndTime:'2022-03-16',
+      process:'閽㈠寲',
+      RepairMaintenancePersonnel:'SSS',
+      cost:'112',
+    },
+  ],//table body瀹為檯鏁版嵁
+  //鑴氶儴姹傚拰
+  footerMethod ({ columns, data }) {//椤佃剼鍑芥暟
+    let footList=['maintenanceFrequency','MaintenancesFrequency']
+    return[
+      columns.map((column, columnIndex) => {
+        if (columnIndex === 0) {
+          return '鍚堣:'
+        }
+        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 = '130px'
+const formLabelWidth = '140px'
 
 const form = reactive({
   name: '',
@@ -68,44 +149,46 @@
   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 class="main-div-customer">
+    <vxe-grid
+        max-height="100%"
+        @filter-change="filterChanged"
+        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="105" />
-      <el-table-column prop="2" label="绫诲瀷" width="65" />
-      <el-table-column prop="3" label="鏁呴殰鏃ユ湡" :show-overflow-tooltip='true' width="105" />
-      <el-table-column prop="4" label="鏁呴殰鍘熷洜" :show-overflow-tooltip='true' width="135" />
-      <el-table-column prop="5" label="淇濆吇鏃ユ湡" width="125" />
-      <el-table-column prop="6" label="淇濆吇璇存槑" width="125" />
-      <el-table-column prop="7" label="缁翠慨/淇濆吇寮�濮嬫椂闂�" width="155" />
-      <el-table-column prop="8" label="缁翠慨/淇濆吇瀹屾垚鏃堕棿" width="150" />
-      <el-table-column prop="9" label="鎵�鍦ㄥ伐鑹�" width="85" />
-      <el-table-column prop="10" label="缁翠慨/淇濆吇浜哄憳" :show-overflow-tooltip='true' width="125" />
-      <el-table-column prop="11" label="璐圭敤" width="112" />
-    </el-table><!-- <h1>{{msg}}</h1> -->
+      <!--宸﹁竟鍥哄畾鏄剧ず鐨勬彃妲�-->
+      <template #button_slot="{ row }">
+        <el-button @click="dialogFormVisible = true" link type="primary" size="small">缂栬緫</el-button>
+        <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">鍒犻櫎</el-button>
+      </template>
 
+      <template #num1_filter="{ column, $panel }">
+        <div>
+          <div v-for="(option, index) in column.filters" :key="index">
+            <input type="type" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/>
+          </div>
+        </div>
+      </template>
+
+
+    </vxe-grid>
 
     <el-dialog v-model="dialogFormVisible" title="淇濆吇涓庣淮淇紪杈�">
 
@@ -212,11 +295,8 @@
 </template>
 
 <style scoped>
-#selectForm {
-  width: 40%;
+.main-div-customer{
+  width: 99%;
   height: 100%;
-  text-align: center;
 }
-
-
 </style>
\ No newline at end of file

--
Gitblit v1.8.0