From 9477c09873492574e584c2791a07c1cf9ff2566c Mon Sep 17 00:00:00 2001 From: guoyuji <guoyujie@ng.com> Date: 星期二, 12 三月 2024 08:15:36 +0800 Subject: [PATCH] 中英文切换相关文件 --- north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue | 295 +++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 205 insertions(+), 90 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 a23c822..6602727 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 @@ -43,13 +43,14 @@ } let flag = $ref(true) -function intoCreateProduct(){ - if(flag){ + +function intoCreateProduct() { + if (flag) { router.push(`/main/processCard/SplittingDetails?orderId=${orderId}`) - }else { + } else { router.push('/main/processCard/SplittingDetails?orderId=${orderId}') } - flag=!flag + flag = !flag } //瀹氫箟鏃堕棿 @@ -91,6 +92,8 @@ let orderId = route.query.orderId let productionId = route.query.productionId + + //绗竴娆″姞杞芥暟鎹� request.post(`/processCard/selectNoCard/${orderId}/${productionId}`, filterData.value).then((res) => { @@ -116,7 +119,6 @@ } - /*鍚庣杩斿洖缁撴灉澶氬眰宓屽灞曠ず*/ const hasDecimal = (value) => { const regex = /\./; // 瀹氫箟姝e垯琛ㄨ揪寮忥紝鏌ユ壘灏忔暟鐐� @@ -125,7 +127,7 @@ //绛涢�夋柟娉� -const filterChanged = ({ option, row, column }) => { +const filterChanged = ({option, row, column}) => { if (option.data) { return row[column.field].toString().toLowerCase().indexOf(option.data) > -1 } @@ -153,7 +155,7 @@ useKey: true }, filterConfig: { //绛涢�夐厤缃」 - //remote: true + //remote: true }, customConfig: { storage: true @@ -165,14 +167,43 @@ },//琛ㄥご鍙傛暟 columns: [ {type: 'checkbox', fixed: "left", title: '閫夋嫨'}, - {field: 'orderNumber', title: '璁㈠簭', filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged}, - {field: 'shape', title: '褰㈢姸', showOverflow: "ellipsis", filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged}, - {field: 'width', title: '瀹�', sortable: true, filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged,width:'60px'}, - {field: 'height', title: '楂�', sortable: true, filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged,width:'60px'}, - {field: 'baiscQuantity', title: '寰呭垎鏁伴噺', showOverflow: "ellipsis",width:'60px'}, - {field: 'computeGrossArea', title: '寰呭垎闈㈢Н',width:'60px'}, - {field: 'totalThickness', title: '鎬诲帤搴�',width:'80px'}, - {field: 'thickness', title: '鐜荤拑鍘氬害',width:'60px'}, + { + field: 'orderNumber', + title: '璁㈠簭', + filters: [{data: ''}], + slots: {filter: 'num1_filter'}, + filterMethod: filterChanged + }, + { + field: 'shape', + title: '褰㈢姸', + showOverflow: "ellipsis", + filters: [{data: ''}], + slots: {filter: 'num1_filter'}, + filterMethod: filterChanged + }, + { + field: 'width', + title: '瀹�', + sortable: true, + filters: [{data: ''}], + slots: {filter: 'num1_filter'}, + filterMethod: filterChanged, + width: '60px' + }, + { + field: 'height', + title: '楂�', + sortable: true, + filters: [{data: ''}], + slots: {filter: 'num1_filter'}, + filterMethod: filterChanged, + width: '60px' + }, + {field: 'baiscQuantity', title: '寰呭垎鏁伴噺', showOverflow: "ellipsis", width: '60px'}, + {field: 'computeGrossArea', title: '寰呭垎闈㈢Н', width: '60px'}, + {field: 'totalThickness', title: '鎬诲帤搴�', width: '80px'}, + {field: 'thickness', title: '鐜荤拑鍘氬害', width: '60px'}, {field: 'weight', title: '閲嶉噺'} ],//琛ㄥご鎸夐挳 @@ -189,7 +220,7 @@ data: [],//table body瀹為檯鏁版嵁 //鑴氶儴姹傚拰 footerMethod({columns, data}) {//椤佃剼鍑芥暟 - let footList = ['baiscQuantity', 'computeGrossArea', 'totalThickness','thickness', 'weight'] + let footList = ['', '', '', '', ''] return [ columns.map((column, columnIndex) => { if (columnIndex === 0) { @@ -204,7 +235,6 @@ } }) - //宸︿晶瀛愮粍浠舵帴鏀跺弬鏁� const xGridLeft = ref() @@ -226,7 +256,7 @@ useKey: true }, filterConfig: { //绛涢�夐厤缃」 - //remote: true + //remote: true }, customConfig: { storage: true @@ -238,17 +268,30 @@ },//琛ㄥご鍙傛暟 columns: [ {type: 'checkbox', fixed: "left", title: '閫夋嫨'}, - {field: 'processId', title: '娴佺▼鍗″彿', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 130,filterMethod:filterChanged}, + { + field: 'processId', + title: '娴佺▼鍗″彿', + filters: [{data: ''}], + slots: {filter: 'num1_filter'}, + width: 130, + filterMethod: filterChanged + }, { field: 'orderNumber', title: '璁㈠簭', showOverflow: "ellipsis", filters: [{data: ''}], slots: {filter: 'num1_filter'} - ,filterMethod:filterChanged + , filterMethod: filterChanged }, - {field: 'landingSequence', title: '钀芥灦椤哄簭', filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged}, - {field: 'shape', title: '褰㈢姸', filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged}, + { + field: 'landingSequence', + title: '灏忕墖椤哄簭', + filters: [{data: ''}], + slots: {filter: 'num1_filter'}, + filterMethod: filterChanged + }, + {field: 'shape', title: '褰㈢姸', filters: [{data: ''}], slots: {filter: 'num1_filter'}, filterMethod: filterChanged}, {field: 'width', title: '瀹�', showOverflow: "ellipsis"}, {field: 'height', title: '楂�'}, {field: 'quantity', title: '鎬绘暟閲�'}, @@ -268,7 +311,7 @@ data: [],//table body瀹為檯鏁版嵁 //鑴氶儴姹傚拰 footerMethod({columns, data}) {//椤佃剼鍑芥暟 - let footList = ['鎬绘暟閲�', '鎬婚潰绉�', '鍒嗙鏁�'] + let footList = [''] return [ columns.map((column, columnIndex) => { if (columnIndex === 0) { @@ -287,6 +330,7 @@ const createProcessCard = () => { const $grid = xGrid.value const checkedList = $grid.getCheckboxRecords() + if (checkedList.length === 0) { ElMessage.warning("璇峰厛閫夋嫨鍙充晶鏁版嵁") return @@ -303,14 +347,17 @@ checkedList.forEach((item) => { item.processId = processId item.landingSequence = index - item.quantity=item.baiscQuantity + item.quantity = item.baiscQuantity }) - checkedList.forEach((item)=>{ + checkedList.forEach((item) => { delete item._X_ROW_KEY }) - $gridLeft.insertAt(checkedList) $grid.remove(checkedList) + if ($gridLeft || $grid) { + $gridLeft.clearCheckboxRow() + $grid.clearCheckboxRow() + } } let checkedNum = ref('') @@ -356,6 +403,9 @@ } else { //鍙宠竟琛ㄦ牸娌℃湁姝ゆ潯鏁版嵁鍒欏線鍙宠竟琛ㄦ牸鎻掑叆鏁版嵁 item.baiscQuantity = checkedNum.value + if (item.quantity === 0) { + $gridLeft.remove(item) + } $grid.insert(item) } }) @@ -374,8 +424,11 @@ $gridLeft.remove(item) }) - } + + } + $gridLeft.clearCheckboxRow() + $grid.clearCheckboxRow() } catch (e) { ElMessage.warning(e.message) } @@ -392,7 +445,7 @@ //鑾峰彇宸﹁竟琛ㄦ牸checkbox閫変腑鐨勬暟鎹� const checkedListLeft = $gridLeft.getCheckboxRecords() //鍒ゆ柇鍙宠竟琛ㄦ牸鏄惁鏈夐�変腑鐨勬暟鎹� - if (checkedList.length === 0) { + if (checkedList.length * 1 === 0) { ElMessage.warning("璇峰厛閫夋嫨鍙充晶鏁版嵁") return } @@ -409,41 +462,100 @@ if (/^[1-9]\d*$/.test(checkedNum.value)) { checkedList.forEach((item) => { //鍒ゆ柇鍙敤鏁伴噺鏄惁澶т簬绛変簬杈撳叆鐨勬暟閲�,涓嶆弧瓒冲垯鎶涘嚭寮傚父 - if (item.baiscQuantity < checkedNum.value) throw new Error("璇疯緭鍏ュ皬浜庣瓑浜庡彲鐢ㄦ暟閲忕殑鏁板瓧"); + if (item.baiscQuantity * 1 < checkedNum.value * 1) throw new Error("璇疯緭鍏ュ皬浜庣瓑浜庡彲鐢ㄦ暟閲忕殑鏁板瓧"); item.baiscQuantity = item.baiscQuantity - checkedNum.value + //瀹氫箟key鍊间繚鎸� + let key = item._X_ROW_KEY //宸﹁竟琛ㄦ牸鏁版嵁 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 (checkedListLeft[0].orderNumber === item.orderNumber) { - if (item.baiscQuantity === 0) { - $grid.remove(checkedList) + //濡傛灉鍙宠竟琛ㄦ牸鏁版嵁涓瓨鍦ㄥ綋鍓嶆暟鎹垯鏁伴噺鐩稿姞 + if (filterIndex >= 0) { + leftData[filterIndex].quantity = leftData[filterIndex].quantity * 1 + checkedNum.value * 1 + + if (item.baiscQuantity === 0) { + $grid.remove(checkedList) + } + //delete item._X_ROW_KEY + } else { + item.quantity = checkedNum.value + item.processId = checkedListLeft[0].processId + item.landingSequence = checkedListLeft[0].landingSequence + delete item._X_ROW_KEY + $gridLeft.insert(item) + item._X_ROW_KEY = key } } else { + + // if (){ + // + // } + //濡傛灉鍕鹃�変袱涓�间笉鍚屽垯鎻掑叆鍚屾祦绋嬪崱 item.quantity = checkedNum.value item.processId = checkedListLeft[0].processId item.landingSequence = checkedListLeft[0].landingSequence - delete item._X_ROW_KEY - $gridLeft.insert(item) + if (item.baiscQuantity === 0) { + $grid.remove(checkedList) + + } + for (let i = 0; i < leftData.length; i++) { + if (leftData[i].orderNumber === item.orderNumber && leftData[i].processId === item.processId) { + leftData[i].quantity = leftData[i].quantity * 1 + checkedNum.value * 1 + break + } else if (leftData[i].orderNumber === item.orderNumber && leftData[i].processId !== item.processId) { + + delete item._X_ROW_KEY + $gridLeft.insert(item) + item._X_ROW_KEY = key + break + } + else if (leftData[i].orderNumber !== item.orderNumber && leftData[i].processId !== item.processId) { + + delete item._X_ROW_KEY + $gridLeft.insert(item) + item._X_ROW_KEY = key + break + } + } + // leftData.forEach((items) => { + // console.log(items.processId, item.processId,"鈥斺�斺�斺�斺�斺��",items.orderNumber, item.orderNumber) + // if (items.orderNumber === item.orderNumber && items.processId===item.processId) { + // console.log("娴嬭瘯333") + // + // } + // else{ + // + // } + // + // }) + } }) - } else if (checkedNum.value === '') {//鍒ゆ柇鏁伴噺杈撳叆妗嗘湁鏃犺緭鍏ユ暟瀛� + } else if (checkedNum.value === '') {//鍒ゆ柇鏁伴噺杈撳叆妗嗘棤杈撳叆鏁板瓧 checkedList.forEach((item) => { item.processId = checkedListLeft[0].processId item.landingSequence = checkedListLeft[0].landingSequence + item.quantity = checkedListLeft[0].baiscQuantity delete item._X_ROW_KEY }) $gridLeft.insertAt(checkedList) $grid.remove(checkedList) } + if ($gridLeft || $grid) { + $gridLeft.clearCheckboxRow() + $grid.clearCheckboxRow() + } + } catch (e) { ElMessage.warning(e.message) } } + //淇濆瓨娴佺▼鍗℃暟鎹� const gridEvents = { @@ -457,25 +569,28 @@ if ($table) { const selectRecords = $table.getCheckboxRecords() const selectRight = $tableRight.getCheckboxRecords() - if (selectRecords.length === 0){ + if (selectRecords.length === 0) { ElMessage.warning("璇峰厛閫夋嫨淇濆瓨鐨勬暟鎹�") return } - if (selectRight.length > 0){ + if (selectRight.length > 0) { ElMessage.warning("璇峰厛灏嗗彸渚ф暟鎹叏閮ㄥ缓绔嬫祦绋嬪崱鍚庝繚瀛�") return; } let flowCardData = ref({ flowCard: selectRecords, - userName:username, - productionId:productionId + userName: username, + productionId: productionId }) request.post("/processCard/addFlowCard", flowCardData.value).then((res) => { if (res.code == 200) { ElMessage.success("淇濆瓨鎴愬姛") //router.push('/main/processCard/SplittingDetails?orderId=${orderId}') - router.push({path: '/main/processCard/AddProcessCard', query: {orderId: orderId,productionId:productionId,random:Math.random()}}) + router.push({ + path: '/main/processCard/AddProcessCard', + query: {orderId: orderId, productionId: productionId, random: Math.random()} + }) //location.reload(); } else { @@ -502,26 +617,26 @@ <div class="header" style="height: 5%;width: 100%"> <el-button - style="float: left" - @click="intoCreateProduct" id="searchButton1" - type="primary" :icon="ArrowLeftBold" - round> + round + style="float: left" + type="primary" + @click="intoCreateProduct"> {{ flag ? '杩斿洖' : '杩斿洖' }} </el-button> <!-- <el-button type="primary">淇濆瓨鍒嗘灦</el-button>--> -<!-- <el-button type="primary" :hidden="true">鍒嗘灦姹囨��</el-button>--> + <!-- <el-button type="primary" :hidden="true">鍒嗘灦姹囨��</el-button>--> <div style="width: 100px;"> </div> </div> <el-container style="height: 100%;width: 100%"> - <el-aside style="width: 44%;height: 100%" > + <el-aside style="width: 44%;height: 100%"> <vxe-grid - max-height="100%" - class="mytable-scrollbar" ref="xGridLeft" + class="mytable-scrollbar" + max-height="100%" v-bind="gridLeftOptions" v-on="gridEvents" > @@ -540,15 +655,15 @@ </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> + <el-button link size="small" type="primary" @click="getTableRow(row,'edit')">鎵撳嵃</el-button> + <el-button link size="small" type="primary" @click="getTableRow(row,'setType')">鎺掔増</el-button> + <el-button link size="small" type="primary" @click="getTableRow(row,'delete')">鍒犻櫎</el-button> </template> <template #num1_filter="{ column, $panel }"> <div> <div v-for="(option, index) in column.filters" :key="index"> - <input type="text" - v-model="option.data" + <input v-model="option.data" + type="text" @input="changeFilterEvent($event, option, $panel)"/> </div> </div> @@ -560,55 +675,55 @@ </el-aside> <div width="12%"> - <el-main style=""> - <span>閫変腑鏁伴噺:<el-input type="number" v-model="checkedNum"></el-input></span><br> + <el-main style=""> + <span>閫変腑鏁伴噺:<el-input v-model="checkedNum" clearable type="number"></el-input></span><br> <el-button type="primary" @click="addRight"> 鈫�</el-button> <br> <br> <el-button type="primary" @click="addLeft"> 鈫�</el-button> <br> <br> - <el-button @click="createProcessCard" type="primary">寤虹珛娴佺▼鍗�</el-button> + <el-button type="primary" @click="createProcessCard">寤虹珛娴佺▼鍗�</el-button> </el-main> </div> -<!-- 鍙充晶--> + <!-- 鍙充晶--> <div style="height: 100%;width: 100%"> - <el-aside style="width: 100%;height: 100%"> - <vxe-grid + <el-aside style="width: 100%;height: 100%"> + <vxe-grid - max-height="100%" - class="mytable-scrollbar" - ref="xGrid" - v-bind="gridOptions" - > - <!-- @toolbar-button-click="toolbarButtonClickEvent"--> - <!-- 涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�--> - <template #content="{ row }"> - <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-else>{{ row[item.field] }}</span> - </li> - </ul> - </template> + ref="xGrid" + class="mytable-scrollbar" + max-height="100%" + v-bind="gridOptions" + > + <!-- @toolbar-button-click="toolbarButtonClickEvent"--> + <!-- 涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�--> + <template #content="{ row }"> + <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-else>{{ row[item.field] }}</span> + </li> + </ul> + </template> - <template #num1_filter="{ column, $panel }"> - <div> - <div v-for="(option, index) in column.filters" :key="index"> - <input type="text" - v-model="option.data" - @input="changeFilterEvent($event, option, $panel)"/> + <template #num1_filter="{ column, $panel }"> + <div> + <div v-for="(option, index) in column.filters" :key="index"> + <input v-model="option.data" + type="text" + @input="changeFilterEvent($event, option, $panel)"/> + </div> </div> - </div> - </template> - </vxe-grid> - </el-aside> + </template> + </vxe-grid> + </el-aside> </div> </el-container> </div> @@ -620,7 +735,7 @@ height: 100%; } -.header{ +.header { width: 100%; height: 35px; margin-top: -20px; -- Gitblit v1.8.0