Commit 593f5e6f authored by 陈浩玮's avatar 陈浩玮

Merge branch 'feature/shuiluo' into 'master'

feat: 国际化完善

See merge request product/kim3-web-vue/starter-web-vue!55
parents 6815675f 8a614ced
import Wraper from './wraper.vue';
import Table from './table.vue';
import MoreItem from './more_item.vue';
export const WraperMixins = {
props: { hidden: Function, row: Object, type: String, refresh: Function },
components: { Wraper },
data() {
return {
form: {},
};
},
};
export { Wraper, Table, MoreItem };
<template> <template>
<div> <div>
<my-card v-if="$scopedSlots.search"> <my-card v-if="$scopedSlots.search">
<a-form-model :model="queryForm" layout="horizontal"> <div class="tw-flex">
<a-row :gutter="16">
<slot name="search" :query="queryForm" /> <slot name="search" :query="queryForm" />
</a-row> </div>
</a-form-model>
<div class="tw-text-right tw-mt-2"> <div class="tw-text-right tw-mt-2">
<a-space> <a-space>
<a-button @click="reset">重置</a-button> <a-button @click="reset">{{ $t('table.reset') }}</a-button>
<a-button type="primary" @click="getData">查询</a-button> <a-button type="primary" @click="getData">{{ $t('table.search') }}</a-button>
</a-space> </a-space>
</div> </div>
</my-card> </my-card>
...@@ -18,14 +16,14 @@ ...@@ -18,14 +16,14 @@
<my-card :class="$scopedSlots.search ? 'tw-mt-3' : ''"> <my-card :class="$scopedSlots.search ? 'tw-mt-3' : ''">
<a-space class="tw-mb-2.5"> <a-space class="tw-mb-2.5">
<a-button v-if="addBtn" type="primary" key="add" v-bind="addBtn.options" @click="add"> <a-button v-if="addBtn" type="primary" key="add" v-bind="addBtn.options" @click="add">
{{ addBtn.text || '新建' }} {{ addBtn.text || $t('table.add') }}
</a-button> </a-button>
<slot name="buttons" /> <slot name="buttons" />
</a-space> </a-space>
<div class="tw-mb-2"> <div class="tw-mb-2">
<a-alert <a-alert
v-if="selectedRowKeys.length" v-if="selectedRowKeys.length"
:message="`已选择${selectedRowKeys.length}项`" :message="$t('table.hasSelectedSome', { num: selectedRowKeys.length })"
type="success" type="success"
closable closable
:after-close="handleClose" :after-close="handleClose"
...@@ -64,8 +62,10 @@ ...@@ -64,8 +62,10 @@
<template v-if="!noFooter"> <template v-if="!noFooter">
<a-divider /> <a-divider />
<a-space class="tw-justify-end"> <a-space class="tw-justify-end">
<a-button @click="addVisible = false">取消</a-button> <a-button @click="addVisible = false">{{ $t('table.cancel') }}</a-button>
<a-button type="primary" @click="submit" :loading="submitLoading"> 确认 </a-button> <a-button type="primary" @click="submit" :loading="submitLoading">
{{ $t('table.confirm') }}
</a-button>
</a-space> </a-space>
</template> </template>
</a-drawer> </a-drawer>
...@@ -188,7 +188,7 @@ export default { ...@@ -188,7 +188,7 @@ export default {
this.addVisible = true; this.addVisible = true;
this.type = 0; this.type = 0;
this.noFooter = false; this.noFooter = false;
this.title = '新增'; this.title = this.$t('table.add');
}, },
addDrawerClose() { addDrawerClose() {
this.addVisible = false; this.addVisible = false;
...@@ -206,13 +206,13 @@ export default { ...@@ -206,13 +206,13 @@ export default {
}, },
show({ type, title, noFooter } = {}) { show({ type, title, noFooter } = {}) {
if (type === 0) { if (type === 0) {
this.title = '新增'; this.title = this.$t('table.add');
} }
if (type === 1) { if (type === 1) {
this.title = '编辑'; this.title = this.$t('table.edit');
} }
if (type === 2) { if (type === 2) {
this.title = '查看'; this.title = this.$t('table.view');
} }
if (title) { if (title) {
this.title = title; this.title = title;
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
<a-button @click="reset">{{ $t('table.reset') }}</a-button> <a-button @click="reset">{{ $t('table.reset') }}</a-button>
<a-button type="primary" @click="resetGetData">{{ $t('table.search') }}</a-button> <a-button type="primary" @click="resetGetData">{{ $t('table.search') }}</a-button>
</a-space> </a-space>
</div> </div>
</my-card> </my-card>
...@@ -113,7 +112,6 @@ export default { ...@@ -113,7 +112,6 @@ export default {
}, },
data() { data() {
const newBtn = this.addBtn ? (typeof this.addBtn === 'object' ? this.addBtn : {}) : this.addBtn;
return { return {
initQuery: { initQuery: {
...initQuery, ...initQuery,
......
import selectLang from './select'; import selectLang from './select';
import TableLang from './table'; import tableLang from './table';
import UserLang from './user'; import userLang from './user';
import systemLang from './system';
const zh_CN = {}; const zh_CN = {};
const en_US = {}; const en_US = {};
...@@ -14,7 +15,8 @@ function formatLang(langObject) { ...@@ -14,7 +15,8 @@ function formatLang(langObject) {
} }
formatLang(selectLang); formatLang(selectLang);
formatLang(TableLang); formatLang(tableLang);
formatLang(UserLang); formatLang(userLang);
formatLang(systemLang);
export { en_US, zh_CN }; export { en_US, zh_CN };
export default {
'system.jobName': ['任务名称', 'Job Name'],
'system.jobName.add': ['请输入@:system.jobName', 'Please Input @:system.jobName'],
'system.department': ['所属部门', 'Department'],
'system.userTitleName': ['用户职称', 'User Title Name'],
};
...@@ -27,5 +27,10 @@ export default { ...@@ -27,5 +27,10 @@ export default {
'table.confirm': ['确认', 'Confirm'], 'table.confirm': ['确认', 'Confirm'],
'table.cancel': ['取消', 'Cancel'], 'table.cancel': ['取消', 'Cancel'],
'table.delete': ['删除', 'Delete'], 'table.delete': ['删除', 'Delete'],
'table.confirmDelete': ['确认是否删除', 'Confirm To Delete'] 'table.confirmDelete': ['确认是否删除', 'Confirm To Delete'],
'table.describe': ['描述', 'Describe'],
'table.describe.add': ['请输入描述信息', 'Please Input @:table.describe'],
'table.confirmReset': ['确认是否重置', 'Confirm Reset'],
'table.hasSelectedSome': ['已选择{num}项', '{num} have been selected'],
'table.view': ['查看', 'View'],
}; };
...@@ -24,4 +24,9 @@ export default { ...@@ -24,4 +24,9 @@ export default {
'user.twoInconsistent': ['两次密码不一致', 'The two passwords are inconsistent'], 'user.twoInconsistent': ['两次密码不一致', 'The two passwords are inconsistent'],
'user.modifiedSuccessfully': ['修改成功', 'Modified successfully'], 'user.modifiedSuccessfully': ['修改成功', 'Modified successfully'],
'user.serverException': ['服务器异常', 'Server exception'], 'user.serverException': ['服务器异常', 'Server exception'],
'user.isLocked': ['是否锁定', 'Is Locked'],
'user.deblocking': ['解锁', 'Deblocking'],
'user.confirmUnlock': ['确认是否解锁', 'Confirm Whether To Unlock'],
'user.locking': ['锁定', 'Locking'],
'user.confirmLocked': ['确认是否锁定', 'Confirm Locked'],
}; };
<template> <template>
<my-table url="/api/v1/jobs" rowKey="jobId" :addBtn="addBtn" ref="table" noPage> <Table url="/api/v1/jobs" rowKey="jobId" addBtn ref="table" :drawerWidth="600" noPage :buttons="buttons">
<template #drawer> <template #drawer="drawer">
<Form ref="form" /> <Form v-bind="drawer" />
</template> </template>
<!-- <template #search="{ query }">
<a-form-model-item label="名称">
<a-input v-model="query.jobName" />
</a-form-model-item>
</template> -->
<a-table-column title="名称" data-index="jobName" /> <a-table-column :title="$t('system.jobName')" data-index="jobName" />
<a-table-column title="描述" data-index="jobDescription" /> <a-table-column :title="$t('table.describe')" data-index="jobDescription" />
<a-table-column title="操作"> </Table>
<template #default="row">
<a @click="() => view(row, 1)">编辑</a>
<a-divider type="vertical" />
<PopconfirmDelete :url="`/api/v1/jobs/${row.jobId}`" :cb="refreshTable" />
</template>
</a-table-column>
</my-table>
</template> </template>
<script> <script>
import Form from './form.vue'; import Form from './form.vue';
import PopconfirmDelete from '@/components/popconfirm_delete/index.vue'; import { Table } from '@/components/table';
export default { export default {
components: { Form, PopconfirmDelete }, components: { Form, Table },
data() {
return { computed: {
addBtn: { width: 600, onOk: () => this.$refs['form']?.submit() }, buttons() {
}; return [
{ label: this.$t('table.edit'), click: this.edit },
{
type: 'confirm',
url: (row) => `/api/v1/jobs/${row.jobId}`,
after: this.refreshTable,
}, },
];
},
},
methods: { methods: {
refreshTable() { refreshTable() {
this.$refs['table']?.getData(); this.$refs['table']?.getData();
}, },
view(data, type) { edit(row) {
this.$refs['table']?.show({ type }); this.$refs.table.show({ row, title: this.$t('table.edit'), type: 'edit' });
this.$nextTick(() => {
this.$refs['form'].setData({ ...data }, type);
});
}, },
}, },
}; };
......
<template> <template>
<a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm"> <Wraper :hidden="hidden" :refresh="refresh" :onOk="submit">
<a-form-model-item label="名称" prop="jobName"> <a-form-model layout="vertical" :model="form" :rules="rules" ref="form">
<a-input v-model="form.jobName" :disabled="isView" /> <a-form-model-item :label="$t('system.jobName')" prop="jobName">
<a-input v-model="form.jobName" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="描述" prop="jobDescription"> <a-form-model-item :label="$t('table.describe')" prop="jobDescription">
<a-textarea v-model="form.jobDescription" :disabled="isView" :rows="4" /> <a-textarea v-model="form.jobDescription" :rows="4" />
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
</Wraper>
</template> </template>
<script> <script>
import JobsApi from '@/api/organization'; import JobsApi from '@/api/organization';
import FormMixin from '@/components/FormMixin'; import { WraperMixins } from '@/components/table';
export default { export default {
mixins: [FormMixin], mixins: [WraperMixins],
data() { data() {
return { return {
rules: { rules: {
jobName: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }], jobName: [{ required: true, message: this.$t('system.jobName.add'), trigger: 'change' }],
jobDescription: [ jobDescription: [
{ required: true, message: 'Please select Activity zone', trigger: 'change' }, { required: true, message: this.$t('table.describe.add'), trigger: 'change' },
], ],
}, },
}; };
}, },
methods: { mounted() {
add() { if (this.row) {
return JobsApi.addJobs({ ...this.form }); this.form = { ...this.row };
}
},
computed: {
isEdit() {
return this.type === 'edit';
}, },
edit() { isAdd() {
return JobsApi.updateJobs({ ...this.form }); return this.type === null;
},
},
methods: {
async submit() {
await this.$refs.form.validate();
if (this.isAdd) return JobsApi.addJobs({ ...this.form });
if (this.isEdit) return JobsApi.updateJobs({ ...this.form });
}, },
}, },
}; };
......
<template> <template>
<my-table url="/api/v1/users" rowKey="userId" ref="table"> <my-table url="/api/v1/users" rowKey="userId" ref="table">
<template #search="{ query }"> <template #search="{ query }">
<my-form-item label="归属部门"> <MoreItem :label="$t('system.department')">
<OrganizationTree v-model="query.orgId" /> <OrganizationTree v-model="query.orgId" />
</my-form-item> </MoreItem>
<my-form-item label="账号"> <MoreItem :label="$t('user.account')">
<a-input placeholder="Basic usage" v-model="query.loginId" /> <a-input :placeholder="$t('input.placeholder')" v-model="query.loginId" />
</my-form-item> </MoreItem>
</template> </template>
<template #buttons> <template #buttons>
<a-button type="primary" @click="() => view()">新增</a-button> <a-button type="primary" @click="() => view()">{{ $t('table.add') }}</a-button>
</template> </template>
<a-table-column title="账号" data-index="loginId" /> <a-table-column :title="$t('user.account')" data-index="loginId" />
<a-table-column title="姓名" data-index="userName" /> <a-table-column :title="$t('user.name')" data-index="userName" />
<a-table-column title="职称" data-index="userTitleName" /> <a-table-column :title="$t('system.userTitleName')" data-index="userTitleName" />
<a-table-column title="移动电话" data-index="mobilePhone" /> <a-table-column :title="$t('user.mobilePhone')" data-index="mobilePhone" />
<a-table-column title="固定电话" data-index="fixedPhone" /> <a-table-column :title="$t('user.fixedPhone')" data-index="fixedPhone" />
<a-table-column title="电子邮箱" data-index="userEmail" /> <a-table-column :title="$t('user.email')" data-index="userEmail" />
<a-table-column title="是否锁定" data-index="isLockedName" /> <a-table-column :title="$t('user.isLocked')" data-index="isLockedName" />
<a-table-column title="操作"> <a-table-column :title="$t('table.operation')">
<template #default="row"> <template #default="row">
<ActionButton :buttons="buttons" :row="row" /> <ActionButton :buttons="buttons" :row="row" />
</template> </template>
...@@ -36,14 +36,15 @@ import ActionButton from '@/components/action_button/index.vue'; ...@@ -36,14 +36,15 @@ import ActionButton from '@/components/action_button/index.vue';
import { formatObj } from '@/utils'; import { formatObj } from '@/utils';
import Form from './form.vue'; import Form from './form.vue';
import OrganizationTree from '../components/OrganizationTree.vue'; import OrganizationTree from '../components/OrganizationTree.vue';
import { MoreItem } from '@/components/table';
export default { export default {
components: { Form, OrganizationTree, ActionButton }, components: { Form, OrganizationTree, ActionButton, MoreItem },
data() { data() {
return { return {
buttons: [ buttons: [
{ {
label: '编辑', label: this.$t('table.edit'),
click: (row) => { click: (row) => {
this.view(row, 1); this.view(row, 1);
}, },
...@@ -58,8 +59,8 @@ export default { ...@@ -58,8 +59,8 @@ export default {
}, },
{ {
type: 'confirm', type: 'confirm',
label: '重置', label: this.$t('table.reset'),
title: '确认是否重置?', title: this.$t('table.confirmReset'),
url: (row) => { url: (row) => {
return { return {
url: `/api/v1/users/${row.userId}/resetting`, url: `/api/v1/users/${row.userId}/resetting`,
...@@ -70,8 +71,8 @@ export default { ...@@ -70,8 +71,8 @@ export default {
}, },
{ {
type: 'confirm', type: 'confirm',
label: '解锁', label: this.$t('user.deblocking'),
title: '确认是否解锁?', title: this.$t('user.confirmUnlock'),
url: (row) => { url: (row) => {
return { return {
url: `/api/v1/users/${row.userId}/unlocking`, url: `/api/v1/users/${row.userId}/unlocking`,
...@@ -85,8 +86,8 @@ export default { ...@@ -85,8 +86,8 @@ export default {
}, },
{ {
type: 'confirm', type: 'confirm',
label: '锁定', label: this.$t('user.locking'),
title: '确认是否锁定?', title: this.$t('user.confirmLocked'),
url: (row) => { url: (row) => {
return { return {
url: `/api/v1/users/${row.userId}/locking`, url: `/api/v1/users/${row.userId}/locking`,
......
...@@ -154,7 +154,7 @@ const hasAuthorityRoutes = [ ...@@ -154,7 +154,7 @@ const hasAuthorityRoutes = [
component: RouterView, component: RouterView,
children: [ children: [
{ {
path: 'job', path: 'jobs',
name: '岗位管理', name: '岗位管理',
component: () => component: () =>
import('@/pages/system/organization/jobsmanagement/Jobs.vue'), import('@/pages/system/organization/jobsmanagement/Jobs.vue'),
...@@ -166,7 +166,7 @@ const hasAuthorityRoutes = [ ...@@ -166,7 +166,7 @@ const hasAuthorityRoutes = [
import('@/pages/system/organization/usermanagement/User.vue'), import('@/pages/system/organization/usermanagement/User.vue'),
}, },
{ {
path: 'org', path: 'manager',
name: '机构管理', name: '机构管理',
component: () => import('@/pages/system/organization/orgmanagement/Org.vue'), component: () => import('@/pages/system/organization/orgmanagement/Org.vue'),
}, },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment