From 92f00c92b4e6c1c61ce8461d9b72fd2969e66802 Mon Sep 17 00:00:00 2001 From: chenlu <1320612696@qq.com> Date: 星期五, 23 二月 2024 17:12:53 +0800 Subject: [PATCH] 流程卡新增 --- north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue | 339 +++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 235 insertions(+), 104 deletions(-) diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue index c9978b9..83deb13 100644 --- a/north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue +++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue @@ -11,9 +11,12 @@ import Sortable from 'sortablejs' import BasicTable from '@/components/basic/BasicTable.vue' import {VXETable} from "vxe-table"; +import useUserInfoStore from "@/stores/userInfo"; let productGlassTypeStore = useProductGlassTypeStore() let router = useRouter() +const userStore = useUserInfoStore() +const username = userStore.user.userName const getTableRow = (row, type) => { switch (type) { case 'edit' : { @@ -39,6 +42,15 @@ } } +let flag = $ref(true) +function intoCreateProduct(){ + if(flag){ + router.push(`/main/processCard/SplittingDetails?orderId=${orderId}`) + }else { + router.push('/main/processCard/SplittingDetails?orderId=${orderId}') + } + flag=!flag +} //瀹氫箟鏃堕棿 const form = reactive({ @@ -68,16 +80,16 @@ let filterData = ref({ product: { thickness: '', - totalThickness:'' + totalThickness: '' }, orderDetail: { orderNumber: '', height: '', computeGrossArea: '', - quantity: '', - shape:'', - width:'', - weight:'' + binningQuantity: '', + shape: '', + width: '', + weight: '' } }) @@ -99,7 +111,7 @@ request.post(`/processCard/selectNoCard/${orderId}/${productionId}`, filterData.value).then((res) => { if (res.code == 200) { - //console.log(res.data) + console.log(res.data) pageTotal.value = res.data.total produceList = produceList.value.concat(deepClone(res.data.data)) xGrid.value.reloadData(produceList) @@ -114,9 +126,11 @@ // 鎵嬪姩瑙﹀彂绛涢�� $panel.changeOption(event, !!option.data, option) } + function padLeftZero(str) { return ('00' + str).substr(str.length) } + function filterChanged(column) { gridOptions.loading = true //绛涢�夋潯浠跺彂鐢熷彉鍖栨潯浠跺彂鐢熷彉鍖� @@ -134,12 +148,13 @@ request.post(`/processCard/selectNoCard/${orderId}/${productionId}`, filterData.value).then((res) => { - if(res.code==200){ - pageTotal.value=res.data.total + if (res.code == 200) { + + pageTotal.value = res.data.total produceList = deepClone(res.data.data) xGrid.value.loadData(produceList) - gridOptions.loading=false - }else{ + gridOptions.loading = false + } else { ElMessage.warning(res.msg) } }) @@ -154,18 +169,18 @@ //鍙充晶瀛愮粍浠舵帴鏀跺弬鏁� const xGrid = ref() const gridOptions = reactive({ - border: "full",//琛ㄦ牸鍔犺竟妗� + border: "full",//琛ㄦ牸鍔犺竟妗� keepSource: true,//淇濇寔婧愭暟鎹� align: 'center',//鏂囧瓧灞呬腑 - stripe:true,//鏂戦┈绾� - rowConfig: {isCurrent: true, isHover: true,height: 30},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒 + stripe: true,//鏂戦┈绾� + rowConfig: {isCurrent: true, isHover: true, height: 30},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒 id: 'CustomerList', showFooter: true,//鏄剧ず鑴� printConfig: {}, importConfig: {}, exportConfig: {}, - scrollY:{ enabled: true },//寮�鍚櫄鎷熸粴鍔� - showOverflow:true, + scrollY: {enabled: true},//寮�鍚櫄鎷熸粴鍔� + showOverflow: true, columnConfig: { resizable: true, useKey: true @@ -181,14 +196,14 @@ mode: 'row', showStatus: true },//琛ㄥご鍙傛暟 - columns:[ + columns: [ {type: 'checkbox', fixed: "left", title: '閫夋嫨'}, - {field: 'orderNumber', title: '璁㈠簭',filters:[{ data: '' }],slots: { filter: 'num1_filter' } }, - {field: 'shape', title: '褰㈢姸', showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, - {field: 'width', title: '瀹�', filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, - {field: 'height', title: '楂�',filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, - {field: 'baiscQuantity', title: '鏁伴噺', showOverflow:"ellipsis"}, - {field: 'computeGrossArea', title: '闈㈢Н'}, + {field: 'orderNumber', title: '璁㈠簭', filters: [{data: ''}], slots: {filter: 'num1_filter'}}, + {field: 'shape', title: '褰㈢姸', showOverflow: "ellipsis", filters: [{data: ''}], slots: {filter: 'num1_filter'}}, + {field: 'width', title: '瀹�', filters: [{data: ''}], slots: {filter: 'num1_filter'}}, + {field: 'height', title: '楂�', filters: [{data: ''}], slots: {filter: 'num1_filter'}}, + {field: 'baiscQuantity', title: '寰呭垎鏁伴噺', showOverflow: "ellipsis"}, + {field: 'computeGrossArea', title: '寰呭垎闈㈢Н'}, {field: 'totalThickness', title: '鎬诲帤搴�'}, {field: 'thickness', title: '鐜荤拑鍘氬害'}, {field: 'weight', title: '閲嶉噺'} @@ -204,13 +219,11 @@ zoom: true, custom: true }, - data: [ - - ],//table body瀹為檯鏁版嵁 + data: [],//table body瀹為檯鏁版嵁 //鑴氶儴姹傚拰 - footerMethod ({ columns, data }) {//椤佃剼鍑芥暟 - let footList=['鎬绘暟閲�','鎬婚潰绉�','鍒嗙鏁�'] - return[ + footerMethod({columns, data}) {//椤佃剼鍑芥暟 + let footList = ['baiscQuantity', 'computeGrossArea', 'totalThickness','thickness', 'weight'] + return [ columns.map((column, columnIndex) => { if (columnIndex === 0) { return '鍚堣:' @@ -229,18 +242,18 @@ //宸︿晶瀛愮粍浠舵帴鏀跺弬鏁� const xGridLeft = ref() const gridLeftOptions = reactive({ - border: "full",//琛ㄦ牸鍔犺竟妗� + border: "full",//琛ㄦ牸鍔犺竟妗� keepSource: true,//淇濇寔婧愭暟鎹� align: 'center',//鏂囧瓧灞呬腑 - stripe:true,//鏂戦┈绾� - rowConfig: {isCurrent: true, isHover: true,height: 30},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒 + stripe: true,//鏂戦┈绾� + rowConfig: {isCurrent: true, isHover: true, height: 30},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒 id: 'CustomerList', showFooter: true,//鏄剧ず鑴� printConfig: {}, importConfig: {}, exportConfig: {}, - scrollY:{ enabled: true },//寮�鍚櫄鎷熸粴鍔� - showOverflow:true, + scrollY: {enabled: true},//寮�鍚櫄鎷熸粴鍔� + showOverflow: true, columnConfig: { resizable: true, useKey: true @@ -256,35 +269,39 @@ mode: 'row', showStatus: true },//琛ㄥご鍙傛暟 - columns:[ + columns: [ {type: 'checkbox', fixed: "left", title: '閫夋嫨'}, - {field: 'processId', title: '娴佺▼鍗″彿',filters:[{ data: '' }],slots: { filter: 'num1_filter' },width:130 }, - {field: 'orderNumber', title: '璁㈠簭', showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, - {field: 'landingSequence', title: '钀芥灦椤哄簭', filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, - {field: 'shape', title: '褰㈢姸',filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, - {field: 'width', title: '瀹�', showOverflow:"ellipsis"}, + {field: 'processId', title: '娴佺▼鍗″彿', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 130}, + { + field: 'orderNumber', + title: '璁㈠簭', + showOverflow: "ellipsis", + filters: [{data: ''}], + slots: {filter: 'num1_filter'} + }, + {field: 'landingSequence', title: '钀芥灦椤哄簭', filters: [{data: ''}], slots: {filter: 'num1_filter'}}, + {field: 'shape', title: '褰㈢姸', filters: [{data: ''}], slots: {filter: 'num1_filter'}}, + {field: 'width', title: '瀹�', showOverflow: "ellipsis"}, {field: 'height', title: '楂�'}, {field: 'quantity', title: '鎬绘暟閲�'}, {field: 'totalThickness', title: '鎬诲帤搴�'}, ],//琛ㄥご鎸夐挳 toolbarConfig: { - // buttons: [{ - // - // }], + buttons: [ + {code: 'saveFlowCard', name: '淇濆瓨', status: 'primary', icon: 'vxe-icon-save'}, + ], import: false, export: true, print: true, zoom: true, custom: true }, - data: [ - - ],//table body瀹為檯鏁版嵁 + data: [],//table body瀹為檯鏁版嵁 //鑴氶儴姹傚拰 - footerMethod ({ columns, data }) {//椤佃剼鍑芥暟 - let footList=['鎬绘暟閲�','鎬婚潰绉�','鍒嗙鏁�'] - return[ + footerMethod({columns, data}) {//椤佃剼鍑芥暟 + let footList = ['鎬绘暟閲�', '鎬婚潰绉�', '鍒嗙鏁�'] + return [ columns.map((column, columnIndex) => { if (columnIndex === 0) { return '鍚堣:' @@ -302,7 +319,7 @@ const createProcessCard = () => { const $grid = xGrid.value const checkedList = $grid.getCheckboxRecords() - if(checkedList.length===0){ + if (checkedList.length === 0) { ElMessage.warning("璇峰厛閫夋嫨鍙充晶鏁版嵁") return } @@ -310,8 +327,8 @@ const $gridLeft = xGridLeft.value const leftData = $gridLeft.getTableData().fullData let index = 1 - if(leftData.length!==0){ - index = leftData[0].landingSequence + 1 + if (leftData.length !== 0) { + index = leftData[0].landingSequence + 1 //index = index.toString().padStart(2, '0') } const processId = productionId + index.toString().padStart(2, '0') @@ -323,11 +340,11 @@ $grid.remove(checkedList) } -let checkedNum = ref('') +let checkedNum = ref('') //鍚戝彸杈硅〃鏍兼坊鍔犳暟鎹� -const addRight = () => { - try{ +const addRight = () => { + try { //宸﹁竟琛ㄦ牸瀹氫箟 const $gridLeft = xGridLeft.value //鍙宠竟琛ㄦ牸瀹氫箟 @@ -335,49 +352,49 @@ //鑾峰彇宸﹁竟琛ㄦ牸checkbox閫変腑鐨勬暟鎹� const checkedList = $gridLeft.getCheckboxRecords() //鍒ゆ柇宸﹁竟琛ㄦ牸鏄惁鏈夐�変腑鐨勬暟鎹� - if(checkedList.length===0){ + if (checkedList.length === 0) { ElMessage.warning("璇峰厛閫夋嫨宸︿晶鏁版嵁") return } - const regex = /^(\d+|)$/; - if(!regex.test(checkedNum.value)){ + const regex = /^(\d+|)$/; + if (!regex.test(checkedNum.value)) { ElMessage.warning("璇疯緭鍏ユ鏁存暟") return } //鍒ゆ柇姝f暣鏁� - if(/^[1-9]\d*$/.test(checkedNum.value)){ + if (/^[1-9]\d*$/.test(checkedNum.value)) { //瀵归�変腑鐨勫乏杈硅〃鏍兼暟鎹繘琛屽惊鐜� - checkedList.forEach((item)=> { + checkedList.forEach((item) => { //鍒ゆ柇鍙敤鏁伴噺鏄惁澶т簬绛変簬杈撳叆鐨勬暟閲�,涓嶆弧瓒冲垯鎶涘嚭寮傚父 - if(item.quantity <checkedNum.value) throw new Error("璇疯緭鍏ュ皬浜庣瓑浜庡彲鐢ㄦ暟閲忕殑鏁板瓧"); + if (item.quantity < checkedNum.value) throw new Error("璇疯緭鍏ュ皬浜庣瓑浜庡彲鐢ㄦ暟閲忕殑鏁板瓧"); //宸﹁竟琛ㄦ牸鍙敤鏁伴噺鍑忓幓杈撳叆鐨勬暟閲� - item.quantity = item.quantity-checkedNum.value + item.quantity = item.quantity - checkedNum.value //鍙宠竟琛ㄦ牸鏁版嵁 let rightData = $grid.getTableData().fullData //鍙宠竟琛ㄦ牸鏁版嵁涓煡鎵惧綋鍓嶆暟鎹笅鏍� let filterIndex = rightData.findIndex(item1 => item1.orderNumber === item.orderNumber) //濡傛灉鍙宠竟琛ㄦ牸鏁版嵁涓瓨鍦ㄥ綋鍓嶆暟鎹垯鏁伴噺鐩稿姞 - if (filterIndex>=0){ - rightData[filterIndex].baiscQuantity =rightData[filterIndex].baiscQuantity*1+ checkedNum.value*1 + if (filterIndex >= 0) { + rightData[filterIndex].baiscQuantity = rightData[filterIndex].baiscQuantity * 1 + checkedNum.value * 1 //濡傛灉宸﹁竟鏁伴噺涓�0鏃跺垹闄ゆ鏉℃暟鎹� - if(item.quantity=== 0){ + if (item.quantity === 0) { $gridLeft.remove(item) } - }else { + } else { //鍙宠竟琛ㄦ牸娌℃湁姝ゆ潯鏁版嵁鍒欏線鍙宠竟琛ㄦ牸鎻掑叆鏁版嵁 item.baiscQuantity = checkedNum.value $grid.insert(item) } }) - }else if(checkedNum.value===''){//鍒ゆ柇鏁伴噺杈撳叆妗嗘湁鏃犺緭鍏ユ暟瀛� + } else if (checkedNum.value === '') {//鍒ゆ柇鏁伴噺杈撳叆妗嗘湁鏃犺緭鍏ユ暟瀛� - checkedList.forEach((item)=> { + checkedList.forEach((item) => { let rightData = $grid.getTableData().fullData let filterIndex = rightData.findIndex(item1 => item1.orderNumber === item.orderNumber) //鏃犺緭鍏ュ苟涓斿鏋滃彸杈硅〃鏍兼暟鎹腑瀛樺湪褰撳墠鏁版嵁鍒欐暟閲忕浉鍔� - if(filterIndex>-1){ - rightData[filterIndex].baiscQuantity =rightData[filterIndex].baiscQuantity*1+ item.quantity*1 - }else{ + if (filterIndex > -1) { + rightData[filterIndex].baiscQuantity = rightData[filterIndex].baiscQuantity * 1 + item.quantity * 1 + } else { $grid.insert(item) } @@ -385,46 +402,153 @@ }) } - } - catch (e){ + } catch (e) { ElMessage.warning(e.message) } } //鍚戝乏杈硅〃鏍兼坊鍔犳暟鎹� -const addLeft = () => { +const addLeft = () => { + try { + //宸﹁竟琛ㄦ牸瀹氫箟 + const $gridLeft = xGridLeft.value + //鍙宠竟琛ㄦ牸瀹氫箟 + const $grid = xGrid.value + //鑾峰彇鍙宠竟琛ㄦ牸checkbox閫変腑鐨勬暟鎹� + const checkedList = $grid.getCheckboxRecords() + //鑾峰彇宸﹁竟琛ㄦ牸checkbox閫変腑鐨勬暟鎹� + const checkedListLeft = $gridLeft.getCheckboxRecords() + //鍒ゆ柇鍙宠竟琛ㄦ牸鏄惁鏈夐�変腑鐨勬暟鎹� + if (checkedList.length === 0) { + ElMessage.warning("璇峰厛閫夋嫨鍙充晶鏁版嵁") + return + } + if (checkedListLeft.length !== 1) { + ElMessage.warning("璇峰厛閫夋嫨宸︿晶涓�鏉℃暟鎹�") + return + } + const regex = /^(\d+|)$/; + if (!regex.test(checkedNum.value)) { + ElMessage.warning("璇疯緭鍏ユ鏁存暟") + return + } + //鍒ゆ柇姝f暣鏁� + if (/^[1-9]\d*$/.test(checkedNum.value)) { + checkedList.forEach((item) => { + //鍒ゆ柇鍙敤鏁伴噺鏄惁澶т簬绛変簬杈撳叆鐨勬暟閲�,涓嶆弧瓒冲垯鎶涘嚭寮傚父 + if (item.baiscQuantity < checkedNum.value) throw new Error("璇疯緭鍏ュ皬浜庣瓑浜庡彲鐢ㄦ暟閲忕殑鏁板瓧"); + item.baiscQuantity = item.baiscQuantity - checkedNum.value + //宸﹁竟琛ㄦ牸鏁版嵁 + let leftData = $gridLeft.getTableData().fullData + //宸﹁竟琛ㄦ牸鏁版嵁涓煡鎵惧綋鍓嶆暟鎹笅鏍� + let filterIndex = leftData.findIndex(item1 => item1.orderNumber === item.orderNumber) + //濡傛灉鍙宠竟琛ㄦ牸鏁版嵁涓瓨鍦ㄥ綋鍓嶆暟鎹垯鏁伴噺鐩稿姞 + if (filterIndex >= 0) { + leftData[filterIndex].quantity = leftData[filterIndex].quantity * 1 + checkedNum.value * 1 + if (item.baiscQuantity === 0) { + $grid.remove(checkedList) + } + } else { + item.quantity = checkedNum.value + item.processId = checkedListLeft[0].processId + item.landingSequence = checkedListLeft[0].landingSequence + $gridLeft.insert(item) + } + + }) + } else if (checkedNum.value === '') {//鍒ゆ柇鏁伴噺杈撳叆妗嗘湁鏃犺緭鍏ユ暟瀛� + checkedList.forEach((item) => { + item.processId = checkedListLeft[0].processId + item.landingSequence = checkedListLeft[0].landingSequence + }) + $gridLeft.insertAt(checkedList) + $grid.remove(checkedList) + } + } catch (e) { + ElMessage.warning(e.message) + } } +//淇濆瓨娴佺▼鍗℃暟鎹� +const gridEvents = { + toolbarButtonClick({code}) { + const $grid = xGridLeft.value + if ($grid) { + switch (code) { + case 'saveFlowCard': { + const $table = xGridLeft.value + const $tableRight = xGrid.value + if ($table) { + const selectRecords = $table.getCheckboxRecords() + const selectRight = $tableRight.getCheckboxRecords() + if (selectRecords.length === 0){ + ElMessage.warning("璇峰厛閫夋嫨淇濆瓨鐨勬暟鎹�") + return + } + if (selectRight.length > 0){ + ElMessage.warning("璇峰厛灏嗗彸渚ф暟鎹叏閮ㄥ缓绔嬫祦绋嬪崱鍚庝繚瀛�") + return; + } + //console.log(selectRecords[0].quantity) + let flowCardData = ref({ + flowCard: selectRecords, + userName:username, + productionId:productionId + }) + console.log(flowCardData.value) + request.post("/processCard/addFlowCard", flowCardData.value).then((res) => { + if (res.code == 200) { + ElMessage.success("淇濆瓨鎴愬姛") + location.reload(); + } else { + ElMessage.warning(res.msg) + router.push("/login") + } + }) + + } + return; + + } + + } + } + }, + +} </script> <template> <div> - <div class="header"> - <el-button - style="float: left" - @click="intoCreateProduct" - id="searchButton1" - type="primary" - :icon="ArrowLeftBold" - round > - {{flag?'杩斿洖':'杩斿洖'}} - </el-button> - <el-button type="primary">淇濆瓨鍒嗘灦</el-button> - <el-button type="primary">鍒嗘灦姹囨��</el-button> - <el-button type="primary">宸︿晶鍏ㄩ��</el-button> - <el-button type="primary">鍙充晶鍏ㄩ��</el-button> - </div> - <div class="common-layout"> - <el-container height="100%"> - <el-aside width="44%" style=""> + <div class="common-layout" style="height: 100%"> + <div class="header"> + + <el-button + style="float: left" + @click="intoCreateProduct" + id="searchButton1" + type="primary" + :icon="ArrowLeftBold" + round> + {{ flag ? '杩斿洖' : '杩斿洖' }} + </el-button> + <!-- <el-button type="primary">淇濆瓨鍒嗘灦</el-button>--> +<!-- <el-button type="primary" :hidden="true">鍒嗘灦姹囨��</el-button>--> + <div style="width: 100px;"> + + </div> + </div> + <el-container height="600px"> + <el-aside width="44%" > <vxe-grid max-height="100%" @filter-change="filterChanged" class="mytable-scrollbar" ref="xGridLeft" v-bind="gridLeftOptions" + v-on="gridEvents" > <!-- @toolbar-button-click="toolbarButtonClickEvent"--> <!-- 涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�--> @@ -432,7 +556,9 @@ <ul class="expand-wrapper"> <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)">{{ row[item.field.split('.')[0]][item.field.split('.')[1]] }}</span> + <span v-if="hasDecimal(item.field)">{{ + row[item.field.split('.')[0]][item.field.split('.')[1]] + }}</span> <span v-else>{{ row[item.field] }}</span> </li> </ul> @@ -457,22 +583,20 @@ </el-aside> <el-main width="12%" style=""> - <span>鏈垎鏁伴噺:45</span><br> - <span>鏈垎閲嶉噺:333</span><br> <span>閫変腑鏁伴噺:<el-input type="number" v-model="checkedNum"></el-input></span><br> - <el-button type="primary" @click="addRight"> 鈫� </el-button> + <el-button type="primary" @click="addRight"> 鈫�</el-button> <br> <br> - <el-button type="primary" @click="addLeft"> 鈫� </el-button> + <el-button type="primary" @click="addLeft"> 鈫�</el-button> <br> <br> <el-button @click="createProcessCard" type="primary">寤虹珛娴佺▼鍗�</el-button> </el-main> - <el-aside width="44%" style=""> - + <el-aside width="45%" height="500px" style=""> <vxe-grid - max-height="100%" + + max-height="97%" @filter-change="filterChanged" class="mytable-scrollbar" ref="xGrid" @@ -484,7 +608,9 @@ <ul class="expand-wrapper"> <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)">{{ row[item.field.split('.')[0]][item.field.split('.')[1]] }}</span> + <span v-if="hasDecimal(item.field)">{{ + row[item.field.split('.')[0]][item.field.split('.')[1]] + }}</span> <span v-else>{{ row[item.field] }}</span> </li> </ul> @@ -512,19 +638,24 @@ </template> <style scoped> -.common-layout{ +.common-layout { height: 100%; } -.el-aside{ +.header{ + width: 100%; + height: 35px; + margin-top: -20px; +} + +.el-aside { height: 100%; } -.el-main{ +.el-main { height: 100%; text-align: center; } - </style> \ No newline at end of file -- Gitblit v1.8.0