配件类型左侧树

This commit is contained in:
jjLv 2024-11-11 09:52:14 +08:00
parent 5d2a0e272b
commit b4ea9dbf98
2 changed files with 46 additions and 26 deletions

View File

@ -54,4 +54,11 @@ export function addAccessory(data) {
}) })
} }
// 配件类型管理--新增
export function addMaType(data) {
return request({
url: '/material/ma_part_type',
method: 'post',
data: data,
})
}

View File

@ -339,8 +339,8 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="名称" prop="typeName"> <el-form-item label="名称" prop="paName">
<el-input style="width: 100%" v-model="addFormParams.typeName" /> <el-input style="width: 100%" v-model="addFormParams.paName" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -366,6 +366,7 @@ import {
addAccessory, addAccessory,
editAccessory, editAccessory,
delAccessory, delAccessory,
addMaType,
} from "@/api/ma/partType"; } from "@/api/ma/partType";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
@ -429,7 +430,7 @@ export default {
addTitle: "", // addTitle: "", //
addFormParams: { addFormParams: {
label: "", label: "",
typeName: "", paName: "",
companyId: 101, companyId: 101,
}, },
treeOptions: undefined, treeOptions: undefined,
@ -449,6 +450,16 @@ export default {
}, },
], ],
}, },
addFormParamsRules: {
paName: [
{
required: true,
message: "名称不能为空",
trigger: "blur",
},
],
},
}; };
}, },
created() { created() {
@ -639,7 +650,9 @@ export default {
this.title = "新增"; this.title = "新增";
} else { } else {
Object.assign(this.addFormParams, data); Object.assign(this.addFormParams, data);
this.addFormParams.typeName = ""; console.log("data", data);
console.log("addFormParams", this.addFormParams);
this.addFormParams.paName = "";
this.addTitle = "新增"; this.addTitle = "新增";
this.addTitleVisible = true; this.addTitleVisible = true;
} }
@ -667,22 +680,22 @@ export default {
this.parentId = data.parentId; this.parentId = data.parentId;
Object.assign(this.addFormParams, data); Object.assign(this.addFormParams, data);
this.addTitle = "修改"; this.addTitle = "修改";
this.addFormParams.typeName = data.label; this.addFormParams.paName = data.label;
this.addTitleVisible = true; this.addTitleVisible = true;
}, },
/* 确定 */ /* 确定 */
onSubmit() { onSubmit() {
const { id, typeName } = this.addFormParams; const { id, paName } = this.addFormParams;
const addParams = { const addParams = {
parentId: this.levelTemp == 0 ? 0 : this.idTemp, parentId: this.levelTemp == 0 ? 0 : this.idTemp,
typeName, paName,
level: this.levelTemp, level: this.levelTemp,
houseId: this.levelTemp == 0 ? id : null, id: id,
}; };
const editParams = { const editParams = {
houseId: id, houseId: id,
typeName, paName,
level: this.levelTemp, level: this.levelTemp,
parentId: this.parentId, parentId: this.parentId,
typeId: id, typeId: id,