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/report/ProductionSchedule.vue |  499 +++++++++++++++++++++++++++++++++---------------------
 1 files changed, 303 insertions(+), 196 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/report/ProductionSchedule.vue b/north-glass-erp/northglass-erp/src/views/pp/report/ProductionSchedule.vue
index c406346..5b2b085 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/report/ProductionSchedule.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/report/ProductionSchedule.vue
@@ -1,27 +1,254 @@
-<script lang="ts" setup>
-import {reactive, ref} from 'vue'
-import type { TableColumnCtx } from 'element-plus'
+<script setup>
 
-interface User {
-  id: string
-  name: string
-  amount1: string
-  amount2: string
-  amount3: number
+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
+    }
+  }
 }
 
-interface SpanMethodProps {
-  row: User
-  column: TableColumnCtx<User>
-  rowIndex: number
-  columnIndex: number
+//琛ㄥ熬姹傚拰
+const sumNum = (list, field) => {
+  let count = 0
+  list.forEach(item => {
+    count += Number(item[field])
+  })
+  return count.toFixed(2)
 }
 
-const defaultTime = ref<[Date, Date]>([
-  new Date(2000, 1, 1, 0, 0, 0),
-  new Date(2000, 2, 1, 23, 59, 59),
-])
-// do not use same name with ref
+//瀛愮粍浠舵帴鏀跺弬鏁�
+
+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 },
+    {field: '1', width: 100, title: '搴忓彿',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true, },
+    {field: '2',width: 120, title: '妤煎眰缂栧彿', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: '3', width: 100,title: '褰㈢姸', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: '4',width: 120, title: '鎴愬搧鍚嶇О',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
+    {field: '5', width: 90,title: '瀹�', sortable: true,showOverflow:"ellipsis"},
+    {field: '6', width: 90,title: '楂�', sortable: true},
+    {field: '7',width: 90, title: '鏁伴噺', sortable: true},
+    {field: '8',width: 90, title: '鐗囨爣璁�', sortable: true,showOverflow:"ellipsis"},
+    {field: '9', width: 80,title: '鏍囪', sortable: true},
+    {field: '10', width: 120,title: '鍗曠墖鍚嶇О', sortable: true},
+    {field: '11',width: 120, title: '鍒囧壊', sortable: true},
+    {field: '12',width: 120, title: '纾ㄨ竟', sortable: true},
+    {field: '13',width: 120, title: '閽㈠寲', sortable: true},
+    {field: '14',width: 120, title: '鍏ュ簱鏁伴噺', sortable: true},
+    {field: '15',width: 120, title: '鍏ュ簱闈㈢Н', sortable: true},
+    {field: '16',width: 120, title: '鍙戣揣鏁伴噺', sortable: true},
+    {field: '17',width: 120, title: '鍙戣揣闈㈢Н', sortable: true},
+    {field: '17',width: 120, title: '缁撶畻鎬婚潰绉�', sortable: true},
+  ],//琛ㄥご鎸夐挳
+
+  toolbarConfig: {
+    // buttons: [{
+    //
+    // }],
+    import: false,
+    export: true,
+    print: true,
+    zoom: true,
+    custom: true
+  },
+  data:  [
+    {
+      1:'1',
+      2:'J8-B1-BD-BL1-001',
+      3:'鏅舰',
+      4:'10mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+10mm瓒呯櫧骞抽挗+12Ar(缁�)+10mm瓒呯櫧骞抽挗(鍐�)',
+      5:'1114',
+      6:'1445',
+      7:'3',
+      8:'(澶�)',
+      9:'1',
+      10:'10mm瓒呯櫧UD60骞抽挗(澶�)',
+      11:'1',
+      12:'1',
+      13:'1',
+      14:'0',
+      15:'0',
+      16:'0',
+      17:'0',
+      18:'4.11',
+    },
+    {
+      1:'1',
+      2:'J8-B1-BD-BL1-001',
+      3:'鏅舰',
+      4:'10mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+10mm瓒呯櫧骞抽挗+12Ar(缁�)+10mm瓒呯櫧骞抽挗(鍐�)',
+      5:'1114',
+      6:'1445',
+      7:'3',
+      8:'(涓�)',
+      9:'2',
+      10:'10mm瓒呯櫧UD60骞抽挗(澶�)',
+      11:'1',
+      12:'1',
+      13:'1',
+      14:'0',
+      15:'0',
+      16:'0',
+      17:'0',
+      18:'4.11',
+    },
+    {
+      1:'1',
+      2:'J8-B1-BD-BL1-001',
+      3:'鏅舰',
+      4:'10mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+10mm瓒呯櫧骞抽挗+12Ar(缁�)+10mm瓒呯櫧骞抽挗(鍐�)',
+      5:'1114',
+      6:'1445',
+      7:'3',
+      8:'(鍐�)',
+      9:'3',
+      10:'10mm瓒呯櫧UD60骞抽挗(澶�)',
+      11:'1',
+      12:'1',
+      13:'1',
+      14:'0',
+      15:'0',
+      16:'0',
+      17:'0',
+      18:'4.11',
+    },
+    {
+      1:'2',
+      2:'J8-B1-BD-BL1-001',
+      3:'鏅舰',
+      4:'6mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+6mm瓒呯櫧骞抽挗+12Ar(缁�)+6mm瓒呯櫧骞抽挗(鍐�)',
+      5:'1114',
+      6:'1445',
+      7:'3',
+      8:'(澶�)',
+      9:'1',
+      10:'6mm瓒呯櫧UD60骞抽挗(澶�)',
+      11:'1',
+      12:'1',
+      13:'1',
+      14:'0',
+      15:'0',
+      16:'0',
+      17:'0',
+      18:'4.11',
+    },
+    {
+      1:'2',
+      2:'J8-B1-BD-BL1-001',
+      3:'鏅舰',
+      4:'6mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+6mm瓒呯櫧骞抽挗+12Ar(缁�)+6mm瓒呯櫧骞抽挗(鍐�)',
+      5:'1114',
+      6:'1445',
+      7:'3',
+      8:'(涓�)',
+      9:'2',
+      10:'6mm瓒呯櫧UD60骞抽挗(澶�)',
+      11:'1',
+      12:'1',
+      13:'1',
+      14:'0',
+      15:'0',
+      16:'0',
+      17:'0',
+      18:'4.11',
+    },
+    {
+      1:'2',
+      2:'J8-B1-BD-BL1-001',
+      3:'鏅舰',
+      4:'6mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+6mm瓒呯櫧骞抽挗+12Ar(缁�)+6mm瓒呯櫧骞抽挗(鍐�)',
+      5:'1114',
+      6:'1445',
+      7:'3',
+      8:'(鍐�)',
+      9:'3',
+      10:'6mm瓒呯櫧UD60骞抽挗(澶�)',
+      11:'1',
+      12:'1',
+      13:'1',
+      14:'0',
+      15:'0',
+      16:'0',
+      17:'0',
+      18:'4.11',
+    },
+  ],//table body瀹為檯鏁版嵁
+  //鑴氶儴姹傚拰
+  footerMethod ({ columns, data }) {//椤佃剼鍑芥暟
+    let footList=['7','11','12','13','14','15','16','17','18']
+    return[
+      columns.map((column, columnIndex) => {
+        if (columnIndex === 0) {
+          return '鍚堣:'
+        }
+        if (footList.includes(column.field)) {
+          return sumNum(data, column.field)
+        }
+        return ''
+      })
+    ]
+  }
+
+})
+
+const value = ref('')
+const options = [
+  {
+    value: 'Option1',
+    label: 'Option1',
+  },
+  {
+    value: 'Option2',
+    label: 'Option2',
+  },
+  {
+    value: 'Option3',
+    label: 'Option3',
+  },
+]
+
 const form = reactive({
   name: '',
   region: '',
@@ -31,159 +258,30 @@
   type: [],
   resource: '',
   desc: '',
+
 })
 
