fly před 3 roky
rodič
revize
2d637fff10

+ 37 - 0
VinnoManagementSystem/src/api/wing/adminManage.js

@@ -0,0 +1,37 @@
+import http from "@/utils/request"
+import common from "@/utils/common"
+
+export default {
+    adminRoleSelectList: {
+        method: 'GetAdminRoleSelectList',
+        name: "角色下拉列表",
+        post: async function (data = {}) {
+            return await http.post({
+                "jsonrpc": "2.0",
+                "id": common.guid(),
+                "method": this.method,
+                "params": [data]
+            });
+        }
+    },
+    adminList: {
+        method: 'GetAdminPagesAsync',
+        name: "查询管理员列表",
+        post: async function (params) {
+            var queryType = params.queryType == null ? '' : params.queryType;
+            var data = {
+                'PageIndex': params.page,
+                'PageSize': params.pageSize,
+                'QueryType': queryType,
+                'KeyWord': params.keyword,
+                'RoleCode': params.roleCode
+            }
+            return await http.post({
+                "jsonrpc": "2.0",
+                "id": common.guid(),
+                "method": this.method,
+                "params": [data]
+            });
+        }
+    },
+}

+ 9 - 1
VinnoManagementSystem/src/locales/lang/zh-cn.js

@@ -86,6 +86,14 @@ export default {
 		email: "邮箱",
 		hospitalName: "所在医院",
 	},
+	admin: {
+		adminQueryTypeOption0: "用户名",
+		adminQueryTypeOption1: "姓名",
+		adminRoleQuery: "管理员角色",
+		adminName: "用户名",
+		adminFullName: "姓名",
+		adminRoleName: "管理员角色名称"
+	},
 	organization: {
 		OrganizationName: "机构名称",
 		OrganizationLogo: "机构Logo",
@@ -173,6 +181,6 @@ export default {
 		userQueryOptions7: "所属科室",
 		confirmShareDevice: "分享当前设备?",
 		confirmCancelShareDevice: "取消分享当前设备?",
-		removeDeviceBindUsers:"此操作将解除已绑定的分享用户, 是否继续?"
+		removeDeviceBindUsers: "此操作将解除已绑定的分享用户, 是否继续?"
 	},
 }

+ 242 - 0
VinnoManagementSystem/src/views/adminManage/adminList.vue

