Commit 27800600 authored by shuiluo's avatar shuiluo

feat: 设备管理分类配置国际化完成

parent fe13177a
...@@ -7,6 +7,7 @@ import OtherLang from './other'; ...@@ -7,6 +7,7 @@ import OtherLang from './other';
import acronLang from './acron'; import acronLang from './acron';
import basicLang from './basic'; import basicLang from './basic';
import taskCenterLang from './task_center'; import taskCenterLang from './task_center';
import oceanusLang from './oceanus';
const zh_CN = {}; const zh_CN = {};
const en_US = {}; const en_US = {};
...@@ -31,5 +32,6 @@ formatLang(OtherLang); ...@@ -31,5 +32,6 @@ formatLang(OtherLang);
formatLang(acronLang); formatLang(acronLang);
formatLang(basicLang); formatLang(basicLang);
formatLang(taskCenterLang); formatLang(taskCenterLang);
formatLang(oceanusLang);
export { en_US, zh_CN }; export { en_US, zh_CN };
export default {
'oc.attributeName': ['属性名称', 'Attribute Name'],
'oc.attributeNameErrorInfo': ['请输入属性名称', 'Please enter attribute Name'],
'oc.toBottom': ['置底', 'ToBottom'],
'oc.cancelConfirm': ['确认是否取消', 'Confirm Whether To Cancel'],
'oc.code': ['编码', 'Code']
};
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
<a-col :span="24" class="tw-text-right"> <a-col :span="24" class="tw-text-right">
<a-button-group> <a-button-group>
<a-button type="primary" ghost @click="add">新增</a-button> <a-button type="primary" ghost @click="add">{{ $t('table.add') }}</a-button>
<a-button type="primary" ghost @click="edit">编辑</a-button> <a-button type="primary" ghost @click="edit">{{ $t('table.edit') }}</a-button>
<a-button type="primary" ghost @click="del">删除</a-button> <a-button type="primary" ghost @click="del">{{ $t('table.delete') }}</a-button>
</a-button-group> </a-button-group>
</a-col> </a-col>
</a-row> </a-row>
...@@ -136,14 +136,12 @@ export default { ...@@ -136,14 +136,12 @@ export default {
if (!categoryId) return; if (!categoryId) return;
try { try {
await Api.delOceanusTree({ categoryId }); await Api.delOceanusTree({ categoryId });
this.$message.success('删除成功!'); this.$message.success(this.$t('table.operationSucceeded'));
this.init(); this.init();
} catch (e) { } catch (e) {
this.$message.warning('删除失败!'); this.$message.warning(this.$t('table.operationFailed'));
} }
}, },
}, },
}; };
</script> </script>
<style scoped>
</style>
...@@ -12,13 +12,13 @@ ...@@ -12,13 +12,13 @@
<template #search> <template #search>
<a-row> <a-row>
<a-col :span="12"> <a-col :span="12">
<a-button type="link" @click="onAddTableRow">新增</a-button> <a-button type="link" @click="onAddTableRow">{{ $t('table.add') }}</a-button>
</a-col> </a-col>
<a-col :span="12" class="tw-text-right"> <a-col :span="12" class="tw-text-right">
<a-input-search <a-input-search
v-model="attributeName" v-model="attributeName"
:style="{ width: '80%' }" :style="{ width: '80%' }"
placeholder="请输入搜索内容" :placeholder="$t('input.placeholder')"
enter-button enter-button
allowClear allowClear
@search="onSearch" @search="onSearch"
...@@ -27,15 +27,19 @@ ...@@ -27,15 +27,19 @@
</a-row> </a-row>
</template> </template>
<a-table-column title="属性名称"> <a-table-column :title="$t('oc.attributeName')">
<template #default="row"> <template #default="row">
<a-input v-if="row.editable" v-model="row.attributeName" /> <a-input
v-if="row.editable"
v-model="row.attributeName"
:placeholder="$t('input.placeholder')"
/>
<span v-else> <span v-else>
{{ row.attributeName }} {{ row.attributeName }}
</span> </span>
</template> </template>
</a-table-column> </a-table-column>
<a-table-column title="操作" :width="180"> <a-table-column :title="$t('table.operation')" :width="180">
<template #default="row"> <template #default="row">
<ActionButton v-if="row.editable" :buttons="editButtons" :row="row" /> <ActionButton v-if="row.editable" :buttons="editButtons" :row="row" />
<ActionButton v-else :buttons="buttons" :row="row" /> <ActionButton v-else :buttons="buttons" :row="row" />
...@@ -69,7 +73,7 @@ export default { ...@@ -69,7 +73,7 @@ export default {
return { return {
buttons: [ buttons: [
{ {
label: '编辑', label: this.$t('table.edit'),
click: this.onEditTableRow, click: this.onEditTableRow,
}, },
{ {
...@@ -78,41 +82,41 @@ export default { ...@@ -78,41 +82,41 @@ export default {
after: () => this.refreshTable(), after: () => this.refreshTable(),
}, },
{ {
label: '置顶', label: this.$t('basic.topping'),
click: async (row) => { click: async (row) => {
const { attributeId, categoryId } = row; const { attributeId, categoryId } = row;
try { try {
await Api.movementAttributes({ attributeId, categoryId, moveType: 'TOP' }); await Api.movementAttributes({ attributeId, categoryId, moveType: 'TOP' });
this.refreshTable(); this.refreshTable();
this.$message.success('置顶成功!'); this.$message.success(this.$t('table.operationSucceeded'));
} catch (e) { } catch (e) {
this.$message.warning('置顶失败!'); this.$message.warning(this.$t('table.operationFailed'));
} }
}, },
}, },
{ {
label: '置底', label: this.$t('oc.toBottom'),
click: async (row) => { click: async (row) => {
const { attributeId, categoryId } = row; const { attributeId, categoryId } = row;
try { try {
await Api.movementAttributes({ attributeId, categoryId, moveType: 'BOTTOM' }); await Api.movementAttributes({ attributeId, categoryId, moveType: 'BOTTOM' });
this.refreshTable(); this.refreshTable();
this.$message.success('置顶成功!'); this.$message.success(this.$t('table.operationSucceeded'));
} catch (e) { } catch (e) {
this.$message.warning('置顶失败!'); this.$message.warning(this.$t('table.operationFailed'));
} }
}, },
}, },
], ],
editButtons: [ editButtons: [
{ {
label: '确定', label: this.$t('table.submit'),
click: this.onSubmitTableRow, click: this.onSubmitTableRow,
}, },
{ {
type: 'confirm', type: 'confirm',
label: '取消', label: this.$t('table.cancel'),
title: '确认是否取消?', title: this.$t('oc.cancelConfirm'),
onOk: this.onCancelTableRow, onOk: this.onCancelTableRow,
}, },
], ],
...@@ -162,7 +166,7 @@ export default { ...@@ -162,7 +166,7 @@ export default {
}, },
async onSubmitTableRow(row) { async onSubmitTableRow(row) {
if (row.attributeName === '') { if (row.attributeName === '') {
return this.$message.warning('请输入属性名称!'); return this.$message.warning(this.$t('oc.attributeNameErrorInfo'));
} else { } else {
try { try {
if (row.action === 'add') { if (row.action === 'add') {
...@@ -172,9 +176,9 @@ export default { ...@@ -172,9 +176,9 @@ export default {
await Api.updateAttributes(row); await Api.updateAttributes(row);
} }
this.refreshTable(); this.refreshTable();
this.$message.success('提交成功!'); this.$message.success(this.$t('table.operationSucceeded'));
} catch (e) { } catch (e) {
this.$message.warning('保存失败!'); this.$message.warning(this.$t('table.operationFailed'));
} }
} }
}, },
...@@ -196,5 +200,3 @@ export default { ...@@ -196,5 +200,3 @@ export default {
}, },
}; };
</script> </script>
<style scoped>
</style>
<template> <template>
<Drawer ref="drawerRef" v-model="visible" :title="title" :onOk="submit" :colesAfter="refresh"> <Drawer ref="drawerRef" v-model="visible" :title="title" :onOk="submit" :colesAfter="refresh">
<a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm"> <a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm">
<a-form-model-item label="编码" prop="categoryCode"> <a-form-model-item :label="$t('oc.code')" prop="categoryCode">
<a-input v-model="form.categoryCode" :disabled="isView" /> <a-input
v-model="form.categoryCode"
:disabled="isView"
:placeholder="$t('input.placeholder')"
/>
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="名称" prop="categoryName"> <a-form-model-item :label="$t('basic.name')" prop="categoryName">
<a-input v-model="form.categoryName" :disabled="isView" /> <a-input
v-model="form.categoryName"
:disabled="isView"
: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"
:disabled="isView"
:rows="4"
:placeholder="$t('input.placeholder')"
/>
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
</Drawer> </Drawer>
...@@ -30,14 +43,13 @@ export default { ...@@ -30,14 +43,13 @@ export default {
visible: false, visible: false,
form: {}, form: {},
rules: { rules: {
categoryCode: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }], categoryCode: [{ required: true, message: this.$t('input.error'), trigger: 'change' }],
categoryName: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }], categoryName: [{ required: true, message: this.$t('input.error'), trigger: 'change' }],
remark: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }], remark: [{ required: true, message: this.$t('input.error'), trigger: 'change' }],
}, },
Api, Api,
}; };
}, },
async mounted() {},
methods: { methods: {
open() { open() {
this.form = {}; this.form = {};
......
...@@ -20,11 +20,5 @@ export default { ...@@ -20,11 +20,5 @@ export default {
treeVale: {}, treeVale: {},
}; };
}, },
watch: {
treeVale(val) {
console.log(val);
},
},
methods: {},
}; };
</script> </script>
...@@ -22,6 +22,5 @@ export default { ...@@ -22,6 +22,5 @@ export default {
isObjEmpty, isObjEmpty,
}; };
}, },
watch: {},
}; };
</script> </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