同步6/16
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader :title="userid ? '编辑车辆信息' : '添加车辆信息'"></PageHeader>
|
||||
<PageHeader></PageHeader>
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">基本信息</div>
|
||||
<div class="addBuildingFormBody">
|
||||
@@ -41,7 +41,7 @@
|
||||
<el-col :span="11">
|
||||
<el-form-item label="隶属父级" prop="email">
|
||||
<el-select @change="handleChange" v-model="form.parentId" placeholder="请选择隶属父级" style="width: 240px">
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.projectName" :value="item.id" />
|
||||
<el-option v-for="item in options" :key="item.id" :disabled="item.disabled" :label="item.projectName" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -59,7 +59,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { addRepairProject, listRepairProject, updateRepairProject } from '@/api/system/RepairProject';
|
||||
import { addRepairProject, getRepairProject, listRepairProject, updateRepairProject } from '@/api/system/RepairProject';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_repair_project_types } = toRefs<any>(proxy?.useDict('com_repair_project_types'));
|
||||
const { com_repair_project_status } = toRefs<any>(proxy?.useDict('com_repair_project_status'));
|
||||
@@ -88,6 +88,7 @@ const userid = ref(null);
|
||||
const options = ref([]);
|
||||
|
||||
function handleChange(val) {
|
||||
if (!val) return;
|
||||
const find = options.value.find((item) => item.id === val);
|
||||
if (find) {
|
||||
form.value.projectType = find.projectType;
|
||||
@@ -95,7 +96,7 @@ function handleChange(val) {
|
||||
}
|
||||
// != ==========================================
|
||||
|
||||
function init() {
|
||||
async function init() {
|
||||
form.value = {
|
||||
id: null,
|
||||
projectName: null, // 项目名称
|
||||
@@ -104,22 +105,26 @@ function init() {
|
||||
projectLevel: 0, //项目层级
|
||||
status: '0' //状态
|
||||
};
|
||||
listRepairProject().then((res) => {
|
||||
const arr = res.rows.filter((ite) => ite.projectLevel === 0);
|
||||
options.value = arr;
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
const find = res.rows.find((item) => item.id === userid.value);
|
||||
if (find) {
|
||||
form.value = {
|
||||
...form.value,
|
||||
...find,
|
||||
projectLevel: find.projectLevel
|
||||
};
|
||||
handleChange(find.parentId);
|
||||
}
|
||||
}
|
||||
});
|
||||
const res = await listRepairProject();
|
||||
const arr = res.rows.filter((ite) => ite.projectLevel === 0);
|
||||
options.value = arr;
|
||||
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
getRepairProject(userid.value).then((res) => {
|
||||
form.value = res.data;
|
||||
form.value.status = res.data.status ?? '0' + '';
|
||||
options.value = options.value.map((ite) => {
|
||||
if (ite.id === res.data.id) {
|
||||
ite.disabled = true;
|
||||
} else {
|
||||
ite.disabled = false;
|
||||
}
|
||||
return ite;
|
||||
});
|
||||
handleChange(res.data.parentId);
|
||||
});
|
||||
}
|
||||
}
|
||||
init();
|
||||
// !== 提交 =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user