Commit 677bfee1 authored by shuiluo's avatar shuiluo

feat: 参数管理国际化

parent 4b216178
...@@ -45,4 +45,16 @@ export default { ...@@ -45,4 +45,16 @@ export default {
'log.businessModule': ['业务模块', 'Business Module'], 'log.businessModule': ['业务模块', 'Business Module'],
'log.operationService': ['操作服务', 'Operation Service'], 'log.operationService': ['操作服务', 'Operation Service'],
'log.operateTime': ['操作时间', 'Operate Time'], 'log.operateTime': ['操作时间', 'Operate Time'],
'paramter.paramValue': ['参数值', 'Parameter Value'],
'paramter.paramValueError': ['请输入 @:paramter.paramValue', 'Please Input @:paramter.paramValue'],
'paramter.parameterCoding': ['参数编码', 'Parameter Coding'],
'paramter.parameterCodingError': [
'请输入 @:paramter.parameterCoding',
'Please Input @:paramter.parameterCoding',
],
'paramter.moduleParameters': ['参数模块', 'Module Parameters'],
'paramter.moduleParametersError': [
'请输入 @:paramter.moduleParameters',
'Please Input @:paramter.moduleParameters',
],
}; };
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
<template #moreSearch="{ query }"> <template #moreSearch="{ query }">
<MoreItem :label="$t('log.operationService')"> <MoreItem :label="$t('log.operationService')">
<a-select v-model="query.isSuccess" allowClear :placeholder="$t('select.placeholder')"> <a-select v-model="query.isSuccess" allowClear :placeholder="$t('select.placeholder')">
<a-select-option value="0">失败</a-select-option> <a-select-option value="0">{{ $t('fail') }}</a-select-option>
<a-select-option value="1">成功</a-select-option> <a-select-option value="1">{{ $t('success') }}</a-select-option>
</a-select> </a-select>
</MoreItem> </MoreItem>
</template> </template>
......
<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="paramModule"> <a-form-model layout="vertical" :model="form" :rules="rules" ref="form">
<a-input v-model="form.paramModule" placeholder="请输入" :disabled="isView" /> <a-form-model-item :label="$t('paramter.moduleParameters')" prop="paramModule">
<a-input v-model="form.paramModule" :placeholder="$t('input.placeholder')" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="参数编码" prop="paramCode"> <a-form-model-item :label="$t('paramter.parameterCoding')" prop="paramCode">
<a-input v-model="form.paramCode" placeholder="请输入" :disabled="isView" /> <a-input v-model="form.paramCode" :placeholder="$t('input.placeholder')" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="参数值" prop="paramValue"> <a-form-model-item :label="$t('paramter.paramValue')" prop="paramValue">
<a-input v-model="form.paramValue" placeholder="请输入" :disabled="isView" /> <a-input v-model="form.paramValue" :placeholder="$t('input.placeholder')" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="说明" prop="remark"> <a-form-model-item :label="$t('table.remark')" prop="remark">
<a-textarea v-model="form.remark" :disabled="isView" :rows="4" /> <a-textarea v-model="form.remark" :rows="4" :placeholder="$t('input.placeholder')" />
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
</Wraper>
</template> </template>
<script> <script>
import Api from '@/api/organization'; import Api 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 {
form: {},
rules: { rules: {
paramModule: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }], paramModule: [{ required: true, message: this.$t('paramter.moduleParametersError') }],
paramCode: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }], paramCode: [{ required: true, message: this.$t('paramter.parameterCodingError') }],
paramValue: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }], paramValue: [{ required: true, message: this.$t('paramter.paramValueError') }],
paramIndex: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }],
}, },
}; };
}, },
methods: { computed: {
add() { isEdit() {
return Api.addOperation({ ...this.form }); return this.type === 'edit';
},
}, },
edit() { mounted() {
return Api.updateOperation({ ...this.form }); if (this.type) {
this.form = { ...this.row };
}
},
methods: {
async submit() {
await this.$refs.form.validate();
return this.isEdit ? Api.updateOperation({ ...this.form }) : Api.addOperation({ ...this.form });
}, },
}, },
}; };
......
<template> <template>
<my-table <Table url="/api/v1/parameters/operation" rowKey="paramId" addBtn ref="table" :buttons="buttons">
url="/api/v1/parameters/operation" <template #drawer="drawer">
rowKey="paramId" <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="参数模块"> <MoreItem :label="$t('paramter.moduleParameters')">
<a-input v-model="query.paramModule" placeholder="请输入" /> <a-input v-model="query.paramModule" :placeholder="$t('input.placeholder')" />
</MyFormModelItem> </MoreItem>
<MyFormModelItem label="参数编码"> <MoreItem :label="$t('paramter.parameterCoding')">
<a-input v-model="query.paramCode" placeholder="请输入" /> <a-input v-model="query.paramCode" :placeholder="$t('input.placeholder')" />
</MyFormModelItem> </MoreItem>
<MyFormModelItem label="参数值"> <MoreItem :label="$t('paramter.paramValue')">
<a-input v-model="query.paramValue" placeholder="请输入" /> <a-input v-model="query.paramValue" :placeholder="$t('input.placeholder')" />
</MyFormModelItem> </MoreItem>
</template> </template>
<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="remark" /> <a-table-column :title="$t('table.remark')" data-index="remark" />
<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/operation/${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';
export default { export default {
components: { Form, PopconfirmDelete, MyFormModelItem }, components: { Form, Table, MoreItem },
data() { computed: {
return { buttons() {
addBtn: { width: 600, onOk: () => this.$refs['form']?.submit() }, return [
}; { label: this.$t('table.edit'), click: this.edit },
{
type: 'confirm',
url: (row) => `/api/v1/parameters/operation/${row.paramId}`,
after: this.refreshTable,
},
];
},
}, },
methods: { methods: {
refreshTable() { refreshTable() {
this.$refs['table']?.getData(); this.$refs['table']?.getData();
}, },
view(data, type) {
this.$refs['table']?.show({ type }); edit(row) {
this.$nextTick(() => { this.$refs['table']?.show({ row, title: this.$t('table.edit'), type: 'edit' });
this.$refs['form'].setData({ ...data }, type);
});
}, },
}, },
}; };
......
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