desc: 修改权限列表显示字段内容,逻辑流程

This commit is contained in:
zyy 2019-09-02 14:43:16 +08:00
parent 4a466e6a8c
commit 0388b2a1df
12 changed files with 66 additions and 116 deletions

3
.gitignore vendored
View File

@ -6,7 +6,8 @@ yarn-debug.log*
yarn-error.log* yarn-error.log*
package-lock.json package-lock.json
tests/**/coverage/ tests/**/coverage/
src/utils/baseUrl* /src/utils/baseUrl.js
/src/utils/
# Editor directories and files # Editor directories and files
.idea .idea

View File

@ -144,6 +144,6 @@ export default {
line: '线路:', line: '线路:',
permissionList: '权限列表:', permissionList: '权限列表:',
remove: '移除', remove: '移除',
append: '添加', append: '添 加',
release: '发布' release: '发布'
}; };

View File

@ -119,7 +119,7 @@ export default {
getTotalRemains(model).then(response => { getTotalRemains(model).then(response => {
this.maxTotal = response.data; this.maxTotal = response.data;
if (this.maxTotal == 0) { if (this.maxTotal == 0) {
this.numberMessage = ''; this.numberMessage = '可用权限数量为0';
} else { } else {
this.numberMessage = `${this.$t('global.remainPermissionNumber')}${this.maxTotal}`; this.numberMessage = `${this.$t('global.remainPermissionNumber')}${this.maxTotal}`;
} }

View File

@ -125,7 +125,7 @@ export default {
getTotalRemains(model).then(response => { getTotalRemains(model).then(response => {
this.maxTotal = response.data; this.maxTotal = response.data;
if (this.maxTotal == 0) { if (this.maxTotal == 0) {
this.numberMessage = ''; this.numberMessage = '可用权限数量为0';
} else { } else {
this.numberMessage = `${this.$t('global.remainPermissionNumber')}${this.maxTotal}`; this.numberMessage = `${this.$t('global.remainPermissionNumber')}${this.maxTotal}`;
} }

View File

@ -51,16 +51,22 @@
<script> <script>
import { getScriptPageListOnline, getScriptById } from '@/api/script'; import { getScriptPageListOnline, getScriptById } from '@/api/script';
import { listPublishMap } from '@/api/jmap/map'; import { listPublishMap } from '@/api/jmap/map';
import { roleType } from '@/scripts/ConstConfig'; // import { roleType } from '@/scripts/ConstConfig';
export default { export default {
name: 'AddQuest', name: 'AddQuest',
props: { props: {
trainings: { trainings: {
type: Array type: Array,
default() {
return [];
}
}, },
detail: { detail: {
type: Object type: Object,
default() {
return null;
}
} }
}, },
data() { data() {
@ -123,15 +129,15 @@ export default {
}, },
currentModel: {}, currentModel: {},
roleConfig: { roleConfig: {
'Admin': '管理员', 'Admin': '管理员',
'Instructor': '教员', 'Instructor': '教员',
'Dispatcher': '行调', 'Dispatcher': '行调',
'Attendant': '车站', 'Attendant': '车站',
'Audience': '观众', 'Audience': '观众',
'Driver': '列车', 'Driver': '列车',
'no':'' 'no': ''
} }
}; };
}, },
created() { created() {
@ -161,10 +167,10 @@ export default {
const res = await getScriptById(row.id); const res = await getScriptById(row.id);
let newMemberList = []; let newMemberList = [];
if (res.code == 200) { if (res.code == 200) {
if(res.data.memberVOList && res.data.memberVOList.length > 0) { if (res.data.memberVOList && res.data.memberVOList.length > 0) {
newMemberList = res.data.memberVOList.filter(item => item.hasPlay === true); newMemberList = res.data.memberVOList.filter(item => item.hasPlay === true);
} }
this.memberList = newMemberList?newMemberList : []; this.memberList = newMemberList || [];
this.memberList.unshift({ id: '', name: '无', role: 'no' }); this.memberList.unshift({ id: '', name: '无', role: 'no' });
} }
this.roleShow = true; this.roleShow = true;
@ -177,10 +183,10 @@ export default {
}, },
async confirm() { async confirm() {
await this.$store.dispatch('training/over'); await this.$store.dispatch('training/over');
await this.$store.dispatch('training/setMapDefaultState'); await this.$store.dispatch('training/setMapDefaultState');
await this.$store.dispatch('map/clearJlmapTrainView'); await this.$store.dispatch('map/clearJlmapTrainView');
await this.$store.dispatch('map/setTrainWindowShow', false); await this.$store.dispatch('map/setTrainWindowShow', false);
this.$emit('selectQuest', this.row, this.form.role); this.$emit('selectQuest', this.row, this.form.role);
this.doClose(); this.doClose();
this.roleDoClose(); this.roleDoClose();
@ -201,9 +207,9 @@ export default {
} }
}, },
handleName(item){ handleName(item) {
return this.roleConfig[item.role]?this.roleConfig[item.role]: ''+(item.name?item.name: ''); return this.roleConfig[item.role]?this.roleConfig[item.role]: ''+(item.name?item.name: '');
} }
} }
}; };
</script> </script>

View File

@ -88,7 +88,6 @@ export default {
name: '', name: '',
lengthShow: 0, lengthShow: 0,
lengthFact: 0, lengthFact: 0,
color: '',
leftFdCode: '', leftFdCode: '',
leftSdCode: '', leftSdCode: '',
rightFdCode: '', rightFdCode: '',
@ -111,8 +110,7 @@ export default {
lengthShow: 200, lengthShow: 200,
lengthFact: 0, lengthFact: 0,
lfd: '', lfd: '',
rfd: '', rfd: ''
color: '#4e8de6'
}, },
skins: [], skins: [],
makeRules1: { makeRules1: {
@ -158,7 +156,7 @@ export default {
'linkList' 'linkList'
]), ]),
form() { form() {
const form = { return {
labelWidth: '130px', labelWidth: '130px',
items: { items: {
code: { code: {
@ -192,10 +190,9 @@ export default {
} }
} }
}; };
return form;
}, },
rules() { rules() {
const rules = { return {
code: [ code: [
{ required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' } { required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' }
], ],
@ -218,53 +215,39 @@ export default {
{ required: true, message: this.$t('rules.linkSelectName'), trigger: 'blur' } { required: true, message: this.$t('rules.linkSelectName'), trigger: 'blur' }
] ]
}; };
//
this.$nextTick(() =>{
this.$refs.dataform &&
this.$refs.dataform.clearValidate();
});
return rules;
}, },
formMake1() { formMake1() {
const form = { return {
labelWidth: '120px', labelWidth: '120px',
items: [ items: [
{ prop: 'lengthShow', label: this.$t('rules.lengthShow'), type: 'number', min: 0, placeholder: 'px' }, { prop: 'lengthShow', label: this.$t('rules.lengthShow'), type: 'number', min: 0, placeholder: 'px' },
{ prop: 'lengthFact', label: this.$t('rules.lengthFact'), type: 'number', min: 0, placeholder: this.$t('tip.meter') }, { prop: 'lengthFact', label: this.$t('rules.lengthFact'), type: 'number', min: 0, placeholder: this.$t('tip.meter') },
{ prop: 'color', label: this.$t('rules.color'), type: 'color' },
{ prop: 'x', label: this.$t('rules.pointX'), type: 'number', placeholder: 'px' }, { prop: 'x', label: this.$t('rules.pointX'), type: 'number', placeholder: 'px' },
{ prop: 'y', label: this.$t('rules.pointY'), type: 'number', placeholder: 'px' } { prop: 'y', label: this.$t('rules.pointY'), type: 'number', placeholder: 'px' }
] ]
}; };
return form;
}, },
formMake2() { formMake2() {
const form = { return {
labelWidth: '120px', labelWidth: '120px',
items: [ items: [
{ prop: 'code', label: this.$t('rules.basisLink'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.linkList }, { prop: 'code', label: this.$t('rules.basisLink'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.linkList },
{ prop: 'direct', label: this.$t('rules.direct'), type: 'radio', border: true, radioList: this.LinkDriectTypeList }, { prop: 'direct', label: this.$t('rules.direct'), type: 'radio', border: true, radioList: this.LinkDriectTypeList },
{ prop: 'lengthShow', label: this.$t('rules.lengthShow'), type: 'number', min: 0, placeholder: 'px', isHidden: this.isSd }, { prop: 'lengthShow', label: this.$t('rules.lengthShow'), type: 'number', min: 0, placeholder: 'px', isHidden: this.isSd },
{ prop: 'lengthFact', label: this.$t('rules.lengthFact'), type: 'number', min: 0, placeholder: this.$t('tip.meter') }, { prop: 'lengthFact', label: this.$t('rules.lengthFact'), type: 'number', min: 0, placeholder: this.$t('tip.meter') }
{ prop: 'color', label: this.$t('rules.color'), type: 'color' }
] ]
}; };
return form;
}, },
formMake3() { formMake3() {
const form = { return {
labelWidth: '120px', labelWidth: '120px',
items: [ items: [
{ prop: 'lfd', label: '左侧正向Link:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.linkList }, { prop: 'lfd', label: '左侧正向Link:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.linkList },
{ prop: 'rfd', label: '右侧正向Link:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.linkList }, { prop: 'rfd', label: '右侧正向Link:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.linkList },
{ prop: 'lengthShow', label: this.$t('rules.lengthShow'), type: 'number', min: 0, placeholder: 'px', isHidden: this.isSd }, { prop: 'lengthShow', label: this.$t('rules.lengthShow'), type: 'number', min: 0, placeholder: 'px', isHidden: this.isSd },
{ prop: 'lengthFact', label: this.$t('rules.lengthFact'), type: 'number', min: 0, placeholder: this.$t('tip.meter') }, { prop: 'lengthFact', label: this.$t('rules.lengthFact'), type: 'number', min: 0, placeholder: this.$t('tip.meter') }
{ prop: 'color', label: this.$t('rules.color'), type: 'color' }
] ]
}; };
return form;
}, },
// link // link
@ -305,26 +288,9 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.dataform.clearValidate(); this.$refs.dataform.clearValidate();
this.$refs.make.resetFields(); this.$refs.make.resetFields();
this.activeName = 'first';
if (selected && selected._type.toUpperCase() === 'Link'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Link'.toUpperCase()) {
this.editModel.name = selected.name; Object.assign(this.editModel, selected);
this.editModel.code = this.addModel.code = selected.code;
this.editModel.type = selected.type;
this.editModel.lengthShow = Math.sqrt(Math.pow(selected.rp.x - selected.lp.x, 2) + Math.pow(selected.rp.y - selected.lp.y, 2));
this.editModel.lengthFact = selected.lengthFact;
this.editModel.color = selected.color;
this.editModel.leftFdCode = selected.leftFdCode || '';
this.editModel.leftSdCode = selected.leftSdCode || '';
this.editModel.rightFdCode = selected.rightFdCode || '';
this.editModel.rightSdCode = selected.rightSdCode || '';
this.editModel.lp = {
x: selected.lp.x,
y: selected.lp.y
};
this.editModel.rp = {
x: selected.rp.x,
y: selected.rp.y
};
this.activeName = 'first';
} }
}); });
}, },
@ -408,7 +374,6 @@ export default {
type: this.addModel.type, type: this.addModel.type,
lp: lp, lp: lp,
rp: rp, rp: rp,
color: this.addModel.color ? this.addModel.color : '#4e8de6',
lengthFact: this.addModel.lengthFact, lengthFact: this.addModel.lengthFact,
leftFdCode: leftFdCode, leftFdCode: leftFdCode,
rightFdCode: rightFdCode rightFdCode: rightFdCode
@ -473,7 +438,6 @@ export default {
code: model.code, code: model.code,
name: model.name, name: model.name,
type: model.type, type: model.type,
color: model.color,
lp: model.lp, lp: model.lp,
rp: model.rp, rp: model.rp,
lengthFact: model.lengthFact, lengthFact: model.lengthFact,
@ -497,7 +461,6 @@ export default {
_type: 'Link', _type: 'Link',
code: this.editModel.code, code: this.editModel.code,
name: this.editModel.name, name: this.editModel.name,
color: this.editModel.color == '' ? '#4e8de6' : this.editModel.color,
leftFdCode: this.editModel.leftFdCode, leftFdCode: this.editModel.leftFdCode,
leftSdCode: this.editModel.leftSdCode, leftSdCode: this.editModel.leftSdCode,
rightFdCode: this.editModel.rightFdCode, rightFdCode: this.editModel.rightFdCode,

View File

@ -103,7 +103,7 @@ export default {
width: '120', width: '120',
buttons: [ buttons: [
{ {
name: this.$t('global.add'), name: this.$t('global.append'),
handleClick: this.handlePut, handleClick: this.handlePut,
type: '', type: '',
showControl: (row) => { return !row.isPut; } showControl: (row) => { return !row.isPut; }
@ -133,9 +133,9 @@ export default {
methods: { methods: {
loadInitData() { loadInitData() {
this.$Dictionary.permissionType().then(list => { this.$Dictionary.permissionType().then(list => {
if (list && list.length) { list.forEach(elem => {
this.queryForm.queryObject.type.config.data = list; this.queryForm.queryObject.type.config.data.push({ value: elem.code, label: elem.name });
} });
this.$convertList(list, this.PermissionTypeList, elem => { this.$convertList(list, this.PermissionTypeList, elem => {
return true; return true;
}); });

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog <el-dialog
:title="this.$t('orderAuthor.trainingList')" title="选择权限"
:visible.sync="show" :visible.sync="show"
top="20px" top="20px"
width="90%" width="90%"
@ -65,12 +65,8 @@ export default {
indexShow: true, indexShow: true,
columns: [ columns: [
{ {
title: '创建时间', title: '权限名称',
prop: 'createTime' prop: 'name'
},
{
title: '创建者',
prop: 'creatorUserName'
}, },
{ {
title: '是否包权限', title: '是否包权限',
@ -79,10 +75,6 @@ export default {
columnValue: (row) => { return this.$convertField(row.isPackage, this.ruleLists, ['value', 'label']); }, columnValue: (row) => { return this.$convertField(row.isPackage, this.ruleLists, ['value', 'label']); },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },
{
title: '权限名称',
prop: 'name'
},
{ {
title: this.$t('orderAuthor.permissionType'), title: this.$t('orderAuthor.permissionType'),
prop: 'type', prop: 'type',
@ -90,6 +82,14 @@ export default {
columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']); }, columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']); },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },
{
title: '创建者',
prop: 'creatorUserName'
},
{
title: '创建时间',
prop: 'createTime'
},
{ {
type: 'button', type: 'button',
title: this.$t('global.operate'), title: this.$t('global.operate'),
@ -126,13 +126,12 @@ export default {
}, },
async loadInitData() { async loadInitData() {
this.$Dictionary.permissionType().then(list => { this.$Dictionary.permissionType().then(list => {
if (list && list.length) { list.forEach(elem => {
this.queryForm.queryObject.type.config.data = list; this.queryForm.queryObject.type.config.data.push({ value: elem.code, label: elem.name });
} });
this.$convertList(list, this.PermissionTypeList, elem => { this.$convertList(list, this.PermissionTypeList, elem => {
return true; return true;
}); });
this.PermissionTypeList.push({ value: undefined, label: this.$t('orderAuthor.permissionPack') });
}); });
}, },

View File

@ -281,6 +281,7 @@ export default {
selectGoods(data) { selectGoods(data) {
this.formModel.goodsId = data.id; this.formModel.goodsId = data.id;
this.formModel.goodsName = data.name; this.formModel.goodsName = data.name;
this.formModel.price = data.price;
}, },
initLoadPage() { initLoadPage() {
// //
@ -415,13 +416,6 @@ export default {
this.$message.info(this.$t('error.cancelled')); this.$message.info(this.$t('error.cancelled'));
}); });
}, },
selectCommodity(data) {
this.goodsList.forEach(v => {
if (v.value == data) {
this.formModel.price = v.price;
}
});
},
buildModel() { buildModel() {
// , // ,
let orgzId = this.formModel.organizationId; let orgzId = this.formModel.organizationId;

View File

@ -7,7 +7,7 @@
</template> </template>
<script> <script>
import { superAdmin } from '@/router'; import { admin } from '@/router';
import { listPackagePermission, restorePackagePermission, getPackageQrCode, permissionDistributeUnPackage } from '@/api/management/distribute'; import { listPackagePermission, restorePackagePermission, getPackageQrCode, permissionDistributeUnPackage } from '@/api/management/distribute';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import QrCode from '@/components/QrCode'; import QrCode from '@/components/QrCode';
@ -149,7 +149,7 @@ export default {
type: 'button', type: 'button',
title: this.$t('global.operate'), title: this.$t('global.operate'),
width: this.$i18n.locale == 'en' ? '400': '300', width: this.$i18n.locale == 'en' ? '400': '300',
hide: (row) => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; }, hide: (row) => { return this.$store.state.user.roles.indexOf(admin) < 0; },
buttons: [ buttons: [
{ {
name: this.$t('orderAuthor.obtainQrCode'), name: this.$t('orderAuthor.obtainQrCode'),

View File

@ -11,7 +11,6 @@
<script> <script>
import { getPublishMapDetailList } from '@/api/jmap/map'; import { getPublishMapDetailList } from '@/api/jmap/map';
import { getSkinCodeList } from '@/api/management/mapskin';
export default { export default {
name: 'PublishMap', name: 'PublishMap',
@ -63,20 +62,7 @@ export default {
}, },
methods: { methods: {
loadInitData() { loadInitData() {
// this.cityList = [];
// this.$Dictionary.cityType().then(list => {
// this.cityList = list;
// this.cityList.forEach(elem => {
// this.queryForm.queryObject.cityCode.config.data.push({ value: elem.code, label: elem.name });
// });
// }).catch(() => {
// this.$messageBox(this.$t('error.loadingCityListFailed'));
// });
// this.skinCodeList = [];
// getSkinCodeList().then(response => {
// this.skinCodeList = response.data;
// });
}, },
queryFunction(params) { queryFunction(params) {
return getPublishMapDetailList(params, this.$route.query.code); return getPublishMapDetailList(params, this.$route.query.code);

View File

@ -53,6 +53,7 @@ export default {
methods: { methods: {
doShow(row) { doShow(row) {
this.formMdoel.planId = row.id; this.formMdoel.planId = row.id;
this.formMdoel.mapId = '';
this.show = true; this.show = true;
getPublishMapListBySkinCode(row.skinCode).then(resp => { getPublishMapListBySkinCode(row.skinCode).then(resp => {
this.mapList = resp.data; this.mapList = resp.data;