+const mergeCells = ref([
+  { row: 0, col: 2, rowspan: 3, colspan: 0},
+  { row: 3, col: 2, rowspan: 3, colspan: 0},
 
-const objectSpanMethod = ({
-                            row,
-                            column,
-                            rowIndex,
-                            columnIndex,
-                          }: SpanMethodProps) => {
-  if (columnIndex === 0 ||columnIndex === 1||columnIndex === 2||columnIndex === 3||columnIndex === 6) {
-    console.log(rowIndex)
-    if (rowIndex % 3 === 0) {
-      return {
-        rowspan: 3,
-        colspan: 1,
-        column:1
-      }
-    } else {
-      return {
-        rowspan: 0,
-        colspan: 0,
-        column:1
-      }
-    }
-  }
+  { row: 0, col: 3, rowspan: 3, colspan: 0},
+  { row: 3, col: 3, rowspan: 3, colspan: 0},
 
-}
-const tableData = [
-  {
-    1:'1',
-    2:'J8-B1-BD-BL1-001',
-    3:'鏅舰',
-    4:'10mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+10mm瓒呯櫧骞抽挗+12Ar(缁�)+10mm瓒呯櫧骞抽挗(鍐�)',
-    5:'1114',
-    6:'1445',
-    7:'3',
-    8:'(澶�)',
-    9:'1',
-    10:'10mm瓒呯櫧UD60骞抽挗(澶�)',
-    11:'1',
-    12:'1',
-    13:'1',
-    14:'0',
-    15:'0',
-    16:'0',
-    17:'0',
-    18:'4.11',
-  },
-  {
-    1:'1',
-    2:'J8-B1-BD-BL1-001',
-    3:'鏅舰',
-    4:'10mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+10mm瓒呯櫧骞抽挗+12Ar(缁�)+10mm瓒呯櫧骞抽挗(鍐�)',
-    5:'1114',
-    6:'1445',
-    7:'3',
-    8:'(涓�)',
-    9:'2',
-    10:'10mm瓒呯櫧UD60骞抽挗(澶�)',
-    11:'1',
-    12:'1',
-    13:'1',
-    14:'0',
-    15:'0',
-    16:'0',
-    17:'0',
-    18:'4.11',
-  },
-  {
-    1:'1',
-    2:'J8-B1-BD-BL1-001',
-    3:'鏅舰',
-    4:'10mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+10mm瓒呯櫧骞抽挗+12Ar(缁�)+10mm瓒呯櫧骞抽挗(鍐�)',
-    5:'1114',
-    6:'1445',
-    7:'3',
-    8:'(鍐�)',
-    9:'3',
-    10:'10mm瓒呯櫧UD60骞抽挗(澶�)',
-    11:'1',
-    12:'1',
-    13:'1',
-    14:'0',
-    15:'0',
-    16:'0',
-    17:'0',
-    18:'4.11',
-  },
-  {
-    1:'2',
-    2:'J8-B1-BD-BL1-001',
-    3:'鏅舰',
-    4:'6mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+6mm瓒呯櫧骞抽挗+12Ar(缁�)+6mm瓒呯櫧骞抽挗(鍐�)',
-    5:'1114',
-    6:'1445',
-    7:'3',
-    8:'(澶�)',
-    9:'1',
-    10:'6mm瓒呯櫧UD60骞抽挗(澶�)',
-    11:'1',
-    12:'1',
-    13:'1',
-    14:'0',
-    15:'0',
-    16:'0',
-    17:'0',
-    18:'4.11',
-  },
-  {
-    1:'2',
-    2:'J8-B1-BD-BL1-001',
-    3:'鏅舰',
-    4:'6mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+6mm瓒呯櫧骞抽挗+12Ar(缁�)+6mm瓒呯櫧骞抽挗(鍐�)',
-    5:'1114',
-    6:'1445',
-    7:'3',
-    8:'(涓�)',
-    9:'2',
-    10:'6mm瓒呯櫧UD60骞抽挗(澶�)',
-    11:'1',
-    12:'1',
-    13:'1',
-    14:'0',
-    15:'0',
-    16:'0',
-    17:'0',
-    18:'4.11',
-  },
-  {
-    1:'2',
-    2:'J8-B1-BD-BL1-001',
-    3:'鏅舰',
-    4:'6mm瓒呯櫧UD60骞抽挗(澶�)+12Ar(缁�)+6mm瓒呯櫧骞抽挗+12Ar(缁�)+6mm瓒呯櫧骞抽挗(鍐�)',
-    5:'1114',
-    6:'1445',
-    7:'3',
-    8:'(鍐�)',
-    9:'3',
-    10:'6mm瓒呯櫧UD60骞抽挗(澶�)',
-    11:'1',
-    12:'1',
-    13:'1',
-    14:'0',
-    15:'0',
-    16:'0',
-    17:'0',
-    18:'4.11',
-  },
-]
+  { row: 0, col: 4, rowspan: 3, colspan: 0},
+  { row: 3, col: 4, rowspan: 3, colspan: 0},
+
+  { row: 0, col: 5, rowspan: 3, colspan: 0},
+  { row: 3, col: 5, rowspan: 3, colspan: 0},
+
+  { row: 0, col: 8, rowspan: 3, colspan: 0},
+  { row: 3, col: 8, rowspan: 3, colspan: 0},
+])
+
 </script>
