diff --git a/src/pages/raw/handover/aggregating/model.ts b/src/pages/raw/handover/aggregating/model.ts index 6dbaef9..e90b40a 100644 --- a/src/pages/raw/handover/aggregating/model.ts +++ b/src/pages/raw/handover/aggregating/model.ts @@ -86,15 +86,8 @@ export class AggregatingModule extends VuexModule { */ @Mutation checkAllAggregateList(checked: boolean) { - console.log('this.nodel.aggregateList222', this.aggregateList); - this.aggregateList = this.aggregateList.map((item: any) => { - item.checked = checked; - if (item.checked) { - item.hvAmount = item.totalMoAmount - item.totalHvAmount; - } else { - item.hvAmount = 0; - } - return item; + this.aggregateList.map((item: any) => { + Object.assign(item, { checked, hvAmount: (checked && item.totalMoAmount - item.totalHvAmount) || 0 }); }); } /** @@ -103,15 +96,8 @@ export class AggregatingModule extends VuexModule { */ @Mutation checkAllOrderList(checked: boolean) { - console.log('this.nodel.orderList222', this.orderList); - this.orderList = this.orderList.map((item: any) => { - item.checked = checked; - if (item.checked) { - item.hvAmount = item.totalMoAmount - item.totalHvAmount; - } else { - item.hvAmount = 0; - } - return item; + this.orderList.map((item: any) => { + Object.assign(item, { checked, hvAmount: (checked && item.totalMoAmount - item.totalHvAmount) || 0 }); }); } /** @@ -129,8 +115,6 @@ export class AggregatingModule extends VuexModule { */ @Mutation setAggregateListItemHvAmount({ index, hvAmount }: { index: number; hvAmount: number }) { - const original = this.aggregateList[index]; - const newItem = { ...original, hvAmount }; this.aggregateList[index].hvAmount = hvAmount; // this.aggregateList.splice(index, 1, newItem); // if (this.aggregateList[index].checked) { @@ -146,8 +130,6 @@ export class AggregatingModule extends VuexModule { */ @Mutation setOrderListItemHvAmount({ index, hvAmount }: { index: number; hvAmount: number }) { - const original = this.orderList[index]; - const newItem = { ...original, hvAmount }; // this.orderList.splice(index, 1, newItem); this.orderList[index].hvAmount = hvAmount; } @@ -256,12 +238,8 @@ export class AggregatingModule extends VuexModule { await http.post(url.sumscan.lock.list, queryParams); const orderList = cloneDeep(proOrderResultList); orderList.map((item: any) => { - item.checked = false; + Object.assign(item, { checked: false }); }); - if (orderList.length == 0) { - return { orderList }; - } - console.log('orderList', orderList); return { orderList }; } /** @@ -305,7 +283,7 @@ export class AggregatingModule extends VuexModule { @Action({ commit: 'updateCheckedOrderInInfoListKw' }) async queryByFactoryCodeAndWorkAreaCode(content: any) { - let res = await http.post('/wmspda/fg/queryByFactoryCodeAndWorkAreaCode', content); + const res = await http.post('/wmspda/fg/queryByFactoryCodeAndWorkAreaCode', content); return res; } } diff --git a/src/pages/raw/handover/aggregating/order.vue b/src/pages/raw/handover/aggregating/order.vue index d534a10..4495732 100644 --- a/src/pages/raw/handover/aggregating/order.vue +++ b/src/pages/raw/handover/aggregating/order.vue @@ -2,7 +2,7 @@ - + {{ $t('message.Summary_HandoverByOrder') }} @@ -152,8 +152,9 @@ export default class AggregatingOrder extends BasePage { * 全选 */ onSelectAll() { - console.log('this.nodel.orderList111',this.model.orderList) - model.checkAllOrderList(!model.isOrderCheckedAll); + // console.log('this.nodel.orderList111', this.model.orderList, this.$refs.table); + const isOrderCheckedAll = !model.isOrderCheckedAll; + this.model.checkAllOrderList(isOrderCheckedAll); } clickIndex(e: any) { console.log('ccccc', e.data); @@ -165,7 +166,7 @@ export default class AggregatingOrder extends BasePage { //debugger; console.log('xuanzedeindex', e.data); console.log('hvmount', item.lineData.totalMoAmount - item.lineData.totalHvAmount); - model.setOrderListItemHvAmount({ + this.model.setOrderListItemHvAmount({ index: e.data[index].index, hvAmount: item.lineData.totalMoAmount - item.lineData.totalHvAmount, }); @@ -189,33 +190,6 @@ export default class AggregatingOrder extends BasePage { this.submitForm.receiverName = userInfo.userName; } - /** - * 确认 - */ - /**onOk() { - this.$amountForm.validate((valid) => { - if (!valid) return; - const firstSelection = this.model.orderList.find((_) => _.checked); - if (firstSelection === undefined) { - this.customToast(this.$t('message.Pi_tip7') as string); - } else { - // 本次交接数量 - const currentPickNum = parseFloat(this.amountForm.amount); - // 已交接数量 - const totalHvAmount = parseFloat(firstSelection.totalHvAmount); - // 拣配数量 - const totalMoAmount = parseFloat(firstSelection.totalMoAmount); - if (currentPickNum != totalMoAmount - totalHvAmount) { - this.customToast(this.$t('message.Pi_tip12') as string); - return; - } - model.setOrderListItemHvAmount({ - index: this.model.orderList.findIndex((_) => _.checked), - hvAmount: currentPickNum, - }); - } - }); - }**/ onSubmit() { this.$submitForm.validate(async (valid) => { if (valid) { @@ -230,9 +204,9 @@ export default class AggregatingOrder extends BasePage { }); let submit = false; let selectsta = true; - model.orderList.forEach((item, index) => { + this.model.orderList.forEach((item, index) => { if (!item.checked) { - model.setOrderListItemHvAmount({ index, hvAmount: 0 }); + this.model.setOrderListItemHvAmount({ index, hvAmount: 0 }); } else if (item.hvAmount == null || item.hvAmount == 0) { submit = true; } @@ -269,7 +243,7 @@ export default class AggregatingOrder extends BasePage { this.customToast(this.$t('message.Pi_tip15') as string); return; } - await model.uploadOrderList({ + await this.model.uploadOrderList({ operatorPass: this.submitForm.receiver, factoryCode: session.factoryCode, loginName: session.loginName, @@ -297,24 +271,14 @@ export default class AggregatingOrder extends BasePage { queryParams: this.model.orderOutIdListParams, proOrderResultList: this.model.proOrderResultList, }); - // model.orderList.forEach((item: any, index: any) => { - // if (item.orderOutId == this.spliceItem) { - // model.orderList.splice(index, 1); - // } - // }); - // model.proOrderResultList.forEach((item: any, index: any) => { - // if (item.orderOutId == this.spliceItem) { - // model.proOrderResultList.splice(index, 1); - // } - // }); - //this.$amountForm.setRules(this.amountFormRules); + this.$submitForm.setRules(this.submitFormRules); } /** * 解锁 */ async unlock() { - const orderOutIdList = model.proOrderResultList.map((_: any) => _.orderOutId); + const orderOutIdList = this.model.proOrderResultList.map((_: any) => _.orderOutId); try { await http.post(url.sumscan.unlock.list, { factoryCode: session.factoryCode, @@ -323,10 +287,6 @@ export default class AggregatingOrder extends BasePage { }); } catch (e) { this.customToast((this.$t('message.Summary_Tip') as string) + e.message); - // uni.showToast({ - // icon: 'none', - // title: (this.$t('message.Summary_Tip') as string) + e.message, - // }); } } } diff --git a/src/pages/raw/handover/aggregating/result.vue b/src/pages/raw/handover/aggregating/result.vue index 1f213fe..b49cfbd 100644 --- a/src/pages/raw/handover/aggregating/result.vue +++ b/src/pages/raw/handover/aggregating/result.vue @@ -2,7 +2,7 @@ - + {{ $t('message.Summary_Result') }} @@ -27,7 +27,7 @@ - {{ $t('message.po_Return') }} + {{ $t('message.po_Return') }} @@ -73,7 +73,7 @@ export default class AggregatingResult extends BasePage { * 按单 */ async onOrder() { - const orderOutIdList = this.model.proOrderResultList.map((_: any) => _.orderOutId); + const orderOutIdList = await this.model.proOrderResultList.map((_: any) => _.orderOutId); const params = { factoryCode: session.factoryCode, loginName: session.loginName, diff --git a/src/pages/raw/handover/aggregating/summary.vue b/src/pages/raw/handover/aggregating/summary.vue index 53f614a..34f35de 100644 --- a/src/pages/raw/handover/aggregating/summary.vue +++ b/src/pages/raw/handover/aggregating/summary.vue @@ -2,7 +2,7 @@ - + {{ $t('message.Summary_SummaryAndHandover') }} @@ -136,7 +136,8 @@ export default class AggregatingSummary extends BasePage { }; // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕 - onReady() { + onShow() { + this.model = model; /**this.$amountForm.setRules(this.amountFormRules);**/ this.$submitForm.setRules(this.submitFormRules); this.isBusinessFinished = false; @@ -153,7 +154,7 @@ export default class AggregatingSummary extends BasePage { //debugger; console.log('xuanzedeindex', e.data); console.log('hvmount', item.lineData.totalMoAmount - item.lineData.totalHvAmount); - model.setAggregateListItemHvAmount({ + this.model.setAggregateListItemHvAmount({ index: e.data[index].index, hvAmount: item.lineData.totalMoAmount - item.lineData.totalHvAmount, }); @@ -175,8 +176,8 @@ export default class AggregatingSummary extends BasePage { * 全选 */ onSelectAll() { - console.log('this.nodel.aggregateList111',this.model.aggregateList) - model.checkAllAggregateList(!model.isAggregateCheckedAll); + console.log('this.nodel.aggregateList111', this.model.aggregateList); + this.model.checkAllAggregateList(!this.model.isAggregateCheckedAll); } /** @@ -227,7 +228,7 @@ export default class AggregatingSummary extends BasePage { onSubmit() { this.$submitForm.validate(async (valid) => { if (valid) { - if (model.aggregateList.length === 0) { + if (this.model.aggregateList.length === 0) { this.customToast(this.$t('message.Pi_tip4') as string); } else { await auth.checkPassword({ @@ -237,7 +238,7 @@ export default class AggregatingSummary extends BasePage { }); let submit = false; let selectsta = true; - model.aggregateList.forEach((item) => { + this.model.aggregateList.forEach((item) => { if (!item.checked) { return; } else if (item.hvAmount == null || item.hvAmount == 0) { @@ -278,7 +279,7 @@ export default class AggregatingSummary extends BasePage { this.customToast(this.$t('message.Pi_tip15') as string); return; } - await model.uploadAggregateList({ + await this.model.uploadAggregateList({ operatorPass: this.submitForm.receiver, factoryCode: session.factoryCode as string, loginName: session.loginName as string, @@ -291,7 +292,7 @@ export default class AggregatingSummary extends BasePage { totalHvAmount: String(item.totalHvAmount), prdMaterialDesc: String(item.prdMaterialCode), })), - includeOrderOutIdList: model.proOrderResultList.map((item: any) => item.orderOutId), + includeOrderOutIdList: this.model.proOrderResultList.map((item: any) => item.orderOutId), }); setTimeout(() => { this.onAggregate(); diff --git a/src/plugins/wyb-table/wyb-table.vue b/src/plugins/wyb-table/wyb-table.vue index 3582a39..27d3bf8 100644 --- a/src/plugins/wyb-table/wyb-table.vue +++ b/src/plugins/wyb-table/wyb-table.vue @@ -45,8 +45,7 @@ maxWidth: checkColWidth + 'rpx', minHeight: minHeight[0] + 'rpx', textAlign: textAlign, - justifyContent: - textAlign === 'center' ? textAlign : textAlign === 'left' ? 'flex-start' : 'flex-end', + justifyContent: textAlign === 'center' ? textAlign : textAlign === 'left' ? 'flex-start' : 'flex-end', fontSize: fontSize[0] + 'rpx', color: headerFtColor, padding: padding[0] + 'rpx ' + (padding[1] || padding[0]) + 'rpx', @@ -93,27 +92,21 @@ maxWidth: (item.width || defaultColWidth) + 'rpx', minHeight: minHeight[0] + 'rpx', textAlign: textAlign, - justifyContent: - textAlign === 'center' ? textAlign : textAlign === 'left' ? 'flex-start' : 'flex-end', + justifyContent: textAlign === 'center' ? textAlign : textAlign === 'left' ? 'flex-start' : 'flex-end', fontSize: fontSize[0] + 'rpx', fontWeight: headerWeight ? 'bold' : 'normal', color: headerFtColor, padding: padding[0] + 'rpx ' + (padding[1] || padding[0]) + 'rpx', backgroundColor: headerBgColor, - borderRight: - index === headers.length - 1 || (!showVertBorder && index !== 0) - ? 'none' - : '1px solid' + borderColor, + borderRight: index === headers.length - 1 || (!showVertBorder && index !== 0) ? 'none' : '1px solid' + borderColor, zIndex: index === 0 ? 20 : 0, - left: - index === 0 && firstLineFixed ? (enableCheck ? checkColWidth + 'rpx' : 0) : 'auto', + left: index === 0 && firstLineFixed ? (enableCheck ? checkColWidth + 'rpx' : 0) : 'auto', position: index === 0 ? 'sticky' : 'static', }" > {{ item.label || emptyString }} @@ -122,10 +115,7 @@ - + { if (item.bottomComputedFormat) { @@ -837,10 +789,7 @@ export default { // 升序 if (isNumber) { arr.sort((a, b) => { - return ( - (parseFloat(a[key].toString().replace(/[^0-9]/gi, '')) || 0) - - (parseFloat(b[key].toString().replace(/[^0-9]/gi, '')) || 0) - ); + return (parseFloat(a[key].toString().replace(/[^0-9]/gi, '')) || 0) - (parseFloat(b[key].toString().replace(/[^0-9]/gi, '')) || 0); }); } else { arr.sort((a, b) => { @@ -861,10 +810,7 @@ export default { // 倒序 if (isNumber) { arr.sort((a, b) => { - return ( - (parseFloat(b[key].toString().replace(/[^0-9]/gi, '')) || 0) - - (parseFloat(a[key].toString().replace(/[^0-9]/gi, '')) || 0) - ); + return (parseFloat(b[key].toString().replace(/[^0-9]/gi, '')) || 0) - (parseFloat(a[key].toString().replace(/[^0-9]/gi, '')) || 0); }); } else { arr.sort((a, b) => { @@ -992,8 +938,8 @@ export default { this.$emit('onCellClick', event); } }, - onEmpty(){ - this.event.data=[] + onEmpty() { + this.event.data = []; }, onCheckAllTap() { if (this.enableCheck === 'multiple') { @@ -1128,10 +1074,7 @@ export default { let rgbc = [r, g, b]; // 减淡或加深 - for (var i = 0; i < 3; i++) - type === 'light' - ? (rgbc[i] = Math.floor((255 - rgbc[i]) * level + rgbc[i])) - : (rgbc[i] = Math.floor(rgbc[i] * (1 - level))); + for (var i = 0; i < 3; i++) type === 'light' ? (rgbc[i] = Math.floor((255 - rgbc[i]) * level + rgbc[i])) : (rgbc[i] = Math.floor(rgbc[i] * (1 - level))); if (hasAlpha) { return `rgba(${rgbc[0]}, ${rgbc[1]}, ${rgbc[2]}, ${alpha})`;