From bd8f3a15f17facd2f77521da844eaf76dca22bad Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期五, 22 三月 2024 10:02:25 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
---
north-glass-erp/northglass-erp/src/views/mm/mainIngredient/SelectIngredients.vue | 329 ++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 255 insertions(+), 74 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/views/mm/mainIngredient/SelectIngredients.vue b/north-glass-erp/northglass-erp/src/views/mm/mainIngredient/SelectIngredients.vue
index de48f33..beff7f3 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/mainIngredient/SelectIngredients.vue
+++ b/north-glass-erp/northglass-erp/src/views/mm/mainIngredient/SelectIngredients.vue
@@ -1,26 +1,231 @@
<script setup>
-import {reactive} from "vue";
-import {useRouter} from 'vue-router'
-let router=useRouter()
+import request from "@/utils/request"
+import deepClone from "@/utils/deepClone"
+import {ElMessage} from "element-plus"
+import {computed, onMounted, reactive, ref} from "vue"
+import {useRoute, useRouter} from "vue-router"
+import {changeFilterEvent,filterChanged} from "@/hook"
+
+const router = useRouter()
+const route = useRoute()
+let produceList = ref([])
const getTableRow = (row,type) =>{
switch (type) {
case 'edit' :{
- //alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑缂栬緫淇℃伅')
router.push({path: '/main/ingredients/CreateIngredients', query: { id: row.id }})
- break
+ return
}
case 'delete':{
- alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅')
- break
+ let flowData = ref({
+ id: row.id
+ })
+ request.post("/Material/deleteMaterialStore",flowData.value).then((res) => {
+ if(res.code==200){
+ ElMessage.success("鍒犻櫎鎴愬姛")
+ router.push({path:'/main/ingredients/SelectIngredients',query:{random:Math.random()}})
+ }else{
+ ElMessage.warning(res.msg)
+ router.push("/login")
+ }
+ })
+ return
}
}
+}
+
+const value = ref('')
+const options = [
+ {
+ value: '鍘熺墖',
+ label: '鍘熺墖'
+ },
+ {
+ value: '杈呮枡',
+ label: '杈呮枡',
+ }
+]
+
+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 : 2
+})
+
+let filterData = ref({
+ type:''
+
+})
+let BasicData = ref([])
+
+let materialStore= ref([])
+
+let arr = [
+ {type:'expand',fixed:'left',slots: { content:'content' },width: '50'},
+ {title: '鎿嶄綔', width: '110', slots: { default: 'button_slot' },fixed:'left'},
+ { type: 'seq',fixed:'left', title: '鑷簭', width: '80' },
+ {field: 'id', width: '150',title: '鐗╂枡缂栫爜', sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged}
+]
+
+/*//绗竴娆″姞杞介粯璁�
+value.value='鍘熺墖'
+filterData.value.type='鍘熺墖'
+request.get(`/BasicWarehouse/BasicWarehouseType/${value.value}`).then((res) => {
+ if(res.code==200){
+ gridOptions.columns.splice(0,gridOptions.columns.length)
+ console.log(res.data)
+ BasicData.value = res.data
+ //娣诲姞鍒�
+ gridOptions.columns=arr
+
+ for (let i=0;i<BasicData.value.length;i++){
+ let aa={field: BasicData.value[i].OperateType, width: '150',title: BasicData.value[i].OperateTypeName, sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged}
+ console.log(gridOptions.columns)
+ gridOptions.columns.push(aa)
+
+ }
+ getWorks()
+
+ }else{
+ ElMessage.warning(res.msg)
+ }
+})*/
+
+
+//鍒楁煡璇�
+const getWork = () => {
+ filterData.value.type=value.value
+ request.get(`/BasicWarehouse/BasicWarehouseType/${value.value}`).then((res) => {
+ if(res.code==200){
+ gridOptions.columns=[]
+ BasicData.value = res.data
+ //娣诲姞鍒�
+ gridOptions.columns=arr.slice()
+
+ for (let i=0;i<BasicData.value.length;i++){
+ let column={field: BasicData.value[i].OperateType,
+ width: '150',title: BasicData.value[i].OperateTypeName,
+ sortable: true,showOverflow:'ellipsis' ,
+ filters:[{ data: '' }],
+ slots: { filter: 'num1_filter' },
+ filterMethod:filterChanged}
+
+ gridOptions.columns.push(column)
+
+ }
+ getWorks()
+
+ }else{
+ ElMessage.warning(res.msg)
+ }
+ })
+}
+
+
+//鏁版嵁缁戝畾
+const getWorks = () => {
+ console.log(filterData.value)
+ request.post(`/Material/getSelectMaterialStore/1/${total.pageSize}`,filterData.value).then((res) => {
+
+ if(res.code==200){
+ console.log(res.data.data)
+ materialStore.value=[]
+ for (let i=0;i<res.data.data.length;i++){
+ materialStore.value[i]= JSON.parse(res.data.data[i].json)
+ materialStore.value[i].id= res.data.data[i].id
+ }
+ console.log(materialStore)
+
+ total.dataTotal = res.data.total.total*1
+ total.pageTotal= res.data.total.pageTotal
+ pageNum.value=1
+
+ produceList = deepClone(materialStore.value)
+ xGrid.value.loadData(produceList)
+ gridOptions.loading=false
+ }else{
+ ElMessage.warning(res.msg)
+ router.push("/login")
+ }
+ })
+}
+
+//鍒嗛〉鏌ヨ
+const getWorkPaging = () => {
+ console.log(filterData.value)
+ request.post(`/Material/getSelectMaterialStore/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => {
+
+ if(res.code==200){
+ console.log(res.data.data)
+ materialStore.value=[]
+ for (let i=0;i<res.data.data.length;i++){
+ materialStore.value[i]= JSON.parse(res.data.data[i].json)
+ materialStore.value[i].id= res.data.data[i].id
+ }
+
+ produceList = deepClone(materialStore.value)
+ xGrid.value.loadData(produceList)
+ gridOptions.loading=false
+ }else{
+ ElMessage.warning(res.msg)
+ router.push("/login")
+ }
+ })
+}
+
+//鍒嗛〉鏌ヨ
+const selectOrderList = ()=>{
+ filterData.value.type=value.value
+ request.get(`/BasicWarehouse/BasicWarehouseType/${value.value}`).then((res) => {
+ if(res.code==200){
+ gridOptions.columns.splice(0,gridOptions.columns.length)
+ console.log(res.data)
+ BasicData.value = res.data
+ //娣诲姞鍒�
+ gridOptions.columns=arr
+
+ for (let i=0;i<BasicData.value.length;i++){
+ let aa={field: BasicData.value[i].OperateType, width: '150',title: BasicData.value[i].OperateTypeName, sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged}
+ console.log(gridOptions.columns)
+ gridOptions.columns.push(aa)
+
+ }
+ getWorkPaging()
+
+ }else{
+ ElMessage.warning(res.msg)
+ }
+ })
+}
+//椤佃剼璺宠浆
+const handlePageChange = ({ currentPage, pageSize }) => {
+ total.pageTotal = pageSize
+ pageNum.value=currentPage
+
+ selectOrderList();
}
//瀛愮粍浠舵帴鏀跺弬鏁�
-
+const xGrid = ref()
const gridOptions = reactive({
border: "full",//琛ㄦ牸鍔犺竟妗�
keepSource: true,//淇濇寔婧愭暟鎹�
@@ -39,7 +244,7 @@
useKey: true
},
filterConfig: { //绛涢�夐厤缃」
- remote: true
+ //remote: true
},
customConfig: {
storage: true
@@ -50,25 +255,9 @@
showStatus: true
},//琛ㄥご鍙傛暟
columns:[
- {type:'expand',fixed:"left",slots: { content:'content' },width: '50'},
- // { type: 'checkbox',fixed:"left", title: '閫夋嫨', width: '80' },
- {title: '鎿嶄綔', width: '110', slots: { default: 'button_slot' },fixed:"left"},
- { type: 'seq',fixed:"left", title: '鑷簭', width: '80' },
- {field: 'materialCode', width:'150', title: '鐗╂枡缂栫爜', sortable: true,editRender: { name: 'input', attrs: { placeholder: '' } } },
- {field: 'materialName', width: '150',title: '鐗╂枡鍚嶇О', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
- {field: 'origin', width: '120',title: '浜у湴', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
- {field: 'width', width: '100',title: '瀹藉害', sortable: true},
- {field: 'height',width: '100', title: '楂樺害', sortable: true,showOverflow:"ellipsis"},
- {field: 'thickness', width: '80',title: '鍘氬害', sortable: true},
- {field: 'model',width: '100', title: '鍨嬪彿', sortable: true},
- {field: 'conversionRate', width: '100',title: '鎹㈢畻鐜�', sortable: true},
- {field: 'unit',width: '100', title: '鍗曚綅', sortable: true},
- {field: 'conversionUnit', width: '80',title: '鎹㈢畻鍗曚綅', sortable: true},
- {field: 'shelfLife',width: '100', title: '淇濊川鏈�', sortable: true},
- {field: 'weight', width: '100',title: ' 閲嶉噺', sortable: true},
- {field: 'quantity',width: '110', title: '鏁伴噺', sortable: true},
- {field: 'inventoryOrganization',width: '100', title: '搴撳瓨缁勭粐', sortable: true},
- {field: 'remark',width: '80', title: '澶囨敞', sortable: true},
+
+
+
],//琛ㄥご鎸夐挳
toolbarConfig: {
@@ -79,51 +268,13 @@
zoom: true,
custom: true
},
- data: [
- {
- "materialCode": 700900000000941,
- "materialName": "涓濊闃叉檼鎵嬪濂楄",
- "origin": "00",
- "width": "00",
- "height": "00",
- "thickness":'00',
- "model": "鏈嶉グ",
- "conversionRate": "1000",
- "unit": "鍙�",
- "conversionUnit": "1",
- "shelfLife": "12涓湀",
- "weight": "0.0000",
- "quantity": "10000",
- "inventoryOrganization": "浜哄伐搴�",
- "remark": "娴嬭瘯",
- },
- {
- "materialCode": 700900000000941,
- "materialName": "涓濊闃叉檼鎵嬪濂楄",
- "origin": "00",
- "width": "00",
- "height": "00",
- "thickness":'00',
- "model": "鏈嶉グ",
- "conversionRate": "1000",
- "unit": "鍙�",
- "conversionUnit": "1",
- "shelfLife": "12涓湀",
- "weight": "0.0000",
- "quantity": "10000",
- "inventoryOrganization": "浜哄伐搴�",
- "remark": "娴嬭瘯",
- },
- ],//table body瀹為檯鏁版嵁
footerMethod ({ columns, data }) {//椤佃剼鍑芥暟
return[
columns.map((column, columnIndex) => {
if (columnIndex === 0) {
return '鍚堣:'
}
- // if (props.tableProp.footList.includes(column.field)) {
- // return sumNum(data, column.field)
- // }
+
return ''
})
]
@@ -136,22 +287,39 @@
</script>
<template>
+
+
<div class="main-div-customer">
+ <div>
+ <el-row>
+ <el-col :span="4">
+ <el-select v-model="value" placeholder="璇烽�夋嫨绫诲埆" @change="getWork">
+ <el-option
+ v-for="item in options"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ </el-col>
+ </el-row>
+ </div>
+
+
<vxe-grid
max-height="100%"
- @filter-change="filterChanged"
class="mytable-scrollbar"
ref="xGrid"
v-bind="gridOptions"
>
<!-- @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 v-if="hasDecimal(item.field)">{{ hasDecimalhtml(item.field,row) }}</span>
+ <span v-else>{{ row[item.field] }}</span>
</li>
</ul>
</template>
@@ -161,7 +329,7 @@
<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>
</template>
-
+ <!-- 涓嬫媺璇︽儏寰幆鏄剧ず涓枃 -->
<template #num1_filter="{ column, $panel }">
<div>
<div v-for="(option, index) in column.filters" :key="index">
@@ -170,6 +338,19 @@
</div>
</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>
--
Gitblit v1.8.0