From e50fa16b6dbc4e7c50d5fbdbc04d2a556ca01c4e Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期一, 02 十二月 2024 11:26:36 +0800
Subject: [PATCH] 补片流程卡调整
---
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/ProjectMange.vue | 604 +++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 496 insertions(+), 108 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/ProjectMange.vue b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/ProjectMange.vue
index 0093d12..933e6bb 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/ProjectMange.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/ProjectMange.vue
@@ -1,25 +1,33 @@
<script setup>
-import {reactive, ref} from "vue";
+import {computed, reactive, ref} from "vue";
import {useI18n} from "vue-i18n";
+import deepClone from "@/utils/deepClone"
import {Search} from "@element-plus/icons-vue";
-import {ElDatePicker} from "element-plus";
+import request from "@/utils/request";
+import {ElDatePicker, ElMessage, ElMessageBox} from "element-plus";
import useOrderInfoStore from "@/stores/sd/order/orderInfo";
+import useUserInfoStore from "@/stores/userInfo";
+import userInfo from "@/stores/userInfo";
+import GlassComputed from "@/views/pp/glassOptimize/GlassComputed.vue";
-const { t } = useI18n()
+const {t} = useI18n()
+const userStore = useUserInfoStore()
+const user = userInfo()
+const orderInfo = useOrderInfoStore()
const xGrid = ref()
const gridOptions = reactive({
- height:'100%',
+ height: '100%',
loading: false,
- border: "full",//琛ㄦ牸鍔犺竟妗�
+ border: "full",//琛ㄦ牸鍔犺竟妗�
keepSource: true,//淇濇寔婧愭暟鎹�
align: 'center',//鏂囧瓧灞呬腑
- stripe:true,//鏂戦┈绾�
- rowConfig: {isCurrent: true, isHover: true,height: 30, useKey: true},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
+ stripe: true,//鏂戦┈绾�
+ rowConfig: {isCurrent: true, isHover: true, height: 30, useKey: true},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
id: 'ProjectMange',
- scrollX:{enabled: true},
- scrollY:{ enabled: true ,gt:0},//寮�鍚櫄鎷熸粴鍔�
- showOverflow:true,
+ scrollX: {enabled: true},
+ scrollY: {enabled: true, gt: 0},//寮�鍚櫄鎷熸粴鍔�
+ showOverflow: true,
columnConfig: {
resizable: true,
useKey: true
@@ -35,124 +43,508 @@
mode: 'row',
showStatus: true
},
- /*formConfig: {
- data: {
- width: '',
- height: '',
- quantity: ''
- },
- items: [
- { field: 'width', title: t('order.width')+':', itemRender: { name: 'VxeInput' } },
- { field: 'height', title: t('order.height')+':', itemRender: { name: 'VxeInput' } },
- { field: 'quantity', title: t('order.quantity')+':', itemRender: { name: 'VxeInput' } },
- {
- itemRender: {
- name: 'VxeButtonGroup',
- options: [
- { type: 'submit', content: t('craft.sure'), status: 'primary' },
- { type: 'reset', content: t('product.msg.reset') }
- ]
- }
- }
- ]
- },*/
- columns:[
- {type:'expand',fixed:"left",slots: { content:'content' },width: 50},
- {field: 'id', width: 100,title: '宸ョ▼鍙�',},
- {field: '',width: 50,title: '鍚嶇О',},
- {field: 'id', width: 50,title: '鑶滅郴',},
- {field: 'id', width: 50,title: '鍘氬害',},
- {field: 'id', width: 50,title: '绫诲瀷',},
- {field: 'id', width: 50,title: '鐘舵��',},
- {field: 'id', width: 50,title: '鏁伴噺',},
- {field: 'id', width: 50,title: '闈㈢Н',},
- {field: 'id', width: 100,title: '娴佺▼鍗℃暟閲�',},
- {field: 'id', width: 100,title: '鍘熺墖浣跨敤鏁�',},
- {field: 'id', width: 70,title: '娴佺▼鍗�',},
- {field: 'id', width: 100,title: '閽㈠寲瑁呰浇鐜�',},
- {field: '',width: 100,title: '閽㈠寲鐐夋暟',},
- {field: '',width: 100,title: '骞冲潎鍒囪鐜�',},
- {field: '',width: 100,title: '鏈夋晥鍒囪鐜�',},
- {field: '',width: 100,title: '灏剧墖鍒囪鐜�',},
- {field: '',width: 100,title: '鍘熸枡浣跨敤鏁�',},
- {field: '',width: 100,title: '骞冲潎鍒囪鐜�',},
- {field: '',width: 50,title: '澶囨敞',},
- {field: '',width: 100,title: '鍒涘缓浜�',},
- {field: '',width: 100,title: '鍒涘缓鏃堕棿',},
- {field: '',width: 100,title: '淇敼鏃堕棿',},
+
+ columns: [
+ {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50},
+ {field: 'projectNumber', width: 100, title: '宸ョ▼鍙�', filters: [{data: ''}], slots: {filter: 'num1_filter'},},
+ {field: 'projectName', width: 50, title: '鍚嶇О',},
+ {field: 'glassType', width: 50, title: '鑶滅郴',},
+ {field: 'thickness', width: 50, title: '鍘氬害',},
+ {field: 'type', width: 50, title: '绫诲瀷',},
+ {field: 'state', width: 50, title: '鐘舵��',},
+ {field: 'quantity', width: 50, title: '鏁伴噺',},
+ {field: 'area', width: 50, title: '闈㈢Н',},
+ {field: 'processCardQuantity', width: 100, title: '娴佺▼鍗℃暟閲�',},
+ {field: 'usingQuantity', width: 100, title: '鍘熺墖浣跨敤鏁�',},
+ {field: 'processCardCollection', width: 70, title: '娴佺▼鍗�',},
+ {field: 'temperedLoadingRate', width: 100, title: '閽㈠寲瑁呰浇鐜�',},
+ {field: 'numberOfTemperingFurnaces', width: 100, title: '閽㈠寲鐐夋暟',},
+ {field: 'averageCuttingRate', width: 100, title: '骞冲潎鍒囪鐜�',},
+ {field: 'effectiveCuttingRate', width: 100, title: '鏈夋晥鍒囪鐜�',},
+ {field: 'residueGlassCuttingRate', width: 100, title: '灏剧墖鍒囪鐜�',},
+ {field: 'amountOfOriginalGlassUsage1', width: 100, title: '鍘熸枡浣跨敤鏁�',},
+ {field: 'averageCuttingRate1', width: 100, title: '骞冲潎鍒囪鐜�',},
+ {field: 'notes', width: 50, title: '澶囨敞',},
+ {field: 'creator', width: 100, title: '鍒涘缓浜�',},
+ {field: 'createTime', width: 100, title: '鍒涘缓鏃堕棿',},
+ {field: 'modifyTime', width: 100, title: '淇敼鏃堕棿',},
],//琛ㄥご鍙傛暟
- data:null,//琛ㄦ牸鏁版嵁
+ data: null,//琛ㄦ牸鏁版嵁
+ //鍙抽敭鑿滃崟閫夐」
+ menuConfig: {
+ body: {
+ options: [
+ [
+ {code: 'openproject', name: '鎵撳紑宸ョ▼', prefixIcon: 'vxe-icon-folder-open'},
+ {code: 'compute', name: '妯℃嫙璁$畻', prefixIcon: 'vxe-icon-subtable'},
+ {code: 'optimizetypography', name: '浼樺寲鎺掔増', prefixIcon: 'vxe-icon-menu'},
+ {code: 'production', name: '鍏佽鐢熶骇', prefixIcon: 'vxe-icon-square-checked'},
+ {code: 'novisible', name: '鐢熶骇涓嶅彲瑙�', prefixIcon: 'vxe-icon-eye-fill-close'},
+ {code: 'copyproject', name: '澶嶅埢宸ョ▼', prefixIcon: 'vxe-icon-copy'},
+ {code: 'undooptimize', name: '鎾ら攢浼樺寲', prefixIcon: 'vxe-icon-error-circle-fill'},
+ {code: 'undocompute', name: '鎾ら攢妯℃嫙璁$畻', prefixIcon: 'vxe-icon-error-circle-fill'},
+ {code: 'Initializeproject', name: '鍒濆鍖栧伐绋�', prefixIcon: 'vxe-icon-undo'},
+ {code: 'delproject', name: '鍒犻櫎宸ョ▼', prefixIcon: 'vxe-icon-delete'},
+ {code: 'viewTempered', name: '鏌ョ湅閽㈠寲鐗堝浘', prefixIcon: 'vxe-icon-custom-column'},
+ {code: 'viewOptimize', name: '鏌ョ湅浼樺寲鐗堝浘', prefixIcon: 'vxe-icon-layout'},
+ {code: 'Export', name: '鏁版嵁瀵煎嚭', prefixIcon: 'vxe-icon-download', visible: true, disabled: false},
+
+ ],
+ []
+ ]
+ },
+ },
toolbarConfig: {
buttons: [],
- slots:{
+ slots: {
buttons: "toolbar_buttons"
},
},
})
-const oderInfo = useOrderInfoStore()
+// 瀹氫箟鎿嶄綔閰嶇疆瀵硅薄鏁扮粍锛岄泦涓鐞嗕笉鍚屾搷浣滈�夐」瀵瑰簲鐨勫弬鏁�
+const operationConfigs = [
+ {
+ code: 'compute', // 鎵撳紑妯℃嫙璁$畻鎿嶄綔
+ initialState: ['1', '2'], //
+ targetState: null,
+ successMsg: '妯℃嫙璁$畻宸插惎鍔紒',
+ checkMessage: '褰撳墠宸ョ▼鐘舵�佷笉绗﹀悎妯℃嫙璁$畻鏉′欢锛岃纭宸ョ▼鐘舵�佸悗鍐嶆搷浣滐紒',
+ requiresRow: true,
+ actionFunction: () => {
+ optimizeCompute.value = true;
+ Mange.value = false;
+ }
+ },
+ {
+ code: 'undocompute',
+ initialState: '10',
+ targetState: 2,
+ successMsg: '鎾ら攢妯℃嫙璁$畻鎴愬姛锛屾暟鎹凡鏇存柊锛�',
+ checkMessage: '褰撳墠宸ョ▼鐘舵�佷笉绗﹀悎鎾ら攢妯℃嫙璁$畻鏉′欢锛岃纭宸ョ▼鐘舵�佸悗鍐嶆搷浣滐紒',
+ requiresRow: true,
+ },
+ {
+ code: 'undooptimize',
+ initialState: '20',
+ targetState: 10,
+ successMsg: '鎾ら攢浼樺寲鎴愬姛锛屾暟鎹凡鏇存柊锛�',
+ checkMessage: '褰撳墠宸ョ▼鐘舵�佷笉绗﹀悎鎾ら攢浼樺寲鏉′欢锛岃纭宸ョ▼鐘舵�佸悗鍐嶆搷浣滐紒',
+ requiresRow: true,
+ },
+ {
+ code: 'production',
+ initialState: '20',
+ targetState: 100,
+ successMsg: '璁剧疆鎴愬姛锛屽厑璁哥敓浜э紒',
+ checkMessage: '褰撳墠宸ョ▼鐘舵�佷笉绗﹀悎鍏佽鐢熶骇鏉′欢锛岃纭宸ョ▼鐘舵�佸悗鍐嶆搷浣滐紒',
+ requiresRow: true,
+ },
+ {
+ code: 'novisible',
+ initialState: '100',
+ targetState: 20,
+ successMsg: '璁剧疆鎴愬姛锛岀敓浜т笉鍙锛�',
+ checkMessage: '褰撳墠宸ョ▼鐘舵�佷笉绗﹀悎鐢熶骇涓嶅彲瑙佹潯浠讹紝璇风‘璁ゅ伐绋嬬姸鎬佸悗鍐嶆搷浣滐紒',
+ requiresRow: true,
+ },
+ {
+ code: 'Initializeproject',
+ initialState: ['2', '10', '20'],
+ targetState: 1,
+ successMsg: '鍒濆鍖栧伐绋嬫垚鍔燂紒',
+ checkMessage: '褰撳墠宸ョ▼鐘舵�佷笉绗﹀悎鍒濆鍖栨潯浠讹紝璇风‘璁ゅ伐绋嬬姸鎬佸悗鍐嶆搷浣滐紒',
+ requiresRow: true,
+ },
+ {
+ code: 'delproject',
+ initialState: ['1', '2', '10', '20', '100'],
+ targetState: null,
+ successMsg: '宸ョ▼鍒犻櫎鎴愬姛锛�',
+ checkMessage: '褰撳墠宸ョ▼鐘舵�佷笉绗﹀悎鍒犻櫎鏉′欢锛岃纭宸ョ▼鐘舵�佸悗鍐嶆搷浣滐紒',
+ },
+ {
+ code: 'Export', // 瀵煎嚭鏂囦欢鎿嶄綔鐨勯厤缃�
+ initialState: [],
+ targetState: null,
+ successMsg: '鏂囦欢瀵煎嚭鎴愬姛锛�',
+ gridRef: xGrid,
+ requiresRow: false,
+ },
+ {
+ code: 'viewTempered',
+ initialState: [],
+ targetState: null,
+ successMsg: '閽㈠寲鐗堝浘宸叉墦寮�锛�',
+ failureMsg: '宸ョ▼鍒犻櫎澶辫触锛岃鑱旂郴绠$悊鍛橈紒',
+ },
+ {
+ code: 'viewOptimize',
+ initialState: [],
+ targetState: null,
+ successMsg: '浼樺寲鐗堝浘宸叉墦寮�锛�',
+ failureMsg: '宸ョ▼鍒犻櫎澶辫触锛岃鑱旂郴绠$悊鍛橈紒',
+ }
+];
+function getOriginalState(targetState) {
+ // 鏍规嵁宸ョ▼鐘舵�佽繑鍥炲搴旂殑鍘熷鐘舵��
+ const stateMapping = {
+ 2: '10',
+ 10: '20',
+ 100: '200',
+ 200: '100',
+ 1:['2', '10', '20'],
+ };
+ return stateMapping[targetState] || targetState;
+}
+//鍙抽敭鑿滃崟鏉′欢鍒ゆ柇
+function checkOperationCondition(config, row) {
+ if (!config.requiresRow ||!row) {
+ return false;
+ }
+ if (Array.isArray(config.initialState)) {
+ return config.initialState.includes(String(row.state));
+ }
+ return config.initialState === String(row.state);
+}
+// 鍙抽敭鑿滃崟鐐瑰嚮浜嬩欢
+const gridEvents = {
+ menuClick({ menu, row }) {
+ const $grid = xGrid.value;
+ if ($grid) {
+ const config = operationConfigs.find(c => c.code === menu.code);
+ if (config) {
+ if (config.requiresRow &&!row) {
+ ElMessage.warning('鏈�変腑宸ョ▼锛岃閫変腑宸ョ▼鍚庡啀杩涜褰撳墠鎿嶄綔锛�');
+ return;
+ }
+ if (config.code === 'Export') {
+ config.gridRef.value.exportData();
+ ElMessage.success(config.successMsg);
+ return;
+ }
+ // 娣诲姞纭鎻愮ず寮圭獥锛岃闂敤鎴锋槸鍚﹁繘琛屽綋鍓嶆搷浣�
+ ElMessageBox.confirm('鏄惁杩涜褰撳墠鎿嶄綔锛�', '纭鎿嶄綔', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ if (config.code === 'viewTempered'){
+ ElMessageBox.alert('褰撳墠鐐瑰嚮鐨勬槸鏌ョ湅閽㈠寲鐗堝浘鍔熻兘锛岀洰鍓嶆殏鏃朵粎鍋氭彁绀猴紝鏆傛棤瀹為檯鏌ョ湅鎿嶄綔!', '鍔熻兘鎻愮ず', {
+ confirmButtonText: '鎴戠煡閬撲簡'
+ });
+ return;
+ }
+ if (config.code === 'viewOptimize'){
+ ElMessageBox.alert('褰撳墠鐐瑰嚮鐨勬槸鏌ョ湅閽㈠寲鐗堝浘鍔熻兘锛岀洰鍓嶆殏鏃朵粎鍋氭彁绀猴紝鏆傛棤瀹為檯鏌ョ湅鎿嶄綔!', '鍔熻兘鎻愮ず', {
+ confirmButtonText: '鎴戠煡閬撲簡'
+ });
+ return;
+ }
+ if (config.code === 'delproject') {
+ if (!row) {
+ ElMessage.warning(config.checkMessage);
+ return;
+ }
+ const isInitialStateMatched = config.initialState.includes(String(row.state));
+ if (!isInitialStateMatched) {
+ ElMessage.warning(config.checkMessage);
+ return;
+ }
+ deleteProject(row.projectNumber, config);
+ } else if (!checkOperationCondition(config, row)) {
+ ElMessage.warning(config.checkMessage);
+ return;
+ } else {
+ if (config.code === 'compute') {
+ config.actionFunction();
+ } else {
+ row.state = config.targetState;
+ const index = produceList.value.findIndex(item => item === row);
+ if (index!== -1) {
+ produceList.value.splice(index, 1, {...row });
+ xGrid.value.reloadData(produceList.value);
+ }
+ updateProjectStateAndHandleResponse(row, row.projectNumber, config.targetState, config.successMsg);
+ }
+ }
+ }).catch(() => {
+ // 鐢ㄦ埛鐐瑰嚮鍙栨秷鍚庢墽琛岀殑閫昏緫
+ ElMessage.info('宸插彇娑堟搷浣�');
+ });
+ } else {
+ console.error(`鏈壘鍒版搷浣滈�夐」 ${menu.code} 瀵瑰簲鐨勯厤缃紝璇锋鏌ラ厤缃」`);
+ }
+ }
+ }
+};
+// 灏佽鍙戦�佸彸閿彍鍗曡姹傘�佸鐞嗗搷搴斾互鍙婇敊璇洖婊氱瓑閫昏緫鐨勫嚱鏁�
+function rollbackStateAndReloadGrid(row, targetState) {
+ row.state = getOriginalState(targetState);
+ const rollbackIndex = produceList.value.findIndex(item => item === row);
+ if (rollbackIndex!== -1) {
+ produceList.value.splice(rollbackIndex, 1, {...row});
+ xGrid.value.reloadData(produceList.value);
+ }
+}
+function updateProjectStateAndHandleResponse(row, projectNumber, targetState, successMsg) {
+ const updateParams = {
+ projectNumber: projectNumber,
+ stateToUpdate: targetState
+ };
+ request.post(`/glassOptimize/updateProjectState/${projectNumber}/${targetState}`, updateParams, {
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ }).then((res) => {
+ if (Number(res.code) === 200 && (res.msg === "" || res.msg === null)) {
+ ElMessage.success(successMsg);
+ } else {
+ console.log('res.code 鐨勫��:', res.code, ', 绫诲瀷:', typeof res.code);
+ console.log('res.msg 鐨勫��:', res.msg, ', 绫诲瀷:', typeof res.msg);
+ const errorMsg = res.data? res.data.errorMessage : '鎿嶄綔澶辫触锛屾湭鑾峰彇鍒板叿浣撳師鍥狅紝璇疯仈绯荤鐞嗗憳';
+ ElMessage.error(`鎿嶄綔澶辫触锛屽師鍥�: ${errorMsg}`);
+ rollbackStateAndReloadGrid(row, targetState); // 璋冪敤鍥炴粴鍑芥暟
+ }
+ }).catch((error) => {
+ console.error('璇锋眰鍑洪敊锛屾搷浣滄湭瀹屾垚锛岃缁嗛敊璇俊鎭�:', error);
+ const errorMsg = (res.data && res.data.errorMessage)? res.data.errorMessage : '鎿嶄綔澶辫触锛屾湭鑾峰彇鍒板叿浣撳師鍥狅紝璇疯仈绯荤鐞嗗憳';
+ ElMessage.error(`璇锋眰鍑洪敊锛屾搷浣滄湭瀹屾垚锛屽師鍥�: ${errorMsg}`);
+ rollbackStateAndReloadGrid(row, targetState); // 璋冪敤鍥炴粴鍑芥暟
+ });
+}
+
+//鍒犻櫎宸ョ▼
+function deleteProject(projectNumber, config) {
+ request.post(`/glassOptimize/deleteProject/${projectNumber}`, {
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ }).then((res) => {
+ if (Number(res.code) === 200 && (res.msg === "" || res.msg === null)) {
+ ElMessage.success(config.successMsg);
+ // 浠庡垪琛ㄤ腑绉婚櫎宸插垹闄ょ殑宸ョ▼鏁版嵁
+ const index = produceList.value.findIndex(item => item.projectNumber === projectNumber);
+ if (index!== -1) {
+ produceList.value.splice(index, 1);
+ xGrid.value.reloadData(produceList.value);
+ }
+ } else {
+ console.log('res.code 鐨勫��:', res.code, ', 绫诲瀷:', typeof res.code);
+ console.log('res.msg 鐨勫��:', res.msg, ', 绫诲瀷:', typeof res.msg);
+ const errorMsg = res.data? res.data.errorMessage : config.failureMsg;
+ ElMessage.error(`鎿嶄綔澶辫触锛屽師鍥�: ${errorMsg}`);
+ }
+ }).catch((error) => {
+ console.error('璇锋眰鍑洪敊锛屽伐绋嬪垹闄ゆ湭瀹屾垚锛岃缁嗛敊璇俊鎭�:', error);
+ const errorMsg = (res.data && res.data.errorMessage)? res.data.errorMessage : config.failureMsg;
+ ElMessage.error(`璇锋眰鍑洪敊锛屽伐绋嬪垹闄ゆ湭瀹屾垚锛屽師鍥�: ${errorMsg}`);
+ });
+}
+
+//瀹氫箟妯℃嫙璁$畻寮圭獥榛樿闅愯棌
+const optimizeCompute = ref(false)
+const Mange = ref(true)
//瀹氫箟宸ョ▼鐘舵��
-const optionVal = ref('0')
+const optionVal = ref('all')
const options = [
{
- value: '0',
+ value: 'all',
label: '鍏ㄩ儴',
},
{
value: '1',
- label: '1',
+ label: '鍒濆宸ョ▼',
},
{
value: '2',
- label: '2',
+ label: '绗竴娆′紭鍖�',
},
{
- value: '3',
- label: '10',
+ value: '10',
+ label: '妯℃嫙璁$畻淇濆瓨',
},
{
- value: '4',
- label: '20',
+ value: '20',
+ label: '浼樺寲淇濆瓨',
},
{
- value: '5',
- label: '100',
+ value: '100',
+ label: '鍏佽鐢熶骇',
},
{
- value: '6',
- label: '200',
+ value: '200',
+ label: '宸查鍙�',
},
]
+
+//宸ョ▼鐘舵�佸嚱鏁�
+function handleOptionChange() {
+ if (optionVal.value === 'all') {
+ // 娓呯┖宸ョ▼鐘舵�佺浉鍏崇殑宸叉湁绛涢�夋潯浠�
+ delete filterData.value['state'];
+ } else {
+ filterData.value['state'] = optionVal.value; // 鏄庣‘娣诲姞閫夋嫨鐨勫伐绋嬬姸鎬佸�煎埌绛涢�夋潯浠朵腑
+ }
+ getWorkOrder();
+}
+
+//鍏叡鍑芥暟
+function buildRequestParams() {
+ let startSelectTime = orderInfo.workOrderDate[0];
+ let endSelectTime = orderInfo.workOrderDate[1];
+
+ const params = {
+ startSelectTime,
+ endSelectTime,
+ };
+
+ return params;
+}
+
+//绛涢�夋潯浠�
+let filterData = ref({
+ projectNumber: '',
+})
+// 瀹氫箟鏁版嵁杩斿洖缁撴灉锛屼娇鐢╮ef鍒涘缓鍝嶅簲寮忔暟鎹紝鍒濆鍖栦负绌烘暟缁�
+let produceList = ref([])
+
+// 鑾峰彇15澶╁墠鍒板綋鍓嶆椂闂�
+function getNowTime() {
+ const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 15)
+ .toISOString()
+ .replace('T', ' ')
+ .slice(0, 10) //榛樿寮�濮嬫椂闂�15澶╁墠
+ const end = new Date(new Date().getTime())
+ .toISOString()
+ .replace('T', ' ')
+ .slice(0, 10)//榛樿缁撴潫鏃堕棿褰撳墠鏃堕棿
+ return [start, end]
+}
+
+// 鍒濆鍖栨椂闂磋寖鍥达紝鑻ヤ负绌哄垯璁句负杩�15澶╂椂闂�
+if (orderInfo.workOrderDate[0] === "" && orderInfo.workOrderDate[1] === "") {
+ orderInfo.workOrderDate = getNowTime();
+}
+//鑾峰彇閫変腑鏃堕棿
+let startSelectTime = orderInfo.workOrderDate[0]
+let endSelectTime = orderInfo.workOrderDate[1]
+// 棣栨鍔犺浇鏁版嵁
+request.post(`/glassOptimize/optimizeProjectMange/${startSelectTime}/${endSelectTime}`, filterData.value).then((res) => {
+ if (res.code == 200) {
+ produceList.value = produceList.value.concat(deepClone(res.data.data))
+ xGrid.value.reloadData(produceList.value);
+ gridOptions.loading = false;
+ } else {
+ ElMessage.warning(res.msg);
+ }
+})
+
+/*浣跨敤绛涢�夛紝鍚庣鑾峰彇鏁版嵁*/
+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();
+ //鍒ゆ柇鏄惁涓哄伐绋嬬姸鎬佸垪鐨勭瓫閫夋敼鍙橈紙鍋囪宸ョ▼鐘舵�佸瓧娈靛悕涓�'state'锛屽彲鏍规嵁瀹為檯鎯呭喌璋冩暣锛�
+ if (column.property === 'state') {
+ if (value === 'all') {
+ // 濡傛灉閫夋嫨鐨勬槸鍏ㄩ儴锛屼粠绛涢�夋暟鎹腑鍒犻櫎姝ゆ潯浠讹紝閬垮厤浼犻�掔粰鍚庣骞叉壈鑾峰彇鍏ㄩ儴鏁版嵁
+ delete filterData.value['state'];
+ } else {
+ filterData.value['state'] = value;
+ }
+ } else {
+ //鍒ゆ柇鏄惁瀛樺湪澶栭敭
+ if (column.property.indexOf('.') > -1) {
+ const columnArr = column.property.split('.');
+ filterData.value[columnArr[0]] = {
+ [columnArr[1]]: value,
+ };
+ } else {
+ filterData.value[column.property] = value;
+ }
+ }
+
+ const params = buildRequestParams();
+ request.post(`/glassOptimize/optimizeProjectMange/${params.startSelectTime}/${params.endSelectTime}`, filterData.value).then((res) => {
+ if (res.code == 200) {
+ produceList.value = deepClone(res.data.data);
+ xGrid.value.reloadData(produceList)
+ gridOptions.loading = false
+ } else {
+ ElMessage.warning(res.msg)
+ }
+ });
+}
+
+// 鐐瑰嚮鏌ヨ鎸夐挳瑙﹀彂鐨勫嚱鏁帮紝鏍规嵁褰撳墠绛涢�夋潯浠惰幏鍙栨暟鎹苟鍔犺浇鍒拌〃鏍�
+const getWorkOrder = () => {
+ const params = buildRequestParams();
+ request.post(`/glassOptimize/optimizeProjectMange/${params.startSelectTime}/${params.endSelectTime}`, filterData.value).then((res) => {
+ if (res.code == 200) {
+ produceList.value = deepClone(res.data.data);
+ gridOptions.data = produceList.value;
+ xGrid.value.reloadData(produceList.value);
+ gridOptions.loading = false;
+ } else {
+ ElMessage.warning(res.msg);
+ }
+ });
+};
+// 璁$畻灏忕墖鏁伴噺
+const smallPieceQuantityInput = computed(() => {
+ return produceList.value.reduce((acc, item) => acc + item.quantity, 0);
+});
+// 璁$畻灏忕墖闈㈢Н
+const smallPieceAreaInput = computed(() => {
+ const sum = produceList.value.reduce((acc, item) => acc + item.area, 0);
+ return Number(sum.toFixed(2)); // 鍏堜娇鐢╰oFixed淇濈暀涓や綅灏忔暟锛屽啀杞崲鍥炴暟鍊肩被鍨嬶紙鍥犱负toFixed杩斿洖瀛楃涓诧級
+});
+
+// 璁$畻鍘熺墖鏁伴噺
+const originalPieceQuantityInput = computed(() => {
+ return produceList.value.reduce((acc, item) => acc + item.usingQuantity, 0);
+});
+
+// 鍘熺墖闈㈢Н鍥哄畾涓�0锛岀洿鎺ヨ繑鍥�0
+const originalPieceAreaInput = 0;
</script>
<template>
- <div id="mange">
+ <div id="mange">
+ <glass-computed v-if="optimizeCompute"/>
+ <div style="height: 100%; width: 100%" v-if="Mange">
<div id="select">
<span>浼樺寲鏃ユ湡</span>
<el-date-picker
style="margin-left:10px; margin-top: -5px; "
- v-model="oderInfo.mangeDate"
+ v-model="orderInfo.workOrderDate"
+ :default-time="defaultTime"
+ :start-placeholder="$t('basicData.startDate')"
+ :end-placeholder="$t('basicData.endDate')"
type="daterange"
format="YYYY/MM/DD"
value-format="YYYY-MM-DD"
- :start-placeholder="$t('basicData.startDate')"
- :end-placeholder="$t('basicData.endDate')"
- :default-time="defaultTime"
-
/>
+ <span class="input">宸ョ▼鐘舵��</span>
<el-select
- style="margin-left:10px; margin-top: -5px; "
+ style="margin-left:10px; margin-top: -5px; width: 150px"
:default-first-option="true"
ref="getSelect"
v-model="optionVal"
clearable
class="m-2"
- @change="getWorkOrder"
- >
-
+ @change="handleOptionChange"
+ >
<el-option
v-for="item in options"
:key="item.value"
@@ -160,27 +552,27 @@
:value="item.value"
/>
</el-select>
-
+ <!--鏌ヨ-->
<el-button
style="margin-left:10px;margin-top: -5px"
- @click="searchByDateRange"
- type="primary" :icon="Search">
- 鏌ヨ
+ :icon="Search"
+ type="primary"
+ @click="getWorkOrder">{{ $t('basicData.search') }}
</el-button>
</div>
<vxe-grid
- @filter-change="filterChanged"
height="100%"
class="mytable-scrollbar"
ref="xGrid"
v-bind="gridOptions"
v-on="gridEvents"
+ @filter-change="filterChanged"
>
- <template #num2_filter="{ column, $panel }">
+ <template #select_filter="{ column, $panel }">
<div>
<div v-for="(option, index) in column.filters" :key="index">
- <vxe-select v-model="option.data" :placeholder="$t('processCard.pleaseSelect')" @change="changeFilterEvent($event, option, $panel)">
+ <vxe-select v-model="option.data" @change="changeFilterEvent($event, option, $panel)">
<vxe-option value="0" :label="$t('basicData.unchecked')"></vxe-option>
<vxe-option value="1" :label="$t('basicData.selected')"></vxe-option>
</vxe-select>
@@ -191,43 +583,39 @@
<template #num1_filter="{ column, $panel }">
<div>
<div v-for="(option, index) in column.filters" :key="index">
- <input
- type="type"
- v-model="option.data"
- @keyup.enter.native="$panel.confirmFilter()"
- @input="changeFilterEvent($event, option, $panel)"/>
+ <input v-model="option.data" type="text"
+ @keyup.enter.native="$panel.confirmFilter()"
+ @input="changeFilterEvent($event, option, $panel)"/>
</div>
</div>
</template>
</vxe-grid>
<div id="last">
- <span>
- 灏忕墖鏁�<vxe-input size="small" class="input" disabled></vxe-input>
- 灏忕墖闈�<vxe-input size="small" class="input" disabled></vxe-input>
- 鍘熺墖鏁�<vxe-input size="small" class="input" disabled></vxe-input>
- 鍘熺墖闈�<vxe-input size="small" class="input" disabled></vxe-input>
- </span>
- <span style="float: right">
- <el-button type="primary" class="input">閽㈠寲鐗堝浘</el-button>
- <el-button type="primary" class="input">妯℃嫙璁$畻</el-button>
- <el-button type="primary" class="input">浼樺寲鐗堝浘</el-button>
- <el-button type="primary" class="input">浼樺寲鎺掔増</el-button>
- <el-button type="primary" class="input">鏁版嵁瀵煎嚭</el-button>
- </span>
+ 灏忕墖鏁伴噺
+ <el-input class="input" disabled v-model="smallPieceQuantityInput"></el-input>
+ 灏忕墖闈㈢Н
+ <el-input class="input" disabled v-model="smallPieceAreaInput"></el-input>
+ 鍘熺墖鏁伴噺
+ <el-input class="input" disabled v-model="originalPieceQuantityInput"></el-input>
+ 鍘熺墖闈㈢Н
+ <el-input class="input" disabled v-model="originalPieceAreaInput"></el-input>
</div>
</div>
+ </div>
</template>
<style scoped>
-#mange{
+#mange {
width: 100%;
height: 85%;
}
+
#last {
margin-top: 10px;
}
-.input{
+
+.input {
width: 80px;
- margin-left: 15px;
+ margin-left: 10px;
}
</style>
\ No newline at end of file
--
Gitblit v1.8.0