From d3475019350136c3946afcb3a831a5444e97bc17 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期五, 29 三月 2024 09:59:02 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue |  329 +++++++++++++++++++++++++++++++++---------------------
 1 files changed, 198 insertions(+), 131 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue b/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue
index b7e5868..5fb42f1 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue
+++ b/north-glass-erp/northglass-erp/src/views/mm/mainIngredientStock/MaterialOutbound.vue
@@ -5,25 +5,166 @@
 
 import {reactive, ref} from "vue";
 import {useRouter} from  'vue-router'
-let router=useRouter()
+import request from "@/utils/request";
+import deepClone from "@/utils/deepClone";
+import useUserInfoStore from "@/stores/userInfo";
+import {ElMessage} from "element-plus";
+import {Search} from "@element-plus/icons-vue";
+import { useI18n } from 'vue-i18n'
+import {toolbarButtonClickEvent} from "@/hook/mouseMove";
+
+//璇█鑾峰彇
+const { t } = useI18n()
+
+const router = useRouter()
+let produceList = ref([])
 const getTableRow = (row,type) =>{
   switch (type) {
     case 'edit' :{
-      alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑缂栬緫淇℃伅')
-      router.push({path: '/main/ingredientsStock/CreateOutbound', query: { id: row.id }})
+      router.push({path: '/main/ingredientsStock/CreateOutbound', query: { materialOutboundId: row.materialOutboundId }})
       break
     }
     case 'delete':{
-      alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅')
-      break
+      let flowData = ref({
+        materialOutboundId:row.materialOutboundId
+      })
+      request.post("/MaterialInventory/deleteMaterialOutbound",flowData.value).then((res) => {
+        if(res.code==200){
+          ElMessage.success(t('searchOrder.msgDeleteSuccess'))
+          router.push({path:'/main/ingredientsStock/MaterialOutbound', query:{random:Math.random()}})
+        }else{
+          ElMessage.warning(res.msg)
+          router.push("/login")
+        }
+      })
+
+      return
     }
   }
 }
 
 
+const hasDecimal=(value)=>{
+  const regex=/\./ // 瀹氫箟姝e垯琛ㄨ揪寮忥紝鏌ユ壘灏忔暟鐐�
+  return regex.test(value) //杩斿洖true/false
+}
+
+const hasDecimalhtml=(item,row)=>{
+  let aa=item.split('.').length
+  if (aa===2){
+    return row[item.split('.')[0]][item.split('.')[1]]
+  }else if(aa===3){
+    return row[item.split('.')[0]][item.split('.')[1]][item.split('.')[2]]
+  }
+
+
+}
+
+let pageNum=ref(1)
+let total = reactive({
+  pageTotal : 0,
+  dataTotal : 0,
+  pageSize : 10
+})
+
+let filterData = ref({
+
+})
+
+let selectDate = ref(["",""])
+
+
+request.post(`/MaterialInventory/getSelectMaterialOutboundDate/1/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
+
+  if(res.code==200){
+    console.log(res.data)
+    total.dataTotal = res.data.total.total*1
+    total.pageTotal= res.data.total.pageTotal
+    pageNum.value=1
+    selectDate.value = res.data.selectDate
+    produceList = deepClone(res.data.data)
+    xGrid.value.loadData(produceList)
+    gridOptions.loading=false
+  }else{
+    ElMessage.warning(res.msg)
+    router.push("/login")
+  }
+})
+
+
+
+/*浣跨敤绛涢�夛紝鍚庣鑾峰彇鏁版嵁*/
+const changeFilterEvent = (event, option, $panel,) => {
+  // 鎵嬪姩瑙﹀彂绛涢��
+  $panel.changeOption(event, !!option.data, option)
+}
+function filterChanged(column){
+  gridOptions.loading=true
+  //绛涢�夋潯浠跺彂鐢熷彉鍖栨潯浠跺彂鐢熷彉鍖�
+  let value = column.datas[0]!=undefined?column.datas[0]:''
+  value = value.trim()
+  //鍒ゆ柇鏄惁瀛樺湪澶栭敭
+  if (column.property.indexOf('.')>-1){
+    const  columnArr = column.property.split('.')
+    filterData.value[columnArr[0]] = {
+      [columnArr[1]]:value
+    }
+  }else{
+    filterData.value[column.property] = value
+  }
+  request.post(`/MaterialInventory/getSelectMaterialOutboundDate/1/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
+
+    if(res.code==200){
+      total.dataTotal = res.data.total.total*1
+      total.pageTotal= res.data.total.pageTotal
+
+      selectDate.value = res.data.selectDate
+      pageNum.value=1
+      produceList = deepClone(res.data.data)
+      xGrid.value.loadData(produceList)
+      gridOptions.loading=false
+    }else{
+      ElMessage.warning(res.msg)
+      router.push("/login")
+    }
+  })
+}
+
+
+const selectOrderList = ()=>{
+  request.post(`/MaterialInventory/getSelectMaterialOutboundDate/${pageNum.value}/${total.pageSize}/${selectDate.value}`,filterData.value).then((res) => {
+    if(res.code==200){
+      selectDate.value = res.data.selectDate
+
+      if (res.data.total!=null){
+        total.dataTotal = res.data.total.total*1
+        total.pageTotal= res.data.total.pageTotal
+      }
+      produceList = deepClone(res.data.data)
+      xGrid.value.loadData(produceList)
+      gridOptions.loading=false
+    }else{
+      ElMessage.warning(res.msg)
+      router.push("/login")
+    }
+  })
+}
+
+const changeDate =  ()=>{
+  selectOrderList()
+}
+
+//椤佃剼璺宠浆
+const handlePageChange = ({ currentPage, pageSize }) => {
+  total.pageTotal = pageSize
+  pageNum.value=currentPage
+
+  selectOrderList()
+}
+
 
 //瀛愮粍浠舵帴鏀跺弬鏁�
