删除权限管理的权限打包按钮

删除权限分发管理的权限打包按钮
This commit is contained in:
joylink_cuiweidong 2019-12-26 18:07:43 +08:00
parent cd5e923c52
commit d157dc0a88
10 changed files with 17 additions and 1125 deletions

View File

@ -99,10 +99,8 @@ const CommodityDraft = () => import('@/views/orderauthor/commodity/draft');
const OrderList = () => import('@/views/orderauthor/order/list');
const OrderDraft = () => import('@/views/orderauthor/order/draft');
const Author = () => import('@/views/orderauthor/author/index');
const AuthorDraft = () => import('@/views/orderauthor/author/draft/ruleForm');
const Permission = () => import('@/views/orderauthor/permission/index');
const PermissionDetail = () => import('@/views/orderauthor/permission/detail');
const PermissionDraft = () => import('@/views/orderauthor/permission/package/ruleForm');
const PermissionCreate = () => import('@/views/orderauthor/permission/create/index');
const UserRules = () => import('@/views/orderauthor/rules/index');
const UserRulesDetail = () => import('@/views/orderauthor/rules/detail');
@ -208,9 +206,7 @@ export const UrlConfig = {
orderDraft: '/orderauthor/order/draft',
authorMange: '/orderauthor/author/manage',
authorDetail: '/orderauthor/author/detail',
authorDraft: '/orderauthor/author/draft',
transferDetail: '/orderauthor/transfer/detail',
trainferPackage: '/orderauthor/transfer/package',
createPackage: '/orderauthor/transfer/create'
},
script: {
@ -729,24 +725,11 @@ export const asyncRouter = [
i18n: 'router.addOrder'
}
},
{
path: 'author/manage/rules',
hidden: true,
component: AuthorDraft,
meta: {
i18n: 'router.addCoursePermissions'
}
},
{
path: 'transfer/detail/:permissionId',
component: PermissionDetail,
hidden: true
},
{
path: 'transfer/package',
component: PermissionDraft,
hidden: true
},
{
path: 'transfer/create',
component: PermissionCreate,

View File

@ -1,184 +0,0 @@
<template>
<el-dialog
v-dialogDrag
:title="$t('orderAuthor.editPermissionRules')"
:visible.sync="show"
top="20px"
width="90%"
:before-close="doClose"
:close-on-click-modal="false"
:z-index="3000"
>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-dialog>
</template>
<script>
import { getLessonPermissonPageList } from '@/api/management/author';
export default {
name: 'Author',
props: {
ruleList: {
type: Array,
default() {
return [];
}
},
effectiveTypeList: {
type: Array,
default() {
return [];
}
},
permissionTypeList: {
type: Array,
default() {
return [];
}
}
},
data() {
return {
mapId: '',
PermissionTypeList: [],
ruleLists: [
{ value: true, label: this.$t('global.yes') },
{ value: false, label: this.$t('global.no') }
],
show: false,
param: '',
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '100px',
reset: true,
queryObject: {
'name': {
type: 'text',
label: this.$t('orderAuthor.permissionName')
},
'type': {
type: 'select',
label: this.$t('orderAuthor.permissionType'),
config: {
data: []
}
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('orderAuthor.permissionName'),
prop: 'name'
},
{
title: this.$t('orderAuthor.isPackage'),
prop: 'isPackage',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.isPackage, this.ruleLists, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('orderAuthor.permissionType'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('orderAuthor.creationTime'),
prop: 'createTime'
},
{
title: this.$t('orderAuthor.founder'),
prop: 'creatorUserName'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '120',
buttons: [
{
name: this.$t('global.append'),
handleClick: this.handlePut,
type: '',
showControl: (row) => { return !row.isPut; }
},
{
name: this.$t('global.delete'),
handleClick: this.handlePop,
type: 'warning',
showControl: (row) => { return row.isPut; }
}
]
}
]
}
};
},
watch: {
},
mounted() {
this.loadInitData();
},
methods: {
loadInitData() {
this.$Dictionary.permissionType().then(list => {
list.forEach(elem => {
this.queryForm.queryObject.type.config.data.push({ value: elem.code, label: elem.name });
});
this.$convertList(list, this.PermissionTypeList, elem => {
return true;
});
// this.PermissionTypeList.push({ value: undefined, label: this.$t('orderAuthor.permissionPack') });
});
},
formatterDate(row, porpInfo) {
return String(row[porpInfo.property] || '').split(' ')[0];
},
async queryFunction(params) {
params['isPackage'] = false;
params['mapId'] = this.mapId;
const resp = await getLessonPermissonPageList(params);
this.ruleList.forEach(elem => {
resp.data.list.forEach(item => {
if (item.id == elem.id) {
item.isPut = true;
}
});
});
return resp;
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
doShow(mapId) {
this.mapId = mapId;
this.show = true;
this.reloadTable();
},
doClose() {
this.show = false;
},
handlePut(index, row) {
row.isPut = true;
this.$emit('addRuleForm', index, row);
this.$refs.queryListPage.refresh();
},
handlePop(index, row) {
row.isPut = false;
this.$emit('deleteForm', index, row);
this.$refs.queryListPage.refresh();
}
}
};
</script>

View File

@ -17,59 +17,21 @@
/>
</el-form-item>
</el-form>
<div v-show="isPackage">
<div class="form_title">{{ $t('orderAuthor.mapName') }}:</div>
<el-select v-model="editModel.mapId" size="mini" :disabled="ruleList.length ? true : false">
<el-option
v-for="item in mapList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-button class="addList" size="small" @click="dialogSelect">{{ $t('orderAuthor.addPermissions') }}</el-button>
<el-table :data="ruleList" border style="width: 100%" :height="200">
<el-table-column prop="name" :label="this.$t('orderAuthor.permissionName')" />
<el-table-column prop="type" :label="this.$t('orderAuthor.permissionType')">
<template slot-scope="scope">
{{ computedName(permissionTypeList, scope.row.type) }}
</template>
</el-table-column>
<el-table-column :label="this.$t('global.operate')" width="80">
<template slot-scope="scope">
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
<div style="text-align:center">
<span slot="footer" class="dialog-footer">
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="saveAs">{{ $t('map.confirm') }}</el-button>
</span>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="saveAs">{{ $t('map.confirm') }}</el-button>
</span>
</el-dialog>
<choose-permission
ref="choosePermission"
:rule-list="ruleList"
:effective-type-list="EffectiveTypeList"
:permission-type-list="permissionTypeList"
@addRuleForm="addRuleForm"
@deleteForm="deleteForm"
/>
</div></el-dialog>
</div>
</template>
<script>
import { putPermissonDetail } from '@/api/management/author';
import { EventBus } from '@/scripts/event-bus';
import ChoosePermission from './choosePermission';
export default {
name: 'MapSaveAs',
components: {
ChoosePermission
},
props:{
mapList:{
required:true,
@ -119,13 +81,6 @@ export default {
});
return name;
},
dialogSelect(row) {
if (this.editModel.mapId) {
this.$refs.choosePermission.doShow(this.editModel.mapId);
} else {
this.$messageBox(this.$t('rules.mapInput'));
}
},
async doShow(data) {
this.dialogShow = true;
this.editModel = {
@ -134,14 +89,6 @@ export default {
remarks: data.remarks,
mapId: ''
};
// this.isPackage = data.isPackage;
// if (this.isPackage) {
// const res = await getPermissionList(data.id);
// if (res.code == 200) {
// this.ruleList = res.data.relPermissions;
// this.editModel.mapId = res.data.relPermissions[0].mapId;
// }
// }
},
close() {
this.editModel = {
@ -157,51 +104,17 @@ export default {
},
saveAs() {
this.$refs['form'].validate((valid) => {
if (!this.isPackage) {
this.loading = true;
putPermissonDetail(this.editModel).then(response => {
this.loading = false;
this.$message.success(this.$t('rules.successfullyModified'));
this.$emit('refresh');
this.close();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('map.saveFailed'));
});
} else {
if (this.ruleList.length) {
const arr = this.ruleList.map(nor => {
return nor.id;
});
this.editModel['relPermissions'] = arr;
this.loading = true;
putPermissonDetail(this.editModel).then(response => {
this.loading = false;
this.$message.success(this.$t('rules.successfullyModified'));
this.$emit('refresh');
this.close();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('map.saveFailed'));
});
} else {
this.$messageBox(this.$t('rules.selectMultiplePermissions'));
}
}
this.loading = true;
putPermissonDetail(this.editModel).then(response => {
this.loading = false;
this.$message.success(this.$t('rules.successfullyModified'));
this.$emit('refresh');
this.close();
}).catch(() => {
this.loading = false;
this.$messageBox(this.$t('map.saveFailed'));
});
});
},
deleteForm(index, row) {
const idx = this.ruleList.findIndex(elem => { return elem.id == row.id; });
if (idx >= 0) {
row['isPut'] = false;
this.ruleList.splice(idx, 1);
}
EventBus.$emit('reloadTable', { index: index, list: row });
},
addRuleForm(index, row) {
row['isPut'] = true;
this.ruleList.push(row);
EventBus.$emit('reloadTable', { index: index, list: row });
}
}
};

View File

@ -1,306 +0,0 @@
<template>
<el-card>
<div class="pack-box">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-steps class="steps" :active="display">
<el-step :title="title" icon="el-icon-edit" />
<el-step icon="el-icon-setting" />
</el-steps>
<el-card class="forms pack-rule">
<el-form ref="formData" label-width="130px" :model="addModel" size="mini" :rules="rules" class="rule_box">
<el-form-item :label="this.$t('orderAuthor.permissionName') + ':'" prop="name">
<el-input v-model="addModel.name" size="small" />
</el-form-item>
<el-form-item :label="this.$t('orderAuthor.describtion') + ':'" prop="remarks">
<el-input
v-model="addModel.remarks"
type="textarea"
:rows="2"
:placeholder="this.$t('orderAuthor.pleaseEnterContent')"
maxlength="60"
show-word-limit
/>
</el-form-item>
<el-form-item v-show="isPackage" :label=" this.$t('orderAuthor.mapName') + ':'">
<el-select v-model="addModel.mapId" :disabled="ruleList.length ? true : false">
<el-option
v-for="item in mapList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<div v-show="isPackage">
<el-button class="addList" size="small" @click="dialogSelect">{{ $t('orderAuthor.addPermissions') }}</el-button>
<el-table
:data="ruleList"
border
style="width: 100%; min-height: 200px;"
>
<el-table-column prop="name" :label="this.$t('orderAuthor.permissionName')" />
<el-table-column prop="type" :label="this.$t('orderAuthor.permissionType')">
<template slot-scope="scope">
{{ computedName(PermissionTypeList, scope.row.type) }}
</template>
</el-table-column>
<el-table-column :label="this.$t('global.operate')" width="80">
<template slot-scope="scope">
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
<div class="draft">
<el-button-group>
<el-button v-if="!$route.query.id" type="primary" @click="packForm">{{ $t('orderAuthor.packaging') }}</el-button>
<el-button v-if="$route.query.id" type="primary" @click="update">{{ $t('global.update') }}</el-button>
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
</el-button-group>
</div>
<choose-permission
ref="choosePermission"
:rule-list="ruleList"
:effective-type-list="EffectiveTypeList"
:permission-type-list="PermissionTypeList"
@addRuleForm="addRuleForm"
@deleteForm="deleteForm"
/>
</el-scrollbar>
</div>
</el-card>
</template>
<script>
import { UrlConfig } from '@/router/index';
import { createLessonPermisson, getPermissionList, putPermissonDetail } from '@/api/management/author';
import { getPublishMapListOnline } from '@/api/jmap/map';
import ChoosePermission from './choosePermission';
import { EventBus } from '@/scripts/event-bus';
import { setTimeout } from 'timers';
export default {
name: 'PackRule',
components: {
ChoosePermission
},
data() {
return {
display: 1,
addModel: {
name: '',
remarks: '',
mapId: ''
},
rules: {
name: [
{ required: true, message: this.$t('rules.enterPermissionName'), trigger: 'blur' }
]
},
urlInfo: {},
ruleList: [],
EffectiveTypeList: [],
PermissionTypeList: [],
mapList: [],
isPackage: true
};
},
computed: {
title() {
return this.$route.query.id ? this.$t('orderAuthor.modifyPermissions') : this.$t('orderAuthor.createPermission');
}
},
mounted() {
this.loadInitData();
},
methods: {
turnback() {
this.$router.go(-1);
},
computedName(list, code) {
let name = '';
list.forEach(elem => {
if (elem.value == code) {
name = elem.label;
}
});
return name;
},
async loadInitData() {
this.EffectiveTypeList = [];
this.$Dictionary.effectiveType().then(list => {
this.EffectiveTypeList = list.map(elem => { return { value: elem.code, label: elem.name }; });
});
this.PermissionTypeList = [];
this.$Dictionary.permissionType().then(list => {
this.PermissionTypeList = list.map(elem => { return { value: elem.code, label: elem.name }; });
});
try {
//
this.mapList = [];
const res = await getPublishMapListOnline();
res.data.forEach(elem => {
this.mapList.push({ value: elem.id, label: elem.name });
});
} catch (error) {
console.error(error, '获取发布地图');
}
if (this.$route.query.id) {
const res = await getPermissionList(this.$route.query.id);
if (res.code == 200) {
this.ruleList = res.data.relPermissions;
this.addModel.mapId = res.data.relPermissions[0].mapId;
this.isPackage = res.data.isPackage;
this.addModel.name = res.data.name;
this.addModel.remarks = res.data.remarks;
}
}
},
dialogSelect(row) {
if (this.addModel.mapId) {
this.$refs.choosePermission.doShow(this.addModel.mapId);
} else {
this.$messageBox(this.$t('rules.mapInput'));
}
},
deleteForm(index, row) {
const idx = this.ruleList.findIndex(elem => { return elem.id == row.id; });
if (idx >= 0) {
row['isPut'] = false;
this.ruleList.splice(idx, 1);
}
EventBus.$emit('reloadTable', { index: index, list: row });
},
addRuleForm(index, row) {
row['isPut'] = true;
this.ruleList.push(row);
EventBus.$emit('reloadTable', { index: index, list: row });
},
packForm() {
if (this.ruleList && this.ruleList.length) {
const arr = this.ruleList.map(nor => {
return nor.id;
});
const data = {
name: this.addModel.name,
isPackage: true,
relPermissions: arr
};
createLessonPermisson(data).then(resp => {
this.$message.success(this.$t('tip.packagedSuccessfully'));
setTimeout(() => {
this.$router.push({ path: `${UrlConfig.orderauthor.authorMange}` });
}, 500);
}).catch(() => {
this.$messageBox(this.$t('tip.packagingFailed'));
});
} else {
this.$messageBox(this.$t('rules.selectMultiplePermissions'));
}
},
update() {
this.$refs['formData'].validate((valid) => {
if (this.ruleList.length) {
const arr = this.ruleList.map(nor => {
return nor.id;
});
const data = {
id: this.$route.query.id,
name: this.addModel.name,
remarks: this.addModel.remarks,
relPermissions: arr
};
putPermissonDetail(data).then(response => {
this.$message.success(this.$t('rules.successfullyModified'));
setTimeout(() => {
this.$router.push({ path: `${UrlConfig.orderauthor.authorMange}` });
}, 500);
}).catch(() => {
this.$messageBox(this.$t('map.saveFailed'));
});
} else {
this.$messageBox(this.$t('rules.selectMultiplePermissions'));
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.rule_box{
width: 80%;
}
.steps{
/deep/ {
.el-step__title.is-finish {
padding-left: 15px;
}
}
}
.pack-box {
padding-top: 10px;
height: 100%;
overflow-y: auto;
/deep/ {
.el-step__icon.is-icon {
width: 95px;
}
}
.steps {
width: 980px;
margin: 0 auto;
padding-top: 5px;
}
.forms {
width: 800px;
margin: 0 auto;
margin-top: 20px;
padding: 40px;
}
}
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
.pack-rule {
.addList {
float: right;
font-size: 14px;
color: #000;
margin-bottom: 8px;
cursor: pointer;
}
.btn-footer {
width: 100%;
display: flex;
justify-content: center;
margin-top: 20px;
}
/deep/ .el-table__footer-wrapper {
.is-leaf:nth-child(3) {
font-size: 0;
}
}
}
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
</style>

View File

@ -10,7 +10,6 @@
<script>
import { getLessonPermissonPageList } from '@/api/management/author';
import { getPublishMapListOnline } from '@/api/jmap/map';
import { UrlConfig } from '@/router/index';
import Edit from './draft/edit';
import Create from './create';
import Detail from './detail';
@ -132,7 +131,6 @@ export default {
}
],
actions: [
{ text: this.$t('orderAuthor.packaging'), handler: this.handleAdd },
{ text: this.$t('orderAuthor.oneClickGeneration'), handler: this.create }
]
}
@ -174,9 +172,6 @@ export default {
handleRulesDetail(index, row) {
this.$refs.detail.doShow(row.id);
},
handleAdd() {
this.$router.push({ path: `${UrlConfig.orderauthor.authorMange}/rules` });
},
handleEdit(index, row) {
// if (row.isPackage) {
// this.$router.push({ path: `${UrlConfig.orderauthor.authorMange}/rules`, query: { id: row.id } });

View File

@ -173,7 +173,6 @@ export default {
}
],
actions: [
{ text: this.$t('orderAuthor.privilegePackaging'), btnCode: 'employee_insert', handler: this.handlePackage },
{ text: this.$t('orderAuthor.createPackage'), handler: this.handleCreatePackage },
{ text: this.$t('orderAuthor.receivingPermission'), handler: this.handlerPermission, show: process.env.NODE_ENV == 'development' }
]
@ -237,9 +236,6 @@ export default {
});
}).catch(() => { });
},
handlePackage() {
this.$router.push({ path: `${UrlConfig.orderauthor.trainferPackage}` });
},
handlerPermission() {
this.$refs.qcode.doShow();
},

View File

@ -1,225 +0,0 @@
<template>
<el-dialog
v-dialogDrag
:title="$t('orderAuthor.editPermissionRules')"
:visible.sync="show"
top="20px"
width="90%"
:before-close="doClose"
:close-on-click-modal="false"
>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-dialog>
</template>
<script>
import { listCanPackagePermission } from '@/api/management/distribute';
export default {
name: 'Author',
props: {
ruleList: {
type: Array,
default() {
return [];
}
},
effectiveTypeList: {
type: Array,
default() {
return [];
}
},
permissionTypeList: {
type: Array,
default() {
return [];
}
}
},
data() {
return {
show: false,
param: '',
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '100px',
reset: true,
queryObject: {
'permissionName': {
type: 'text',
label: this.$t('orderAuthor.permissionName'),
config: {
data: []
}
},
'canDistribute': {
type: 'select',
label: this.$t('orderAuthor.publicOrPrivate'),
config: {
data: []
}
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('orderAuthor.organizationOrEnterprise'),
prop: 'organizationName'
},
{
title: this.$t('orderAuthor.permissionName'),
prop: 'permissionName'
},
{
title: this.$t('orderAuthor.userName'),
prop: 'userName'
},
{
title: this.$t('orderAuthor.userMobile'),
prop: 'userMobile'
},
// {
// title: this.$t('orderAuthor.mapName'),
// prop: 'mapName'
// },
// {
// title: this.$t('orderAuthor.mapProductName'),
// prop: 'mapProductName'
// },
// {
// title: this.$t('orderAuthor.courseName'),
// prop: 'lessonName'
// },
// {
// title: this.$t('orderAuthor.permissionType'),
// prop: 'permissionType',
// type: 'tag',
// columnValue: (row) => { return this.$convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']); },
// tagType: (row) => { return ''; }
// },
{
title: this.$t('orderAuthor.publicOrPrivate'),
prop: 'canDistribute',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.canDistribute, 'PermissionUseList'); },
tagType: (row) => {
switch (row.canDistribute) {
case true: return 'success';
case false: return 'danger';
}
}
},
{
title: this.$t('orderAuthor.permanenceOrNot'),
prop: 'forever',
type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.forever, 'Whether'); },
tagType: (row) => {
switch (row.forever) {
case true: return 'success';
case false: return 'danger';
}
}
},
// {
// title: '',
// prop: 'amount'
// },
// {
// title: '',
// prop: 'remains'
// },
{
title: this.$t('orderAuthor.startTime'),
prop: 'startTime',
type: 'formatter',
formatter: this.formatterDate
},
{
title: this.$t('orderAuthor.endTime'),
prop: 'endTime',
type: 'formatter',
formatter: this.formatterDate
},
{
type: 'button',
title: this.$t('global.operate'),
width: '120',
buttons: [
{
name: this.$t('global.add'),
handleClick: this.handlePut,
type: '',
showControl: (row) => { return !row.isPut; }
},
{
name: this.$t('global.delete'),
handleClick: this.handlePop,
type: 'warning',
showControl: (row) => { return row.isPut; }
}
]
}
]
}
};
},
watch: {
PermissionTypeList: function (list) {
if (list && list.length) {
this.queryForm.queryObject.permissionType.config.data = list;
}
}
},
mounted() {
this.queryForm.queryObject.canDistribute.config.data = this.$ConstSelect.PermissionUseList;
},
methods: {
formatterDate(row, porpInfo) {
return String(row[porpInfo.property] || '').split(' ')[0];
},
async queryFunction(params) {
const resp = await listCanPackagePermission(params);
this.ruleList.forEach(elem => {
resp.data.list.forEach(item => {
if (item.id == elem.id) {
item.isPut = true;
}
});
});
return resp;
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
doShow() {
this.show = true;
},
doClose() {
this.show = false;
},
handlePut(index, row) {
row.isPut = true;
this.$emit('addRuleForm', index, row);
this.$refs.queryListPage.refresh();
},
handlePop(index, row) {
row.isPut = false;
this.$emit('deleteForm', index, row);
this.$refs.queryListPage.refresh();
}
}
};
</script>

