Commit 27800600 authored by shuiluo's avatar shuiluo

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

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