-
+const  xGrid = ref();
 const gridOptions = reactive({
   border:  "full",//琛ㄦ牸鍔犺竟妗�
   keepSource: true,//淇濇寔婧愭暟鎹�
@@ -53,116 +194,29 @@
     showStatus: true
   },//琛ㄥご鍙傛暟
   columns:[
-    {type:'expand',fixed:"left",slots: { content:'content' },width: '50'},
+    {type:'expand',fixed:"left",slots: { content:'content' },width: '60'},
     {title: '鎿嶄綔', width: '110', slots: { default: 'button_slot' },fixed:"left"},
-    // { type: 'checkbox',fixed:"left", title: '閫夋嫨', width: '80' },
     { type: 'seq',fixed:"left", title: '鑷簭', width: '80' },
-
-    {title: '瀹℃牳', width: 50, slots: { default: 'state' },},
-
-    {field: 'InventoryOrganization', width:'150', title: '搴撳瓨缁勭粐', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } } },
-    {field: 'MaterialCode', width: '150',title: '鐗╂枡缂栫爜', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
-    {field: 'MaterialName', width: '120',title: '鐗╂枡鍚嶇О', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
-    {field: 'InventoryCount',width: '100', title: '搴撳瓨鏁伴噺', sortable: true},
-    {field: 'OutNum', width:'150', title: '鍑哄簱鏁伴噺', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } } },
-    {field: 'Origin', width: '100',title: '浜у湴', sortable: true},
-    {field: 'InventoryNumber',width: '100', title: '搴撳瓨缂栧彿', sortable: true,showOverflow:"ellipsis"},
-    {field: 'Width', width: '80',title: '瀹藉害', sortable: true},
-    {field: 'Height',width: '100', title: '楂樺害', sortable: true},
-    {field: 'Thickness', width: '100',title: '鍘氬害', sortable: true},
-    {field: 'MainUnit',width: '100', title: '涓诲崟浣�', sortable: true},
-    {field: 'SafetyStock', width: '100',title: '瀹夊叏搴撳瓨', sortable: true},
-    {field: 'AvailableInventory', width: '100',title: '鍙敤搴撳瓨', sortable: true},
-    {field: 'UnclaimedQuantity',width: '140', title: '鏈鍙栨暟閲�', sortable: true},
-    {field: 'TotalArea',width: '100', title: '鎬婚潰绉�', sortable: true},
-    {field: 'ProductionDate',width: '100', title: '鐢熶骇鏃ユ湡', sortable: true},
-    {field: 'ShelfLife',width: '100', title: '淇濊川鏈�', sortable: true},
-    {field: 'LocationNumber',width: '100', title: '搴撲綅缂栧彿', sortable: true},
-    {field: 'StorageArea',width: '100', title: '瀛樺偍鍖哄煙', sortable: true},
-    {field: 'Location',width: '100', title: '搴撲綅', sortable: true},
-    {field: 'BacklogInventory',width: '100', title: '绉帇搴撳瓨', sortable: true},
-    {field: 'remark',width: '80', title: '澶囨敞', sortable: true},
+    {field: 'reviewedState',title: '瀹℃牳', width: 50, slots: { default: 'state' },},
+    {field: 'materialOutboundId', width:'150', title: '鍑哄簱鍗曞彿', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'materialRequisitionPersonnel', width: '150',title: '棰嗘枡鍛�', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'materialRequisitionTeam', width: '120',title: '棰嗘枡鐝粍', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'orderId', width:'150', title: '閿�鍞崟鍙�', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'outboundType', width: '100',title: '鍑哄簱绫诲瀷', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'warehouseManager',width: '100', title: '浠撶鍛�', sortable: true,showOverflow:"ellipsis",filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'materialRequisitionDate', width: '80',title: '棰嗘枡鏃ユ湡', sortable: true},
+    {field: 'reviewed',width: '100', title: '瀹℃牳鍛�', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+    {field: 'reviewedTime', width: '100',title: '瀹℃牳鏃堕棿', sortable: true},
+    {field: 'createTime',width: '100', title: '鍒涘缓鏃堕棿', sortable: true},
   ],//琛ㄥご鎸夐挳
   toolbarConfig: {
-    buttons: [{
-      code:'add','name': '鍑哄簱鏂板',status:'primary'
-    }],
-    import: false,
+
+    /*import: false,
     export: true,
-    print: true,
+    print: true,*/
     zoom: true,
     custom: true
   },
