Commit 635894d4 authored by shuiluo's avatar shuiluo

feat: 参数模块国际化完成

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