领料出库

This commit is contained in:
jjLv 2024-11-16 14:01:15 +08:00
parent 21eb93dc29
commit 5832a7f9ca
2 changed files with 101 additions and 46 deletions

View File

@ -26,7 +26,7 @@
/> />
</el-select> </el-select>
</el-form-item> --> </el-form-item> -->
<el-form-item label="租赁单位" prop="leaseUnitId"> <el-form-item label="租赁单位" prop="unitId">
<el-cascader <el-cascader
v-model="unitId" v-model="unitId"
:show-all-levels="false" :show-all-levels="false"
@ -36,10 +36,11 @@
clearable clearable
collapse-tags collapse-tags
@change="uniteChange" @change="uniteChange"
placeholder="请选择退料单位" :disabled="isEdit"
placeholder="请选择租赁单位"
></el-cascader> ></el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="租赁工程" prop="leaseProjectId"> <el-form-item label="租赁工程" prop="projectId">
<el-cascader <el-cascader
v-model="projectId" v-model="projectId"
:show-all-levels="false" :show-all-levels="false"
@ -49,6 +50,7 @@
clearable clearable
collapse-tags collapse-tags
@change="projectChange" @change="projectChange"
:disabled="isEdit"
placeholder="请选择租赁工程" placeholder="请选择租赁工程"
></el-cascader> ></el-cascader>
</el-form-item> </el-form-item>
@ -278,14 +280,14 @@ export default {
}, },
// //
rules: { rules: {
leaseUnitId: [ unitId: [
{ {
required: true, required: true,
message: "请选择租赁单位", message: "请选择租赁单位",
trigger: "blur", trigger: "blur",
}, },
], ],
leaseProjectId: [ projectId: [
{ {
required: true, required: true,
message: "请选择租赁工程", message: "请选择租赁工程",
@ -339,16 +341,18 @@ export default {
}, },
watch: {}, watch: {},
mounted() { mounted() {
this.projectInfoList();
this.equipmentType();
if (this.isEdit) { if (this.isEdit) {
console.log("isEdit", this.isEdit); console.log("isEdit", this.isEdit);
this.taskId = this.editTaskId; this.taskId = this.editTaskId;
this.id = this.editId; this.id = this.editId;
this.getTaskInfo(); this.getTaskInfo();
this.equipmentType(); this.equipmentType();
} else {
this.projectInfoList();
this.equipmentType();
} }
// this.projectInfoList();
// this.equipmentType();
}, },
methods: { methods: {
uniteChange(val) { uniteChange(val) {
@ -358,11 +362,10 @@ export default {
} else if (val && val.length == 0) { } else if (val && val.length == 0) {
this.maForm.unitId = ""; this.maForm.unitId = "";
} }
// this.$set(this.maForm, "leaseProjectId", null);
getListProject({ unitId: this.maForm.unitId }).then((response) => { getListProject({ unitId: this.maForm.unitId }).then((response) => {
this.projectList = response.data; this.projectList = response.data;
}); });
this.unitTemp = this.unitid; // this.unitTemp = this.unitid;
}, },
projectChange(val) { projectChange(val) {
if (val && val.length > 0) { if (val && val.length > 0) {
@ -373,8 +376,7 @@ export default {
getListUnite({ projectId: this.maForm.projectId }).then((response) => { getListUnite({ projectId: this.maForm.projectId }).then((response) => {
this.uniteList = response.data; this.uniteList = response.data;
}); });
// this.maForm.leaseProjectId = val; // this.projectTemp = this.projectId;
this.projectTemp = this.projectId;
}, },
/** 租赁单位和工程-下拉选 */ /** 租赁单位和工程-下拉选 */
projectInfoList() { projectInfoList() {
@ -389,8 +391,7 @@ export default {
getListUnite({ projectId: null }).then((response) => { getListUnite({ projectId: null }).then((response) => {
this.uniteList = response.data; this.uniteList = response.data;
}); });
console.log("maForm", this.maForm.leaseUnitId); getListProject({ unitId: this.maForm.unitId }).then((response) => {
getListProject({ unitId: this.maForm.leaseUnitId }).then((response) => {
this.projectList = response.data; this.projectList = response.data;
}); });
} }
@ -490,12 +491,36 @@ export default {
// this.loading = true; // this.loading = true;
await getApplyInfo(this.id).then((response) => { await getApplyInfo(this.id).then((response) => {
this.maForm = response.data.leaseApplyInfo; this.maForm = response.data.leaseApplyInfo;
console.log("this.maForm", this.maForm); this.maForm.unitId = response.data.leaseApplyInfo.leaseUnitId;
this.maForm.projectId = response.data.leaseApplyInfo.leaseProjectId;
this.unitId = this.treeParentsById(this.uniteList, this.maForm.unitId);
this.projectId = this.treeParentsById(
this.projectList,
this.maForm.projectId
);
this.equipmentList = response.data.leaseApplyDetailsList; this.equipmentList = response.data.leaseApplyDetailsList;
// this.loading = false; // this.loading = false;
}); });
await this.projectInfoList(); await this.projectInfoList();
}, },
//
treeParentsById(list, id) {
for (let i in list) {
if (list[i].id == id) {
//value
return [list[i].id];
}
if (list[i].children) {
let node = this.treeParentsById(list[i].children, id);
if (node !== undefined) {
//
node.unshift(list[i].id);
return node;
}
}
}
},
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map((item) => item.roleId); this.ids = selection.map((item) => item.roleId);
@ -505,6 +530,7 @@ export default {
/** 保存按钮操作 */ /** 保存按钮操作 */
handleSave() { handleSave() {
// console.log(this.equipmentList) // console.log(this.equipmentList)
console.log("maForm", this.maForm);
if (this.equipmentList.length > 0) { if (this.equipmentList.length > 0) {
this.$refs["maForm"].validate(async (valid) => { this.$refs["maForm"].validate(async (valid) => {
if (valid) { if (valid) {
@ -523,6 +549,8 @@ export default {
.then(function () {}) .then(function () {})
.then(() => { .then(() => {
if (this.isEdit) { if (this.isEdit) {
this.maForm.leaseUnitId = this.maForm.unitId;
this.maForm.leaseProjectId = this.maForm.projectId;
console.log("编辑"); console.log("编辑");
this.loading = true; this.loading = true;
updateApplyInfo({ updateApplyInfo({

View File

@ -8,39 +8,33 @@
:inline="true" :inline="true"
label-width="120px" label-width="120px"
> >
<el-form-item label="租赁单位" prop="leaseUnitId"> <el-form-item label="租赁单位" prop="unitId">
<el-select <el-cascader
v-model="maForm.leaseUnitId" v-model="unitId"
:show-all-levels="false"
:options="uniteList"
:props="selectTreeProps"
filterable
clearable
collapse-tags
@change="uniteChange"
disabled
placeholder="请选择租赁单位" placeholder="请选择租赁单位"
clearable ></el-cascader>
filterable
style="width: 240px"
disabled
>
<el-option
v-for="item in uniteList"
:key="item.unitId"
:label="item.unitName"
:value="item.unitId"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="租赁工程" prop="leaseProjectId"> <el-form-item label="租赁工程" prop="projectId">
<el-select <el-cascader
v-model="maForm.leaseProjectId" v-model="projectId"
placeholder="请选择租赁工程" :show-all-levels="false"
clearable :options="projectList"
:props="selectTreeProps"
filterable filterable
style="width: 240px" clearable
collapse-tags
@change="projectChange"
disabled disabled
> placeholder="请选择租赁工程"
<el-option ></el-cascader>
v-for="item in projectList"
:key="item.proId"
:label="item.proName"
:value="item.proId"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="领料人" prop="leasePerson"> <el-form-item label="领料人" prop="leasePerson">
<el-input <el-input
@ -175,12 +169,21 @@ export default {
projectList: [], projectList: [],
// //
equipmentList: [], equipmentList: [],
unitId: null,
projectId: null,
// //
open: false, open: false,
rowData: {}, rowData: {},
maForm: { maForm: {
leaseUnitId: undefined, unitId: undefined,
leaseProjectId: undefined, projectId: undefined,
},
selectTreeProps: {
children: "children",
label: "name",
// multiple: false,
value: "id",
// multiple: true,
}, },
}; };
}, },
@ -206,11 +209,35 @@ export default {
this.loading = true; this.loading = true;
getApplyInfo(this.id).then((response) => { getApplyInfo(this.id).then((response) => {
this.maForm = response.data.leaseApplyInfo; this.maForm = response.data.leaseApplyInfo;
this.maForm.unitId = response.data.leaseApplyInfo.leaseUnitId;
this.maForm.projectId = response.data.leaseApplyInfo.leaseProjectId;
this.unitId = this.treeParentsById(this.uniteList, this.maForm.unitId);
this.projectId = this.treeParentsById(
this.projectList,
this.maForm.projectId
);
this.equipmentList = response.data.leaseApplyDetailsList; this.equipmentList = response.data.leaseApplyDetailsList;
this.loading = false; this.loading = false;
}); });
}, },
//
treeParentsById(list, id) {
for (let i in list) {
if (list[i].id == id) {
//value
return [list[i].id];
}
if (list[i].children) {
let node = this.treeParentsById(list[i].children, id);
if (node !== undefined) {
//
node.unshift(list[i].id);
return node;
}
}
}
},
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download( this.download(