|
|
@@ -146,43 +146,52 @@ export default {
|
|
|
jobProps: {
|
|
|
handler(newVal, oldVal) {
|
|
|
console.log("jobProps 发生变化", newVal);
|
|
|
- // 在这里处理 jobProps 变化后的逻辑
|
|
|
- this.form.workShop = newVal[0].workshopId;
|
|
|
- this.form.producLine = newVal[0].workareaId;
|
|
|
- this.form.sopId = newVal[0].sopId;
|
|
|
- console.log(this.form.sopId, "form.sopId jobProps");
|
|
|
- // 确保 handleselect 完成后再调用 handleselectProductLine
|
|
|
- this.handleselect(newVal[0].workshopId)
|
|
|
- .then(() => {
|
|
|
- this.handleselectProductLine(newVal[0].workareaId);
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- console.error("处理车间下拉失败", error);
|
|
|
- });
|
|
|
+ if(newVal.length == 0) {
|
|
|
+ this.setSopEdit(true);
|
|
|
+ this.form.workShop=[];
|
|
|
+ this.form.producLine=''
|
|
|
+ this.form.sopId=''
|
|
|
+ this.form.t
|
|
|
+ }else{
|
|
|
+ // 在这里处理 jobProps 变化后的逻辑
|
|
|
+ this.form.workShop = newVal[0].workshopId;
|
|
|
+ this.form.producLine = newVal[0].workareaId;
|
|
|
+ this.form.sopId = newVal[0].sopId;
|
|
|
+ console.log(this.form.sopId, "form.sopId jobProps");
|
|
|
+ // 确保 handleselect 完成后再调用 handleselectProductLine
|
|
|
+ this.handleselect(newVal[0].workshopId)
|
|
|
+ .then(() => {
|
|
|
+ this.handleselectProductLine(newVal[0].workareaId);
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.error("处理车间下拉失败", error);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 这里是为了拿到sop模板里默认的隔离点选中的数据a
|
|
|
+ if (!newVal[0].EditBool) {
|
|
|
+ selectIsSopById(newVal[0].sopId).then((res) => {
|
|
|
+ console.log(res, "sop");
|
|
|
+ const selectSopPoints = res.data.pointDetailVOList.map((item) => {
|
|
|
+ return item.pointId;
|
|
|
+ });
|
|
|
|
|
|
- // 这里是为了拿到sop模板里默认的隔离点选中的数据a
|
|
|
- if (!newVal[0].EditBool) {
|
|
|
- selectIsSopById(newVal[0].sopId).then((res) => {
|
|
|
- console.log(res, "sop");
|
|
|
- const selectSopPoints = res.data.pointDetailVOList.map((item) => {
|
|
|
+ // 调用 Vuex action 来存储 selectSopPoints
|
|
|
+ this.setSelectSopPoints(selectSopPoints);
|
|
|
+ this.setPointTableData(res.data);
|
|
|
+
|
|
|
+ this.setSopEdit(false);
|
|
|
+ console.log(selectSopPoints, "sop_selectePoints");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ const selectSopPoints = newVal[0].spoint.map((item) => {
|
|
|
return item.pointId;
|
|
|
});
|
|
|
-
|
|
|
- // 调用 Vuex action 来存储 selectSopPoints
|
|
|
this.setSelectSopPoints(selectSopPoints);
|
|
|
- this.setPointTableData(res.data);
|
|
|
-
|
|
|
- this.setSopEdit(false);
|
|
|
- console.log(selectSopPoints, "sop_selectePoints");
|
|
|
- });
|
|
|
- } else {
|
|
|
- const selectSopPoints = newVal[0].spoint.map((item) => {
|
|
|
- return item.pointId;
|
|
|
- });
|
|
|
- this.setSelectSopPoints(selectSopPoints);
|
|
|
- this.setPointTableData(newVal[0].spoint);
|
|
|
- this.setSopEdit(true);
|
|
|
+ this.setPointTableData(newVal[0].spoint);
|
|
|
+ this.setSopEdit(true);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
immediate: true, // 立即执行一次,确保在组件初始化时也能捕获到 jobProps 的值
|
|
|
},
|
|
|
@@ -218,6 +227,7 @@ export default {
|
|
|
|
|
|
// 单选车间下拉
|
|
|
handleselect(value) {
|
|
|
+
|
|
|
return new Promise((resolve, reject) => {
|
|
|
getIsWorkareaList(value)
|
|
|
.then((response) => {
|
|
|
@@ -270,6 +280,10 @@ export default {
|
|
|
data2 = this.$route.query.ticketId; // ticketId 存在时,data1 设置为空字符串
|
|
|
}
|
|
|
console.log(this.form.sopId, "form.sopId");
|
|
|
+ if(this.jobProps.length==0){
|
|
|
+ console.log(this.jobProps,'如果jobProps是空数组表示编辑情况下修改sop为空值需要重新拿到所有渲染隔离点')
|
|
|
+ data2=""
|
|
|
+ }
|
|
|
if (this.form.sopId) {
|
|
|
data1 = this.form.sopId;
|
|
|
}
|