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/reportingWorks/SelectReportingWorks.vue |  378 ++++++++++++++++++++++++++++++++---------------------
 1 files changed, 227 insertions(+), 151 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue
index e555543..693dadc 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue
@@ -1,169 +1,245 @@
-<script lang="ts" setup>
-import {reactive, ref} from 'vue'
-import {useRouter} from "vue-router";
+<script setup>
 
-// do not use same name with ref
-const form = reactive({
-  name: '',
-  region: '',
-  date1: '',
-  date2: '',
-  delivery: false,
-  type: [],
-  resource: '',
-  desc: '',
-})
-const value = ref('')
-const defaultTime = ref<[Date, Date]>([
-  new Date(2000, 1, 1, 0, 0, 0),
-  new Date(2000, 2, 1, 23, 59, 59),
-])
-const router = useRouter()
-function goToPage() {
-  router.push('/main/reportingWorks/AddReportingWork')
+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/reportingWorks/AddReportingWork', query: { id: row.id }})
+      break
+    }
+    case 'delete':{
+      alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅')
+      break
+    }
+    case  'setType':{
+      alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍙嶅鐘舵��')
+      break
+    }
+  }
 }
-const tableData = [
-  {
-    reportingWorkNo: 'BG2312080011',
-    reportingWorkTime: '2023-12-08 09:05:58',
-    processCard: 'NG23120801A01',
-    entryName: '淇″悎鏄ュぉ閲�',
-    batch: '鍥涙壒浜�',
-    device:'澶ф捣鍒╁畞',
-    thisProcess: '鍒囧壊',
-    finishedNumber: '13',
-    finishedArea: '44.22',
-    wornNumber: '',
-    wornArea: '',
-    teamName:'鍒囧壊涓�鐝�'
+
+//琛ㄥ熬姹傚拰
+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
   },
-  {
-    reportingWorkNo: 'BG2312080013',
-    reportingWorkTime: '2023-12-08 09:05:58',
-    processCard: 'NG23120801A01',
-    entryName: '淇″悎鏄ュぉ閲�',
-    batch: '涓�鎵逛簩',
-    device:'澶ф捣鍒╁畞',
-    thisProcess: '鍒囧壊',
-    finishedNumber: '13',
-    finishedArea: '44.22',
-    wornNumber: '',
-    wornArea: '',
-    teamName:'鍒囧壊涓�鐝�'
+  filterConfig: {   //绛涢�夐厤缃」
+    remote: true
   },
-  {
-    reportingWorkNo: 'BG2311080025',
-    reportingWorkTime: '2023-12-08 09:05:58',
-    processCard: 'NG23120801A01',
-    entryName: '淇″悎鏄ュぉ閲�',
-    batch: '涓�鎵逛簩',
-    device:'澶ф捣鍒╁畞',
-    thisProcess: '鍒囧壊',
-    finishedNumber: '13',
-    finishedArea: '44.22',
-    wornNumber: '',
-    wornArea: '',
-    teamName:'鍒囧壊涓�鐝�'
+  customConfig: {
+    storage: true
   },
-  {
-    reportingWorkNo: 'BG2303080025',
-    reportingWorkTime: '2023-12-08 09:05:58',
-    processCard: 'NG23120801A01',
-    entryName: '淇″悎鏄ュぉ閲�',
-    batch: '涓�鎵逛簩',
-    device:'澶ф捣鍒╁畞',
-    thisProcess: '鍒囧壊',
-    finishedNumber: '13',
-    finishedArea: '44.22',
-    wornNumber: '',
-    wornArea: '',
-    teamName:'鍒囧壊涓�鐝�'
+  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: 'reportingWorkNo', width: 120, title: '鎶ュ伐缂栧彿',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true, },
+    {field: 'reportingWorkTime',width: 120, title: '鎶ュ伐鏃堕棿', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'processCard', width: 130,title: '娴佺▼鍗″彿', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'entryName',width: 120, title: '椤圭洰鍚嶇О',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
+    {field: 'batch', width: 100,title: '鎵规', sortable: true,showOverflow:"ellipsis"},
+    {field: 'device', width: 100,title: '璁惧', sortable: true},
+    {field: 'thisProcess',width: 100, title: '鏈伐搴�', sortable: true},
+    {field: 'finishedNumber',width: 120, title: '鏈伐搴忓畬宸�', sortable: true,showOverflow:"ellipsis"},
+    {field: 'finishedArea', width: 120,title: '瀹屽伐闈㈢Н', sortable: true},
+    {field: 'wornNumber',width: 120, title: '鏈伐搴忔鐮�', sortable: true},
+    {field: 'wornArea',width: 120, title: '娆$牬闈㈢Н', sortable: true},
+    {field: 'teamName',width: 120, title: '鐝粍鍚嶇О', sortable: true}
+  ],//琛ㄥご鎸夐挳
+
+  toolbarConfig: {
+    // buttons: [{
+    //
+    // }],
+    import: false,
+    export: true,
+    print: true,
+    zoom: true,
+    custom: true
   },
-  {
-    reportingWorkNo: 'BG2312080001',
-    reportingWorkTime: '2023-12-08 09:05:58',
-    processCard: 'NG23120801A01',
-    entryName: '淇″悎鏄ュぉ閲�',
-    batch: '涓�鎵逛簩',
-    device:'澶ф捣鍒╁畞',
-    thisProcess: '鍒囧壊',
-    finishedNumber: '13',
-    finishedArea: '44.22',
-    wornNumber: '',
-    wornArea: '',
-    teamName:'鍒囧壊涓�鐝�'
-  },
-  {
-    reportingWorkNo: 'BG2312080015',
-    reportingWorkTime: '2023-12-08 09:05:58',
-    processCard: 'NG23120801A01',
-    entryName: '淇″悎鏄ュぉ閲�',
-    batch: '涓�鎵逛簩',
-    device:'澶ф捣鍒╁畞',
-    thisProcess: '鍒囧壊',
-    finishedNumber: '13',
-    finishedArea: '44.22',
-    wornNumber: '',
-    wornArea: '',
-    teamName:'鍒囧壊涓�鐝�'
-  },
-]
+  data:  [
+    {
+      reportingWorkNo: 'BG2312080011',
+      reportingWorkTime: '2023-12-08 09:05:58',
+      processCard: 'NG23120801A01',
+      entryName: '淇″悎鏄ュぉ閲�',
+      batch: '鍥涙壒浜�',
+      device:'澶ф捣鍒╁畞',
+      thisProcess: '鍒囧壊',
+      finishedNumber: '13',
+      finishedArea: '44.22',
+      wornNumber: '',
+      wornArea: '',
+      teamName:'鍒囧壊涓�鐝�'
+    },
+    {
+      reportingWorkNo: 'BG2312080013',
+      reportingWorkTime: '2023-12-08 09:05:58',
+      processCard: 'NG23120801A01',
+      entryName: '淇″悎鏄ュぉ閲�',
+      batch: '涓�鎵逛簩',
+      device:'澶ф捣鍒╁畞',
+      thisProcess: '鍒囧壊',
+      finishedNumber: '13',
+      finishedArea: '44.22',
+      wornNumber: '',
+      wornArea: '',
+      teamName:'鍒囧壊涓�鐝�'
+    },
+    {
+      reportingWorkNo: 'BG2311080025',
+      reportingWorkTime: '2023-12-08 09:05:58',
+      processCard: 'NG23120801A01',
+      entryName: '淇″悎鏄ュぉ閲�',
+      batch: '涓�鎵逛簩',
+      device:'澶ф捣鍒╁畞',
+      thisProcess: '鍒囧壊',
+      finishedNumber: '13',
+      finishedArea: '44.22',
+      wornNumber: '',
+      wornArea: '',
+      teamName:'鍒囧壊涓�鐝�'
+    },
+    {
+      reportingWorkNo: 'BG2303080025',
+      reportingWorkTime: '2023-12-08 09:05:58',
+      processCard: 'NG23120801A01',
+      entryName: '淇″悎鏄ュぉ閲�',
+      batch: '涓�鎵逛簩',
+      device:'澶ф捣鍒╁畞',
+      thisProcess: '鍒囧壊',
+      finishedNumber: '13',
+      finishedArea: '44.22',
+      wornNumber: '',
+      wornArea: '',
+      teamName:'鍒囧壊涓�鐝�'
+    },
+    {
+      reportingWorkNo: 'BG2312080001',
+      reportingWorkTime: '2023-12-08 09:05:58',
+      processCard: 'NG23120801A01',
+      entryName: '淇″悎鏄ュぉ閲�',
+      batch: '涓�鎵逛簩',
+      device:'澶ф捣鍒╁畞',
+      thisProcess: '鍒囧壊',
+      finishedNumber: '13',
+      finishedArea: '44.22',
+      wornNumber: '',
+      wornArea: '',
+      teamName:'鍒囧壊涓�鐝�'
+    },
+    {
+      reportingWorkNo: 'BG2312080015',
+      reportingWorkTime: '2023-12-08 09:05:58',
+      processCard: 'NG23120801A01',
+      entryName: '淇″悎鏄ュぉ閲�',
+      batch: '涓�鎵逛簩',
+      device:'澶ф捣鍒╁畞',
+      thisProcess: '鍒囧壊',
+      finishedNumber: '13',
+      finishedArea: '44.22',
+      wornNumber: '',
+      wornArea: '',
+      teamName:'鍒囧壊涓�鐝�'
+    },
+  ],//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 id="selectForm" >
-      <el-row :gutter="0">
-<!--          <el-input placeholder="娴佺▼鍗″彿" v-model="form.name" style="width: 200px"/>-->
+  <div class="main-div-customer">
+    <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>
+        <el-button @click="getTableRow(row,'setType')" 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>
 
 
-<!--        &nbsp;&nbsp;-->
-<!--          <el-input placeholder="椤圭洰鍚嶇О" v-model="form.name" style="width: 200px"/>-->
-
-<!--        &nbsp;&nbsp;-->
-        <el-date-picker
-            v-model="value"
-            type="daterange"
-            start-placeholder="鎶ュ伐寮�濮嬫椂闂�"
-            end-placeholder="缁撴潫鏃堕棿"
-            :default-time="defaultTime"
-        />
-        &nbsp;&nbsp;
-        <el-button type="primary">鏌ヨ</el-button>
-      </el-row>
-
-    </div>
-    <el-table :data="tableData" border style="width: 100%" height="100%">
-      <el-table-column fixed label="鎿嶄綔" width="140"  >
-        <el-button link type="primary" size="small" @click="goToPage">缂栬緫</el-button>
-        <el-button link type="primary" size="small">鍒犻櫎</el-button>
-        <el-button link type="primary" size="small">鍙嶅</el-button>
-      </el-table-column>
-      <el-table-column sortable prop="reportingWorkNo" label="鎶ュ伐缂栧彿" width="120" >
-        <template v-slot="scope">
-          <router-link :to="{path:'ReportingWorkDetail'}" >{{scope.row.reportingWorkNo}}</router-link>
-        </template>
-      </el-table-column>
-      <el-table-column prop="reportingWorkTime" label="鎶ュ伐鏃堕棿" width="155" />
-      <el-table-column prop="processCard" label="娴佺▼鍗″彿" width="135" />
-      <el-table-column prop="entryName" label="椤圭洰鍚嶇О" width="155" />
-      <el-table-column prop="batch" label="鎵规" width="75" />
-      <el-table-column prop="device" label="璁惧" width="100" />
-      <el-table-column prop="thisProcess" label="鏈伐搴�" width="100" />
-      <el-table-column prop="finishedNumber" label="鏈伐搴忓畬宸�" width="100" />
-      <el-table-column prop="finishedArea" label="瀹屽伐闈㈢Н" width="90" />
-      <el-table-column prop="wornNumber" label="鏈伐搴忔鐮�" width="100" />
-      <el-table-column prop="wornArea" label="娆$牬闈㈢Н" width="90" />
-      <el-table-column prop="teamName" label="鐝粍鍚嶇О"  width="150" />
-    </el-table><!-- <h1>{{msg}}</h1> -->
+    </vxe-grid>
   </div>
 </template>
 
 <style scoped>
-#selectForm {
-  width: 45%;
+.main-div-customer{
+  width: 99%;
   height: 100%;
-  text-align: center;
 }
-
 </style>
\ No newline at end of file

--
Gitblit v1.8.0