|
@@ -207,18 +207,18 @@ const originTableData=ref([ {}])
|
|
|
|
|
|
const tabChange = ({key}) => {
|
|
|
tabKey.value = key
|
|
|
- console.log(tableData.value,'tableData.value');
|
|
|
if(key=='supervision'){
|
|
|
- tableData.value=supervisorUnitData.value.length>0?supervisorUnitData.value:originTableData.value
|
|
|
+ tableData.value=supervisorUnitData.value&&supervisorUnitData.value[radioType.value]?.length>0?supervisorUnitData.value:originTableData.value
|
|
|
detailData.value.supervisorUnit=tableData.value
|
|
|
}else if(key=='construction'){
|
|
|
- tableData.value=constructionData.value.length>0?constructionData.value:originTableData.value
|
|
|
+ tableData.value=constructionData.value[radioType.value]?.length>0?constructionData.value:originTableData.value
|
|
|
detailData.value.constructUnit=tableData.value
|
|
|
|
|
|
+
|
|
|
}else if(key=='bulid'){
|
|
|
- console.log(buildData.value,'=buildData.value');
|
|
|
- tableData.value=buildData.value.length>0?buildData.value:originTableData.value
|
|
|
+ tableData.value=buildData.value[radioType.value]?.length>0?buildData.value:originTableData.value
|
|
|
detailData.value.buildUnit=tableData.value
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -228,7 +228,6 @@ watch(() => [
|
|
|
radioType.value,
|
|
|
tabKey.value
|
|
|
], ([radioType]) => {
|
|
|
- console.log(radioType,'radioType');
|
|
|
if(tabKey.value==='construction'){
|
|
|
console.log(constructionData.value[radioType],'constructionData.value');
|
|
|
tableData.value=constructionData.value[radioType]
|
|
@@ -436,11 +435,35 @@ const updatePlan=async(obj)=>{
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+const isEmptyObj=(obj)=> {
|
|
|
+ let arr = Object.keys(obj);
|
|
|
+ return(arr.length == 0)
|
|
|
+
|
|
|
+}
|
|
|
//批量保存
|
|
|
const saveLoaing=ref(false)
|
|
|
const saveClick = () => {
|
|
|
console.log(tableData.value,'tableData.value');
|
|
|
console.log( detailData.value,' detailData.value');
|
|
|
+ //取消空对象提交
|
|
|
+ if(detailData.value?.supervisorUnit?.length>0){
|
|
|
+ let suisnullObj= isEmptyObj(detailData.value?.supervisorUnit[0])
|
|
|
+ if(suisnullObj===true){
|
|
|
+ detailData.value.supervisorUnit=[]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(detailData.value?.constructUnit?.length>0){
|
|
|
+ let coisnullObj= isEmptyObj(detailData.value?.constructUnit[0])
|
|
|
+ if(coisnullObj){
|
|
|
+ detailData.value.constructUnit=[]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(detailData.value?.buildUnit?.length>0){
|
|
|
+ let buisnullObj= isEmptyObj(detailData.value?.buildUnit[0])
|
|
|
+ if(buisnullObj){
|
|
|
+ detailData.value.buildUnit=[]
|
|
|
+ }
|
|
|
+ }
|
|
|
updatePlan(detailData.value)
|
|
|
}
|
|
|
//取消并返回
|