View File

@ -1,56 +0,0 @@
<template>
<div>
<div class="pack-box">
<div style="text-align:center; margin:auto; margin-top: 35px;">
<qrcode-vue v-loading="loading" :value="url" :size="500" />
</div>
</div>
<div class="draft">
<el-button-group>
<el-button @click="turnback">{{ $t('orderAuthor.back') }}</el-button>
</el-button-group>
</div>
</div>
</template>
<script>
import QrcodeVue from 'qrcode.vue';
export default {
name: 'QCode',
components: {
QrcodeVue
},
data() {
return {
loading: false,
url: ''
};
},
mounted() {
},
methods: {
qrCodeShow(data) { //
this.url = data.url;
},
turnback() {
this.$router.go(-1);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.pack-rule {
width: 800px;
margin: 0 auto;
margin-top: 12px;
padding: 40px;
}
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
</style>

View File

@ -1,225 +0,0 @@
<template>
<div class="pack-box">
<el-scrollbar wrap-class="scrollbar-wrapper" style="">
<el-steps class="steps" :active="display" align-center>
<el-step :title="$t('orderAuthor.selectPermissionsPackage')" icon="el-icon-edit" />
<el-step :title="$t('orderAuthor.permissionToDistributeQRCode')" icon="el-icon-setting" />
</el-steps>
<div v-show="display == 1">
<el-card class="forms pack-rule">
<el-button class="addList" size="small" @click="dialogSelect">{{ $t('orderAuthor.addRecords') }}</el-button>
<el-table :data="ruleList" border show-summary :summary-method="getSummaries" style="width: 100%; min-height: 300px;">
<el-table-column prop="permissionName" :label="this.$t('orderAuthor.permissionName')" />
<el-table-column prop="amount" :label="this.$t('orderAuthor.totalPermissions')" width="120" />
<el-table-column prop="remains" :label="this.$t('orderAuthor.residualPermissionNumber')" width="120" />
<el-table-column :label="this.$t('global.operate')" width="60">
<template slot-scope="scope">
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<div class="draft">
<el-button-group>
<el-button type="primary" @click="packForm">{{ $t('orderAuthor.packaging') }}</el-button>
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
</el-button-group>
</div>
</div>
<div v-show="display == 2">
<q-code ref="qCode" />
</div>
<choose-permission
ref="choosePermission"
:rule-list="ruleList"
:effective-type-list="EffectiveTypeList"
:permission-type-list="PermissionTypeList"
@addRuleForm="addRuleForm"
@deleteForm="deleteForm"
/>
</el-scrollbar>
</div>
</template>
<script>
import { permissionDistributePackage } from '@/api/management/distribute';
import ChoosePermission from './choosePermission';
import QCode from './qCode';
import { EventBus } from '@/scripts/event-bus';
export default {
name: 'PackRule',
components: {
ChoosePermission,
QCode
},
data() {
return {
display: 1,
urlInfo: {},
ruleList: [],
EffectiveTypeList: [],
PermissionTypeList: []
};
},
computed: {
height() {
return this.$store.state.app.height - 62;
}
},
mounted() {
this.loadInitData();
},
methods: {
turnback() {
this.$router.go(-1);
},
computedName(list, code) {
let name = '';
list.forEach(elem => {
if (elem.value == code) {
name = elem.label;
}
});
return name;
},
loadInitData() {
this.EffectiveTypeList = [];
this.$Dictionary.effectiveType().then(list => {
this.EffectiveTypeList = list.map(elem => { return { value: elem.code, label: elem.name }; });
});
this.PermissionTypeList = [];
this.$Dictionary.permissionType().then(list => {
this.PermissionTypeList = list.map(elem => { return { value: elem.code, label: elem.name }; });
});
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = this.$t('orderAuthor.totalNumber');
return;
}
if (index === 4 || index === 5) {
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
}
}
});
return sums;
},
dialogSelect(row) {
this.$refs.choosePermission.doShow();
},
deleteForm(index, row) {
const idx = this.ruleList.findIndex(elem => { return elem.id == row.id; });
if (idx >= 0) {
row['isPut'] = false;
this.ruleList.splice(idx, 1);
}
EventBus.$emit('reloadTable', { index: index, list: row });
},
addRuleForm(index, row) {
row['isPut'] = true;
this.ruleList.push(row);
EventBus.$emit('reloadTable', { index: index, list: row });
},
packForm() {
if (this.ruleList && this.ruleList.length) {
const dis = [];
this.ruleList.forEach(elem => {
dis.push(elem.id);
});
permissionDistributePackage(dis).then(resp => {
this.urlInfo = {
url: resp.data
};
this.qrCodeShow(this.urlInfo);
}).catch((error) => {
this.$messageBox(`${this.$t('tip.packagingFailed')}, ${error.message}`);
});
} else {
this.$messageBox(this.$t('tip.selectPackagingRecord'));
}
},
qrCodeShow(data) {
this.display = 2;
this.$refs.qCode.qrCodeShow(data);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.pack-box {
padding-top: 10px;
height: 100%;
overflow-y: auto;
/deep/ {
.el-step__icon.is-icon {
width: 95px;
}
}
.steps {
width: 980px;
margin: 0 auto;
padding-top: 5px;
}
.forms {
width: 800px;
margin: 0 auto;
margin-top: 20px;
padding: 40px;
}
}
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
.pack-rule {
.addList {
float: right;
font-size: 14px;
color: #000;
margin-bottom: 8px;
cursor: pointer;
}
.btn-footer {
width: 100%;
display: flex;
justify-content: center;
margin-top: 20px;
}
/deep/ .el-table__footer-wrapper {
.is-leaf:nth-child(3) {
font-size: 0;
}
}
}
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
</style>

View File

@ -31,6 +31,7 @@ export default {
projectList:[],
typeList:[],
formModel:{
customized:'',
mapId:'',
name: '',
prdType: '',