@@ -0,0 +1,242 @@
+<template>
+  <el-container>
+    <el-header>
+    
+        <div class="left-panel">
+          <el-button type="primary" icon="el-icon-plus" @click="add">{{
+            $t("create")
+          }}</el-button>
+          <el-button
+            type="primary"
+            icon="el-icon-compass"
+            :disabled="selection.length == 0"
+            @click="add"
+            >{{ $t("organization.AssignAdmin") }}</el-button
+          >
+        </div>
+        <el-form ref="form" class="right-panel">
+          <div class="right-panel-search">
+            <el-input
+              v-model="search.keyword"
+              clearable
+              style="width: 320px"
+              :placeholder="$t('pleaseInput')"
+            >
+              <template #prepend>
+                <el-select
+                  v-model="search.queryType"
+                  style="width: 120px"
+                  :placeholder="$t('pleaseChoose')"
+                  class="filter-item"
+                >
+                  <el-option
+                    v-for="item in queryTypes"
+                    :key="item"
+                    :label="$t('admin.adminQueryTypeOption' + item)"
+                    :value="item"
+                  />
+                </el-select>
+              </template>
+            </el-input>
+            <el-form-item
+              ref="form"
+              style="padding: 20px 0px 0px 0px"
+              :label="$t('admin.adminRoleQuery')"
+            >
+              <sc-select
+                v-model="search.roleCode"
+                :apiObj="$API.adminManage.adminRoleSelectList"
+                clearable
+                filterable
+                style="width: 100%"
+              ></sc-select>
+            </el-form-item>
+            <el-button type="primary" icon="el-icon-search" @click="upsearch">{{
+              $t("query")
+            }}</el-button>
+          </div>
+        </el-form>
+      
+    </el-header>
+    <el-main class="nopadding">
+      <scTable
+        ref="table"
+        :apiObj="apiObj"
+        :pageSize="10"
+        row-key="UserCode"
+        @selection-change="selectionChange"
+        stripe
+      >
+        <el-table-column type="selection" width="50"></el-table-column>
+        <el-table-column
+          :label="$t('admin.adminName')"
+          prop="AdminName"
+        ></el-table-column>
+         <el-table-column
+          :label="$t('admin.adminFullName')"
+          prop="FullName"
+        ></el-table-column>
+        <el-table-column
+          :label="$t('admin.adminRoleName')"
+          prop="DefaultRoleName"
+        ></el-table-column>
+        <el-table-column :label="$t('createTime')" prop="CreateTime">
+          <template #default="scope">
+            <span>{{
+              scope.row.CreateTime.slice(0, 19).replace("T", " ")
+            }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column
+          :label="$t('operate')"
+          fixed="right"
+          align="center"
+          width="120"
+        >
+          <template #default="scope">
+            <!-- 编辑 -->
+            <el-button
+              type="text"
+              size="small"
+              @click="table_edit(scope.row, scope.$index)"
+              >{{ $t("edit") }}</el-button
+            >
+            <!-- 删除 -->
+            <el-popconfirm
+              :title="confirmDel"
+              @confirm="table_del(scope.row, scope.$index)"
+            >
+              <template #reference>
+                <el-button
+                  type="text"
+                  size="small"
+                  @click="changeTitle(scope.row)"
+                  >{{ $t("delete") }}</el-button
+                >
+              </template>
+            </el-popconfirm>
+          </template>
+        </el-table-column>
+      </scTable>
+    </el-main>
+  </el-container>
+
+  <save-dialog
+    v-if="dialog.show"
+    ref="saveDialog"
+    @success="refresh"
+    @closed="dialog.show = false"
+  ></save-dialog>
+</template>
+
+<script>
+import saveDialog from "./saveAdmin";
+
+export default {
+  components: {
+    saveDialog,
+  },
+  data() {
+    return {
+      dialog: {
+        show: false,
+      },
+      apiObj: this.query,
+      search: {
+        queryType: "0",
+        roleCode: "",
+        keyword: null,
+      },
+      queryTypes: ["0", "1"],
+      selection: [],
+      confirmDel: this.$t("organization.ConfirmDelete"),
+    };
+  },
+  methods: {
+    async query(params) {
+      return await this.$API.adminManage.adminList.post(params);
+    },
+    //搜索
+    upsearch() {
+      this.$refs.table.upData(this.search);
+    },
+    //刷新当前页
+    refresh() {
+      this.$refs.table.refresh();
+    },
+    //增加
+    add() {
+      this.dialog.show = true;
+      this.$nextTick(() => {
+        this.$refs.saveDialog.open();
+      });
+    },
+    //编辑
+    table_edit(row) {
+      this.dialog.show = true;
+      this.$nextTick(() => {
+        this.$refs.saveDialog.open(true).setData(row);
+      });
+    },
+    //审核
+    table_audit(row) {
+      this.$confirm(this.$t("organization.ApproveOrgMsg"), this.$t("audit"), {
+        distinguishCancelAndClose: true,
+        confirmButtonText: this.$t("audited"),
+        cancelButtonText: this.$t("rejected"),
+        type: "warning",
+      })
+        .then(() => {
+          this.$API.wing.post(
+            "ModifyOrganizationStateAsync",
+            {
+              OrganizationCode: row.OrganizationCode,
+              State: 1,
+            },
+            this.refresh
+          );
+        })
+        .catch((action) => {
+          if (action === "cancel") {
+            this.$API.wing.post(
+              "ModifyOrganizationStateAsync",
+              {
+                OrganizationCode: row.OrganizationCode,
+                State: 2,
+              },
+              this.refresh
+            );
+          }
+        })
+        .finally(() => {});
+    },
+    //删除
+    async table_del(row) {
+      await this.$API.wing.post(
+        "RemoveOrganization",
+        {
+          OrganizationCode: row.OrganizationCode,
+        },
+        this.refresh
+      );
+    },
+    //删除前验证
+    async changeTitle(row) {
+      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");
+      }
+    },
+    //表格选择后回调事件
+    selectionChange(selection) {
+      this.selection = selection;
+    },
+  },
+};
+</script>
+
+<style>
+</style>

+ 143 - 0
VinnoManagementSystem/src/views/adminManage/saveAdmin.vue

