配件类型左侧树

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

@ -3,26 +3,26 @@ import request from '@/utils/request'
//机具类型管理列表信息 //机具类型管理列表信息
export function getListByPartType(query) { export function getListByPartType(query) {
return request({ return request({
url: '/material/ma_part_type/getListByPartType', url: '/material/ma_part_type/getListByPartType',
method: 'get', method: 'get',
params: query, params: query,
}) })
} }
//机具类型管理列表信息 //机具类型管理列表信息
export function getListTree(query) { export function getListTree(query) {
return request({ return request({
url: '/material/ma_part_type/getPartTree', url: '/material/ma_part_type/getPartTree',
method: 'get', method: 'get',
params: query, params: query,
}) })
} }
//查看机具类型管理列表详细信息 //查看机具类型管理列表详细信息
export function getAccessoryDetail(id) { export function getAccessoryDetail(id) {
return request({ return request({
url: '/material/ma_part_type/'+ id, url: '/material/ma_part_type/' + id,
method: 'get', method: 'get',
}) })
} }
@ -31,27 +31,34 @@ export function getAccessoryDetail(id) {
// 仓库管理--删除 // 仓库管理--删除
export function delAccessory(id) { export function delAccessory(id) {
return request({ return request({
url: '/material/ma_part_type/' + id, url: '/material/ma_part_type/' + id,
method: 'delete', method: 'delete',
}) })
} }
// 仓库管理--修改 // 仓库管理--修改
export function editAccessory(data) { export function editAccessory(data) {
return request({ return request({
url: '/material/ma_part_type', url: '/material/ma_part_type',
method: 'put', method: 'put',
data: data, data: data,
}) })
} }
// 仓库管理--新增 // 仓库管理--新增
export function addAccessory(data) { export function addAccessory(data) {
return request({ return request({
url: '/material/ma_part_type', url: '/material/ma_part_type',
method: 'post', method: 'post',
data: data, data: 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,