-<!--鐢熶骇鍙戣揣杩涘害-->
+
 <template>
-  <div class="div-main">
+  <div class="main-div-customer">
     <div id="selectForm">
       <el-row :gutter="0">
         <el-input placeholder="閿�鍞崟鍙�" v-model="form.name" style="width: 150px"/>
@@ -192,44 +290,53 @@
       </el-row>
 
     </div>
-    <div>
-      <el-table
-          :data="tableData"
-          :span-method="objectSpanMethod"
-          border
-          style="width: 100%; margin-top: 20px"
-      >
-        <el-table-column prop="1" label="搴忓彿" />
-        <el-table-column prop="2" label="妤煎眰缂栧彿" width="120px" :show-overflow-tooltip='true'/>
-        <el-table-column prop="3" label="褰㈢姸" :show-overflow-tooltip='true' />
-        <el-table-column prop="4" label="鎴愬搧鍚嶇О" width="120px" :show-overflow-tooltip='true'/>
-        <el-table-column prop="5" label="瀹�" />
-        <el-table-column prop="6" label="楂�" />
-        <el-table-column prop="7" label="鏁伴噺"/>
-        <el-table-column prop="8" label="鐗囨爣璁�"/>
-        <el-table-column prop="9" label="鏍囪" :show-overflow-tooltip='true' />
-        <el-table-column prop="10" label="鍗曠墖鍚嶇О" width="120px"  :show-overflow-tooltip='true'/>
-        <el-table-column prop="11" label="鍒囧壊"  width="120px" />
-        <el-table-column prop="12" label="纾ㄨ竟" :show-overflow-tooltip='true' width="150px" />
-        <el-table-column prop="13" label="閽㈠寲"  />
-        <el-table-column prop="14" label="鍏ュ簱鏁伴噺"  />
-        <el-table-column prop="15" label="鍏ュ簱闈㈢Н"  />
-        <el-table-column prop="16" label="鍙戣揣鏁伴噺"  />
-        <el-table-column prop="17" label="鍙戣揣闈㈢Н"  />
-        <el-table-column prop="18" label="缁撶畻鎬婚潰绉�"  />
-      </el-table>
-    </div>
+    <vxe-grid
+        max-height="100%"
+        @filter-change="filterChanged"
+        class="mytable-scrollbar"
+        ref="xGrid"
+        v-bind="gridOptions"
+        :merge-cells="mergeCells"
 
+    >
+      <!--      @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>
+
+
+    </vxe-grid>
   </div>
 </template>
 
 <style scoped>
-.div-main{
-  width: 100%;
+.main-div-customer{
+  width: 99%;
   height: 100%;
 }
 #selectForm {
-  width: 70%;
+  width: 60%;
   text-align: center;
 }
 </style>
\ No newline at end of file

--
Gitblit v1.8.0