@@ -0,0 +1,143 @@
+<template>
+	<el-dialog :title="titleMap[mode]" v-model="visible" :width="500" destroy-on-close @closed="$emit('closed')">
+		<el-form :model="form" :rules="rules" :disabled="mode=='show'" ref="dialogForm" label-width="100px" label-position="left">
+			<el-form-item :label="$t('device.deviceTypeCode')" prop="deviceTypeCode">
+				<el-input v-model="form.deviceTypeCode" :disabled="mode!='add'" clearable style="width: 100%;"></el-input>
+			</el-form-item>
+			<el-form-item :label="$t('device.deviceTypeName')" prop="deviceTypeName">
+				<el-input v-model="form.deviceTypeName" clearable style="width:85%;"></el-input>
+                <el-button style="margin-left: 10px;" type="primary" icon="el-icon-plus" circle @click="addModel"></el-button>
+			</el-form-item>
+            <el-form-item
+                v-for="(deviceModel, index) in form.deviceModels"
+                :key="deviceModel.key"
+                :label="$t('device.deviceModel') + (index+1)"
+                :prop="'deviceModels.' + index + '.value'"
+                :rules="{required: true, message: $t('device.deviceTypeNotNull'), trigger: 'blur'}">
+                <el-input v-model="deviceModel.value" style="width: 85%;" />
+                <el-button style="margin-left: 10px;" type="danger" icon="el-icon-delete" circle @click.prevent="removeModel(deviceModel)"></el-button>
+            </el-form-item>
+		</el-form>
+		<template #footer>
+			<el-button @click="visible=false" >{{$t("dialogBox.cancelButtonText")}}</el-button>
+			<el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="submit()">{{this.$t("dialogBox.saveButtonText")}}</el-button>
+		</template>
+	</el-dialog>
+</template>
+
+<script>
+	export default {
+		emits: ['success', 'closed'],
+		data() {
+			return {
+				mode: "add",
+				titleMap: {
+					add: this.$t("dialogBox.addTitle"),
+					edit: this.$t("dialogBox.modifyTitle")
+				},
+				visible: false,
+				isSaveing: false,
+				//表单数据
+				form: {
+                    deviceTypeCode: '',
+                    deviceTypeName: '',
+					deviceModels: []
+				},
+				//验证规则
+				rules: {
+					deviceTypeName: [
+						{required: true, message: this.$t("device.requiredDeviceTypeName"), trigger: 'blur'}
+					],
+					deviceTypeCode: [
+						{required: true, message: this.$t("device.requiredDeviceTypeCode"), trigger: 'blur'}
+					]
+				}
+			}
+		},
+		methods: {
+			//显示
+			open(mode='add'){
+				this.mode = mode;
+				this.visible = true;
+				return this
+			},
+			//表单提交方法
+			submit(){
+				this.$refs.dialogForm.validate(async (valid) => {
+					if (valid) {
+						this.isSaveing = true;
+                        var res = false;
+                        //新增或者修改
+                        if (this.mode === "add")
+                        {
+						    res = await this.$API.device.addDeviceType.post(this.form);
+                        }
+                        else
+                        {
+                            res = await this.$API.device.modifyDeviceType.post(this.form);
+                        }
+						this.isSaveing = false;
+						if(res){
+							this.$emit('success');
+							this.visible = false;
+							this.$message.success(this.$t("response.operateSuccess"))
+						}else{
+							this.$alert(res.message, this.$t("dialogBox.confirmWarningTitle"), {type: 'error'})
+						}
+					}
+				})
+			},
+			//表单注入数据
+			setData(data){
+				if (data)
+				{
+					this.form.deviceTypeCode = data.DictionaryCode;
+					this.form.deviceTypeName = data.Value;
+					if (data.DictionaryList && data.DictionaryList.length > 0)
+					{
+						var dictionaryList = data.DictionaryList;
+						for (var i = 0; i < dictionaryList.length; i++) {
+							this.form.deviceModels.push({
+								value: dictionaryList[i].Value,
+								key: dictionaryList[i].DictionaryCode
+							})
+						}
+					}
+				}
+			},
+            //新增型号
+            addModel() {
+                this.form.deviceModels.push({
+                    value: '',
+                    key: Date.now().toString()
+                })
+            },
+            //移除型号,包括编辑状态移除型号
+            async removeModel(item) {
+                this.isSaveing = true;
+                //查询
+                var res = await this.$API.device.queryDeviceModelBindNum.post(item.key);
+                this.isSaveing = false;
+                if (res > 0) {
+                    this.$alert(this.$t('device.deviceModel1') + res + this.$t('device.deviceModel2'), {
+                        confirmButtonText: this.$t('dialogBox.confirm'),
+                        callback: () => {
+                            this.$message({
+                                type: 'info',
+                                message: this.$t('dialogBox.cancelButtonText')
+                            })
+                        }
+                    })
+                } else {
+                    var index = this.form.deviceModels.indexOf(item)
+                    if (index !== -1) {
+                        this.form.deviceModels.splice(index, 1)
+                    }
+                }
+            },
+		}
+	}
+</script>
+
+<style>
+</style>