From 1f772a6c7834eef35ff4c9f2c8ed734a4c2be76a Mon Sep 17 00:00:00 2001 From: 13937891274 <kxc0822> Date: 星期二, 02 八月 2022 11:09:16 +0800 Subject: [PATCH] 数据对接 --- src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue | 156 +++++++++++---------------------------------------- 1 files changed, 35 insertions(+), 121 deletions(-) diff --git a/src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue b/src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue index 60006cf..aa00d4b 100644 --- a/src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue +++ b/src/views/contingencyManagement/emergencyResources/emergencySupplies/component/openAdd.vue @@ -48,7 +48,16 @@ </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="负责部门" prop="departmentId"> - <el-tree-select v-model="ruleForm.departmentId" :data="data" class="w100" placeholder="请选择" /> + <el-tree-select + v-model="ruleForm.departmentId" + check-strictly + :data="data" + :props="propse" + class="w100" + clearable + :render-after-expand="false" + placeholder="请选择" + /> </el-form-item> </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> @@ -180,7 +189,7 @@ </template> <script lang="ts"> -import { reactive, ref, defineComponent } from 'vue'; +import { reactive, ref, defineComponent,onMounted, } from 'vue'; import type { FormInstance, FormRules } from 'element-plus'; import { ElMessage } from 'element-plus'; @@ -190,6 +199,7 @@ import PersonInCharge from '/@/views/contingencyManagement/emergencyResources/emergencySupplies/component/personInCharge.vue'; import RegionsCheckbox from '/@/views/contingencyManagement/emergencyResources/emergencySupplies/component/regionsCheckbox.vue'; import {emergencySuppliesApi} from "/@/api/emergencyResources"; +import {goalManagementApi} from "/@/api/goalManagement"; export default defineComponent({ name: 'openAdd', @@ -244,125 +254,29 @@ }; //日期选择器 const value1 = ref(''); - // 可选择树 - const treeSelect = ref(); - const tree = [ - { - value: '1', - label: 'Level one 1', - children: [ - { - value: '11', - label: 'Level two 1-1', - children: [ - { - value: '111', - label: 'Level three 1-1-1', - }, - ], - }, - ], - }, - { - value: '2', - label: 'Level one 2', - children: [ - { - value: '21', - label: 'Level two 2-1', - children: [ - { - value: '211', - label: 'Level three 2-1-1', - }, - ], - }, - { - value: '22', - label: 'Level two 2-2', - children: [ - { - value: '221', - label: 'Level three 2-2-1', - }, - ], - }, - ], - }, - { - value: '3', - label: 'Level one 3', - children: [ - { - value: '31', - label: 'Level two 3-1', - children: [ - { - value: '311', - label: 'Level three 3-1-1', - }, - ], - }, - { - value: '32', - label: 'Level two 3-2', - children: [ - { - value: '321', - label: 'Level three 3-2-1', - }, - ], - }, - ], - }, - ]; + //部门树 + const department = () => { + goalManagementApi() + .getTreedepartment() + .then((res) => { + if (res.data.code == 200) { + data.value = res.data.data; + } else { + ElMessage.error(res.data.msg); + } + }); + }; //定义树形下拉框 const responsibleDepartment = ref(); - const data = [ - { - value: '1', - label: '广汇能源综合物流发展有限责任公司', - children: [ - { - value: 11, - label: '经营班子', - children: [], - }, - ], - }, - { - value: '2', - label: '生产运行部', - children: [ - { - value: '21', - label: '灌装一班', - children: [], - }, - { - value: '22', - label: '工艺四班', - children: [], - }, - ], - }, - { - value: '3', - label: '设备部', - children: [ - { - value: '31', - label: '仪表班', - children: [], - }, - { - value: '32', - label: '机修班', - children: [], - }, - ], - }, - ]; + const data = ref() + const propse = { + label: 'depName', + children: 'children', + value: 'depId', + }; + onMounted(() => { + department(); + }); // 必填项提示 const rules = reactive<FormRules>({ name: [ @@ -616,11 +530,11 @@ isShowDialog, responsibleDepartment, data, + propse, + department, Search, ruleForm, value1, - treeSelect, - tree, daiInpt, Shows, ruleFormRef, -- Gitblit v1.9.2