This commit is contained in:
helloDy
2024-02-27 16:39:39 +08:00
parent 85791cc10c
commit 8e1a1848fb
9 changed files with 59 additions and 78 deletions

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-02-21 09:04:48
* @LastEditTime: 2024-02-27 15:38:04
* @Description:
-->
<template>
@@ -322,14 +322,14 @@ export default {
this.listQuery.total = response.data.total;
});
},
init(id, isdetail) {
init(row, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.isedit = id ? true : false;
this.dataForm.id = row.id || undefined;
this.isedit = row?.id && row?.externalCode ? true : false;
console.log('你好', this.isedit)
this.visible = true;
if (id) {
if (row) {
this.idAttrShow = true
} else {
this.idAttrShow = false
@@ -340,7 +340,7 @@ export default {
if (this.dataForm.id) {
// 获取产品详情
this.urlOptions.infoURL(id).then(response => {
this.urlOptions.infoURL(this.dataForm.id).then(response => {
this.dataForm = response.data
// this.dataForm.area = response.data.area || 0
// this.dataForm.weight = response.data.weight || 0

View File

@@ -74,9 +74,7 @@ export default {
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getCoreProductAttr({
id: this.dataForm.id
}).then((res) => {
getCoreProductAttr(this.dataForm.id).then((res) => {
const { name, value } = res.data;
this.dataForm.name = name;
this.dataForm.value = value;

View File

@@ -141,6 +141,22 @@ export default {
},
created() {},
methods: {
//tableBtn点击
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex,val.data)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// 删除
deleteHandle(id, name, index) {
this.$confirm(`是否确认删除产品名称为"${name}"的数据项`, "提示", {
@@ -168,7 +184,7 @@ export default {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "详情";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
this.$refs.addOrUpdate.init(val.data, true);
});
}
},