2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList">
|
|
|
|
</QueryListPage>
|
|
|
|
<qr-code ref="qrCode"></qr-code>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { superAdmin } from '@/router';
|
|
|
|
import { listPackagePermission, restorePackagePermission, getPackageQrCode, permissionDistributeUnPackage } from '@/api/management/distribute';
|
|
|
|
import { UrlConfig } from '@/router/index';
|
|
|
|
import QrCode from "@/components/QrCode";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'author',
|
|
|
|
components: {
|
|
|
|
QrCode
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
EffectiveTypeList: [],
|
|
|
|
PermissionTypeList: [],
|
|
|
|
pagerConfig: {
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
},
|
|
|
|
queryForm: {
|
|
|
|
labelWidth: '120px',
|
|
|
|
reset: true,
|
|
|
|
queryObject: {
|
|
|
|
'userMobile': {
|
|
|
|
type: 'text',
|
2019-08-12 18:54:32 +08:00
|
|
|
label: this.$t('orderAuthor.founderPhone')
|
2019-07-26 13:32:43 +08:00
|
|
|
},
|
|
|
|
'userName': {
|
|
|
|
type: 'text',
|
2019-08-12 18:54:32 +08:00
|
|
|
label: this.$t('orderAuthor.founder')
|
2019-07-26 13:32:43 +08:00
|
|
|
},
|
|
|
|
'permissionType': {
|
|
|
|
type: 'select',
|
2019-08-12 18:54:32 +08:00
|
|
|
label: this.$t('orderAuthor.permissionType'),
|
2019-07-26 13:32:43 +08:00
|
|
|
config: {
|
|
|
|
data: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'status': {
|
|
|
|
type: 'select',
|
2019-08-12 18:54:32 +08:00
|
|
|
label: this.$t('orderAuthor.authorityStatus'),
|
2019-07-26 13:32:43 +08:00
|
|
|
value: '1',
|
|
|
|
config: {
|
|
|
|
data: []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
queryList: {
|
|
|
|
query: this.queryFunction,
|
|
|
|
selectCheckShow: false,
|
|
|
|
indexShow: true,
|
|
|
|
columns: [
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.organizationOrEnterprise'),
|
2019-07-26 13:32:43 +08:00
|
|
|
prop: 'organizationName'
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.founder'),
|
2019-07-26 13:32:43 +08:00
|
|
|
prop: 'userName'
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.founderPhone'),
|
2019-07-26 13:32:43 +08:00
|
|
|
prop: 'userMobile'
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.mapName'),
|
2019-07-26 13:32:43 +08:00
|
|
|
prop: 'mapName',
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.mapProductName'),
|
2019-07-26 13:32:43 +08:00
|
|
|
prop: 'mapProductName',
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.courseName'),
|
2019-07-26 13:32:43 +08:00
|
|
|
prop: 'lessonName',
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.permissionType'),
|
2019-07-26 13:32:43 +08:00
|
|
|
prop: 'permissionType',
|
|
|
|
type: 'tag',
|
2019-08-08 15:57:36 +08:00
|
|
|
columnValue: (row) => { return this.$convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']) },
|
2019-07-26 13:32:43 +08:00
|
|
|
tagType: (row) => { return '' }
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.publicOrPrivate'),
|
2019-07-26 13:32:43 +08:00
|
|
|
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';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.permanenceOrNot'),
|
2019-07-26 13:32:43 +08:00
|
|
|
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';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.startTime'),
|
2019-07-26 13:32:43 +08:00
|
|
|
prop: 'startTime',
|
|
|
|
type: 'formatter',
|
|
|
|
formatter: this.formatterDate
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.endTime'),
|
2019-07-26 13:32:43 +08:00
|
|
|
prop: 'endTime',
|
|
|
|
type: 'formatter',
|
|
|
|
formatter: this.formatterDate
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.authorityStatus'),
|
2019-07-26 13:32:43 +08:00
|
|
|
prop: 'status',
|
|
|
|
type: 'tag',
|
2019-08-08 15:57:36 +08:00
|
|
|
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']) },
|
2019-07-26 13:32:43 +08:00
|
|
|
tagType: (row) => {
|
|
|
|
switch (row.status) {
|
|
|
|
case '1': return 'success';
|
|
|
|
default: return 'danger';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'button',
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('global.operate'),
|
2019-07-26 13:32:43 +08:00
|
|
|
width: '300',
|
|
|
|
hide: (row) => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; },
|
|
|
|
buttons: [
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
name: this.$t('orderAuthor.obtainQrCode'),
|
2019-07-26 13:32:43 +08:00
|
|
|
handleClick: this.handleRtCodeShow,
|
|
|
|
type: '',
|
|
|
|
showControl: (row) => { return true }
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
name: this.$t('orderAuthor.authorityDetails'),
|
2019-07-26 13:32:43 +08:00
|
|
|
handleClick: this.handlePermissionDetail,
|
|
|
|
type: '',
|
|
|
|
showControl: (row) => { return row.status == '1' && (row.source == '02' || row.source == '04') }
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
name: this.$t('orderAuthor.recovery'),
|
2019-07-26 13:32:43 +08:00
|
|
|
handleClick: this.handleRestore,
|
|
|
|
type: 'danger',
|
|
|
|
showControl: (row) => { return row.status == '1' && row.source == '04' }
|
|
|
|
},
|
|
|
|
{
|
2019-08-12 18:54:32 +08:00
|
|
|
name: this.$t('orderAuthor.unpacking'),
|
2019-07-26 13:32:43 +08:00
|
|
|
handleClick: this.handleUnPackage,
|
|
|
|
type: 'danger',
|
|
|
|
showControl: (row) => { return row.status == '1' && row.source == '02' }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
actions: [
|
2019-08-12 18:54:32 +08:00
|
|
|
{ text: this.$t('orderAuthor.privilegePackaging'), btnCode: 'employee_insert', handler: this.handlePackage },
|
2019-07-26 13:32:43 +08:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
this.loadInitData();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
loadInitData() {
|
|
|
|
this.$Dictionary.effectiveType().then(list => {
|
|
|
|
list.forEach(elem => {
|
|
|
|
this.queryForm.queryObject.status.config.data.push({ value: elem.code, label: elem.name });
|
|
|
|
})
|
2019-08-08 15:57:36 +08:00
|
|
|
this.$convertList(list, this.EffectiveTypeList, elem => {
|
2019-07-26 13:32:43 +08:00
|
|
|
return true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.$Dictionary.permissionType().then(list => {
|
|
|
|
list.forEach(elem => {
|
|
|
|
this.queryForm.queryObject.permissionType.config.data.push({ value: elem.code, label: elem.name });
|
|
|
|
});
|
2019-08-08 15:57:36 +08:00
|
|
|
this.$convertList(list, this.PermissionTypeList, elem => {
|
2019-07-26 13:32:43 +08:00
|
|
|
return true;
|
|
|
|
});
|
2019-08-12 18:54:32 +08:00
|
|
|
this.PermissionTypeList.push({ value: undefined, label: this.$t('orderAuthor.permissionPack') });
|
2019-07-26 13:32:43 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
formatterDate(row, porpInfo) {
|
|
|
|
if (row.hasOwnProperty(porpInfo.property)) {
|
|
|
|
}
|
|
|
|
return row[porpInfo.property];
|
|
|
|
},
|
|
|
|
queryFunction(params) {
|
|
|
|
return listPackagePermission(params);
|
|
|
|
},
|
|
|
|
reloadTable() {
|
|
|
|
if (this.queryList && this.queryList.reload) {
|
|
|
|
this.queryList.reload()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
handlePermissionDetail(index, row) {
|
|
|
|
this.$router.push({ path: `${UrlConfig.orderauthor.transferDetail}/${row.id}` })
|
|
|
|
},
|
|
|
|
handleRtCodeShow(index, row) {
|
|
|
|
getPackageQrCode({ id: row.id }).then(resp => {
|
|
|
|
this.$refs.qrCode.doShow({
|
|
|
|
url: resp.data,
|
2019-08-12 18:54:32 +08:00
|
|
|
title: this.$t('orderAuthor.privilegeTransferQRCode')
|
2019-07-26 13:32:43 +08:00
|
|
|
});
|
|
|
|
}).catch(error => {
|
2019-08-19 15:46:52 +08:00
|
|
|
this.$messageBox(this.$t('tip.getQRCodeFailure'));
|
2019-07-26 13:32:43 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
handleRestore(index, row) {
|
2019-08-19 15:46:52 +08:00
|
|
|
this.$confirm(this.$t('tip.recoveryPrivilegeTip'), this.$t('tip.hint'), {
|
2019-08-12 18:54:32 +08:00
|
|
|
confirmButtonText: this.$t('tip.confirm'),
|
|
|
|
cancelButtonText: this.$t('tip.cancel'),
|
2019-07-26 13:32:43 +08:00
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
restorePackagePermission(row.id).then(resp => {
|
|
|
|
this.reloadTable();
|
2019-08-12 18:54:32 +08:00
|
|
|
this.$message.success(this.$t('tip.recoveryPrivilegesSuccessful'));
|
2019-07-26 13:32:43 +08:00
|
|
|
}).catch(error => {
|
2019-08-12 18:54:32 +08:00
|
|
|
this.$messageBox(this.$t('tip.recoveryPrivilegesFailed'));
|
2019-07-26 13:32:43 +08:00
|
|
|
})
|
|
|
|
}).catch(() => { });
|
|
|
|
},
|
|
|
|
handleUnPackage(index, row) {
|
2019-08-19 15:46:52 +08:00
|
|
|
this.$confirm(this.$t('tip.unpackingTip'), this.$t('tip.hint'), {
|
2019-08-12 18:54:32 +08:00
|
|
|
confirmButtonText: this.$t('tip.confirm'),
|
|
|
|
cancelButtonText: this.$t('tip.cancel'),
|
2019-07-26 13:32:43 +08:00
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
permissionDistributeUnPackage(row.id).then(resp => {
|
|
|
|
this.reloadTable();
|
2019-08-12 18:54:32 +08:00
|
|
|
this.$message.success(this.$t('tip.unpackingSuccessful'));
|
2019-07-26 13:32:43 +08:00
|
|
|
}).catch(error => {
|
2019-08-12 18:54:32 +08:00
|
|
|
this.$messageBox(this.$t('tip.unpackingFailed'));
|
2019-07-26 13:32:43 +08:00
|
|
|
})
|
|
|
|
}).catch(() => { });
|
|
|
|
},
|
|
|
|
handlePackage() {
|
|
|
|
this.$router.push({ path: `${UrlConfig.orderauthor.trainferPackage}` })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-12 18:54:32 +08:00
|
|
|
</script>
|