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/BOM/SelectBOM.vue |  253 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 198 insertions(+), 55 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/BOM/SelectBOM.vue b/north-glass-erp/northglass-erp/src/views/pp/BOM/SelectBOM.vue
index b043431..b78a75d 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/BOM/SelectBOM.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/BOM/SelectBOM.vue
@@ -1,9 +1,25 @@
-<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
+<script setup>
+
+import {reactive} from "vue";
+import {useRouter} from  'vue-router'
+let router=useRouter()
+const getTableRow = (row,type) =>{
+  switch (type) {
+    case 'edit' :{
+      //alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑缂栬緫淇℃伅')
+      router.push({path: '/main/BOM/StandardBOMDetail', query: { id: row.id }})
+      break
+    }
+    case 'delete':{
+      alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅')
+      break
+    }
+    case  'setType':{
+      alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍙嶅鐘舵��')
+      break
+    }
+  }
+}
 const form = reactive({
   name: '',
   region: '',
@@ -14,36 +30,150 @@
   resource: '',
   desc: '',
 })
-const defaultTime = ref<[Date, Date]>([
-  new Date(2000, 1, 1, 0, 0, 0),
-  new Date(2000, 2, 1, 23, 59, 59),
-])
-let listName = $ref([
-  '鍩哄噯BOM','鏍囧噯BOM','瀹℃牳'
-])
-const tableData = [
-  {
-    serialNumber: '1',
-    2: 'D123123',
-    3: 'XXXX鍏徃',
-    4: '06040000022',
-    5:'10mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+10mm瓒呯櫧骞抽挗(鍐�)',
-    6:'1440',
-    7:'3660',
-    8:'30',
-    9:'鏅舰',
-    10:'111',
-    11:'寮犱笁',
-    12:'鏉庡洓',
-    13:'鐜嬩簲',
+//琛ㄥ熬姹傚拰
+const sumNum = (list, field) => {
+  let count = 0
+  list.forEach(item => {
+    count += Number(item[field])
+  })
+  return count.toFixed(2)
+}
 
+//瀛愮粍浠舵帴鏀跺弬鏁�
 
+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
   },
-]
+  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: 80, slots: { default: 'button_slot' },fixed:"left"},
+    { type: 'checkbox',fixed:"left", title: '鍩哄噯BOM', width: 110 },
+    { type: 'checkbox',fixed:"left", title: '鏍囧噯BOM', width: 110 },
+    { type: 'checkbox',fixed:"left", title: '瀹℃牳', width: 80 },
+    {field: 'customerNumber', width: 120, title: '瀹㈡埛缂栧彿',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true, },
+    {field: 'customerName',width: 120, title: '瀹㈡埛鍚嶇О', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'productNumber', width: 130,title: '浜у搧缂栧彿', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'productName',width: 120, title: '浜у搧鍚嶇О',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
+    {field: 'glassLength', width: 100,title: '鐜荤拑闀�', sortable: true,showOverflow:"ellipsis"},
+    {field: 'glassWidth', width: 100,title: '鐜荤拑瀹�', sortable: true},
+    {field: 'thickness',width: 100, title: '鍘氬害', sortable: true},
+    {field: 'shape',width: 120, title: '褰㈢姸', sortable: true,showOverflow:"ellipsis"},
+    {field: 'notes', width: 120,title: '澶囨敞', sortable: true},
+    {field: 'productCreator',width: 120, title: '浜у搧鍒涘缓浜�', sortable: true},
+    {field: 'BOMCreator',width: 120, title: 'BOM鍒涘缓浜�', sortable: true},
+    {field: 'auditor',width: 120, title: '瀹℃牳鍛�', sortable: true}
+  ],//琛ㄥご鎸夐挳
+
+  toolbarConfig: {
+    // buttons: [{
+    //
+    // }],
+    import: false,
+    export: true,
+    print: true,
+    zoom: true,
+    custom: true
+  },
+  data:  [
+    {
+      customerNumber: 'D123123',
+      customerName: 'XXXX鍏徃',
+      productNumber: '06040000022',
+      productName:'10mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+10mm瓒呯櫧骞抽挗(鍐�)',
+      glassLength:'1440',
+      glassWidth:'3660',
+      thickness:'30',
+      shape:'鏅舰',
+      notes:'111',
+      productCreator:'寮犱笁',
+      BOMCreator:'鏉庡洓',
+      auditor:'鐜嬩簲',
+
+
+    },
+    {
+      customerNumber: 'D123123',
+      customerName: 'XXXX鍏徃',
+      productNumber: '06040000022',
+      productName:'10mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+10mm瓒呯櫧骞抽挗(鍐�)',
+      glassLength:'1440',
+      glassWidth:'3660',
+      thickness:'30',
+      shape:'鏅舰',
+      notes:'111',
+      productCreator:'寮犱笁',
+      BOMCreator:'鏉庡洓',
+      auditor:'鐜嬩簲',
+
+
+    },
+    {
+      customerNumber: 'D123123',
+      customerName: 'XXXX鍏徃',
+      productNumber: '06040000022',
+      productName:'10mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+10mm瓒呯櫧骞抽挗(鍐�)',
+      glassLength:'1440',
+      glassWidth:'3660',
+      thickness:'30',
+      shape:'鏅舰',
+      notes:'111',
+      productCreator:'寮犱笁',
+      BOMCreator:'鏉庡洓',
+      auditor:'鐜嬩簲',
+
+
+    },
+  ],//table body瀹為檯鏁版嵁
+  //鑴氶儴姹傚拰
+  footerMethod ({ columns, data }) {//椤佃剼鍑芥暟
+    let footList=['finishedNumber','finishedArea','wornNumber','wornArea']
+    return[
+      columns.map((column, columnIndex) => {
+        if (columnIndex === 0) {
+          return '鍚堣:'
+        }
+        if (footList.includes(column.field)) {
+          return sumNum(data, column.field)
+        }
+        return ''
+      })
+    ]
+  }
+
+})
+
+
+
 </script>
 
 <template>