-  data:  [
-    {
-      "InventoryOrganization": "浜哄伐搴�",
-      "MaterialCode": "700900000000115",
-      "MaterialName": "鍐170",
-      "Origin": "China",
-      "InventoryNumber": "KC2006891",
-      "Width": '',
-      "Height": "",
-      "Thickness": "",
-      "MainUnit": "浠�",
-      "SafetyStock": "5",
-      "InventoryCount": "20",
-      "AvailableInventory": "9",
-      "UnclaimedQuantity": "2",
-      "TotalArea": "0",
-      "ProductionDate": "2016-10-17",
-      "ShelfLife": "0",
-      "LocationNumber": "0",
-      "StorageArea": "0",
-      "Location": "0",
-      "BacklogInventory": "40",
-      "remark": "娴嬭瘯",
-    },
-    {
-      "InventoryOrganization": "浜哄伐搴�",
-      "MaterialCode": "700900000000115",
-      "MaterialName": "鍐175",
-      "Origin": "China",
-      "InventoryNumber": "KC2006891",
-      "Width": '',
-      "Height": "",
-      "Thickness": "",
-      "MainUnit": "浠�",
-      "SafetyStock": "5",
-      "InventoryCount": "20",
-      "AvailableInventory": "9",
-      "UnclaimedQuantity": "2",
-      "TotalArea": "0",
-      "ProductionDate": "2016-10-17",
-      "ShelfLife": "0",
-      "LocationNumber": "0",
-      "StorageArea": "0",
-      "Location": "0",
-      "BacklogInventory": "40",
-      "remark": "娴嬭瘯",
-    },{
-      "InventoryOrganization": "浜哄伐搴�",
-      "MaterialCode": "700900000000115",
-      "MaterialName": "鍐180",
-      "Origin": "China",
-      "InventoryNumber": "KC2006891",
-      "Width": '',
-      "Height": "",
-      "Thickness": "",
-      "MainUnit": "浠�",
-      "SafetyStock": "2",
-      "InventoryCount": "23",
-      "AvailableInventory": "4",
-      "UnclaimedQuantity": "3",
-      "TotalArea": "0",
-      "ProductionDate": "2016-10-17",
-      "ShelfLife": "0",
-      "LocationNumber": "0",
-      "StorageArea": "0",
-      "Location": "0",
-      "BacklogInventory": "40",
-      "remark": "娴嬭瘯",
-    },
-  ],//table body瀹為檯鏁版嵁
   footerMethod ({ columns, data }) {//椤佃剼鍑芥暟
     return[
       columns.map((column, columnIndex) => {
@@ -179,28 +233,27 @@
 
 })
 
-const  xGrid = ref();
-const gridEvents = {
-  toolbarButtonClick({ code }) {
-    const $grid = xGrid.value
-    if($grid){
-      switch (code){
-        case 'add':{
-          /*VXETable.modal.confirm('鐐瑰嚮浜嗗簱瀛樿皟鎷�');*/
-          router.push({path: '/main/ingredientsStock/CreateOutbound'});
-          return;
-          break
-        }
-      }
-    }
-  }
-}
+
+
+
+
 
 
 </script>
 
 <template>
   <div class="main-div-customer">
+    <el-date-picker
+        v-model="selectDate"
+        type="daterange"
+        start-placeholder="寮�濮嬫椂闂�"
+        end-placeholder="缁撴潫鏃堕棿"
+        format="YYYY-MM-DD"
+        value-format="YYYY-MM-DD"
+
+    />
+    <el-button @click="changeDate" style="margin-top: -5px"  id="searchButton" type="primary" :icon="Search">鏌ヨ</el-button>
+
     <vxe-grid
         max-height="100%"
         @filter-change="filterChanged"
@@ -211,11 +264,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>
@@ -223,7 +276,7 @@
       <!--宸﹁竟鍥哄畾鏄剧ず鐨勬彃妲�-->
       <template #button_slot="{ row }">
         <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">缂栬緫</el-button>
-        <el-button @click="getTableRow(row,'delete')" 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 }">
@@ -234,10 +287,24 @@
         </div>
       </template>
 
-      <template #state="{ row}">
-        <el-checkbox checked/>
+      <template #state="{ row,column}">
+        <el-checkbox @click.native.prevent :checked="row[column.field]===1"/>
       </template>
 
+      <template #pager>
+        <!--浣跨敤 pager 鎻掓Ы-->
+        <vxe-pager
+            @page-change="handlePageChange"
+            :layouts="[  'PrevPage', 'Jump','PageCount', 'NextPage',  'Total']"
+            v-model:current-page="pageNum"
+            v-model:page-size="total.pageSize"
+            v-model:pager-count="total.pageTotal"
+            :total="total.dataTotal"
+        >
+        </vxe-pager>
+      </template>
+
+
     </vxe-grid>
   </div>
 </template>

--
Gitblit v1.8.0