xiangpei
2025-02-20 b81460571b946037ae55a93b9271693d907681bd
项目增加项目子类型字段
2个文件已修改
42 ■■■■■ 已修改文件
src/api/system/dict/data.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/projectEngineering/projectLibrary/component/BasicInfo.vue 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/system/dict/data.js
@@ -59,3 +59,11 @@
    params: query
  })
}
// 根据父级id获取子级数据
export function getChildList(parentId) {
  return request({
    url: '/system/dict/data/child/by/parent/' + parentId,
    method: 'get'
  })
}
src/views/projectEngineering/projectLibrary/component/BasicInfo.vue
@@ -76,12 +76,21 @@
          <el-row :gutter="20">
            <el-col :span="6">
              <el-form-item label="项目类型" label-width="100px" prop="projectType" style="width: 100%">
                <el-select v-model="projectForm.projectType" clearable placeholder="请选择" style="width: 100%">
                <el-select v-model="projectForm.projectType" @change="getChildSelect" clearable placeholder="请选择" style="width: 100%">
                  <el-option v-for="item in dict.type.sys_project_type" :key="item.value" :label="item.label"
                             :value="item.value"/>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="项目子类型" label-width="100px" prop="projectSubType" style="width: 100%">
                <el-select v-model="projectForm.projectSubType" :disabled="projectForm.projectType === ''" clearable placeholder="请选择" style="width: 100%">
                  <el-option v-for="item in projectSubTypeList" :key="item.dictCode + 'zd'" :label="item.dictLabel"
                             :value="item.dictValue"/>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="项目状态" label-width="100px" prop="projectstatus" style="width: 100%">
                <el-select v-model="projectForm.projectStatus" clearable placeholder="请选择" @change="handleProjectStatusChange" style="width: 100%">
@@ -422,6 +431,7 @@
import {addProject, getProject, updateProject, getProjectCode, editProject} from '@/api/projectEngineering/projectInfo';
import {approvalList} from "@/api/system/dept";
import {getByDept} from "@/api/system/user";
import {getChildList} from "@/api/system/dict/data";
export default {
  name: 'BasicInfo',
@@ -445,11 +455,13 @@
  },
  data() {
    return {
      projectSubTypeList: [], // 项目子类型
      projectForm: {
        id: '',
        projectName: '',
        projectCode: '',
        projectType: '',
        projectSubType: '',
        projectStatus: 'pendding',
        fundType: '',
        investType: '',
@@ -542,6 +554,12 @@
          this.personList = res.data;
        })
      }
      if (this.projectForm.projectType) {
        // 根据项目类型查子类型
        getChildList(this.dict.type.sys_project_type.filter(item => item.raw.dictValue === this.projectForm.projectType)[0].raw.dictCode).then(res => {
          this.projectSubTypeList = res.data
        })
      }
      this.$emit('updateIsShow', true);
    } else {
      this.projectForm.id = this.$route.query.projectId;
@@ -559,6 +577,14 @@
    localStorage.setItem("projectForm", JSON.stringify(this.projectForm));
  },
  methods: {
    getChildSelect(select) {
      this.projectForm.projectSubType = ''
      if (select) {
        getChildList(this.dict.type.sys_project_type.filter(item => item.raw.dictValue === select)[0].raw.dictCode).then(res => {
          this.projectSubTypeList = res.data
        })
      }
    },
    // 监听联系人选择事件
    handleContactChange(userId) {
      if (userId) {
@@ -630,6 +656,12 @@
            this.personList = res.data;
          })
        }
        if (this.projectForm.projectType) {
          // 根据项目类型查子类型
          getChildList(this.dict.type.sys_project_type.filter(item => item.raw.dictValue === this.projectForm.projectType)[0].raw.dictCode).then(res => {
            this.projectSubTypeList = res.data
          })
        }
        this.$emit('updateIsShow', true);
      });
    },