Your Name
2022-07-13 656696be4b70513e94f1341db8d1c2d3f43b3e6d
src/views/system/department/component/deptDialog.vue
@@ -7,23 +7,23 @@
                  <el-form-item label="上级部门">
                     <el-cascader
                        :options="deptData"
                        :props="{ checkStrictly: true, value: 'id', label: 'name' }"
                        :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }"
                        placeholder="请选择部门"
                        clearable
                        class="w100"
                        v-model="departmentForm.struct"
                        v-model="departmentForm.parentDepId"
                     >
                     </el-cascader>
                  </el-form-item>
               </el-col>
               <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                  <el-form-item label="部门名称">
                     <el-input v-model="departmentForm.name" placeholder="请输入部门名称" clearable></el-input>
                     <el-input v-model="departmentForm.depName" placeholder="请输入部门名称" clearable></el-input>
                  </el-form-item>
               </el-col>
               <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                  <el-form-item label="部门描述">
                     <el-input v-model="departmentForm.info" type="textarea" placeholder="请输入部门描述" maxlength="150"></el-input>
                     <el-input v-model="departmentForm.depInfo" type="textarea" placeholder="请输入部门描述" maxlength="150"></el-input>
                  </el-form-item>
               </el-col>
            </el-row>
@@ -31,7 +31,7 @@
         <template #footer>
            <span class="dialog-footer">
               <el-button @click="onCancel" size="default">取 消</el-button>
               <el-button type="primary" @click="onSubmit" size="default">新 增</el-button>
               <el-button type="primary" @click="onSubmit" size="default">确 定</el-button>
            </span>
         </template>
      </el-dialog>
@@ -45,7 +45,6 @@
// 定义接口来定义对象的类型
interface TableDataRow {
   struct: Array<string>;
   name:string,
   info:string,
   parentId:string,
@@ -55,10 +54,9 @@
   title:string;
   isShowDialog: boolean;
   departmentForm: {
      struct: Array<string>;
      name:string,
      info:string,
      parentId:string
        depName:string,
        depInfo:string,
        parentDepId:string
   };
   deptData: Array<TableDataRow>;
}
@@ -70,10 +68,9 @@
         title:'',
         isShowDialog: false,
         departmentForm: {
            name:'',
            parentId:'',
            info:'',
            struct:[]
                depName:'',
                parentDepId:'',
                depInfo:'',
         },
         deptData: [], // 部门数据
      });
@@ -84,10 +81,9 @@
         if(type === '新增'){
            state.title = '新增部门'
            state.departmentForm = {
               name:'',
               parentId:'',
               info:'',
               struct:[]
                    depName:'',
                    parentDepId:'',
                    depInfo:'',
            }
         }else{
            state.title = '修改部门'
@@ -104,10 +100,6 @@
      };
      // 新增
      const onSubmit = async () => {
         if(state.departmentForm.struct && state.departmentForm.struct !== []){
            let departmentId = JSON.parse(JSON.stringify(state.departmentForm.struct))
            state.departmentForm.parentId = departmentId[departmentId.length - 1]
         }
         if(state.title === '新增部门'){
            let res = await departmentApi().addDepartment(state.departmentForm)
            if(res.data.code === '200'){