Commit 635894d4 authored by shuiluo's avatar shuiluo

feat: 参数模块国际化完成

parent 677bfee1
......@@ -57,4 +57,7 @@ export default {
'请输入 @:paramter.moduleParameters',
'Please Input @:paramter.moduleParameters',
],
language: ['语言', 'Language'],
'business.parameterName': ['参数名称', 'Parameter Name'],
order: ['顺序', 'Order'],
};
<template>
<a-select v-bind="$attrs" v-on="$listeners" :options="langList" :placeholder="$t('select.placeholder')" />
</template>
<script>
import langUtils from '@/utils/langUtils';
import { formatObj } from '@/utils';
export default {
props: ['value'],
model: {
prop: 'value',
event: 'change',
},
computed: {
langList() {
return formatObj(langUtils.langList, { value: 'key', label: 'name', key: 'key' });
},
},
};
</script>
<template>
<a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm">
<a-form-model-item label="语言" prop="paramLocale">
<a-select
v-model="form.paramLocale"
:options="langList"
placeholder="请选择"
:disabled="isView"
/>
</a-form-model-item>
<a-form-model-item label="参数模块" prop="paramModule">
<a-input v-model="form.paramModule" placeholder="请输入" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="参数编码" prop="paramCode">
<a-input v-model="form.paramCode" placeholder="请输入" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="参数值" prop="paramValue">
<a-input v-model="form.paramValue" placeholder="请输入" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="参数名称" prop="paramName">
<a-input v-model="form.paramName" placeholder="请输入" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="显示顺序" prop="paramIndex">
<a-input v-model="form.paramIndex" placeholder="请输入" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="说明" prop="remark">
<a-textarea v-model="form.remark" :disabled="isView" :rows="4" />
</a-form-model-item>
</a-form-model>
<Wraper :hidden="hidden" :refresh="refresh" :onOk="submit">
<a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm">
<a-form-model-item label="语言" prop="paramLocale">
<language v-model="form.paramLocale" />
</a-form-model-item>
<a-form-model-item label="参数模块" prop="paramModule">
<a-input v-model="form.paramModule" placeholder="请输入" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="参数编码" prop="paramCode">
<a-input v-model="form.paramCode" placeholder="请输入" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="参数值" prop="paramValue">
<a-input v-model="form.paramValue" placeholder="请输入" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="参数名称" prop="paramName">
<a-input v-model="form.paramName" placeholder="请输入" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="显示顺序" prop="paramIndex">
<a-input v-model="form.paramIndex" placeholder="请输入" :disabled="isView" />
</a-form-model-item>
<a-form-model-item label="说明" prop="remark">
<a-textarea v-model="form.remark" :disabled="isView" :rows="4" />
</a-form-model-item>
</a-form-model>
</Wraper>
</template>
<script>
import Api from '@/api/organization';
import FormMixin from '@/components/FormMixin';
import { globalConfig } from '@/config';
import { formatObj } from '@/utils';
import { WraperMixins } from '@/components/table';
import Language from './components/language.vue';
export default {
mixins: [FormMixin],
mixins: [FormMixin, WraperMixins],
components: { Language },
data() {
return {
rules: {
......@@ -50,9 +48,7 @@ export default {
langList: [],
};
},
async mounted() {
this.langList = await formatObj(globalConfig.langs, { value: 'key', label: 'name', key: 'key' });
},
methods: {
add() {
return Api.addBusiness({ ...this.form });
......@@ -60,6 +56,9 @@ export default {
edit() {
return Api.updateBusiness({ ...this.form });
},
async submit() {
await this.$refs.validate();
},
},
};
</script>
<template>
<my-table
url="/api/v1/parameters/business"
rowKey="paramId"
:addBtn="addBtn"
ref="table"
:scroll="{ x: true }"
>
<template #drawer>
<Form ref="form" />
<Table url="/api/v1/parameters/business" rowKey="paramId" addBtn ref="table" :buttons="buttons">
<template #drawer="drawer">
<Form ref="form" v-bind="drawer" />
</template>
<template #search="{ query }">
<MyFormModelItem label="语言">
<a-select v-model="query.paramLocale" :options="langList" placeholder="请选择" />
<MyFormModelItem :label="$t('language')">
<Language v-model="query.paramLocale" />
</MyFormModelItem>
<MyFormModelItem label="参数模块">
<a-input v-model="query.paramModule" placeholder="请输入" />
<MyFormModelItem :label="$t('paramter.moduleParameters')">
<a-input v-model="query.paramModule" :placeholder="$t('input.placeholder')" />
</MyFormModelItem>
<MyFormModelItem label="参数编码">
<a-input v-model="query.paramCode" placeholder="请输入" />
<MyFormModelItem :label="$t('paramter.parameterCoding')">
<a-input v-model="query.paramCode" :placeholder="$t('input.placeholder')" />
</MyFormModelItem>
<MyFormModelItem label="参数名称">
<a-input v-model="query.paramName" placeholder="请输入" />
<MyFormModelItem :label="$t('business.parameterName')">
<a-input v-model="query.paramName" :placeholder="$t('input.placeholder')" />
</MyFormModelItem>
</template>
<a-table-column title="语言" data-index="paramLocale" />
<a-table-column title="参数模块" data-index="paramModule" />
<a-table-column title="参数编码" data-index="paramCode" />
<a-table-column title="参数值" data-index="paramValue" />
<a-table-column title="参数名称" data-index="paramName" />
<a-table-column title="说明" data-index="remark" />
<a-table-column title="显示顺序" data-index="paramIndex" />
<a-table-column title="操作" fixed="right">
<template #default="row">
<a @click="() => view(row, 1)">编辑</a>
<a-divider type="vertical" />
<PopconfirmDelete :url="`/api/v1/parameters/business/${row.paramId}`" :cb="refreshTable" />
</template>
</a-table-column>
</my-table>
<a-table-column :title="$t('language')" data-index="paramLocale" />
<a-table-column :title="$t('paramter.moduleParameters')" data-index="paramModule" />
<a-table-column :title="$t('paramter.parameterCoding')" data-index="paramCode" />
<a-table-column :title="$t('paramter.paramValue')" data-index="paramValue" />
<a-table-column :title="$t('business.parameterName')" data-index="paramName" />
<a-table-column :title="$t('table.remark')" data-index="remark" />
<a-table-column :title="$t('order')" data-index="paramIndex" />
</Table>
</template>
<script>
import PopconfirmDelete from '@/components/popconfirm_delete/index.vue';
import MyFormModelItem from '@/components/table/my_item.vue';
import { globalConfig } from '@/config';
import { formatObj } from '@/utils';
import Form from './form.vue';
import { Table, MoreItem } from '@/components/table';
import Language from './components/language.vue';
export default {
components: { Form, PopconfirmDelete, MyFormModelItem },
data() {
return {
addBtn: { width: 600, onOk: () => this.$refs['form']?.submit() },
langList: [],
};
},
async mounted() {
this.langList = await formatObj(globalConfig.langs, { value: 'key', label: 'name', key: 'key' });
components: { Form, MyFormModelItem: MoreItem, Table, Language },
computed: {
buttons() {
return [
{ label: this.$t('table.edit'), click: this.edit },
{
type: 'confirm',
url: (row) => `/api/v1/parameters/business/${row.paramId}`,
after: this.refreshTable,
},
];
},
},
methods: {
refreshTable() {
this.$refs['table']?.getData();
},
view(data, type) {
this.$refs['table']?.show({ type });
this.$nextTick(() => {
this.$refs['form'].setData({ ...data }, type);
});
edit(row) {
this.$refs['table']?.show({ row, type: 'edit', title: this.$t('table.edit') });
},
},
};
</script>
\ No newline at end of file
</script>
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