-  <div>
+  <div class="main-div-customer">
     <div id="selectForm">
       <el-row :gutter="0">
         <el-date-picker
@@ -58,37 +188,50 @@
       </el-row>
 
     </div>
-    <el-table :data="tableData" border style="width: 100%" height="100%">
-      <el-table-column v-for="item in listName" prop="" :label="item" width="85"   >
-        <el-checkbox checked/>
-      </el-table-column>
-      <el-table-column prop="serialNumber" label="鑷簭" width="55" >
-        <template v-slot="scope">
-          <router-link :to="{path:'StandardBOMDetail'}" >{{scope.row.serialNumber}}</router-link>
-        </template>
-      </el-table-column>
-      <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="125" />
-      <el-table-column prop="5" label="浜у搧鍚嶇О" :show-overflow-tooltip='true' width="150" />
-      <el-table-column prop="6" label="鐜荤拑闀�" width="75" />
-      <el-table-column prop="7" label="鐜荤拑瀹�" width="75" />
-      <el-table-column prop="8" label="鍘氬害" width="65" />
-      <el-table-column prop="9" label="褰㈢姸" width="65" />
-      <el-table-column prop="10" label="澶囨敞" :show-overflow-tooltip='true' width="155" />
-      <el-table-column prop="11" label="浜у搧鍒涘缓浜�" width="95" />
-      <el-table-column prop="12" label="BOM鍒涘缓浜�" width="105" />
-      <el-table-column prop="13" label="瀹℃牳鍛�" width="85" />
-    </el-table>
+    <vxe-grid
+        max-height="100%"
+        @filter-change="filterChanged"
+        class="mytable-scrollbar"
+        ref="xGrid"
+        v-bind="gridOptions"
+
+    >
+      <!--      @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>
+
+      <!--宸﹁竟鍥哄畾鏄剧ず鐨勬彃妲�-->
+      <template #button_slot="{ row }">
+        <el-button @click="getTableRow(row,'edit')" 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>
   </div>
 </template>
 
 <style scoped>
+.main-div-customer{
+  width: 99%;
+  height: 100%;
+}
 #selectForm {
   width: 40%;
-  height: 100%;
   text-align: center;
 }
-
-
 </style>
\ No newline at end of file

--
Gitblit v1.8.0