From c9120bd88aa705d24d81b81cb41022dfdec02c86 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期五, 19 一月 2024 15:40:53 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/northglass-erp/src/views/mm/purchaseOrder/Return.vue |  400 ++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 266 insertions(+), 134 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/mm/purchaseOrder/Return.vue b/north-glass-erp/northglass-erp/src/views/mm/purchaseOrder/Return.vue
index 4420a82..6d8e32e 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/purchaseOrder/Return.vue
+++ b/north-glass-erp/northglass-erp/src/views/mm/purchaseOrder/Return.vue
@@ -42,11 +42,11 @@
 
         <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
         <!--      涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�-->
-        <template #content="{ row}">
+        <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 v-for="(item,index) in gridOptions.columns" v-show="item.field!==undefined ">
+              <span style="font-weight: bold">{{ item.title + ':  ' }}</span>
+              <span>{{ row[item.field] }}</span>
             </li>
           </ul>
         </template>
@@ -70,12 +70,13 @@
 
 
       <!--      璇︽儏妗� 閮ㄥ垎1-->
-      <vxe-modal v-model="showDetails" title="鏌ョ湅璇︽儏" width="600" height="80%" :mask="false" :lock-view="false" resize>
-        <el-container >
+      <vxe-modal v-model="showDetails" title="鏌ョ湅璇︽儏" width="600" height="80%" :mask="false" :lock-view="false"
+                 resize>
+        <el-container>
           <el-header height="35px"
                      style="margin: 0;padding: 0">
 
-            <el-input  v-model="showCGDH" placeholder="閲囪喘鍗曞彿" disabled >
+            <el-input v-model="showCGDH" placeholder="閲囪喘鍗曞彿" disabled>
               <template #prepend>閲囪喘鍗曞彿锛�</template>
             </el-input>
           </el-header>
@@ -119,60 +120,55 @@
 
 
 <script setup>
+
 import {ref} from "vue";
 import {reactive} from "vue";
 import {useRouter} from 'vue-router'
 import {Search} from "@element-plus/icons-vue";
 import dayjs from "dayjs";
-import {VXETable} from "vxe-table";
+import {ElMessage, ElMessageBox} from "element-plus";
+
 
 let router = useRouter()
 const getTableRow = (row, type) => {
   switch (type) {
     case 'edit' : {
       //alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑缂栬緫淇℃伅')
-      router.push({path: '/main/purchaseOrder/CreatePurchaseOrder', query: {id: row.id}})
+      router.push({path: '/main/purchaseOrder/DetailsPurchaseOrder', query: {id: row.id}})
       break
     }
     case 'delete': {
 
 
-
-      alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅'+row.id)
+      alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅' + row.id)
       break
     }
   }
 }
 
 const xGrid = ref()
