Quellcode durchsuchen

Merge branch 'master' of http://git.ius.plus/denny.zhao/VinnoManagementSystem

Conflicts:
	VinnoManagementSystem/src/locales/lang/en.js
denny vor 2 Jahren
Ursprung
Commit
788d58b693

+ 5 - 5
VinnoManagementSystem/src/components/admin/selectAdmin.vue

@@ -1,6 +1,6 @@
 <template>
   <el-dialog
-    :title="$t('admin.AssignAdmin')"
+    :title="$t('admin.assignAdmin')"
     v-model="visible"
     :width="800"
     destroy-on-close
@@ -13,7 +13,7 @@
             <el-input
               v-model="search.KeyWord"
               clearable
-              :placeholder="$t('admin.PleaseInputAdminName')"
+              :placeholder="$t('admin.pleaseInputAdminName')"
             >
             </el-input>
             <el-button type="primary" icon="el-icon-search" @click="upsearch">{{
@@ -41,15 +41,15 @@
             </template>
           </el-table-column>
           <el-table-column
-            :label="$t('admin.AccountName')"
+            :label="$t('admin.accountName')"
             prop="AdminName"
           ></el-table-column>
           <el-table-column
-            :label="$t('admin.FullName')"
+            :label="$t('admin.fullName')"
             prop="FullName"
           ></el-table-column>
           <el-table-column
-            :label="$t('admin.RoleName')"
+            :label="$t('admin.roleName')"
             prop="DefaultRoleName"
           ></el-table-column>
         </scTable>

+ 39 - 35
VinnoManagementSystem/src/locales/lang/en.js

@@ -70,6 +70,10 @@ export default {
 		authenticationState: "Authentication State",
 		userStatusPlaceholder: "Please Choose User Status",		
 		nonactivated: "Nonactivated",
+		authorityNameRequire: "Please input authority name",
+		uniqueCodeRequire: "Please input unique code",
+		frontAuthority: "Front Authority",
+		selectItem: "Please select the menu on the left to operate",
 		activated: "Activated",
 		uncertified: "Uncertified",
 		waitcertified: "Wait Certified",
@@ -114,11 +118,11 @@ export default {
 		description: "Description"
 	},
 	admin: {
-		AssignAdmin: "Assign Admin",
-		PleaseInputAdminName: "Please input name",
-		AccountName: "Account Name",
-		FullName: "User Name",
-		RoleName: "Role Name",
+		assignAdmin: "Assign Admin",
+		pleaseInputAdminName: "Please input name",
+		accountName: "Account Name",
+		fullName: "User Name",
+		roleName: "Role Name",
 		adminQueryTypeOption0: "Account Name",
 		adminQueryTypeOption1: "User Name",
 		adminRoleQuery: "Admin Role",
@@ -130,36 +134,36 @@ export default {
 		assignRole: "assign Role"
 	},
 	organization: {
-		OrganizationName: "Organization Name",
-		OrganizationLogo: "Organization Logo",
-		OrganizationState: "Audit State",
-		OrganizationState0: "WaitAudit",
-		OrganizationState1: "Audited",
-		OrganizationState2: "Rejected",
-		WaitAudit: "WaitAudit",
-		Audited: "Audited",
-		Rejected: "Rejected",
-		CountryName: "Country",
-		ProvinceName: "Province",
-		CityName: "City",
-		PatientType: "Patient Type",
-		PatientType0: "Person",
-		PatientType1: "Animal",
-		AdminFullName: "Admin Name",
-		DirectorName: "Organization Director",
-		QueryType0: "Organization Name",
-		QueryType1: "Admin Name",
-		AssignAdmin: "Assign Admin",
-		ConfirmDelete: "Are You Sure To Del This Organization ?",
-		ConfirmDelete2: "There has users or devices in the current organization. Are you sure to delete this Organization?",
-		FrontOrganization: "Front Organization",
-		ApproveOrgMsg: "Are You Sure To Approve This Organization?",
-		OrgNameRequire: "Please input Organization Name",
-		PatientTypeRequire: "Please choose patient type",
-		UploadLogo: "Upload Logo",
-		SetDirector: "Set Director",
-		Setting0: "Patient Setting",
-		Setting1: "Exam Setting",
+		organizationName: "Organization Name",
+		organizationLogo: "Organization Logo",
+		organizationState: "Audit State",
+		organizationState0: "WaitAudit",
+		organizationState1: "Audited",
+		organizationState2: "Rejected",
+		waitAudit: "WaitAudit",
+		audited: "Audited",
+		rejected: "Rejected",
+		countryName: "Country",
+		provinceName: "Province",
+		cityName: "City",
+		patientType: "Patient Type",
+		patientType0: "Person",
+		patientType1: "Animal",
+		adminFullName: "Admin Name",
+		directorName: "Organization Director",
+		queryType0: "Organization Name",
+		queryType1: "Admin Name",
+		assignAdmin: "Assign Admin",
+		confirmDelete: "Are You Sure To Del This Organization ?",
+		confirmDelete2: "There has users or devices in the current organization. Are you sure to delete this Organizationï¼,
+		frontOrganization: "Front Organization",
+		approveOrgMsg: "Are You Sure To Approve This Organization?",
+		orgNameRequire: "Please input Organization Name",
+		patientTypeRequire: "Please choose patient type",
+		uploadLogo: "Upload Logo",
+		setDirector: "Set Director",
+		setting0: "Patient Setting",
+		setting1: "Exam Setting",
 	},
 	menu: {		
 		home: "Home Page",

+ 4 - 0
VinnoManagementSystem/src/locales/lang/zh-cn.js

@@ -112,6 +112,10 @@ export default {
 		authorityName: "权限名称",
 		uniqueCode: "权限唯一码",
 		uniqueCodeTip: "系统唯一不可重复,否则将导致权限失效。",
+		authorityNameRequire: "请输入权限名称",
+		uniqueCodeRequire: "请输入权限唯一码",
+		frontAuthority: "上级权限",
+		selectItem: "请选择左侧菜单后操作",
 	},
 	admin: {
 		assignAdmin: "分配管理员",

+ 167 - 0
VinnoManagementSystem/src/views/adminManage/adminAuthority.vue

@@ -0,0 +1,167 @@
+<template>
+  <el-container>
+    <el-aside width="300px" v-loading="menuloading">
+      <el-container>
+        <el-header>
+          <el-input
+            :placeholder="$t('pleaseInput')"
+            v-model="menuFilterText"
+            clearable
+          ></el-input>
+        </el-header>
+        <el-main class="nopadding">
+          <el-tree
+            ref="menu"
+            class="menu"
+            node-key="MenuId"
+            :data="menuList"
+            :props="menuProps"
+            highlight-current
+            default-expand-all
+            :expand-on-click-node="false"
+            check-strictly
+            :draggable="false"
+            :filter-node-method="menuFilterNode"
+            @node-click="menuClick"
+            @node-drop="nodeDrop"
+          >
+            <template #default="{ node, data }">
+              <span class="custom-tree-node el-tree-node__label">
+                <span class="label">
+                  {{ node.label }}
+                </span>
+                <span class="do">
+                  <el-icon @click.stop="add(node, data)"
+                    ><el-icon-plus
+                  /></el-icon>
+                </span>
+              </span>
+            </template>
+          </el-tree>
+        </el-main>
+        <el-footer style="height: 51px">
+          <el-button
+            type="primary"
+            size="small"
+            icon="el-icon-plus"
+            @click="add()"
+          ></el-button>
+        </el-footer>
+      </el-container>
+    </el-aside>
+    <el-container>
+      <el-main class="nopadding" style="padding: 20px" ref="main">
+        <save ref="save" :menu="menuList" @success="getMenu"></save>
+      </el-main>
+    </el-container>
+  </el-container>
+</template>
+
+<script>
+let newMenuIndex = 1;
+import save from "./saveAuthority";
+import common from "@/utils/common";
+
+export default {
+  name: "settingMenu",
+  components: {
+    save,
+  },
+  data() {
+    return {
+      menuloading: false,
+      menuList: [],
+      menuProps: {
+        label: function (a) {
+          return `${a.Label}${a.UniqueCode ? `(${a.UniqueCode})` : ""}`;
+        },
+        id: "Id",
+        children: "Children",
+      },
+      menuFilterText: "",
+      authorityList: [],
+    };
+  },
+  watch: {
+    menuFilterText(val) {
+      this.$refs.menu.filter(val);
+    },
+  },
+  mounted() {
+    this.getMenu();
+  },
+  methods: {
+    //加载树数据
+    async getMenu() {
+      this.menuloading = true;
+      var menuList = await this.$API.wing.post("GetAdminFeatureList");
+      this.menuList = menuList;
+      this.authorityList = await this.$API.wing.post(
+        "GetAdminFeatureSelectList"
+      );
+      this.menuloading = false;
+    },
+    //树点击
+    menuClick(data) {
+      if (!data.MenuId) {
+        data.MenuId = data.Id;
+      }
+      this.$refs.save.setData(data, this.authorityList);
+      this.$refs.main.$el.scrollTop = 0;
+    },
+    //树过滤
+    menuFilterNode(value, data) {
+      if (!value) return true;
+      var targetText = `${data.Label}${
+        data.UniqueCode ? `(${data.UniqueCode})` : ""
+      }`;
+      return targetText.indexOf(value) !== -1;
+    },
+    //增加
+    async add(node) {
+      var newMenuData = {
+        MenuId: common.guid(),
+        Label: `未命名${newMenuIndex++}`,
+        FatherCode: node?.data?.Id,
+      };
+      this.$refs.menu.append(newMenuData, node);
+      this.$refs.menu.setCurrentKey(newMenuData.MenuId);
+      this.$refs.save.setData(newMenuData, this.authorityList);
+    },
+  },
+};
+</script>
+
+<style scoped>
+.custom-tree-node {
+  display: flex;
+  flex: 1;
+  align-items: center;
+  justify-content: space-between;
+  font-size: 14px;
+  padding-right: 24px;
+  height: 100%;
+}
+.custom-tree-node .label {
+  display: flex;
+  align-items: center;
+  height: 100%;
+}
+.custom-tree-node .label .el-tag {
+  margin-left: 5px;
+}
+.custom-tree-node .do {
+  display: none;
+}
+.custom-tree-node .do i {
+  margin-left: 5px;
+  color: #999;
+}
+.custom-tree-node .do i:hover {
+  color: #333;
+}
+
+.custom-tree-node:hover .do {
+  display: inline-block;
+}
+</style>

+ 2 - 2
VinnoManagementSystem/src/views/adminManage/adminList.vue

@@ -67,11 +67,11 @@
       >
         <el-table-column type="selection" width="50"></el-table-column>
         <el-table-column
-          :label="$t('admin.AccountName')"
+          :label="$t('admin.accountName')"
           prop="AdminName"
         ></el-table-column>
         <el-table-column
-          :label="$t('admin.FullName')"
+          :label="$t('admin.fullName')"
           prop="FullName"
         ></el-table-column>
         <el-table-column

+ 5 - 5
VinnoManagementSystem/src/views/adminManage/saveAdmin.vue

@@ -13,11 +13,11 @@
       label-width="150px"
       label-position="left"
     >
-      <el-form-item :label="$t('admin.AccountName')" prop="AdminName">
+      <el-form-item :label="$t('admin.accountName')" prop="AdminName">
         <el-input
           v-model="form.AdminName"
           clearable
-          :placeholder="$t('admin.AccountName')"
+          :placeholder="$t('admin.accountName')"
           style="width: 60%"
         ></el-input>
       </el-form-item>
@@ -37,11 +37,11 @@
           style="width: 60%"
         ></el-input>
       </el-form-item>
-      <el-form-item :label="$t('admin.FullName')">
+      <el-form-item :label="$t('admin.fullName')">
         <el-input
           v-model="form.AdminFullName"
           clearable
-          :placeholder="$t('admin.FullName')"
+          :placeholder="$t('admin.fullName')"
           style="width: 60%"
         ></el-input>
       </el-form-item>
@@ -98,7 +98,7 @@ export default {
         AdminName: [
           {
             required: true,
-            message: this.$t("admin.AccountName"),
+            message: this.$t("admin.accountName"),
             trigger: "blur",
           },
         ],

+ 138 - 0
VinnoManagementSystem/src/views/adminManage/saveAuthority.vue

@@ -0,0 +1,138 @@
+<template>
+  <el-empty
+    :description="$t('user.selectItem')"
+    :image-size="100"
+    v-if="!form.MenuId"
+  ></el-empty>
+  <template v-else>
+    <h2>{{ $t(isEdit ? "edit" : "create") }}</h2>
+    <el-form
+      :model="form"
+      :rules="rules"
+      ref="dialogForm"
+      label-width="150px"
+      label-position="right"
+    >
+      <el-form-item :label="$t('user.authorityName')" prop="FeatureName">
+        <el-input
+          v-model="form.FeatureName"
+          clearable
+          :placeholder="$t('user.authorityNameRequire')"
+        ></el-input>
+      </el-form-item>
+      <el-form-item :label="$t('user.uniqueCode')" prop="UniqueCode">
+        <el-input
+          v-model="form.UniqueCode"
+          :placeholder="$t('user.uniqueCodeRequire')"
+          :disabled="form.OldUniqueCode !== ''"
+        ></el-input>
+        <div class="el-form-item-msg">
+          {{ $t("user.uniqueCodeTip") }}
+        </div>
+      </el-form-item>
+      <el-form-item :label="$t('user.frontAuthority')" prop="FatherCode">
+        <el-select
+          v-model="form.FatherCode"
+          clearable
+          filterable
+          style="width: 100%"
+        >
+          <el-option
+            v-for="item in authorityList"
+            :key="item.Key"
+            :label="item.Value"
+            :value="item.Key"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="save" :loading="loading"
+          >保 存</el-button
+        >
+      </el-form-item>
+    </el-form>
+  </template>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      isEdit: false,
+      form: {
+        Id: "",
+        OldUniqueCode: "",
+      },
+      loading: false,
+      rules: {
+        FeatureName: [
+          {
+            required: true,
+            message: this.$t("user.authorityNameRequire"),
+            trigger: "blur",
+          },
+        ],
+        UniqueCode: [
+          {
+            required: true,
+            message: this.$t("user.uniqueCodeRequire"),
+            trigger: "blur",
+          },
+        ],
+      },
+      authorityList: [],
+    };
+  },
+  mounted() {},
+  methods: {
+    //保存
+    async save() {
+      this.$refs.dialogForm.validate(async (valid) => {
+        if (valid) {
+          this.loading = true;
+          var method = this.isEdit ? "ModifyAdminFeature" : "CreateAdminFeature";
+          await this.$API.wing.post(method, this.form, () => {
+            this.form.MenuId = "";
+            this.$message.success(this.$t("response.operateSuccess"));
+            this.$emit("success");
+            this.loading = false;
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    //表单注入数据
+    setData(data, authorityList) {
+      if (data.Id) {
+        this.isEdit = true;
+        authorityList = authorityList.filter((x) => x.Key != data.Id);
+      }
+      var form = JSON.parse(JSON.stringify(data));
+      form.FeatureCode = form.Id;
+      form.FeatureName = form.Label;
+      form.OldUniqueCode = form.UniqueCode || "";
+      this.form = form;
+      this.authorityList = authorityList;
+    },
+  },
+};
+</script>
+
+<style scoped>
+h2 {
+  font-size: 17px;
+  color: #3c4a54;
+  padding: 0 0 30px 0;
+}
+.apilist {
+  border-left: 1px solid #eee;
+}
+
+[data-theme="dark"] h2 {
+  color: #fff;
+}
+[data-theme="dark"] .apilist {
+  border-color: #434343;
+}
+</style>

+ 21 - 21
VinnoManagementSystem/src/views/organizationManage/organizationList.vue

@@ -17,7 +17,7 @@
           icon="el-icon-share"
           :disabled="selection.length == 0"
           @click="table_saveAdmin"
-          >{{ $t("organization.AssignAdmin") }}</el-button
+          >{{ $t("organization.assignAdmin") }}</el-button
         >
       </div>
       <div class="right-panel">
@@ -38,7 +38,7 @@
                 <el-option
                   v-for="item in queryTypes"
                   :key="item"
-                  :label="$t('organization.QueryType' + item)"
+                  :label="$t('organization.queryType' + item)"
                   :value="item"
                 />
               </el-select>
@@ -49,7 +49,7 @@
             v-model="search.State"
             clearable
             style="width: 200px"
-            :placeholder="$t('organization.OrganizationState')"
+            :placeholder="$t('organization.organizationState')"
             class="filter-item"
           >
             <el-option
@@ -77,11 +77,11 @@
       >
         <el-table-column type="selection" width="50"></el-table-column>
         <el-table-column
-          :label="$t('organization.OrganizationName')"
+          :label="$t('organization.organizationName')"
           prop="OrganizationName"
         ></el-table-column>
         <el-table-column
-          :label="$t('organization.OrganizationLogo')"
+          :label="$t('organization.organizationLogo')"
           prop="LogoUrl"
         >
           <template #default="scope">
@@ -93,43 +93,43 @@
           </template>
         </el-table-column>
         <el-table-column
-          :label="$t('organization.OrganizationState')"
+          :label="$t('organization.organizationState')"
           prop="State"
         >
           <template #default="scope">
             <span>{{
-              $t("organization.OrganizationState" + scope.row.State)
+              $t("organization.organizationState" + scope.row.State)
             }}</span>
           </template>
         </el-table-column>
         <el-table-column
-          :label="$t('organization.CountryName')"
+          :label="$t('organization.countryName')"
           prop="CountryName"
         ></el-table-column>
         <el-table-column
-          :label="$t('organization.ProvinceName')"
+          :label="$t('organization.provinceName')"
           prop="ProvinceName"
         ></el-table-column>
         <el-table-column
-          :label="$t('organization.CityName')"
+          :label="$t('organization.cityName')"
           prop="CityName"
         ></el-table-column>
         <el-table-column
-          :label="$t('organization.PatientType')"
+          :label="$t('organization.patientType')"
           prop="PatientType"
         >
           <template #default="scope">
             <span>{{
-              $t("organization.PatientType" + scope.row.PatientType)
+              $t("organization.patientType" + scope.row.PatientType)
             }}</span>
           </template>
         </el-table-column>
         <el-table-column
-          :label="$t('organization.AdminFullName')"
+          :label="$t('organization.adminFullName')"
           prop="AdminFullName"
         ></el-table-column>
         <el-table-column
-          :label="$t('organization.DirectorName')"
+          :label="$t('organization.directorName')"
           prop="DirectorName"
         ></el-table-column>
         <el-table-column :label="$t('createTime')" prop="CreateTime">
@@ -183,13 +183,13 @@
               <template #dropdown>
                 <el-dropdown-menu>
                   <el-dropdown-item @click="table_saveUser(scope.row)">{{
-                    $t("organization.SetDirector")
+                    $t("organization.setDirector")
                   }}</el-dropdown-item>
                   <el-dropdown-item @click="table_Setting(scope.row, 0)">{{
-                    $t("organization.Setting0")
+                    $t("organization.setting0")
                   }}</el-dropdown-item>
                   <el-dropdown-item @click="table_Setting(scope.row, 1)">{{
-                    $t("organization.Setting1")
+                    $t("organization.setting1")
                   }}</el-dropdown-item>
                 </el-dropdown-menu>
               </template>
@@ -254,7 +254,7 @@ export default {
       queryTypes: ["0", "1"],
       stateTypes: ["WaitAudit", "Audited", "Rejected"],
       selection: [],
-      confirmDel: this.$t("organization.ConfirmDelete"),
+      confirmDel: this.$t("organization.confirmDelete"),
       organizationCode: "",
     };
   },
@@ -345,7 +345,7 @@ export default {
     },
     //审核
     table_audit(row) {
-      this.$confirm(this.$t("organization.ApproveOrgMsg"), this.$t("audit"), {
+      this.$confirm(this.$t("organization.approveOrgMsg"), this.$t("audit"), {
         distinguishCancelAndClose: true,
         confirmButtonText: this.$t("audited"),
         cancelButtonText: this.$t("rejected"),
@@ -387,12 +387,12 @@ export default {
     },
     //删除前验证
     async changeTitle(row) {
-      this.confirmDel = this.$t("organization.ConfirmDelete");
+      this.confirmDel = this.$t("organization.confirmDelete");
       var res = await this.$API.wing.post("OrganizationBindQueryResult", {
         OrganizationCode: row.OrganizationCode,
       });
       if (res.BindDeviceNum > 0 || res.BindUserNum > 0) {
-        this.confirmDel = this.$t("organization.ConfirmDelete2");
+        this.confirmDel = this.$t("organization.confirmDelete2");
       }
     },
     //表格选择后回调事件

+ 13 - 13
VinnoManagementSystem/src/views/organizationManage/saveOrganization.vue

@@ -13,38 +13,38 @@
       label-width="100px"
       label-position="right"
     >
-      <el-form-item :label="$t('organization.OrganizationLogo')" prop="LogoUrl">
+      <el-form-item :label="$t('organization.organizationLogo')" prop="LogoUrl">
         <sc-upload
           v-model="form.LogoUrl"
-          :title="$t('organization.UploadLogo')"
+          :title="$t('organization.uploadLogo')"
           :width="90"
           :height="90"
         ></sc-upload>
       </el-form-item>
       <el-form-item
-        :label="$t('organization.OrganizationName')"
+        :label="$t('organization.organizationName')"
         prop="OrganizationName"
       >
         <el-input
           v-model="form.OrganizationName"
           clearable
-          :placeholder="$t('organization.OrgNameRequire')"
+          :placeholder="$t('organization.orgNameRequire')"
         ></el-input>
       </el-form-item>
-      <el-form-item :label="$t('organization.PatientType')" prop="PatientType">
+      <el-form-item :label="$t('organization.patientType')" prop="PatientType">
         <el-select v-model="form.PatientType" style="width: 100%">
           <el-option
-            :label="$t('organization.PatientType0')"
+            :label="$t('organization.patientType0')"
             :value="0"
           ></el-option>
           <el-option
-            :label="$t('organization.PatientType1')"
+            :label="$t('organization.patientType1')"
             :value="1"
           ></el-option>
         </el-select>
       </el-form-item>
 
-      <el-form-item :label="$t('organization.CountryName')" prop="CountryCode">
+      <el-form-item :label="$t('organization.countryName')" prop="CountryCode">
         <el-select
           v-model="form.CountryCode"
           @change="changeCountry"
@@ -60,7 +60,7 @@
       </el-form-item>
 
       <el-form-item
-        :label="$t('organization.ProvinceName')"
+        :label="$t('organization.provinceName')"
         prop="ProvinceCode"
       >
         <el-select
@@ -78,7 +78,7 @@
         </el-select>
       </el-form-item>
 
-      <el-form-item :label="$t('organization.CityName')" prop="CityCode">
+      <el-form-item :label="$t('organization.cityName')" prop="CityCode">
         <el-select
           v-model="form.CityCode"
           @change="changeCity"
@@ -95,7 +95,7 @@
       </el-form-item>
 
       <el-form-item
-        :label="$t('organization.FrontOrganization')"
+        :label="$t('organization.frontOrganization')"
         prop="ParentCode"
       >
         <el-select v-model="form.ParentCode" clearable style="width: 100%">
@@ -129,14 +129,14 @@ export default {
         OrganizationName: [
           {
             required: true,
-            message: this.$t("organization.OrgNameRequire"),
+            message: this.$t("organization.orgNameRequire"),
             trigger: "blur",
           },
         ],
         PatientType: [
           {
             required: true,
-            message: this.$t("organization.PatientTypeRequire"),
+            message: this.$t("organization.patientTypeRequire"),
             trigger: "blur",
           },
         ],

+ 2 - 2
VinnoManagementSystem/src/views/organizationManage/saveSetting.vue

@@ -1,6 +1,6 @@
 <template>
   <el-dialog
-    :title="$t('organization.Setting' + settingType)"
+    :title="$t('organization.setting' + settingType)"
     v-model="visible"
     :width="800"
     destroy-on-close
@@ -17,7 +17,7 @@
         <el-input v-model="form.SettingVersion" disabled></el-input>
       </el-form-item>
       <el-form-item
-        :label="$t('organization.Setting' + settingType)"
+        :label="$t('organization.setting' + settingType)"
         prop="SettingJson"
       >
         <el-input

+ 10 - 49
VinnoManagementSystem/src/views/userManage/authority.vue

@@ -20,6 +20,7 @@
             default-expand-all
             :expand-on-click-node="false"
             check-strictly
+            :draggable="false"
             :filter-node-method="menuFilterNode"
             @node-click="menuClick"
             @node-drop="nodeDrop"
@@ -78,6 +79,7 @@ export default {
         children: "Children",
       },
       menuFilterText: "",
+      authorityList: [],
     };
   },
   watch: {
@@ -93,15 +95,18 @@ export default {
     async getMenu() {
       this.menuloading = true;
       var menuList = await this.$API.wing.post("GetUserFeatureList");
-      menuList.forEach((m) => {
-        m.MenuId = m.Id;
-      });
       this.menuList = menuList;
+      this.authorityList = await this.$API.wing.post(
+        "GetUserFeatureSelectList"
+      );
       this.menuloading = false;
     },
     //树点击
     menuClick(data) {
-      this.$refs.save.setData(data, true);
+      if (!data.MenuId) {
+        data.MenuId = data.Id;
+      }
+      this.$refs.save.setData(data, this.authorityList);
       this.$refs.main.$el.scrollTop = 0;
     },
     //树过滤
@@ -112,13 +117,6 @@ export default {
       }`;
       return targetText.indexOf(value) !== -1;
     },
-    //树拖拽
-    nodeDrop(draggingNode, dropNode, dropType) {
-      this.$refs.save.setData({});
-      this.$message(
-        `拖拽对象:${draggingNode.data.meta.title}, 释放对象:${dropNode.data.meta.title}, 释放对象的位置:${dropType}`
-      );
-    },
     //增加
     async add(node) {
       var newMenuData = {
@@ -126,46 +124,9 @@ export default {
         Label: `未命名${newMenuIndex++}`,
         FatherCode: node?.data?.Id,
       };
-
       this.$refs.menu.append(newMenuData, node);
       this.$refs.menu.setCurrentKey(newMenuData.MenuId);
-      this.$refs.save.setData(newMenuData);
-    },
-    //删除菜单
-    async delMenu() {
-      var CheckedNodes = this.$refs.menu.getCheckedNodes();
-      if (CheckedNodes.length == 0) {
-        this.$message.warning("请选择需要删除的项");
-        return false;
-      }
-
-      var confirm = await this.$confirm("确认删除已选择的菜单吗?", "提示", {
-        type: "warning",
-        confirmButtonText: "删除",
-        confirmButtonClass: "el-button--danger",
-      }).catch(() => {});
-      if (confirm != "confirm") {
-        return false;
-      }
-
-      this.menuloading = true;
-      var reqData = {
-        ids: CheckedNodes.map((item) => item.id),
-      };
-      var res = await this.$API.demo.post.post(reqData);
-      this.menuloading = false;
-
-      if (res.code == 200) {
-        CheckedNodes.forEach((item) => {
-          var node = this.$refs.menu.getNode(item);
-          if (node.isCurrent) {
-            this.$refs.save.setData({});
-          }
-          this.$refs.menu.remove(item);
-        });
-      } else {
-        this.$message.warning(res.message);
-      }
+      this.$refs.save.setData(newMenuData, this.authorityList);
     },
   },
 };

+ 94 - 50
VinnoManagementSystem/src/views/userManage/saveAuthority.vue

@@ -1,45 +1,57 @@
 <template>
-  <h2>{{ $t(isEdit ? "edit" : "create") }}</h2>
-  <el-form
-    :model="form"
-    :rules="rules"
-    ref="dialogForm"
-    label-width="100px"
-    label-position="right"
-  >
-    <el-form-item :label="$t('user.authorityName')" prop="FeatureName">
-      <el-input
-        v-model="form.FeatureName"
-        clearable
-        :placeholder="$t('user.authorityName')"
-      ></el-input>
-    </el-form-item>
-    <!-- <el-form-item label="上级菜单" prop="parentId">
-      <el-cascader
-        v-model="form.parentId"
-        :options="menuOptions"
-        :props="menuProps"
-        :show-all-levels="false"
-        placeholder="顶级菜单"
-        clearable
-        disabled
-      ></el-cascader>
-    </el-form-item> -->
-    <el-form-item :label="$t('user.uniqueCode')" prop="UniqueCode">
-      <el-input
-        v-model="form.UniqueCode"
-        :placeholder="$t('user.uniqueCode')"
-      ></el-input>
-      <div class="el-form-item-msg">
-        {{ $t("user.uniqueCodeTip") }}
-      </div>
-    </el-form-item>
-    <el-form-item>
-      <el-button type="primary" @click="save" :loading="loading"
-        >保 存</el-button
-      >
-    </el-form-item>
-  </el-form>
+  <el-empty
+    :description="$t('user.selectItem')"
+    :image-size="100"
+    v-if="!form.MenuId"
+  ></el-empty>
+  <template v-else>
+    <h2>{{ $t(isEdit ? "edit" : "create") }}</h2>
+    <el-form
+      :model="form"
+      :rules="rules"
+      ref="dialogForm"
+      label-width="150px"
+      label-position="right"
+    >
+      <el-form-item :label="$t('user.authorityName')" prop="FeatureName">
+        <el-input
+          v-model="form.FeatureName"
+          clearable
+          :placeholder="$t('user.authorityNameRequire')"
+        ></el-input>
+      </el-form-item>
+      <el-form-item :label="$t('user.uniqueCode')" prop="UniqueCode">
+        <el-input
+          v-model="form.UniqueCode"
+          :placeholder="$t('user.uniqueCodeRequire')"
+          :disabled="form.OldUniqueCode !== ''"
+        ></el-input>
+        <div class="el-form-item-msg">
+          {{ $t("user.uniqueCodeTip") }}
+        </div>
+      </el-form-item>
+      <el-form-item :label="$t('user.frontAuthority')" prop="FatherCode">
+        <el-select
+          v-model="form.FatherCode"
+          clearable
+          filterable
+          style="width: 100%"
+        >
+          <el-option
+            v-for="item in authorityList"
+            :key="item.Key"
+            :label="item.Value"
+            :value="item.Key"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="save" :loading="loading"
+          >保 存</el-button
+        >
+      </el-form-item>
+    </el-form>
+  </template>
 </template>
 
 <script>
@@ -47,29 +59,61 @@ export default {
   data() {
     return {
       isEdit: false,
-      form: {},
+      form: {
+        Id: "",
+        OldUniqueCode: "",
+      },
       loading: false,
+      rules: {
+        FeatureName: [
+          {
+            required: true,
+            message: this.$t("user.authorityNameRequire"),
+            trigger: "blur",
+          },
+        ],
+        UniqueCode: [
+          {
+            required: true,
+            message: this.$t("user.uniqueCodeRequire"),
+            trigger: "blur",
+          },
+        ],
+      },
+      authorityList: [],
     };
   },
   mounted() {},
   methods: {
     //保存
     async save() {
-      this.loading = true;
-      var method = this.isEdit ? "ModifyUserFeature" : "CreateUserFeature";
-      await this.$API.wing.post(method, this.form, () => {
-        this.loading = false;
-        this.$message.success(this.$t("response.operateSuccess"));
-        this.$emit("success");
+      this.$refs.dialogForm.validate(async (valid) => {
+        if (valid) {
+          this.loading = true;
+          var method = this.isEdit ? "ModifyUserFeature" : "CreateUserFeature";
+          await this.$API.wing.post(method, this.form, () => {
+            this.form.MenuId = "";
+            this.$message.success(this.$t("response.operateSuccess"));
+            this.$emit("success");
+            this.loading = false;
+          });
+        } else {
+          return false;
+        }
       });
     },
     //表单注入数据
-    setData(data) {
-      this.isEdit = !!data.Id;
+    setData(data, authorityList) {
+      if (data.Id) {
+        this.isEdit = true;
+        authorityList = authorityList.filter((x) => x.Key != data.Id);
+      }
       var form = JSON.parse(JSON.stringify(data));
       form.FeatureCode = form.Id;
       form.FeatureName = form.Label;
+      form.OldUniqueCode = form.UniqueCode || "";
       this.form = form;
+      this.authorityList = authorityList;
     },
   },
 };