石广澎
2023-12-12 122f6d1db1e0af5ede6f96cd390f393e5f222e99
admin-web/src/views/systemManger/server/user/edit.vue
@@ -11,6 +11,11 @@
      <el-form-item label="当前机构">
        <el-input v-model="setting.tenantName" disabled style="width: 250px"/>
      </el-form-item>
      <el-form-item label="部门" prop="sysDeptId">
        <el-select v-model="formData.sysDeptId">
            <el-option v-for="(item,index) in deptmentOptions" :key="index" :label="item.name" :value="item.id"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="人员姓名" prop="userName">
        <el-input v-model="formData.userName" clearable maxlength="20" show-word-limit style="width: 250px"/>
      </el-form-item>
@@ -61,13 +66,14 @@
</template>
<script>
    import winSm from '@/components/win/win-sm'
    import myButton from '@/components/myButton/myButton'
    import * as DateFormatter from '@/utils/DateFormatter'
    import * as role from "@/api/system/role";
    import * as user from "@/api/user";
import winSm from '@/components/win/win-sm'
import myButton from '@/components/myButton/myButton'
import * as DateFormatter from '@/utils/DateFormatter'
import * as role from "@/api/system/role";
import * as user from "@/api/user";
import {departmentListAll} from "@/api/system/deptment";
    export default {
export default {
        components: {winSm, myButton},
        props: {
            // setting 中须至少包含控制dialog显示或隐藏的属性,其余属性可拓展
@@ -81,6 +87,7 @@
        },
        data() {
            return {
                deptmentOptions:[],
                checkAll: false,
                checkedList: [],
                roleList: [
@@ -103,6 +110,7 @@
                    label: 'name',
                },
                formData: {
                    sysDeptId:'',
                    userName: '',
                    userCode: '',
                    userPhone: '',
@@ -112,6 +120,9 @@
                    seq: null,
                },
                rules: {
                    sysDeptId: [
                        {required: true, message: '请选择部门', trigger: 'change'}
                    ],
                    userName: [
                        {required: true, message: '请输入人员姓名', trigger: 'blur'}
                    ],
@@ -133,21 +144,23 @@
        created() {
            this.getInfo()
            this.getAllRole()
            this.getDeptmentOptions()
        },
        methods: {
            // 获取所有角色
            getAllRole() {
              const user = this.$store.getters.userInfo
              // const user = this.$store.getters.userInfo
              // this.data_scope = 1
              // if (user.lv == 1) {
              //   this.data_scope = 1
              // }
              // if (user.lv == 2) {
              //   this.data_scope = 2
              // }
              // if (user.lv == 3) {
              //   this.data_scope = 3
              // }
              this.data_scope = 1
              if (user.lv == 1) {
                this.data_scope = 1
              }
              if (user.lv == 2) {
                this.data_scope = 2
              }
              if (user.lv == 3) {
                this.data_scope = 3
              }
              role.listRoleByDataScope({dataScope: this.data_scope}).then(response => {
                  if (response) {
                    this.roleOptions = response;
@@ -158,6 +171,11 @@
                    }
                );
            },
            getDeptmentOptions(){
                departmentListAll({tenantId:this.setting.tenantId}).then(res=>{
                    this.deptmentOptions = res
                })
            },
            handleCheckAllChange(val) {
                if (val) {
                    this.checkedList = this.roleOptions.map(x => {