版本更新
This commit is contained in:
128
openhis-ui-vue3/src/views/system/tenant/bindUser.vue
Normal file
128
openhis-ui-vue3/src/views/system/tenant/bindUser.vue
Normal file
@@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<!-- 绑定用户 -->
|
||||
<el-dialog title="选择用户" v-model="visible" width="1000px" top="5vh" append-to-body>
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true">
|
||||
<el-form-item label="用户名称" prop="userName">
|
||||
<el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable style="width: 150px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户昵称" prop="nickName">
|
||||
<el-input v-model="queryParams.nickName" placeholder="请输入用户昵称" clearable style="width: 150px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phoneNumber">
|
||||
<el-input v-model="queryParams.phoneNumber" placeholder="请输入手机号" clearable style="width: 150px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<el-table @row-click="clickRow" ref="refTable" :data="userList" @selection-change="handleSelectionChange"
|
||||
height="260px">
|
||||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="手机号" prop="phonenumber" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_normal_disable" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-row>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="handleBindUser">确 定</el-button>
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup name="BindUser">
|
||||
import { getUnbindTenantUserList, bindTenantUser } from "@/api/system/tenant";
|
||||
|
||||
const props = defineProps({
|
||||
tenantId: {
|
||||
type: [Number, String]
|
||||
}
|
||||
});
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
|
||||
const userList = ref([]);
|
||||
const visible = ref(false);
|
||||
const total = ref(0);
|
||||
const userIds = ref([]);
|
||||
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
tenantId: undefined,
|
||||
userName: undefined,
|
||||
nickName: undefined,
|
||||
phonenumber: undefined
|
||||
});
|
||||
|
||||
// 显示弹框
|
||||
function show() {
|
||||
queryParams.tenantId = props.tenantId;
|
||||
getList();
|
||||
visible.value = true;
|
||||
}
|
||||
/**选择行 */
|
||||
function clickRow(row) {
|
||||
proxy.$refs["refTable"].toggleRowSelection(row);
|
||||
}
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
userIds.value = selection.map(item => item.userId);
|
||||
}
|
||||
// 查询表数据
|
||||
function getList() {
|
||||
getUnbindTenantUserList(queryParams).then(res => {
|
||||
userList.value = res.data.records;
|
||||
total.value = res.data.total;
|
||||
});
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
const emit = defineEmits(["ok"]);
|
||||
/** 选择绑定用户操作 */
|
||||
function handleBindUser() {
|
||||
if (userIds.value.length == 0) {
|
||||
proxy.$modal.msgError("请选择要绑定的用户");
|
||||
return;
|
||||
}
|
||||
bindTenantUser(queryParams.tenantId, userIds.value).then(res => {
|
||||
proxy.$modal.msgSuccess(res.msg);
|
||||
if (res.code === 200) {
|
||||
visible.value = false;
|
||||
emit("ok");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
</script>
|
||||
434
openhis-ui-vue3/src/views/system/tenant/index.vue
Normal file
434
openhis-ui-vue3/src/views/system/tenant/index.vue
Normal file
@@ -0,0 +1,434 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" v-show="showSearch" :inline="true" label-width="68px">
|
||||
<el-form-item label="租户ID" prop="tenantId">
|
||||
<el-input v-model="queryParams.tenantId" placeholder="请输入租户ID" clearable style="width: 240px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租户编码" prop="tenantCode">
|
||||
<el-input v-model="queryParams.tenantCode" placeholder="请输入租户编码" clearable style="width: 240px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租户名称" prop="tenantName">
|
||||
<el-input v-model="queryParams.tenantName" placeholder="请输入租户名称" clearable style="width: 240px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="状态" clearable style="width: 240px">
|
||||
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="CircleCheck" :disabled="multiple" @click="handleEnable">启用</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="CircleClose" :disabled="multiple" @click="handleDisable">停用</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 表格数据 -->
|
||||
<el-table v-loading="loading" :data="tenantList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="租户ID" prop="id" width="200" />
|
||||
<el-table-column label="租户编码" prop="tenantCode" :show-overflow-tooltip="true" width="250" />
|
||||
<el-table-column label="租户名称" prop="tenantName" :show-overflow-tooltip="true" width="250" />
|
||||
<el-table-column label="状态" align="center" width="100">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1"
|
||||
@change="handleStatusChange(scope.row)"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="remark" :show-overflow-tooltip="true" width="200" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="所属用户" placement="top">
|
||||
<el-button link type="primary" icon="User" @click="handleSetUser(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="合同管理" placement="top">
|
||||
<el-button link type="primary" icon="Document" @click="handleSetContract(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="基本配置" placement="top">
|
||||
<el-button link type="primary" icon="Setting" @click="handleSetOption(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改租户对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="tenantRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="租户编码" prop="tenantCode">
|
||||
<el-input v-model="form.tenantCode" placeholder="请输入租户编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租户名称" prop="tenantName">
|
||||
<el-input v-model="form.tenantName" placeholder="请输入租户名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.value">{{ dict.label
|
||||
}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 修改租户配置项对话框 -->
|
||||
<el-dialog :title="optionTitle" v-model="optionOpen" width="1600px" append-to-body class="tenant-option-dialog">
|
||||
<el-form ref="optionRef" :model="optionForm" label-width="300px" class="three-column-form">
|
||||
<div class="form-grid">
|
||||
<el-form-item v-for="item in dynamicFormList" :key="item.code" :label="`${item.code}(${item.name})`" :prop="item.code"
|
||||
class="grid-item">
|
||||
<el-input v-model="item.content" :placeholder="`请输入${item.name}`" clearable />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer" style="margin-top: 15px;">
|
||||
<el-button type="primary" @click="submitOptionForm">确 定</el-button>
|
||||
<el-button @click="cancelSubmitOption">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Tenant">
|
||||
import { getTenantPage, getTenantDetail, addTenant, editTenant, delTenant, enableTenant, disableTenant, getTenantOptionDetailList, saveTenantOptionDetailList, getTenantOptionFormList } from "@/api/system/tenant";
|
||||
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
|
||||
const dynamicFormList = ref([]);
|
||||
// 当前租户信息
|
||||
const currentTenantId = ref(null);
|
||||
const currentTenantName = ref('');
|
||||
// 配置项值存储对象
|
||||
const optionContents = ref([]);
|
||||
// 配置项表单数据
|
||||
const optionForm = reactive({
|
||||
tenantId: null,
|
||||
optionList: []
|
||||
});
|
||||
|
||||
const tenantList = ref([]);
|
||||
const open = ref(false);
|
||||
const optionOpen = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const optionTitle = ref("");
|
||||
const dateRange = ref([]);
|
||||
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
optionForm: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
tenantId: undefined,
|
||||
tenantName: undefined,
|
||||
status: undefined
|
||||
},
|
||||
rules: {
|
||||
tenantCode: [
|
||||
{ required: true, message: "租户编码不能为空", trigger: "blur" },
|
||||
{ min: 1, max: 50, message: '长度需在1到50个字符之间', trigger: 'blur' }
|
||||
],
|
||||
tenantName: [
|
||||
{ required: true, message: "租户名称不能为空", trigger: "blur" },
|
||||
{ min: 1, max: 50, message: '长度需在1到50个字符之间', trigger: 'blur' }
|
||||
],
|
||||
remark: [
|
||||
{ max: 300, message: '备注不能超过300个字符', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询租户列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
getTenantPage(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
|
||||
tenantList.value = response.data.records;
|
||||
total.value = response.data.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const tenantIds = row.id || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除租户ID为"' + tenantIds + '"的数据项?').then(function () {
|
||||
return delTenant(tenantIds);
|
||||
}).then((response) => {
|
||||
getList();
|
||||
if (response.code != 0) {
|
||||
proxy.$modal.msgSuccess(response.msg);
|
||||
} else {
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}
|
||||
}).catch(() => { });
|
||||
}
|
||||
/** 启用按钮操作 */
|
||||
function handleEnable() {
|
||||
const tenantIds = ids.value;
|
||||
proxy.$modal.confirm('是否确认启用租户ID为"' + tenantIds + '"的数据项?').then(function () {
|
||||
return enableTenant(ids.value);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("启用成功");
|
||||
}).catch(() => { });
|
||||
}
|
||||
/** 停用按钮操作 */
|
||||
function handleDisable() {
|
||||
const tenantIds = ids.value;
|
||||
proxy.$modal.confirm('是否确认停用租户ID为"' + tenantIds + '"的数据项?').then(function () {
|
||||
return disableTenant(tenantIds);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("停用成功");
|
||||
}).catch(() => { });
|
||||
}
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
/** 租户状态修改 */
|
||||
function handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用";
|
||||
proxy.$modal.confirm('确认要' + text + '"' + row.id + '"租户吗?').then(function () {
|
||||
if (row.status === "0") {
|
||||
return enableTenant(Array.of(row.id));
|
||||
} else {
|
||||
return disableTenant(Array.of(row.id));
|
||||
}
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess(text + "成功");
|
||||
}).catch(function () {
|
||||
row.status = row.status === "0" ? "1" : "0";
|
||||
});
|
||||
}
|
||||
/** 所属用户 */
|
||||
function handleSetUser(row) {
|
||||
router.push("/system/tenant-user/set/" + row.id);
|
||||
}
|
||||
/** 合同管理 */
|
||||
function handleSetContract(row) {
|
||||
router.push("/system/tenant-contract/set/" + row.id);
|
||||
}
|
||||
/** 重置新增的表单以及其他数据 */
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: undefined,
|
||||
tenantName: undefined,
|
||||
status: "0",
|
||||
remark: undefined
|
||||
};
|
||||
proxy.resetForm("tenantRef");
|
||||
}
|
||||
/** 添加租户 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加租户";
|
||||
}
|
||||
/** 修改租户 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const tenantId = row.id || ids.value;
|
||||
getTenantDetail(tenantId).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改租户";
|
||||
});
|
||||
}
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["tenantRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != undefined) {
|
||||
editTenant(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addTenant(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
/** 打开配置项对话框 */
|
||||
async function handleSetOption(row) {
|
||||
try {
|
||||
loading.value = true;
|
||||
// 设置当前租户信息
|
||||
currentTenantId.value = row.id;
|
||||
currentTenantName.value = row.tenantName;
|
||||
optionTitle.value = `基本配置`;
|
||||
// 重置表单
|
||||
resetOption();
|
||||
optionForm.tenantId = row.id;
|
||||
// 获取动态表单配置
|
||||
const formListRes = await getTenantOptionFormList();
|
||||
dynamicFormList.value = formListRes.data || [];
|
||||
// 获取租户已有配置
|
||||
const detailRes = await getTenantOptionDetailList(row.id);
|
||||
if (detailRes.data) {
|
||||
dynamicFormList.value.forEach(item => {
|
||||
const existingConfig = detailRes.data.find(c => c.code === item.code);
|
||||
item.content = existingConfig ? existingConfig.content : '';
|
||||
});
|
||||
} else {
|
||||
// 初始化空内容
|
||||
dynamicFormList.value.forEach(item => {
|
||||
item.content = '';
|
||||
});
|
||||
}
|
||||
optionOpen.value = true;
|
||||
} catch (error) {
|
||||
console.error('获取配置项失败:', error);
|
||||
proxy.$modal.msgError("获取配置项失败");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
/** Option提交按钮 */
|
||||
async function submitOptionForm() {
|
||||
try {
|
||||
// 准备提交数据
|
||||
const submitData = {
|
||||
tenantId: optionForm.tenantId,
|
||||
optionList: dynamicFormList.value
|
||||
};
|
||||
// 调用保存接口
|
||||
loading.value = true;
|
||||
const res = await saveTenantOptionDetailList(submitData);
|
||||
if (res.code === 200) {
|
||||
proxy.$modal.msgSuccess("配置保存成功");
|
||||
optionOpen.value = false;
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg || "配置保存失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('表单验证失败:', error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
/** 重置配置项表单 */
|
||||
function resetOption() {
|
||||
dynamicFormList.value.forEach(item => {
|
||||
item.content = '';
|
||||
});
|
||||
if (proxy.$refs["optionRef"]) {
|
||||
proxy.$refs["optionRef"].resetFields();
|
||||
}
|
||||
}
|
||||
/** 取消配置项提交 */
|
||||
function cancelSubmitOption() {
|
||||
optionOpen.value = false;
|
||||
resetOption();
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 20px 15px;
|
||||
}
|
||||
|
||||
.grid-item {
|
||||
margin-bottom: 0;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
padding: 5px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.grid-item :deep(.el-input) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 描述文本样式 */
|
||||
.item-description {
|
||||
font-size: 12px;
|
||||
color: #7f8c8d;
|
||||
margin-top: 8px;
|
||||
line-height: 1.4;
|
||||
padding: 5px;
|
||||
background-color: #f9f9f9;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
267
openhis-ui-vue3/src/views/system/tenant/setContract.vue
Normal file
267
openhis-ui-vue3/src/views/system/tenant/setContract.vue
Normal file
@@ -0,0 +1,267 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="addContract">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Close" @click="handleClose">关闭</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="contractList">
|
||||
<el-table-column label="合同名称" prop="contractName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="状态" align="center" key="status_dictText" prop="status_dictText"
|
||||
:show-overflow-tooltip="true" />
|
||||
<el-table-column label="合同类别" align="center" key="category_dictText" prop="category_dictText"
|
||||
:show-overflow-tooltip="true" />
|
||||
<el-table-column label="合同编码" prop="busNo" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="editContract(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handelDel(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
|
||||
<!-- 添加或修改合同对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="1200px" append-to-body class="tenant-option-dialog">
|
||||
<el-form ref="contractRef" :model="form" label-width="180px" class="three-column-form">
|
||||
<div class="form-grid">
|
||||
<el-form-item label="合同名称" prop="contractName">
|
||||
<el-input v-model="form.contractName" placeholder="请输入合同名称" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="合同编码" prop="busNo">
|
||||
<el-input v-model="form.busNo" placeholder="请输入合同编码" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="statusEnum">
|
||||
<el-input v-model="form.statusEnum" placeholder="请输入状态" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="合同类别" prop="categoryEnum">
|
||||
<el-select v-model="form.categoryEnum" placeholder="请选择合同类别" clearable>
|
||||
<el-option
|
||||
v-for="category in category_enum"
|
||||
:key="category.value"
|
||||
:label="category.label"
|
||||
:value="category.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="机构" prop="orgId">
|
||||
<el-input v-model="form.orgId" placeholder="请输入机构" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否医保" prop="ybFlag">
|
||||
<el-input v-model="form.ybFlag" placeholder="请输入是否医保" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="优先使用标志" prop="sort">
|
||||
<el-input v-model="form.sort" placeholder="请输入优先使用标志" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="医保区划" prop="admVs">
|
||||
<el-input v-model="form.admVs" placeholder="请输入医保区划代码" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="医保PrvKey" prop="cliPrvKey">
|
||||
<el-input v-model="form.cliPrvKey" placeholder="请输入医保PrvKey" clearable type="password"
|
||||
show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="医保PubKey" prop="cliPubKey">
|
||||
<el-input v-model="form.cliPubKey" placeholder="请输入医保PubKey" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="服务端公钥" prop="serverPubKey">
|
||||
<el-input v-model="form.serverPubKey" placeholder="请输入服务端公钥" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="授权范围" prop="scope">
|
||||
<el-input v-model="form.scope" placeholder="请输入授权范围" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="授权类型" prop="grantType">
|
||||
<el-input v-model="form.grantType" placeholder="请选择授权类型" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="医保账号" prop="username">
|
||||
<el-input v-model="form.username" placeholder="请输入医保账号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="医保密码" prop="password">
|
||||
<el-input v-model="form.password" placeholder="请输入医保密码" clearable type="password" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="客户端ID" prop="clientId">
|
||||
<el-input v-model="form.clientId" placeholder="请输入客户端ID" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="客户端密钥" prop="clientSecret">
|
||||
<el-input v-model="form.clientSecret" placeholder="请输入客户端密钥" clearable type="password"
|
||||
show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="机构代码" prop="fixmedinsCode">
|
||||
<el-input v-model="form.fixmedinsCode" placeholder="请输入机构代码" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="机构名称" prop="fixmedinsName">
|
||||
<el-input v-model="form.fixmedinsName" placeholder="请输入机构名称" clearable />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer" style="margin-top: 15px;">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="SetContract">
|
||||
import { getTenantContractPage, getTenantContractDetail, addTenantContract, editTenantContract, delTenantContract } from "@/api/system/tenant";
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const {
|
||||
category_enum
|
||||
} = proxy.useDict(
|
||||
'category_enum'
|
||||
);
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const contractList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
tenantId: route.params.tenantId,
|
||||
},
|
||||
rules: {
|
||||
contractName: [
|
||||
{ required: true, message: "合同名称不能为空", trigger: "blur" },
|
||||
],
|
||||
busNo: [
|
||||
{ required: true, message: "合同编码不能为空", trigger: "blur" },
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
getTenantContractPage(queryParams.value).then(response => {
|
||||
contractList.value = response.data.records;
|
||||
total.value = response.data.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
// 返回按钮
|
||||
function handleClose() {
|
||||
const obj = { path: "/system/basicmanage/tenant" };
|
||||
proxy.$tab.closeOpenPage(obj);
|
||||
}
|
||||
/** 重置新增的表单以及其他数据 */
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: undefined,
|
||||
contractName: undefined,
|
||||
busNo: undefined,
|
||||
};
|
||||
proxy.resetForm("contractForm");
|
||||
}
|
||||
/** 新增 */
|
||||
function addContract() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "新增合同";
|
||||
}
|
||||
/** 编辑 */
|
||||
function editContract(row) {
|
||||
reset();
|
||||
getTenantContractDetail(row.id).then(response => {
|
||||
form.value = {
|
||||
...response.data,
|
||||
categoryEnum: String(response.data.categoryEnum)
|
||||
};
|
||||
open.value = true;
|
||||
title.value = "修改合同";
|
||||
}
|
||||
)
|
||||
}
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
form.value.tenantId = route.params.tenantId
|
||||
proxy.$refs["contractRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != undefined) {
|
||||
editTenantContract(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addTenantContract(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/** 删除 */
|
||||
function handelDel(row) {
|
||||
proxy.$modal.confirm("确认要删除该合同吗?").then(function () {
|
||||
return delTenantContract([row.id]);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => { });
|
||||
}
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 20px 15px;
|
||||
}
|
||||
|
||||
.grid-item {
|
||||
margin-bottom: 0;
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
padding: 5px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.grid-item :deep(.el-input) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 描述文本样式 */
|
||||
.item-description {
|
||||
font-size: 12px;
|
||||
color: #7f8c8d;
|
||||
margin-top: 8px;
|
||||
line-height: 1.4;
|
||||
padding: 5px;
|
||||
background-color: #f9f9f9;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
144
openhis-ui-vue3/src/views/system/tenant/setUser.vue
Normal file
144
openhis-ui-vue3/src/views/system/tenant/setUser.vue
Normal file
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" v-show="showSearch" :inline="true">
|
||||
<el-form-item label="用户名称" prop="userName">
|
||||
<el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable style="width: 240px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户昵称" prop="nickName">
|
||||
<el-input v-model="queryParams.nickName" placeholder="请输入用户昵称" clearable style="width: 240px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phoneNumber">
|
||||
<el-input v-model="queryParams.phoneNumber" placeholder="请输入手机号" clearable style="width: 240px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="openBindUser">绑定用户</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="CircleClose" :disabled="multiple"
|
||||
@click="cancelBindUserAll">解绑用户</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Close" @click="handleClose">关闭</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="手机号" prop="phonenumber" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_normal_disable" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="解绑" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="cancelBindUser(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
<bind-user ref="bindRef" :tenantId="queryParams.tenantId" @ok="handleQuery" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="SetUser">
|
||||
import bindUser from "./bindUser";
|
||||
import { getTenantUserPage, unbindTenantUser } from "@/api/system/tenant";
|
||||
|
||||
const route = useRoute();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
|
||||
const userList = ref([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const userIds = ref([]);
|
||||
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
tenantId: route.params.tenantId,
|
||||
userName: undefined,
|
||||
nickName: undefined,
|
||||
phoneNumber: undefined,
|
||||
});
|
||||
|
||||
/** 查询授权用户列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
getTenantUserPage(queryParams).then(response => {
|
||||
userList.value = response.data.records;
|
||||
total.value = response.data.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
// 返回按钮
|
||||
function handleClose() {
|
||||
const obj = { path: "/system/basicmanage/tenant" };
|
||||
proxy.$tab.closeOpenPage(obj);
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
userIds.value = selection.map(item => item.userId);
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
/** 打开绑定用户弹窗 */
|
||||
function openBindUser() {
|
||||
proxy.$refs["bindRef"].show();
|
||||
}
|
||||
/** 解绑按钮操作 */
|
||||
function cancelBindUser(row) {
|
||||
proxy.$modal.confirm('确认要解绑该用户"' + row.userName + '"吗?').then(function () {
|
||||
return unbindTenantUser(queryParams.tenantId, [row.userId]);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("解绑成功");
|
||||
}).catch(() => { });
|
||||
}
|
||||
/** 批量解绑按钮操作 */
|
||||
function cancelBindUserAll() {
|
||||
proxy.$modal.confirm("确认解绑这些用户吗?").then(function () {
|
||||
return unbindTenantUser(queryParams.tenantId, userIds.value);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("解绑成功");
|
||||
}).catch(() => { });
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
Reference in New Issue
Block a user