领料出库

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

View File

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