@utogether/udp-core 1.0.1-beta.7 → 1.0.1-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{403-BQZ5OAKL.js → 403-BOzKHdlm.js} +1 -1
- package/dist/{404-H55ex36i.js → 404-uwgt4Nll.js} +1 -1
- package/dist/{500-bbrspTnK.js → 500-4HBf6V9m.js} +1 -1
- package/dist/{AuthorityInfo-BWni4UPQ.js → AuthorityInfo-DvbIh1vT.js} +1 -1
- package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-7WtOL6Hs.js → AuthorityInfo.vue_vue_type_style_index_0_lang-BlCPvwXU.js} +1 -1
- package/dist/{Company-CuebFrQ0.js → Company-D7Q9BFmr.js} +3 -3
- package/dist/{CompanyPanel-DxPdJs6x.js → CompanyPanel-C0-PJlrt.js} +1 -1
- package/dist/{Department-D2a6Juur.js → Department-h2hlXACv.js} +3 -3
- package/dist/{DepartmentPanel-C_s2R9yl.js → DepartmentPanel-B6hDEQpG.js} +1 -1
- package/dist/{DesignPanel-CexZj3HF.js → DesignPanel-cS58-1v9.js} +1 -1
- package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-DfmysqwB.js → DesignPanel.vue_vue_type_style_index_0_lang-LdvLC8VU.js} +9 -11
- package/dist/{DictView-C0GS72rG.js → DictView-T3TmpBa8.js} +57 -44
- package/dist/{InvOrganization-a1tQ2CEH.js → InvOrganization-BVuOhzbt.js} +1 -1
- package/dist/Org-CnCBDGKF.js +39 -0
- package/dist/{Preview-BOv5j9i6.js → Preview-BaktKXB1.js} +1 -1
- package/dist/{ReportDefine-Dli1Q0TB.js → ReportDefine-5Rb0PO9A.js} +1 -1
- package/dist/{ReportDesign-zSWkcL_O.js → ReportDesign-DYdkVREA.js} +2 -2
- package/dist/{ReportQuery-D5r3bvFc.js → ReportQuery-BwhzIXMt.js} +1 -1
- package/dist/{ReportQueryFrom-DiostHrX.js → ReportQueryFrom-PHtWwlOe.js} +1 -1
- package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-Cr2eKMmr.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-BE5yZNPM.js} +1 -1
- package/dist/{ReportTemplate-CYy4cZHQ.js → ReportTemplate-DaadVXIi.js} +1 -1
- package/dist/{Role-BFQFxfQS.js → Role-Dtg3nAmG.js} +3 -3
- package/dist/{RoleAssign-BIdWSLTR.js → RoleAssign-DEGtLssH.js} +3 -3
- package/dist/{RolePanel-KC-UgmtF.js → RolePanel-CT7BTPmy.js} +1 -1
- package/dist/{RolePanel-C7ybSknr.js → RolePanel-DpUzfE_o.js} +1 -1
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-C_ZsMf1f.js → RolePanel.vue_vue_type_script_setup_true_lang-Dg2A6DJu.js} +3 -3
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-C91CJO4e.js → RolePanel.vue_vue_type_script_setup_true_lang-Xyo0YEI0.js} +1 -1
- package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-botBBgto.js → ScrollPanel.vue_vue_type_style_index_0_lang-CyutzDZS.js} +1 -1
- package/dist/{Staff-CY0DLsTN.js → Staff-_NlAGkrh.js} +3 -3
- package/dist/{StaffInfo-DA7p265h.js → StaffInfo-DVgUvVgd.js} +1 -1
- package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-f29A44gS.js → StaffInfo.vue_vue_type_script_setup_true_lang-C8hmlFgX.js} +1 -1
- package/dist/{StaffPanel-DYP-mMp9.js → StaffPanel-DKNZE3IE.js} +1 -1
- package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-C0YAG2xV.js → StaffPanel.vue_vue_type_script_setup_true_lang-BOOO6Cek.js} +2 -2
- package/dist/{SysUser-FqS3Ctne.js → SysUser-kQUf7XKz.js} +2 -2
- package/dist/{SysUserPanel-C_t6F99T.js → SysUserPanel-C191uX3U.js} +1 -1
- package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-CKZjy0OF.js → SysUserPanel.vue_vue_type_script_setup_true_lang-SwNbAEvW.js} +43 -43
- package/dist/{SystemMenu-ChFrMzRg.js → SystemMenu-DwuSvHnj.js} +2 -2
- package/dist/{UserInfo-I36LAXVj.js → UserInfo-DIsInFld.js} +1 -1
- package/dist/{UserInfo.vue_vue_type_style_index_0_lang-BGY-LYeL.js → UserInfo.vue_vue_type_style_index_0_lang-CnvGdbej.js} +17 -17
- package/dist/{childView-CYpuOzRx.js → childView-3Bs2UBEw.js} +1 -1
- package/dist/{childView-Csnlaqfs.js → childView-BawyULD7.js} +1 -1
- package/dist/{childView.vue_vue_type_style_index_0_lang-B8EnA03l.js → childView.vue_vue_type_style_index_0_lang-DWIFCX3X.js} +1 -1
- package/dist/{childView.vue_vue_type_style_index_0_lang-DNVlDM_a.js → childView.vue_vue_type_style_index_0_lang-YpWF-p2F.js} +1 -1
- package/dist/{code-rule-DHBSC5Qp.js → code-rule-DVaYcn8S.js} +1 -1
- package/dist/core.es.js +1 -1
- package/dist/{cron-task-CiI1MFla.js → cron-task-xuzP-BpE.js} +1 -1
- package/dist/{frameView-ZWKlbz9p.js → frameView-Cudt06qS.js} +1 -1
- package/dist/index-CKnq5xIa.js +2623 -0
- package/dist/{layoutView-5OsbpP0u.js → layoutView-BlFTV2jX.js} +2 -2
- package/dist/{login-C55sa9gN.js → login-CpKykfdf.js} +11 -11
- package/dist/{lov-view-DFfaUQ5m.js → lov-view-B2HaxyMs.js} +2 -2
- package/dist/{menuInfo-CZdLtLjN.js → menuInfo-BxCTJ1VW.js} +1 -1
- package/dist/{menuInfo.vue_vue_type_style_index_0_lang-DgG0aHRy.js → menuInfo.vue_vue_type_style_index_0_lang-CLOPNeUW.js} +2 -2
- package/dist/{pda-app-fLe8mrx-.js → pda-app-DPsAFNiw.js} +8 -10
- package/dist/{resource-ohWKO6Fh.js → resource-Dibb7t8u.js} +1 -1
- package/dist/{su-welcome-_UZTfrXX.js → su-welcome-DejR0KkM.js} +1 -1
- package/dist/{sys-config-DVuBsK7p.js → sys-config-DiySRWns.js} +1 -1
- package/dist/udp-core.css +2 -2
- package/dist/{utogether-CxobZqGL.js → utogether-Dct_14Zk.js} +1 -1
- package/package.json +1 -1
- package/src/App.vue +1 -6
- package/src/components/SuCharts/src/UserInfo.vue +78 -78
- package/src/components/udp/form-upload.vue +375 -76
- package/src/components/udp/form.vue +12 -7
- package/src/components/udp/grid.vue +2 -18
- package/src/components/udp/lov.vue +5 -27
- package/src/components/udp/upload.vue +1 -3
- package/src/components/udp/utils.ts +12 -6
- package/src/main.ts +119 -119
- package/src/plugins/i18n/en.ts +24 -13
- package/src/plugins/i18n/zh.ts +348 -348
- package/src/plugins/vxe-table/index.ts +3 -3
- package/src/plugins/vxe-table/render.tsx +956 -896
- package/src/style/vxetable.scss +289 -287
- package/src/utils/udp/useRender.ts +17 -6
- package/src/views/organization/org/Org.vue +9 -5
- package/src/views/system/menu/SystemMenu.vue +4 -18
- package/src/views/system/menu/menuInfo.vue +4 -17
- package/src/views/system/role/UserInfo.vue +195 -195
- package/src/views/system/sysUser/SysUserPanel.vue +278 -278
- package/src/views/uapp/pda/pda-app.vue +208 -207
- package/src/views/udev/dict/DictView.vue +7 -0
- package/src/views/ulogin/login.vue +1 -5
- package/src/views/urpt/design/DesignPanel.vue +507 -503
- package/vite.config.ts +2 -1
- package/dist/Org-DifvzLLy.js +0 -35
- package/dist/index-COBMRlmJ.js +0 -5379
|
@@ -1,278 +1,278 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="page">
|
|
3
|
-
<ut-grid
|
|
4
|
-
ref="xgrid"
|
|
5
|
-
:columns="columns"
|
|
6
|
-
:items="formItems"
|
|
7
|
-
:url="url"
|
|
8
|
-
:auto-load="false"
|
|
9
|
-
:default-params="defaultParams"
|
|
10
|
-
:default-value="defaultParams"
|
|
11
|
-
:events="onGridEvents"
|
|
12
|
-
/>
|
|
13
|
-
<!-- 编辑用户信息 -->
|
|
14
|
-
<vxe-modal v-model="data.showModelView" title="用户信息" width="300">
|
|
15
|
-
<template #default>
|
|
16
|
-
<vxe-form ref="xForm" :data="data.record" :rules="rules" title-align="right">
|
|
17
|
-
<vxe-form-item :title="$t('message.unitName')" field="unitId" span="24">
|
|
18
|
-
<template #default="{ data }">
|
|
19
|
-
<vxe-select v-model="data.unitId">
|
|
20
|
-
<vxe-option v-for="unit in treeList" :key="unit.id" :value="unit.id" :label="unit.unitName" />
|
|
21
|
-
</vxe-select>
|
|
22
|
-
</template>
|
|
23
|
-
</vxe-form-item>
|
|
24
|
-
<vxe-form-item
|
|
25
|
-
:title="$t('message.userCode')"
|
|
26
|
-
:item-render="{ name: 'input', attrs: { disabled: data.dataStatus === 'update' } }"
|
|
27
|
-
field="userName"
|
|
28
|
-
span="24"
|
|
29
|
-
/>
|
|
30
|
-
<vxe-form-item :title="$t('message.userName')" field="name" span="24" :item-render="{ name: 'input' }" />
|
|
31
|
-
<vxe-form-item
|
|
32
|
-
v-if="data.dataStatus === 'add'"
|
|
33
|
-
:title="$t('message.userPwd')"
|
|
34
|
-
:item-render="{ name: 'input' }"
|
|
35
|
-
field="userPwd"
|
|
36
|
-
span="24"
|
|
37
|
-
/>
|
|
38
|
-
<vxe-form-item align="right" span="24">
|
|
39
|
-
<template #default>
|
|
40
|
-
<ut-button content="cancel" icon="ri-close-fill" @click="handleClose" />
|
|
41
|
-
<ut-button content="confirm" icon="ri-save-3-fill" status="u-cyan" @click="onSubmit" />
|
|
42
|
-
</template>
|
|
43
|
-
</vxe-form-item>
|
|
44
|
-
</vxe-form>
|
|
45
|
-
</template>
|
|
46
|
-
</vxe-modal>
|
|
47
|
-
<!-- 用户角色 -->
|
|
48
|
-
<vxe-modal v-model="data.showUserRole" :loading="loading" :title="$t('message.title.roleInfo')" width="600">
|
|
49
|
-
<template #default>
|
|
50
|
-
<vxe-table height="300" :data="data.roleList" border>
|
|
51
|
-
<vxe-column type="seq" width="60" />
|
|
52
|
-
<vxe-column field="roleName" :title="$t('message.udp.roleName')" />
|
|
53
|
-
<vxe-column field="roleDesc" :title="$t('message.udp.roleDesc')" />
|
|
54
|
-
</vxe-table>
|
|
55
|
-
</template>
|
|
56
|
-
</vxe-modal>
|
|
57
|
-
|
|
58
|
-
<vxe-modal
|
|
59
|
-
v-model="data.showAuth"
|
|
60
|
-
:loading="loading"
|
|
61
|
-
:title="$t('message.title.authority', { role: data.record.name || '88888' })"
|
|
62
|
-
height="620"
|
|
63
|
-
width="560"
|
|
64
|
-
>
|
|
65
|
-
<template #default>
|
|
66
|
-
<el-tree-v2
|
|
67
|
-
ref="xTree"
|
|
68
|
-
:data="data.roleList"
|
|
69
|
-
:props="{ children: 'children', label: 'menuName' }"
|
|
70
|
-
:height="560"
|
|
71
|
-
node-key="id"
|
|
72
|
-
/>
|
|
73
|
-
</template>
|
|
74
|
-
</vxe-modal>
|
|
75
|
-
</div>
|
|
76
|
-
</template>
|
|
77
|
-
|
|
78
|
-
<script setup lang="tsx">
|
|
79
|
-
import { useI18n } from 'vue-i18n';
|
|
80
|
-
import { ref, reactive, inject, onMounted } from 'vue';
|
|
81
|
-
import to from 'await-to-js';
|
|
82
|
-
import { useRender, errorMessage, warnMessage, delay } from '@utogether/utils';
|
|
83
|
-
import { VxeUI, VxeFormPropTypes } from 'vxe-pc-ui';
|
|
84
|
-
import { isEmpty } from 'xe-utils';
|
|
85
|
-
import { getServiceApi } from '../../../api';
|
|
86
|
-
|
|
87
|
-
const data = reactive<IRecord>({
|
|
88
|
-
record: {},
|
|
89
|
-
listQuery: {},
|
|
90
|
-
dataList: [],
|
|
91
|
-
roleList: [],
|
|
92
|
-
submitLoading: false,
|
|
93
|
-
showModelView: false,
|
|
94
|
-
showUserRole: false,
|
|
95
|
-
showAuth: false,
|
|
96
|
-
dataStatus: ''
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
const serviceApi = getServiceApi();
|
|
100
|
-
const { t } = useI18n();
|
|
101
|
-
|
|
102
|
-
const rules: VxeFormPropTypes.Rules = {
|
|
103
|
-
userName: [
|
|
104
|
-
{
|
|
105
|
-
required: true,
|
|
106
|
-
message: `${t('message.required')}${t('message.userCode')}`
|
|
107
|
-
}
|
|
108
|
-
],
|
|
109
|
-
name: [
|
|
110
|
-
{
|
|
111
|
-
required: true,
|
|
112
|
-
message: `${t('message.required')}${t('message.userName')}`
|
|
113
|
-
}
|
|
114
|
-
],
|
|
115
|
-
unitId: [
|
|
116
|
-
{
|
|
117
|
-
required: true,
|
|
118
|
-
message: `${t('message.required')}${t('message.unitName')}`
|
|
119
|
-
}
|
|
120
|
-
],
|
|
121
|
-
userPwd: [
|
|
122
|
-
{
|
|
123
|
-
required: true,
|
|
124
|
-
message: `${t('message.required')}${t('message.userPwd')}`
|
|
125
|
-
}
|
|
126
|
-
]
|
|
127
|
-
};
|
|
128
|
-
const renderHook = useRender();
|
|
129
|
-
const defaultParams = ref({});
|
|
130
|
-
const treeList: IRecord[] = inject('treeList');
|
|
131
|
-
const loading = ref(false);
|
|
132
|
-
|
|
133
|
-
const url = '/uums/user';
|
|
134
|
-
|
|
135
|
-
const xgrid = ref(null);
|
|
136
|
-
|
|
137
|
-
const formItems = [
|
|
138
|
-
{ field: 'name', title: 'message.userName' },
|
|
139
|
-
{ field: 'userName', title: 'message.userCode' }
|
|
140
|
-
];
|
|
141
|
-
|
|
142
|
-
const columns = [
|
|
143
|
-
{ type: 'checkbox', width: 40, align: 'center' },
|
|
144
|
-
{ field: 'userName', title: 'message.userCode', required: true, editRender: renderHook.renderInput() },
|
|
145
|
-
{ field: 'name', title: 'message.userName', required: true, editRender: renderHook.renderInput() },
|
|
146
|
-
{
|
|
147
|
-
field: 'type',
|
|
148
|
-
title: 'message.
|
|
149
|
-
formatter: ['formatDict', 'SU.
|
|
150
|
-
editRender: renderHook.renderDict('SU.USER.TYPE')
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
field: 'userPwd',
|
|
154
|
-
required: true,
|
|
155
|
-
width: 150,
|
|
156
|
-
editRender: renderHook.renderInput(),
|
|
157
|
-
formatter: () => '*******'
|
|
158
|
-
},
|
|
159
|
-
{ field: 'enabled', width: 80, cellRender: renderHook.renderEnabled(handleClick) },
|
|
160
|
-
{
|
|
161
|
-
field: 'operate',
|
|
162
|
-
width: 240,
|
|
163
|
-
fixed: 'right',
|
|
164
|
-
slots: {
|
|
165
|
-
default: ({ row }) => {
|
|
166
|
-
if (!row.id) return null;
|
|
167
|
-
return [
|
|
168
|
-
<>
|
|
169
|
-
<ut-button icon="ri-user-fill" content="role" onTap={() => handleRole(row)} />
|
|
170
|
-
<ut-button icon="ri-lock-fill" content="auth" status="success" onTap={() => handleAuth(row)} />
|
|
171
|
-
<ut-button icon="ri-lock-fill" content="passwordReset" status="warning" onTap={() => handleResetPwd(row)} />
|
|
172
|
-
</>
|
|
173
|
-
];
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
];
|
|
178
|
-
|
|
179
|
-
// 启用/禁用
|
|
180
|
-
async function handleClick({ row }) {
|
|
181
|
-
await to(serviceApi.put(url, [row]));
|
|
182
|
-
xgrid.value.refreshData();
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* @description: 查看用户角色
|
|
187
|
-
* @param {*} row 用户行
|
|
188
|
-
* @return {*}
|
|
189
|
-
*/
|
|
190
|
-
const handleRole = async (row: any) => {
|
|
191
|
-
data.roleList = [];
|
|
192
|
-
data.showUserRole = true;
|
|
193
|
-
loading.value = true;
|
|
194
|
-
const serverData = await serviceApi.get(url + '/getUserRole', { userName: row.userName });
|
|
195
|
-
loading.value = false;
|
|
196
|
-
data.roleList = serverData[0]?.sysRoles;
|
|
197
|
-
// nextTick(() => {
|
|
198
|
-
// });
|
|
199
|
-
};
|
|
200
|
-
/**
|
|
201
|
-
* @description: 密码重置
|
|
202
|
-
* @param {*} row 用户信息
|
|
203
|
-
* @return {*}
|
|
204
|
-
*/
|
|
205
|
-
const handleResetPwd = async (row: Object) => {
|
|
206
|
-
await serviceApi.put(url + '/resetPwd', row);
|
|
207
|
-
await VxeUI.modal.alert(t('message.tip.initPassword'));
|
|
208
|
-
};
|
|
209
|
-
// 启用/禁用
|
|
210
|
-
// const handleUpdate = async (record: IRecord) => {
|
|
211
|
-
// record.enabled = record.enabled === '1' ? '0' : '1';
|
|
212
|
-
// await serviceApi.put(url, record);
|
|
213
|
-
// getDataList();
|
|
214
|
-
// };
|
|
215
|
-
/**
|
|
216
|
-
* @description: 用户权限
|
|
217
|
-
* @param {*} row 用户信息
|
|
218
|
-
* @return {*}
|
|
219
|
-
*/
|
|
220
|
-
const handleAuth = async row => {
|
|
221
|
-
data.roleList = [];
|
|
222
|
-
data.showAuth = true;
|
|
223
|
-
loading.value = true;
|
|
224
|
-
data.record = row;
|
|
225
|
-
const [err, res] = await to(serviceApi.get(url + '/getUserRole', { userName: row.userName }));
|
|
226
|
-
loading.value = false;
|
|
227
|
-
if (!err) {
|
|
228
|
-
if (!isEmpty(res)) {
|
|
229
|
-
data.roleList = res[0]?.sysMenuExts;
|
|
230
|
-
} else {
|
|
231
|
-
warnMessage(t('message.tip.emptyAuth'));
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
const onGridEvents = {
|
|
237
|
-
editActived({ row }) {
|
|
238
|
-
columns[1].editRender.props.disabled = !!row.id;
|
|
239
|
-
columns[4].editRender.props.disabled = !!row.id;
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
const xForm = ref(null);
|
|
243
|
-
// const xSarchFrom = ref(null);
|
|
244
|
-
|
|
245
|
-
const onSubmit = () => {
|
|
246
|
-
xForm.value.validate(async valid => {
|
|
247
|
-
if (!valid) {
|
|
248
|
-
const { record, dataStatus } = data;
|
|
249
|
-
if (dataStatus === 'add') {
|
|
250
|
-
await serviceApi.post(url, record);
|
|
251
|
-
} else {
|
|
252
|
-
await serviceApi.put(url, record);
|
|
253
|
-
}
|
|
254
|
-
handleClose();
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
const handleClose = () => {
|
|
260
|
-
data.showModelView = false;
|
|
261
|
-
};
|
|
262
|
-
const getUnitList = () => {
|
|
263
|
-
serviceApi
|
|
264
|
-
.get('/uums/unit', { pageSize: 10 })
|
|
265
|
-
.then(async res => {
|
|
266
|
-
defaultParams.value = { unitId: res[0].id, enabled: '1' };
|
|
267
|
-
await delay(100);
|
|
268
|
-
xgrid.value.refreshData();
|
|
269
|
-
})
|
|
270
|
-
.catch(() => {
|
|
271
|
-
errorMessage('获取租户失败,刷新后重试');
|
|
272
|
-
});
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
onMounted(() => {
|
|
276
|
-
getUnitList();
|
|
277
|
-
});
|
|
278
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="page">
|
|
3
|
+
<ut-grid
|
|
4
|
+
ref="xgrid"
|
|
5
|
+
:columns="columns"
|
|
6
|
+
:items="formItems"
|
|
7
|
+
:url="url"
|
|
8
|
+
:auto-load="false"
|
|
9
|
+
:default-params="defaultParams"
|
|
10
|
+
:default-value="defaultParams"
|
|
11
|
+
:events="onGridEvents"
|
|
12
|
+
/>
|
|
13
|
+
<!-- 编辑用户信息 -->
|
|
14
|
+
<vxe-modal v-model="data.showModelView" title="用户信息" width="300">
|
|
15
|
+
<template #default>
|
|
16
|
+
<vxe-form ref="xForm" :data="data.record" :rules="rules" title-align="right">
|
|
17
|
+
<vxe-form-item :title="$t('message.unitName')" field="unitId" span="24">
|
|
18
|
+
<template #default="{ data }">
|
|
19
|
+
<vxe-select v-model="data.unitId">
|
|
20
|
+
<vxe-option v-for="unit in treeList" :key="unit.id" :value="unit.id" :label="unit.unitName" />
|
|
21
|
+
</vxe-select>
|
|
22
|
+
</template>
|
|
23
|
+
</vxe-form-item>
|
|
24
|
+
<vxe-form-item
|
|
25
|
+
:title="$t('message.userCode')"
|
|
26
|
+
:item-render="{ name: 'input', attrs: { disabled: data.dataStatus === 'update' } }"
|
|
27
|
+
field="userName"
|
|
28
|
+
span="24"
|
|
29
|
+
/>
|
|
30
|
+
<vxe-form-item :title="$t('message.userName')" field="name" span="24" :item-render="{ name: 'input' }" />
|
|
31
|
+
<vxe-form-item
|
|
32
|
+
v-if="data.dataStatus === 'add'"
|
|
33
|
+
:title="$t('message.userPwd')"
|
|
34
|
+
:item-render="{ name: 'input' }"
|
|
35
|
+
field="userPwd"
|
|
36
|
+
span="24"
|
|
37
|
+
/>
|
|
38
|
+
<vxe-form-item align="right" span="24">
|
|
39
|
+
<template #default>
|
|
40
|
+
<ut-button content="cancel" icon="ri-close-fill" @click="handleClose" />
|
|
41
|
+
<ut-button content="confirm" icon="ri-save-3-fill" status="u-cyan" @click="onSubmit" />
|
|
42
|
+
</template>
|
|
43
|
+
</vxe-form-item>
|
|
44
|
+
</vxe-form>
|
|
45
|
+
</template>
|
|
46
|
+
</vxe-modal>
|
|
47
|
+
<!-- 用户角色 -->
|
|
48
|
+
<vxe-modal v-model="data.showUserRole" :loading="loading" :title="$t('message.title.roleInfo')" width="600">
|
|
49
|
+
<template #default>
|
|
50
|
+
<vxe-table height="300" :data="data.roleList" border>
|
|
51
|
+
<vxe-column type="seq" width="60" />
|
|
52
|
+
<vxe-column field="roleName" :title="$t('message.udp.roleName')" />
|
|
53
|
+
<vxe-column field="roleDesc" :title="$t('message.udp.roleDesc')" />
|
|
54
|
+
</vxe-table>
|
|
55
|
+
</template>
|
|
56
|
+
</vxe-modal>
|
|
57
|
+
|
|
58
|
+
<vxe-modal
|
|
59
|
+
v-model="data.showAuth"
|
|
60
|
+
:loading="loading"
|
|
61
|
+
:title="$t('message.title.authority', { role: data.record.name || '88888' })"
|
|
62
|
+
height="620"
|
|
63
|
+
width="560"
|
|
64
|
+
>
|
|
65
|
+
<template #default>
|
|
66
|
+
<el-tree-v2
|
|
67
|
+
ref="xTree"
|
|
68
|
+
:data="data.roleList"
|
|
69
|
+
:props="{ children: 'children', label: 'menuName' }"
|
|
70
|
+
:height="560"
|
|
71
|
+
node-key="id"
|
|
72
|
+
/>
|
|
73
|
+
</template>
|
|
74
|
+
</vxe-modal>
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<script setup lang="tsx">
|
|
79
|
+
import { useI18n } from 'vue-i18n';
|
|
80
|
+
import { ref, reactive, inject, onMounted } from 'vue';
|
|
81
|
+
import to from 'await-to-js';
|
|
82
|
+
import { useRender, errorMessage, warnMessage, delay } from '@utogether/utils';
|
|
83
|
+
import { VxeUI, VxeFormPropTypes } from 'vxe-pc-ui';
|
|
84
|
+
import { isEmpty } from 'xe-utils';
|
|
85
|
+
import { getServiceApi } from '../../../api';
|
|
86
|
+
|
|
87
|
+
const data = reactive<IRecord>({
|
|
88
|
+
record: {},
|
|
89
|
+
listQuery: {},
|
|
90
|
+
dataList: [],
|
|
91
|
+
roleList: [],
|
|
92
|
+
submitLoading: false,
|
|
93
|
+
showModelView: false,
|
|
94
|
+
showUserRole: false,
|
|
95
|
+
showAuth: false,
|
|
96
|
+
dataStatus: ''
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const serviceApi = getServiceApi();
|
|
100
|
+
const { t } = useI18n();
|
|
101
|
+
|
|
102
|
+
const rules: VxeFormPropTypes.Rules = {
|
|
103
|
+
userName: [
|
|
104
|
+
{
|
|
105
|
+
required: true,
|
|
106
|
+
message: `${t('message.required')}${t('message.userCode')}`
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
name: [
|
|
110
|
+
{
|
|
111
|
+
required: true,
|
|
112
|
+
message: `${t('message.required')}${t('message.userName')}`
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
unitId: [
|
|
116
|
+
{
|
|
117
|
+
required: true,
|
|
118
|
+
message: `${t('message.required')}${t('message.unitName')}`
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
userPwd: [
|
|
122
|
+
{
|
|
123
|
+
required: true,
|
|
124
|
+
message: `${t('message.required')}${t('message.userPwd')}`
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
};
|
|
128
|
+
const renderHook = useRender();
|
|
129
|
+
const defaultParams = ref({});
|
|
130
|
+
const treeList: IRecord[] = inject('treeList');
|
|
131
|
+
const loading = ref(false);
|
|
132
|
+
|
|
133
|
+
const url = '/uums/user';
|
|
134
|
+
|
|
135
|
+
const xgrid = ref(null);
|
|
136
|
+
|
|
137
|
+
const formItems = [
|
|
138
|
+
{ field: 'name', title: 'message.udp.userName' },
|
|
139
|
+
{ field: 'userName', title: 'message.udp.userCode' }
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
const columns = [
|
|
143
|
+
{ type: 'checkbox', width: 40, align: 'center' },
|
|
144
|
+
{ field: 'userName', title: 'message.udp.userCode', required: true, editRender: renderHook.renderInput() },
|
|
145
|
+
{ field: 'name', title: 'message.udp.userName', required: true, editRender: renderHook.renderInput() },
|
|
146
|
+
{
|
|
147
|
+
field: 'type',
|
|
148
|
+
title: 'message.udp.userType',
|
|
149
|
+
formatter: ['formatDict', 'SU.USER.TYPE'],
|
|
150
|
+
editRender: renderHook.renderDict('SU.USER.TYPE')
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
field: 'userPwd',
|
|
154
|
+
required: true,
|
|
155
|
+
width: 150,
|
|
156
|
+
editRender: renderHook.renderInput(),
|
|
157
|
+
formatter: () => '*******'
|
|
158
|
+
},
|
|
159
|
+
{ field: 'enabled', width: 80, cellRender: renderHook.renderEnabled(handleClick) },
|
|
160
|
+
{
|
|
161
|
+
field: 'operate',
|
|
162
|
+
width: 240,
|
|
163
|
+
fixed: 'right',
|
|
164
|
+
slots: {
|
|
165
|
+
default: ({ row }) => {
|
|
166
|
+
if (!row.id) return null;
|
|
167
|
+
return [
|
|
168
|
+
<>
|
|
169
|
+
<ut-button icon="ri-user-fill" content="role" onTap={() => handleRole(row)} />
|
|
170
|
+
<ut-button icon="ri-lock-fill" content="auth" status="success" onTap={() => handleAuth(row)} />
|
|
171
|
+
<ut-button icon="ri-lock-fill" content="passwordReset" status="warning" onTap={() => handleResetPwd(row)} />
|
|
172
|
+
</>
|
|
173
|
+
];
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
];
|
|
178
|
+
|
|
179
|
+
// 启用/禁用
|
|
180
|
+
async function handleClick({ row }) {
|
|
181
|
+
await to(serviceApi.put(url, [row]));
|
|
182
|
+
xgrid.value.refreshData();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @description: 查看用户角色
|
|
187
|
+
* @param {*} row 用户行
|
|
188
|
+
* @return {*}
|
|
189
|
+
*/
|
|
190
|
+
const handleRole = async (row: any) => {
|
|
191
|
+
data.roleList = [];
|
|
192
|
+
data.showUserRole = true;
|
|
193
|
+
loading.value = true;
|
|
194
|
+
const serverData = await serviceApi.get(url + '/getUserRole', { userName: row.userName });
|
|
195
|
+
loading.value = false;
|
|
196
|
+
data.roleList = serverData[0]?.sysRoles;
|
|
197
|
+
// nextTick(() => {
|
|
198
|
+
// });
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* @description: 密码重置
|
|
202
|
+
* @param {*} row 用户信息
|
|
203
|
+
* @return {*}
|
|
204
|
+
*/
|
|
205
|
+
const handleResetPwd = async (row: Object) => {
|
|
206
|
+
await serviceApi.put(url + '/resetPwd', row);
|
|
207
|
+
await VxeUI.modal.alert(t('message.tip.initPassword'));
|
|
208
|
+
};
|
|
209
|
+
// 启用/禁用
|
|
210
|
+
// const handleUpdate = async (record: IRecord) => {
|
|
211
|
+
// record.enabled = record.enabled === '1' ? '0' : '1';
|
|
212
|
+
// await serviceApi.put(url, record);
|
|
213
|
+
// getDataList();
|
|
214
|
+
// };
|
|
215
|
+
/**
|
|
216
|
+
* @description: 用户权限
|
|
217
|
+
* @param {*} row 用户信息
|
|
218
|
+
* @return {*}
|
|
219
|
+
*/
|
|
220
|
+
const handleAuth = async row => {
|
|
221
|
+
data.roleList = [];
|
|
222
|
+
data.showAuth = true;
|
|
223
|
+
loading.value = true;
|
|
224
|
+
data.record = row;
|
|
225
|
+
const [err, res] = await to(serviceApi.get(url + '/getUserRole', { userName: row.userName }));
|
|
226
|
+
loading.value = false;
|
|
227
|
+
if (!err) {
|
|
228
|
+
if (!isEmpty(res)) {
|
|
229
|
+
data.roleList = res[0]?.sysMenuExts;
|
|
230
|
+
} else {
|
|
231
|
+
warnMessage(t('message.tip.emptyAuth'));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const onGridEvents = {
|
|
237
|
+
editActived({ row }) {
|
|
238
|
+
columns[1].editRender.props.disabled = !!row.id;
|
|
239
|
+
columns[4].editRender.props.disabled = !!row.id;
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const xForm = ref(null);
|
|
243
|
+
// const xSarchFrom = ref(null);
|
|
244
|
+
|
|
245
|
+
const onSubmit = () => {
|
|
246
|
+
xForm.value.validate(async valid => {
|
|
247
|
+
if (!valid) {
|
|
248
|
+
const { record, dataStatus } = data;
|
|
249
|
+
if (dataStatus === 'add') {
|
|
250
|
+
await serviceApi.post(url, record);
|
|
251
|
+
} else {
|
|
252
|
+
await serviceApi.put(url, record);
|
|
253
|
+
}
|
|
254
|
+
handleClose();
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
const handleClose = () => {
|
|
260
|
+
data.showModelView = false;
|
|
261
|
+
};
|
|
262
|
+
const getUnitList = () => {
|
|
263
|
+
serviceApi
|
|
264
|
+
.get('/uums/unit', { pageSize: 10 })
|
|
265
|
+
.then(async res => {
|
|
266
|
+
defaultParams.value = { unitId: res[0].id, enabled: '1' };
|
|
267
|
+
await delay(100);
|
|
268
|
+
xgrid.value.refreshData();
|
|
269
|
+
})
|
|
270
|
+
.catch(() => {
|
|
271
|
+
errorMessage('获取租户失败,刷新后重试');
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
onMounted(() => {
|
|
276
|
+
getUnitList();
|
|
277
|
+
});
|
|
278
|
+
</script>
|