|
|
@@ -253,21 +253,115 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 详情数据
|
|
|
+ // getSopInfo() {
|
|
|
+ // const sopId = this.$route.query.sopId;
|
|
|
+ // console.log(this.$route.query.sopId, "接受路由参数");
|
|
|
+
|
|
|
+ // selectIsSopById(sopId).then((response) => {
|
|
|
+ // console.log(response, "详细内容");
|
|
|
+ // this.form = response.data;
|
|
|
+ // this.sopProps = [response.data];
|
|
|
+ // this.tableData = response.data.pointDetailVOList;
|
|
|
+ // // console.log(this.form, "data数据内容");
|
|
|
+ // this.title = "修改隔离点信息";
|
|
|
+ // });
|
|
|
+ // },
|
|
|
getSopInfo() {
|
|
|
const sopId = this.$route.query.sopId;
|
|
|
console.log(this.$route.query.sopId, "接受路由参数");
|
|
|
|
|
|
- selectIsSopById(sopId).then((response) => {
|
|
|
- console.log(response, "详细内容");
|
|
|
- this.form = response.data;
|
|
|
- this.sopProps = [response.data];
|
|
|
- this.tableData = response.data.pointDetailVOList;
|
|
|
- // console.log(this.form, "data数据内容");
|
|
|
- this.title = "修改隔离点信息";
|
|
|
- });
|
|
|
+ if (sopId) {
|
|
|
+ selectIsSopById(sopId).then((response) => {
|
|
|
+ console.log(response, "详细内容");
|
|
|
+ this.form = response.data;
|
|
|
+ this.sopProps = [response.data];
|
|
|
+ this.tableData = response.data.pointDetailVOList;
|
|
|
+ this.title = "修改隔离点信息";
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.title = "新增隔离点信息";
|
|
|
+ this.form = {
|
|
|
+ spoint: [],
|
|
|
+ sopContent: "",
|
|
|
+ sopCode: "",
|
|
|
+ sopName: "",
|
|
|
+ sopType: "",
|
|
|
+ workareaId: "",
|
|
|
+ workshopId: "",
|
|
|
+ };
|
|
|
+ }
|
|
|
},
|
|
|
+ // 检查 sopId 是否存在且不为 "null"。如果存在,则调用 getSopById 方法从后端获取数据,并将数据填充到 form 和其他相关字段中。
|
|
|
+
|
|
|
// 新增sop确认按钮
|
|
|
+ // submit() {
|
|
|
+ // const selectedpointIds = this.form.spoint.join(",");
|
|
|
+ // const data = {
|
|
|
+ // pointIds: selectedpointIds,
|
|
|
+ // sopContent: this.form.sopContent,
|
|
|
+ // sopCode: this.form.sopCode,
|
|
|
+ // sopName: this.form.sopName,
|
|
|
+ // sopType: this.form.sopType,
|
|
|
+ // workareaId: this.points.value,
|
|
|
+ // workshopId: this.emitWorkShop.value,
|
|
|
+ // };
|
|
|
+ // if (this.$route.query.sopId !== "null") {
|
|
|
+ // // this.form.spoint = this.form.spoint.join(",");
|
|
|
+ // updateIsSop(data).then((res) => {
|
|
|
+ // console.log(res, "修改接口");
|
|
|
+ // if (res.code == 200) {
|
|
|
+ // this.$router.go(-1);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // addinsertIsSop(data).then((res) => {
|
|
|
+ // console.log(res, "新增接口");
|
|
|
+ // if (res.code == 200) {
|
|
|
+ // this.$router.go(-1);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+
|
|
|
+ // submit() {
|
|
|
+ // // 确保 this.form.spoint 是一个数组
|
|
|
+ // if (!Array.isArray(this.form.spoint)) {
|
|
|
+ // this.form.spoint = [];
|
|
|
+ // }
|
|
|
+
|
|
|
+ // const selectedpointIds = this.form.spoint.join(",");
|
|
|
+ // const data = {
|
|
|
+ // pointIds: selectedpointIds,
|
|
|
+ // sopContent: this.form.sopContent,
|
|
|
+ // sopCode: this.form.sopCode,
|
|
|
+ // sopName: this.form.sopName,
|
|
|
+ // sopType: this.form.sopType,
|
|
|
+ // workareaId: this.points.value,
|
|
|
+ // workshopId: this.emitWorkShop.value,
|
|
|
+ // };
|
|
|
+
|
|
|
+ // if (this.$route.query.sopId) {
|
|
|
+ // updateIsSop(data).then((res) => {
|
|
|
+ // console.log(res, "修改接口");
|
|
|
+ // if (res.code == 200) {
|
|
|
+ // this.$router.go(-1);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // addinsertIsSop(data).then((res) => {
|
|
|
+ // console.log(res, "新增接口");
|
|
|
+ // if (res.code == 200) {
|
|
|
+ // this.$router.go(-1);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
submit() {
|
|
|
+ // 确保 this.form.spoint 是一个数组
|
|
|
+ if (!Array.isArray(this.form.spoint)) {
|
|
|
+ this.form.spoint = [];
|
|
|
+ }
|
|
|
+
|
|
|
const selectedpointIds = this.form.spoint.join(",");
|
|
|
const data = {
|
|
|
pointIds: selectedpointIds,
|
|
|
@@ -278,8 +372,18 @@ export default {
|
|
|
workareaId: this.points.value,
|
|
|
workshopId: this.emitWorkShop.value,
|
|
|
};
|
|
|
- if (this.sopId != null) {
|
|
|
- updateIsSop(this.form).then((res) => {
|
|
|
+
|
|
|
+ if (this.$route.query.sopId) {
|
|
|
+ // 确保 sopId 存在
|
|
|
+ if (!this.form.sopId) {
|
|
|
+ console.error("隔离点id不可为空!");
|
|
|
+ this.$message.error("隔离点id不可为空!"); // 假设你使用的是 Element UI 的消息提示
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ data.sopId = this.form.sopId;
|
|
|
+
|
|
|
+ updateIsSop(data).then((res) => {
|
|
|
console.log(res, "修改接口");
|
|
|
if (res.code == 200) {
|
|
|
this.$router.go(-1);
|
|
|
@@ -294,6 +398,60 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
+ submit() {
|
|
|
+ // 确保 this.form.spoint 是一个数组
|
|
|
+ if (!Array.isArray(this.form.spoint)) {
|
|
|
+ this.form.spoint = [this.form.spoint]; // 将其转换为数组
|
|
|
+ }
|
|
|
+
|
|
|
+ const selectedpointIds = this.form.spoint.join(",");
|
|
|
+
|
|
|
+ const data = {
|
|
|
+ pointIds: selectedpointIds,
|
|
|
+ sopContent: this.form.sopContent,
|
|
|
+ sopCode: this.form.sopCode,
|
|
|
+ sopName: this.form.sopName,
|
|
|
+ sopType: this.form.sopType,
|
|
|
+ workareaId: this.points.value,
|
|
|
+ workshopId: this.emitWorkShop.value,
|
|
|
+ };
|
|
|
+
|
|
|
+ if (this.$route.query.sopId) {
|
|
|
+ // 确保 sopId 存在
|
|
|
+ if (!this.form.sopId) {
|
|
|
+ this.$message.error("sopId不可为空!"); // 假设你使用的是 Element UI 的消息提示
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ data.sopId = this.form.sopId; // 添加 sopId 到 data 对象
|
|
|
+
|
|
|
+ updateIsSop(data)
|
|
|
+ .then((res) => {
|
|
|
+ console.log(res, "修改接口");
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$router.go(-1);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.error("修改接口错误:", error);
|
|
|
+ this.$message.error("修改失败,请稍后再试!");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addinsertIsSop(data)
|
|
|
+ .then((res) => {
|
|
|
+ console.log(res, "新增接口");
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$router.go(-1);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.error("新增接口错误:", error);
|
|
|
+ this.$message.error("新增失败,请稍后再试!");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
// 子组件逆向传递选中的隔离点
|
|
|
handleSelectPoint(points) {
|
|
|
console.log(points, "父组件接收逆向传递选中的隔离点");
|