+
 const gridEvents = {
   toolbarButtonClick({code}) {
     const $grid = xGrid.value
     if ($grid) {
       switch (code) {
-        case 'Add': {//鏂板
-          router.push({path: '/main/purchaseOrder/CreatePurchaseOrder'})
-          break
-        }
-        case 'Sure':{
+        case 'Sure': {
           if ($grid.getCheckboxRecords().length === 0) {
-            openAlert({type: 'message', content: '璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�', status: 'warning'})
-            //VXETable.modal.message( '璇烽�夋嫨涓�鏉℃暟鎹紒')
+
+            MessageShow('璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�!', 'warning');
+
             return
           } else {
-            const type = VXETable.modal.confirm('鎮ㄩ�夋嫨浜�' + $grid.getCheckboxRecords().length + '鏉℃暟鎹紒,鏄惁纭閫�璐э紵');
-            //openAlert({type:'alert', content: '鎴愬姛鍏ュ簱'+$grid.getCheckboxRecords().length+'鏉℃暟鎹紒', status: 'success' })
-            //VXETable.modal.message( '璇烽�夋嫨涓�鏉℃暟鎹紒')
-            return
+
+            MessageConfirmShow('纭畾', '鎮ㄩ�夋嫨浜�' + $grid.getCheckboxRecords().length + '鏉℃暟鎹紒,鏄惁纭閫�璐э紵')
           }
           break
         }
-        case 'Log':{
-
-          openAlert({type: 'alert', content: '鐐瑰嚮浜嗛��璐ц褰�', status: 'success'})
+        case 'Log': {
+          MessageAlertShow('鐐瑰嚮浜嗛��璐ц褰�!', '鎿嶄綔鎻愮ず');
           break
         }
-
       }
     }
   },
@@ -189,44 +185,33 @@
   },
 }
 
-const openAlert = (options) => {
-  if(options.type==='message'){
-    VXETable.modal.message(options)
-  }else{
-    VXETable.modal.alert(options)
-  }
 
-}
-const closeAlert = (id) => {
-  VXETable.modal.close(id)
-}
+//鏌ヨ鎸夐挳鏂规硶
+const BtnSearchPurchaseOrder = () => {
 
-const confirmEvent = async () => {
-  const type = await VXETable.modal.confirm('鎮ㄧ‘瀹氳鍒犻櫎鍚楋紵')
-  VXETable.modal.message({ content: `鐐瑰嚮浜� ${type}` })
-}
+  //寮�濮嬫椂闂达紝缁撴潫鏃堕棿鑾峰彇
+  //MessageShow("寮�濮嬫椂闂�"+datevalue._rawValue[0]+"\r\n缁撴潫鏃堕棿\r\n"+datevalue._rawValue[1]);
 
-const BtnSearchPurchaseOrder =()=>{
   for (let i = 1; i < 6; i++) {
     const randomInt = Math.floor(Math.random() * 999) + 1000;//4浣嶆暟闅忔満鏁�
     const randomSumInt = Math.floor(Math.random() * 99) + 10;//2浣嶆暟闅忔満鏁�
     const randomOrderInt = Math.floor(Math.random() * 99) + 100;//3浣嶆暟闅忔満鏁�
     const t = i % 2 === 0 ? 5 : 6;
-    const s = i % 2 === 0 ?  '鍏ュ簱' :i % 3 === 0?'閫�璐�':'閮ㄥ垎鍏ュ簱';
-    const thdh = i % 2 === 0 ?  '' :i % 3 === 0?'THID'+randomOrderInt:'';
+    const s = i % 2 === 0 ? '鍏ュ簱' : i % 3 === 0 ? '閫�璐�' : '閮ㄥ垎鍏ュ簱';
+    const thdh = i % 2 === 0 ? '' : i % 3 === 0 ? 'THID' + randomOrderInt : '';
     const CGNo = 'NGCG231200' + randomOrderInt;//閲囪喘缂栧彿
     const wlNo = 'NGWL1000' + randomInt;
     const xh = 'NGXH' + randomSumInt;
     const wlmc = 'WLMC' + randomInt;
     const gys = '渚涘簲鍟�' + randomSumInt;
-    const xhdh='NG231200'+randomOrderInt;
+    const xhdh = 'NG231200' + randomOrderInt;
     const w = i % 2 === 0 ? '3300' : i % 3 === 0 ? '3660' : i % 4 === 0 ? '2250' : '2580';
     const h = i % 2 === 0 ? '2440' : i % 3 === 0 ? '2440' : i % 4 === 0 ? '2000' : '2300';
     const dw = i % 2 === 0 ? '鐗�' : i % 3 === 0 ? '骞崇背' : i % 4 === 0 ? '鍖�' : '鍚�';
     now.setDate(now.getDate() + 1);
     gridOptions.data.push({
       cgdh: CGNo,
-      thdh:thdh,
+      thdh: thdh,
       h: t,
       xh: xh,
       wlbh: wlNo,
@@ -235,19 +220,18 @@
       w: w,
       g: h,
       dw: dw,
-      cgzt:s,
-      rq:dayjs(now).format('YYYY-MM-DD'),
-      yl:randomSumInt,
-      sl:randomOrderInt,
-      xsdh:xhdh,
-      je:randomInt,
+      cgzt: s,
+      rq: dayjs(now).format('YYYY-MM-DD'),
+      yl: randomSumInt,
+      sl: randomOrderInt,
+      xsdh: xhdh,
+      je: randomInt,
       6: '139xxxxxxxx',
 
     })
   }
 
 }
-
 
 
 //缁勪欢鎺ユ敹鍙傛暟
@@ -280,48 +264,141 @@
     showStatus: true
   },
   columns: [
+    {type: 'expand', title: '', fixed: "left", slots: {content: 'content'}, width: 50},//璇︽儏
     {title: '鎿嶄綔', width: '8%', slots: {default: 'button_slot'}, fixed: "left"},
+    {type: 'checkbox', fixed: "left", title: '', width: 50},
     {type: 'seq', fixed: "left", title: ' ', width: 50},
-    { type: 'checkbox',fixed:"left", title: '', width: 50 },
-    {type: 'expand', title:'璇︽儏', fixed: "left", slots: {content: 'content'}, width: 50},
-    {field: 'thdh', width: '10%', title: '閫�璐у崟鍙�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'cgdh', width: '10%', title: '閲囪喘鍗曞彿', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+
+
+    {
+      field: 'thdh',
+      width: '10%',
+      title: '閫�璐у崟鍙�',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
+    {
+      field: 'cgdh',
+      width: '10%',
+      title: '閲囪喘鍗曞彿',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
     {field: 'cgzt', width: '10%', title: '鐘舵��', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'gys', width: '10%',title: '渚涘簲鍟�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'wlbh', width: '10%',title: '鐗╂枡缂栧彿', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'wlmc', width: '10%', title: '鐗╂枡鍚嶇О', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'w', width: '8%',title: '瀹藉害', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'g', width: '8%',title: '楂樺害', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'h', width: '8%',title: '鍘氬害', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'xh', width: '8%',title: '鍨嬪彿', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'dw', width: '8%',title: '鍗曚綅', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: '6', width: '12%',title: '涓嶅惈绋庡崟浠�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'sl', width: '8%',title: '鏁伴噺', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'sl', width: '12%',title: '宸查噰璐暟閲�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'je', width: '8%',title: '閲戦', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'je', width: '12%',title: '涓嶅惈绋庨噾棰�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: '6', width: '8%',title: '绋庣巼', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'sl', width: '8%',title: '搴撳瓨', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'yl', width: '10%',title: '鍛ㄧ敤閲�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'yl', width: '10%',title: '鏈堢敤閲�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'cgzt', width: '10%',title: '鍗曟嵁鐘舵��', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'xsdh', width: '10%',title: '閿�鍞崟鍙�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: 'rq', width: '10%',title: '鍒跺崟鏃ユ湡', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+    {
+      field: 'gys',
+      width: '10%',
+      title: '渚涘簲鍟�',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
+    {
+      field: 'wlbh',
+      width: '10%',
+      title: '鐗╂枡缂栧彿',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
+    {
+      field: 'wlmc',
+      width: '10%',
+      title: '鐗╂枡鍚嶇О',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
+    {field: 'w', width: '8%', title: '瀹藉害', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+    {field: 'g', width: '8%', title: '楂樺害', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+    {field: 'h', width: '8%', title: '鍘氬害', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+    {field: 'xh', width: '8%', title: '鍨嬪彿', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+    {field: 'dw', width: '8%', title: '鍗曚綅', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+    {
+      field: '6',
+      width: '12%',
+      title: '涓嶅惈绋庡崟浠�',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
+    {field: 'sl', width: '8%', title: '鏁伴噺', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+    {
+      field: 'sl',
+      width: '12%',
+      title: '宸查噰璐暟閲�',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
+    {field: 'je', width: '8%', title: '閲戦', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+    {
+      field: 'je',
+      width: '12%',
+      title: '涓嶅惈绋庨噾棰�',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
+    {field: '6', width: '8%', title: '绋庣巼', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+    {field: 'sl', width: '8%', title: '搴撳瓨', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+    {field: 'yl', width: '10%', title: '鍛ㄧ敤閲�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+    {field: 'yl', width: '10%', title: '鏈堢敤閲�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
+    {
+      field: 'cgzt',
+      width: '10%',
+      title: '鍗曟嵁鐘舵��',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
+    {
+      field: 'xsdh',
+      width: '10%',
+      title: '閿�鍞崟鍙�',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
+    {
+      field: 'rq',
+      width: '10%',
+      title: '鍒跺崟鏃ユ湡',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
     {field: '6', width: '10%', title: '鍒跺崟浜�', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: '6', width: '10%',title: '閲囪喘閮ㄩ棬', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: '6', width: '10%',title: '閲囪喘缁勭粐', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
-    {field: '6', width: '10%',title: '澶囨敞', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true}
+    {
+      field: '6',
+      width: '10%',
+      title: '閲囪喘閮ㄩ棬',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
+    {
+      field: '6',
+      width: '10%',
+      title: '閲囪喘缁勭粐',
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      sortable: true
+    },
+    {field: '6', width: '10%', title: '澶囨敞', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true}
   ],//琛ㄥご鍙傛暟
   toolbarConfig: {
-    buttons: [{type:'text'},{
-        'name': '閫�璐ц褰�',
+    buttons: [{type: 'text'}, {
+      'name': '閫�璐ц褰�',
 
-        'code':'Log'
-      },
+      'code': 'Log'
+    },
       {
         'name': '纭閫�璐�',
-        status:'primary',
-        'code':'Sure'
+        status: 'primary',
+        'code': 'Sure'
       }],
     import: false,
     export: true,
@@ -352,65 +429,52 @@
 
 
 //璇︽儏妗� 閮ㄥ垎2
-const showCGDH =ref();
-const showDetails =ref(false);
-let detailData =[];
+const showCGDH = ref();
+const showDetails = ref(false);
+let detailData = [];
 const cellClickEvent = ({row}) => {
-  detailData = ['cgdh', 'thdh', 'h', 'xh', 'wlbh', 'wlmc', 'gys','w','g','dw','cgzt','rq','yl','sl','xsdh','je','6'].map(field => {
-    return { label: ModelColumnContent(field) , value: row[field] }
+  if (isQueryColumnId === false) {
+    queryColumnId();
+  }
 
+  detailData = list.map(field => {
+    return {label: queryColumnsTitle(field), value: row[field]}
   })
   showDetails.value = true;
   showCGDH.value = row['cgdh'];
 }
 
-const ModelColumnContent = (text) => {
-  switch (text) {
-    case 'cgdh':
-      return "閲囪喘鍗曞彿";
-    case 'thdh':
-      return "閫�璐у崟鍙�";
-    case 'h':
-      return "鍘�";
-    case 'xh':
-      return "鍨嬪彿";
-    case 'wlbh':
-      return "鐗╂枡缂栫爜";
-    case 'wlmc':
-      return "鐗╂枡鍚嶇О";
-    case 'gys':
-      return "渚涘簲鍟�";
-    case 'w':
-      return "瀹�";
-    case 'g':
-      return "楂�";
-    case 'dw':
-      return "鍗曚綅";
-    case 'cgzt':
-      return "閲囪喘鐘舵��";
-    case 'rq':
-      return "鏃ユ湡";
-    case 'yl':
-      return "浣欓噺";
-    case 'sl':
-      return "鏁伴噺";
-    case 'xsdh':
-      return "閿�鍞崟鍙�";
-    case 'je':
-      return "閲戦";
-    case '6':
-      return "鍏朵粬";
+//鑾峰彇琛ㄥ垪
+let list = [];
+let columnIndex = 4;//鍒楁爣澶翠粠绗嚑鍒楀紑濮嬬殑
+let isQueryColumnId = false;
+const queryColumnId = () => {
 
-    default:
-      return text;
-
+  while (columnIndex < gridOptions.columns.length) {
+    list.push(gridOptions.columns[columnIndex].field);
+    columnIndex++;
   }
-
+  isQueryColumnId = true;
+  return list;
 }
 
-const SureReturn=()=>{
+//鑾峰彇琛ㄥ垪鍚�
+function queryColumnsTitle(cn) {
+  let i = 0;
+  while (i < gridOptions.columns.length + 1) {
+    if (gridOptions.columns[i].field === cn) {
+      return gridOptions.columns[i].title;
+    }
+    i++;
+  }
+}
 
-  const type = VXETable.modal.confirm('鏄惁纭閫�璐э紵');
+// 璇︽儏妗嗛儴鍒�2 缁撴潫
+
+const SureReturn = () => {
+
+  MessageConfirmShow('閫�璐�', '鏄惁纭閫�璐э紵')
+
 }
 
 //璇︽儏妗� 閮ㄥ垎2 缁撴潫
@@ -450,12 +514,80 @@
   },
 ]
 
+
+//椤甸潰閫昏緫浠g爜鎵ц
+function logicExecute(type) {
+  const $grid = xGrid.value
+  switch (type) {
+    case '纭畾':
+      //澶氶�夐��璐ч�昏緫浠g爜TODO
+      MessageShow('鎿嶄綔鎴愬姛锛�', 'success');
+      break;
+    case '閫�璐�':
+      //鍗曢��璐ч�昏緫浠g爜TODO
+      MessageShow('鎿嶄綔鎴愬姛锛�', 'success');
+      break;
+    default:
+      MessageShow('鏈煡鎿嶄綔锛�', 'error');
+      break;
+  }
+  return true;
+}
+
+
+//鎻愮ず淇℃伅
+//淇℃伅鍐呭锛屾樉绀烘柟寮忥紝鏄剧ず鏍囬锛岀被鍨�
+const MessageShow = (content, type = 'success') => {
+  ElMessage({
+    message: content,
+    type: type,
+    showClose: true,
+  })
+}
+
+//鎿嶄綔纭绫讳俊鎭細鎿嶄綔绫诲瀷锛屾彁绀哄唴瀹癸紝鎻愮ず鏍囧ご锛屾彁绀虹被鍨�
+const MessageConfirmShow = (czType, content, title = '鎿嶄綔纭鎻愮ず', type = 'warning') => {
+  ElMessageBox.confirm(
+      content,
+      title,
+      {
+        cancelButtonText: '鍙栨秷',
+        confirmButtonText: '纭畾',
+        type: type,
+        center: true,
+      }
+  )
+      //鐐瑰嚮浜嗙‘瀹�
+      .then(() => {
+
+        logicExecute(czType);
+
+        return true;
+      })
+      //鐐瑰嚮浜嗗彇娑�
+      .catch(() => {
+        return false;
+      })
+}
+
+//寮圭獥淇℃伅
+const MessageAlertShow = (content, title, type = 'info') => {
+
+  ElMessageBox.alert(content, title, {
+    // 绂佹鑷姩瀵圭劍
+    //autofocus: false,
+    confirmButtonText: 'OK',
+    /*callback: (action: Action) => {
+      MessageShow(`action: ${action}`,type)
+    },*/
+  })
+}
+
 </script>
 
 
 <style scoped>
-:deep(.v-column-label div span){
+:deep(.v-column-label div span) {
   font-weight: bold;
-  font-align:center;
 }
 </style>
\ No newline at end of file

--
Gitblit v1.8.0