linwenxin 1 год назад
Родитель
Сommit
46b892b475
1 измененных файлов с 13 добавлено и 13 удалено
  1. 13 13
      src/views/workOrder/completedToBeSettled/index.vue

+ 13 - 13
src/views/workOrder/completedToBeSettled/index.vue

@@ -621,13 +621,13 @@ export default {
 										width: "120px"
 									},
 									render: (h, { row, column, index }) => {
-										return expandDataForm.settleStatus == 'YWG' || (expandDataForm.settleStatus == 'YJS' && expandDataForm?.normList[row.pfuqinid]?.workerList.find(item => item.poolStatus == "NO")) ? (<div class="redbordererr redbordererranniuright" style="padding:0 6px;">
+										return expandDataForm.settleStatus == 'YWG' || (expandDataForm.settleStatus == 'YJS' && expandDataForm?.normList[row.pfuqinid]?.workerList?.find(item => item.poolStatus == "NO")) ? (<div class="redbordererr redbordererranniuright" style="padding:0 6px;">
 											{expandDataForm.normList[row.pfuqinid].bianji ? <el-button type="text" onClick={
 												() => {
-													var yjsje = [0, 0, 0, expandDataForm?.normList[row.pfuqinid]?.workerList.filter(item => item.poolStatus == "YES").map(item => item.settleAmount)].reduce(function (prev, curr, idx, arr) {
+													var yjsje = [0, 0, 0, expandDataForm?.normList[row.pfuqinid]?.workerList?.filter(item => item.poolStatus == "YES").map(item => item.settleAmount)].reduce(function (prev, curr, idx, arr) {
 														return prev + curr;
 													})
-													var nou = expandDataForm?.normList[row.pfuqinid]?.workerList.filter(item => item.poolStatus == "NO")
+													var nou = expandDataForm?.normList[row.pfuqinid]?.workerList?.filter(item => item.poolStatus == "NO")
 													var qian = ((((Number(expandDataForm?.normList[row.pfuqinid]["settleAmount"]) - yjsje) / nou.length) * 100) / 100).toFixed(2)
 													var rongyu = ((Number(expandDataForm?.normList[row.pfuqinid]["settleAmount"]) - yjsje) - (qian * nou.length)).toFixed(2)
 													nou.map((item, index) => {
@@ -668,7 +668,7 @@ export default {
 												if (columnIndex === columns.length - 1) {
 													if (row.zijideid == 0) {
 														return {
-															rowspan: formData.normList[row.pfuqinid].workerList.length,
+															rowspan: formData.normList[row.pfuqinid].workerList?.length,
 															colspan: 1
 														};
 													} else {
@@ -932,13 +932,13 @@ export default {
 										width: "120px"
 									},
 									render: (h, { row, column, index }) => {
-										return expandDataForm.settleStatus == 'YWG' || (expandDataForm.settleStatus == 'YJS' && expandDataForm?.otherNormList[row.pfuqinid]?.workerList.find(item => item.poolStatus == "NO")) ? (<div class="redbordererr redbordererranniuright" style="padding:0 6px;display:flex;align-items:center;">
+										return expandDataForm.settleStatus == 'YWG' || (expandDataForm.settleStatus == 'YJS' && expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.find(item => item.poolStatus == "NO")) ? (<div class="redbordererr redbordererranniuright" style="padding:0 6px;display:flex;align-items:center;">
 											{expandDataForm.otherNormList[row.pfuqinid].bianji ? <el-button type="text" onClick={
 												() => {
-													var yjsje = [0, 0, 0, expandDataForm?.otherNormList[row.pfuqinid]?.workerList.filter(item => item.poolStatus == "YES").map(item => item.settleAmount)].reduce(function (prev, curr, idx, arr) {
+													var yjsje = [0, 0, 0, expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.filter(item => item.poolStatus == "YES").map(item => item.settleAmount)].reduce(function (prev, curr, idx, arr) {
 														return prev + curr;
 													})
-													var nou = expandDataForm?.otherNormList[row.pfuqinid]?.workerList.filter(item => item.poolStatus == "NO")
+													var nou = expandDataForm?.otherNormList[row.pfuqinid]?.workerList?.filter(item => item.poolStatus == "NO")
 													var qian = ((((Number(expandDataForm?.otherNormList[row.pfuqinid]["settleAmount"]) - yjsje) / nou.length) * 100) / 100).toFixed(2)
 													var rongyu = ((Number(expandDataForm?.otherNormList[row.pfuqinid]["settleAmount"]) - yjsje) - (qian * nou.length)).toFixed(2)
 													nou.map((item, index) => {
@@ -974,7 +974,7 @@ export default {
 												if (columnIndex === columns.length - 1) {
 													if (row.zijideid == 0) {
 														return {
-															rowspan: formData.otherNormList[row.pfuqinid].workerList.length,
+															rowspan: formData.otherNormList[row.pfuqinid].workerList?.length,
 															colspan: 1
 														};
 													} else {
@@ -1016,8 +1016,7 @@ export default {
 			}
 
 			var { classifyList, gonglr, gonglv, otherList, normListBj, otherNormListBj, showOtherNormList, ...pam } = data.expandData;
-
-			([orderBaseSettleNormConfirm, orderBaseSettleNormReset])[pam.settleStatus == 'YWG' ? 0 : 1]({
+			var pams = {
 				...pam,
 				...(() => {
 					if (type == "normList") {
@@ -1039,7 +1038,8 @@ export default {
 						otherNormList: [],
 					}
 				})(),
-			}).then(res => {
+			};
+			([orderBaseSettleNormConfirm, orderBaseSettleNormReset])[pams[type]?.map(item => item.workerList?.find(resdata => !!resdata.settleOrderId))?.find(item => item) ? 1 : 0](pams).then(res => {
 				orderBaseSettleNormDetail2({
 					id: data.id,
 					orderProductId: data.pgOrderProductId
@@ -1071,7 +1071,7 @@ export default {
 					item.workerList?.map((resdata, ind_) => {
 						if (resdata.settleOrderId) { data.normListBj = true }
 						if (ind_ !== 0) { normList.push({ pfuqinid: pfuqinid, zijideid: ind_ }) }
-						if (ind_ == item.workerList.length - 1) { pfuqinid += (ind_ + 1) }
+						if (ind_ == item.workerList?.length - 1) { pfuqinid += (ind_ + 1) }
 					})
 				})
 				var otherNormList = []
@@ -1085,7 +1085,7 @@ export default {
 					item.workerList?.map((resdata, ind_) => {
 						if (resdata.settleOrderId) { data.otherNormListBj = true }
 						if (ind_ !== 0) { otherNormList.push({ pfuqinid: qtpfuqinid, zijideid: ind_ }) }
-						if (ind_ == item.workerList.length - 1) { qtpfuqinid += (ind_ + 1) }
+						if (ind_ == item.workerList?.length - 1) { qtpfuqinid += (ind_ + 1) }
 					})
 				})
 				Promise.all([