From b5a93f7ce1b0954c1150c769a58468c7d5b75624 Mon Sep 17 00:00:00 2001 From: ival <610568032@qq.com> Date: Wed, 21 Aug 2019 13:48:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/en/error.js | 3 +- src/i18n/langs/en/global.js | 5 +- src/i18n/langs/en/map.js | 4 +- src/i18n/langs/en/permission.js | 14 ++- src/i18n/langs/en/rules.js | 8 +- src/i18n/langs/en/tip.js | 2 +- src/i18n/langs/zh/error.js | 5 +- src/i18n/langs/zh/global.js | 5 +- src/i18n/langs/zh/map.js | 4 +- src/i18n/langs/zh/permission.js | 14 ++- src/i18n/langs/zh/rules.js | 7 +- .../mapedit/mapoperate/train/create.vue | 50 +++++---- .../mapedit/mapoperate/train/trainmodel.vue | 8 +- src/views/package/draft/canDistribute.vue | 102 ++++++++++-------- src/views/package/draft/editRule.vue | 36 +++---- src/views/package/draft/ruleForm.vue | 38 +++---- 16 files changed, 185 insertions(+), 120 deletions(-) diff --git a/src/i18n/langs/en/error.js b/src/i18n/langs/en/error.js index 8fd8babc0..ccf3eba0d 100644 --- a/src/i18n/langs/en/error.js +++ b/src/i18n/langs/en/error.js @@ -55,6 +55,7 @@ export default { batchCreateFailed: 'Batch build operation definition failed', createOperateRuleFailed: 'Failed to create operation definition', createOperateStepFailed: 'The create action step failed', - updateOperateStepFailed: 'The update action step failed' + updateOperateStepFailed: 'The update action step failed', + packagePermissionFailed: 'Packaging authority failed' }; diff --git a/src/i18n/langs/en/global.js b/src/i18n/langs/en/global.js index af2bc94f8..aa803d972 100644 --- a/src/i18n/langs/en/global.js +++ b/src/i18n/langs/en/global.js @@ -96,5 +96,8 @@ export default { distributePermission: 'Distribute permission', transferQRCode: 'Transfer QRCode', minutes: 'minutes', - minute: 'minute' + minute: 'minute', + totoal: 'Totoal', + publishPermission: 'The public authority', + specialPermission: 'Special permission' }; diff --git a/src/i18n/langs/en/map.js b/src/i18n/langs/en/map.js index 35b0f72ad..bdc7ba4fb 100644 --- a/src/i18n/langs/en/map.js +++ b/src/i18n/langs/en/map.js @@ -488,6 +488,8 @@ export default { switchBCode: 'Switch number 2', switchACodeNum: 'Switch ID 1:', - switchBCodeNum: 'Switch ID 2:' + switchBCodeNum: 'Switch ID 2:', + + wellDelTrianModel: 'Deleting the train model will delete the associated class cars together, please confirm whether to continue?' }; diff --git a/src/i18n/langs/en/permission.js b/src/i18n/langs/en/permission.js index 465458765..ca199e6b8 100644 --- a/src/i18n/langs/en/permission.js +++ b/src/i18n/langs/en/permission.js @@ -15,5 +15,17 @@ export default { startTime: 'Start Time', endTime: 'End Time', belonger: 'Owner', - userList: 'User List' + userList: 'User List', + customPackageRules: 'Custom packaging rules', + addRules: 'Add rules', + package: 'Pack', + getQrcode: 'Get qr code', + hasExitRule: 'This type rule already exists', + pleaseAddRule: 'Please add rules', + selectDate: 'Select time', + addPermissionPackageRule: 'Add authority packaging rules', + editPermissionPackageRule: 'edit authority packaging rule', + restPermissionMaxNumber: '(maximum number of remaining permissions: {0})', + pleaseSelectTransferPermission: 'Select transfer permissions' + }; diff --git a/src/i18n/langs/en/rules.js b/src/i18n/langs/en/rules.js index 0298e1a0c..2baded317 100644 --- a/src/i18n/langs/en/rules.js +++ b/src/i18n/langs/en/rules.js @@ -217,5 +217,11 @@ export default { inputSkinType: 'Please select skin type', inputOperateCode: 'Please enter the step code', inputStepNo: 'Please enter the step number', - inputStepTips: 'Please enter step number. Please enter step prompt' + inputStepTips: 'Please enter step number. Please enter step prompt', + selectMapName: 'Please select a map name', + selectMapProductName: 'Please select map product name', + inputTime: 'Please enter time', + inputPermissionNumber: 'Please enter the number of permissions', + permissionNumberGreater0: 'The number of permissions must be greater than 0' + }; diff --git a/src/i18n/langs/en/tip.js b/src/i18n/langs/en/tip.js index 7c32a30b0..0261b8ee6 100644 --- a/src/i18n/langs/en/tip.js +++ b/src/i18n/langs/en/tip.js @@ -5,7 +5,7 @@ export default { creatingFailed: 'Create a failure', confirmDeletion: 'Confirm deletion?', confirmBatchGeneration: 'Is batch generation confirmed?', - hint: 'hint', + hint: 'Tips', cancelledDelete: 'Cancelled delete', cancelGeneration: 'Batch generation has been cancelled', diff --git a/src/i18n/langs/zh/error.js b/src/i18n/langs/zh/error.js index c184ffcb5..af63b7142 100644 --- a/src/i18n/langs/zh/error.js +++ b/src/i18n/langs/zh/error.js @@ -55,6 +55,7 @@ export default { batchCreateFailed: '批量生成操作定义失败', createOperateRuleFailed: '创建操作定义失败', createOperateStepFailed: '创建操作步骤失败', - updateOperateStepFailed: '更新操作步骤失败' - + updateOperateStepFailed: '更新操作步骤失败', + packagePermissionFailed: '打包权限失败' }; + diff --git a/src/i18n/langs/zh/global.js b/src/i18n/langs/zh/global.js index 52d07c21c..45c9f0812 100644 --- a/src/i18n/langs/zh/global.js +++ b/src/i18n/langs/zh/global.js @@ -97,5 +97,8 @@ export default { distributePermission: '权限分发', transferQRCode: '权限转赠', minutes: '分钟', - minute: '分钟' + minute: '分钟', + totoal: '总数', + publishPermission: '公用权限', + specialPermission: '专用权限' }; diff --git a/src/i18n/langs/zh/map.js b/src/i18n/langs/zh/map.js index ec46dd6da..de8a3581d 100644 --- a/src/i18n/langs/zh/map.js +++ b/src/i18n/langs/zh/map.js @@ -490,6 +490,8 @@ export default { switchBCode: '道岔2编号', switchACodeNum: '道岔ID 1:', - switchBCodeNum: '道岔ID 2:' + switchBCodeNum: '道岔ID 2:', + + wellDelTrianModel: '删除车模型会将关联的类车一起删除,请确认是否继续?' }; diff --git a/src/i18n/langs/zh/permission.js b/src/i18n/langs/zh/permission.js index 1bdac6211..3e99db472 100644 --- a/src/i18n/langs/zh/permission.js +++ b/src/i18n/langs/zh/permission.js @@ -15,5 +15,17 @@ export default { startTime: '开始时间', endTime: '结束时间', belonger: '归属人', - userList: '用户列表' + userList: '用户列表', + customPackageRules: '定制打包规则', + addRules: '添加规则', + package: '打包', + getQrcode: '获取二维码', + hasExitRule: '已存在此类型规则', + pleaseAddRule: '请添加规则', + selectDate: '选择时间', + addPermissionPackageRule: '增加权限打包规则', + editPermissionPackageRule: '编辑权限打包规则', + restPermissionMaxNumber: '(剩余最大权限个数:{0})', + pleaseSelectTransferPermission: '选择转赠权限' + }; diff --git a/src/i18n/langs/zh/rules.js b/src/i18n/langs/zh/rules.js index 0a2c0e519..7cec90d9e 100644 --- a/src/i18n/langs/zh/rules.js +++ b/src/i18n/langs/zh/rules.js @@ -224,6 +224,11 @@ export default { inputTrainingRemark: '请输入实训说明', inputOperateCode: '请输入步骤操作码', inputStepNo: '请输入步骤序号', - inputStepTips: '请输入步骤提示信息' + inputStepTips: '请输入步骤提示信息', + selectMapName: '请选择地图名称', + selectMapProductName: '请选择地图产品名称', + inputTime: '请输入时间', + inputPermissionNumber: '请输入权限个数', + permissionNumberGreater0: '权限个数必须大于0' }; diff --git a/src/views/map/mapdraft/mapedit/mapoperate/train/create.vue b/src/views/map/mapdraft/mapedit/mapoperate/train/create.vue index 743f58480..7df1e22fb 100644 --- a/src/views/map/mapdraft/mapedit/mapoperate/train/create.vue +++ b/src/views/map/mapdraft/mapedit/mapoperate/train/create.vue @@ -109,31 +109,35 @@ export default { this.$emit('dispatch', { callback: 'delTrainMode', params: code}); }, handleConfirm() { - const list = []; + this.$refs['form'].validate((valid) => { + if (valid) { + const list = []; - switch (this.mode) { - case '01': - list.push({ - _type: 'Train', - code: getUID('Train'), - modelCode: this.addModel.modelCode, - groupNumber: this.addModel.groupNumber - }); - break; - case '02': - for (var num = this.addModel.range.beg; num <= this.addModel.range.end; num++) { - list.push({ - _type: 'Train', - code: getUID('Train'), - modelCode: this.addModel.modelCode, - groupNumber: ('000'+num).slice(-3) - }); + switch (this.mode) { + case '01': + list.push({ + _type: 'Train', + code: getUID('Train'), + modelCode: this.addModel.modelCode, + groupNumber: this.addModel.groupNumber + }); + break; + case '02': + for (var num = this.addModel.range.beg; num <= this.addModel.range.end; num++) { + list.push({ + _type: 'Train', + code: getUID('Train'), + modelCode: this.addModel.modelCode, + groupNumber: ('000'+num).slice(-3) + }); + } + break; + } + + this.$emit('dispatch', { callback: 'create', params: list}); + this.doClose(); } - break; - } - - this.$emit('dispatch', { callback: 'create', params: list}); - this.doClose(); + }); } } }; diff --git a/src/views/map/mapdraft/mapedit/mapoperate/train/trainmodel.vue b/src/views/map/mapdraft/mapedit/mapoperate/train/trainmodel.vue index b209ca46d..b1922bfde 100644 --- a/src/views/map/mapdraft/mapedit/mapoperate/train/trainmodel.vue +++ b/src/views/map/mapdraft/mapedit/mapoperate/train/trainmodel.vue @@ -156,7 +156,13 @@ export default { } else if (this.isUpt) { this.operateTrainModel({ model: this.formModel, type: 'UPT' }); } else if (this.isDel) { - this.operateTrainModel({ model: this.formModel, type: 'DEL'}); + this.$confirm(this.$t('map.wellDelTrianModel'), this.$t('global.tips'), { + confirmButtonText: this.$t('global.confirm'), + cancelButtonText: this.$t('global.cancel'), + type: 'warning' + }).then(() => { + this.operateTrainModel({ model: this.formModel, type: 'DEL'}); + }).catch(() => { }); } this.doClose(); } diff --git a/src/views/package/draft/canDistribute.vue b/src/views/package/draft/canDistribute.vue index 8dfec5c53..b74356b19 100644 --- a/src/views/package/draft/canDistribute.vue +++ b/src/views/package/draft/canDistribute.vue @@ -1,51 +1,59 @@ \ No newline at end of file + }; + }, + computed: { + show() { + return this.dialogShow; + }, + title() { return this.$t('permission.pleaseSelectTransferPermission'); } + }, + methods: { + doShow(data) { + this.dialogShow = true; + this.formModel.canDistribute = true; + }, + doClose() { + this.dialogShow = false; + }, + handleSure() { + this.doClose(); + this.$emit('distribute', this.formModel); + }, + handleClose() { + this.doClose(); + } + } +}; + diff --git a/src/views/package/draft/editRule.vue b/src/views/package/draft/editRule.vue index 32c0f61ad..77f3947b1 100644 --- a/src/views/package/draft/editRule.vue +++ b/src/views/package/draft/editRule.vue @@ -51,7 +51,7 @@ export default { }, DatePicker: { shortcuts: [{ - text: '今天', + text: this.$t('global.today'), onClick(picker) { picker.$emit('pick', new Date()); } @@ -66,13 +66,13 @@ export default { const form = { labelWidth: '120px', items: [ - { prop: 'permissionType', label: '权限类型', type: 'select', required: false, disabled: !this.isAdd, options: this.PermissionTypeList, change: true, onChange: this.permissionTypeChange }, - { prop: 'mapId', label: '地图名称', type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMap, options: this.PublishMapList, change: true, onChange: this.mapChange }, - { prop: 'mapProductCode', label: '地图产品名称', type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMapProduct, options: this.mapProductList, change: true, onChange: this.mapProductChange }, - { prop: 'lessonId', label: '课程名称', type: 'select', required: false, disabled: !this.isAdd, show: this.isShowLesson, options: this.filterPublisLessonList }, - { prop: 'roleName', label: '选择权限所有者', type: 'complete', required: false, disabled: !this.isAdd, show: this.isShowRole, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: '请输入昵称/名字/手机号' }, - { prop: 'date', label: '选择时间', type: 'daterange', required: false, viewFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss' }, - { prop: 'amount', label: '权限个数', type: 'number', required: false, min: 0, max: this.maxTotal, message: this.numberMessage } + { prop: 'permissionType', label: this.$t('permission.permissionType'), type: 'select', required: false, disabled: !this.isAdd, options: this.PermissionTypeList, change: true, onChange: this.permissionTypeChange }, + { prop: 'mapId', label: this.$t('permission.mapName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMap, options: this.PublishMapList, change: true, onChange: this.mapChange }, + { prop: 'mapProductCode', label: this.$t('permission.mapProductName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMapProduct, options: this.mapProductList, change: true, onChange: this.mapProductChange }, + { prop: 'lessonId', label: this.$t('permission.lessonName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowLesson, options: this.filterPublisLessonList }, + { prop: 'roleName', label: this.$t('permission.belonger'), type: 'complete', required: false, disabled: !this.isAdd, show: this.isShowRole, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: '请输入昵称/名字/手机号' }, + { prop: 'date', label: this.$t('permission.selectDate'), type: 'daterange', required: false, viewFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss' }, + { prop: 'amount', label: this.$t('permission.permissionTotal'), type: 'number', required: false, min: 0, max: this.maxTotal, message: this.numberMessage } ] }; return form; @@ -80,28 +80,28 @@ export default { rules() { const crules = { permissionType: [ - { required: true, message: '请选择权限类型', trigger: 'change' } + { required: true, message: this.$t('rules.permissionTypeInput'), trigger: 'change' } ], mapId: [ - { required: true, message: '请选择地图名称', trigger: 'change' } + { required: true, message: this.$t('rules.selectMapName'), trigger: 'change' } ], mapProductCode: [ - { required: true, message: '请选择地图产品名称', trigger: 'change' } + { required: true, message: this.$t('rules.selectMapProductName'), trigger: 'change' } ], lessonId: [ - { required: true, message: '请选择课程', trigger: 'change' } + { required: true, message: this.$t('rules.lessonInput'), trigger: 'change' } ], date: [ - { required: true, message: '请输入时间', trigger: 'blur' } + { required: true, message: this.$t('rules.inputTime'), trigger: 'blur' } ], amount: [ - { required: true, message: '请输入权限个数', trigger: 'change' }, + { required: true, message: this.$t('rules.inputPermissionNumber'), trigger: 'change' }, { validator(rule, value, callback) { if (Number.isInteger(Number(value)) && Number(value) > 0) { callback(); } else { - callback(new Error('权限个数必须大于0')); + callback(new Error(this.$t('rules.permissionNumberGreater0'))); } }, trigger: 'blur' @@ -112,9 +112,9 @@ export default { }, title() { if (this.isAdd) { - return '增加权限打包规则'; + return this.$t('permission.addPermissionPackageRule'); } else { - return '编辑权限打包规则'; + return this.$t('permission.editPermissionPackageRule'); } }, disabled() { @@ -179,7 +179,7 @@ export default { getTotalRemains(model).then(response => { this.maxTotal = response.data; - this.numberMessage = `(剩余最大权限个数:${this.maxTotal})`; + this.numberMessage = this.$t('permission.restPermissionMaxNumber').replace('{0}', this.maxTotal); }).catch(() => { this.numberMessage = ''; }); diff --git a/src/views/package/draft/ruleForm.vue b/src/views/package/draft/ruleForm.vue index 6968f6a9d..659a1dc1b 100644 --- a/src/views/package/draft/ruleForm.vue +++ b/src/views/package/draft/ruleForm.vue @@ -3,11 +3,11 @@
- + - 添加规则 + {{ $t('permission.addRules') }} - + - + - + - + - - - - + + + +
- 打包 - 获取二维码 + {{ $t('permission.package') }} + {{ $t('permission.getQrcode') }} {{ $t('global.back') }}
@@ -109,7 +109,7 @@ export default { const sums = []; columns.forEach((column, index) => { if (index === 0) { - sums[index] = '总数'; + sums[index] = this.$t('global.totoal'); return; } @@ -212,7 +212,7 @@ export default { if (index < 0) { this.ruleList.push(item); } else { - this.$message.warning('已存在此类型规则'); + this.$message.warning(this.$t('permission.hasExitRule')); } }, editRuleForm(item) { @@ -231,7 +231,7 @@ export default { if (this.ruleList.length) { this.$refs.canDistribute.doShow(); } else { - this.$messageBox('请添加规则'); + this.$messageBox(this.$t('permission.pleaseAddRule')); } }, distribute(data) { @@ -242,11 +242,11 @@ export default { packagePermissionDistribute(this.ruleList).then(resp => { this.urlInfo = { url: resp.data, - title: '权限分发二维码' + title: this.$t('global.distributeQrcode') }; this.qrcodeShow(); }).catch(() => { - this.$messageBox('打包权限失败'); + this.$messageBox(this.$t('error.packagePermissionFailed')); }); }, qrcodeShow() {