2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-19 18:42:53 +08:00
|
|
|
<div>
|
|
|
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
|
|
|
<qr-code ref="qrCode" />
|
2019-08-30 17:00:18 +08:00
|
|
|
<qcode ref="qcode" />
|
2019-08-19 18:42:53 +08:00
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-09-02 14:43:16 +08:00
|
|
|
import { admin } from '@/router';
|
2019-08-19 18:42:53 +08:00
|
|
|
import { listPackagePermission, restorePackagePermission, getPackageQrCode, permissionDistributeUnPackage } from '@/api/management/distribute';
|
|
|
|
import { UrlConfig } from '@/router/index';
|
|
|
|
import QrCode from '@/components/QrCode';
|
2019-08-30 17:00:18 +08:00
|
|
|
import Qcode from './Qcode';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-19 18:42:53 +08:00
|
|
|
export default {
|
|
|
|
name: 'Author',
|
|
|
|
components: {
|
2019-08-30 17:00:18 +08:00
|
|
|
QrCode,
|
|
|
|
Qcode
|
2019-08-19 18:42:53 +08:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
EffectiveTypeList: [],
|
|
|
|
PermissionTypeList: [],
|
|
|
|
pagerConfig: {
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
},
|
|
|
|
queryForm: {
|
2019-08-20 09:12:54 +08:00
|
|
|
labelWidth: '140px',
|
2019-08-19 18:42:53 +08:00
|
|
|
reset: true,
|
|
|
|
queryObject: {
|
2019-09-03 10:45:58 +08:00
|
|
|
// 'userMobile': {
|
|
|
|
// type: 'text',
|
|
|
|
// label: this.$t('orderAuthor.founderPhone')
|
|
|
|
// },
|
2019-08-19 18:42:53 +08:00
|
|
|
'userName': {
|
|
|
|
type: 'text',
|
|
|
|
label: this.$t('orderAuthor.founder')
|
|
|
|
},
|
2019-08-30 17:00:18 +08:00
|
|
|
// 'permissionType': {
|
|
|
|
// type: 'select',
|
|
|
|
// label: this.$t('orderAuthor.permissionType'),
|
|
|
|
// config: {
|
|
|
|
// data: []
|
|
|
|
// }
|
|
|
|
// },
|
2019-08-19 18:42:53 +08:00
|
|
|
'status': {
|
|
|
|
type: 'select',
|
2019-09-03 18:59:46 +08:00
|
|
|
label: '状态',
|
2019-08-19 18:42:53 +08:00
|
|
|
value: '1',
|
|
|
|
config: {
|
|
|
|
data: []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
queryList: {
|
|
|
|
query: this.queryFunction,
|
|
|
|
selectCheckShow: false,
|
|
|
|
indexShow: true,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
title: this.$t('orderAuthor.organizationOrEnterprise'),
|
|
|
|
prop: 'organizationName'
|
|
|
|
},
|
2019-08-30 17:00:18 +08:00
|
|
|
{
|
2019-09-11 09:34:12 +08:00
|
|
|
title: this.$t('orderAuthor.permissionName'),
|
2019-08-30 17:00:18 +08:00
|
|
|
prop: 'permissionName'
|
|
|
|
},
|
2019-08-19 18:42:53 +08:00
|
|
|
{
|
|
|
|
title: this.$t('orderAuthor.founder'),
|
|
|
|
prop: 'userName'
|
|
|
|
},
|
2019-09-03 10:45:58 +08:00
|
|
|
// {
|
|
|
|
// title: this.$t('orderAuthor.founderPhone'),
|
|
|
|
// prop: 'userMobile'
|
|
|
|
// },
|
2019-08-30 17:00:18 +08:00
|
|
|
// {
|
|
|
|
// 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 ''; }
|
|
|
|
// },
|
2019-08-19 18:42:53 +08:00
|
|
|
{
|
|
|
|
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';
|
2019-09-02 17:05:53 +08:00
|
|
|
case false: return 'warning';
|
2019-08-19 18:42:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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';
|
2019-09-02 17:05:53 +08:00
|
|
|
case false: return 'warning';
|
2019-08-19 18:42:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-09-02 17:05:53 +08:00
|
|
|
{
|
|
|
|
title: '总数量',
|
|
|
|
prop: 'amount'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '剩余数量',
|
|
|
|
prop: 'remains'
|
|
|
|
},
|
2019-08-19 18:42:53 +08:00
|
|
|
{
|
|
|
|
title: this.$t('orderAuthor.startTime'),
|
|
|
|
prop: 'startTime',
|
|
|
|
type: 'formatter',
|
|
|
|
formatter: this.formatterDate
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-19 18:42:53 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('orderAuthor.endTime'),
|
|
|
|
prop: 'endTime',
|
|
|
|
type: 'formatter',
|
|
|
|
formatter: this.formatterDate
|
|
|
|
},
|
|
|
|
{
|
2019-09-03 18:59:46 +08:00
|
|
|
title: '状态',
|
2019-08-19 18:42:53 +08:00
|
|
|
prop: 'status',
|
|
|
|
type: 'tag',
|
|
|
|
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
|
|
|
|
tagType: (row) => {
|
|
|
|
switch (row.status) {
|
|
|
|
case '1': return 'success';
|
|
|
|
default: return 'danger';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'button',
|
|
|
|
title: this.$t('global.operate'),
|
2019-08-20 09:12:54 +08:00
|
|
|
width: this.$i18n.locale == 'en' ? '400': '300',
|
2019-09-02 14:43:16 +08:00
|
|
|
hide: (row) => { return this.$store.state.user.roles.indexOf(admin) < 0; },
|
2019-08-19 18:42:53 +08:00
|
|
|
buttons: [
|
|
|
|
{
|
|
|
|
name: this.$t('orderAuthor.obtainQrCode'),
|
|
|
|
handleClick: this.handleRtCodeShow,
|
|
|
|
type: '',
|
2019-09-02 17:05:53 +08:00
|
|
|
showControl: (row) => { return row.status == '1'; }
|
2019-08-19 18:42:53 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.$t('orderAuthor.authorityDetails'),
|
|
|
|
handleClick: this.handlePermissionDetail,
|
|
|
|
type: '',
|
|
|
|
showControl: (row) => { return row.status == '1' && (row.source == '02' || row.source == '04'); }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.$t('orderAuthor.recovery'),
|
|
|
|
handleClick: this.handleRestore,
|
|
|
|
type: 'danger',
|
|
|
|
showControl: (row) => { return row.status == '1' && row.source == '04'; }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.$t('orderAuthor.unpacking'),
|
|
|
|
handleClick: this.handleUnPackage,
|
|
|
|
type: 'danger',
|
|
|
|
showControl: (row) => { return row.status == '1' && row.source == '02'; }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
actions: [
|
2019-08-30 17:00:18 +08:00
|
|
|
{ text: this.$t('orderAuthor.privilegePackaging'), btnCode: 'employee_insert', handler: this.handlePackage },
|
|
|
|
{ text: '领取权限', handler: this.handlerPermission, show: process.env.NODE_ENV == 'development' }
|
2019-08-19 18:42:53 +08:00
|
|
|
]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-19 18:42:53 +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 });
|
|
|
|
});
|
|
|
|
this.$convertList(list, this.EffectiveTypeList, elem => {
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
});
|
2019-08-30 17:00:18 +08:00
|
|
|
// this.$Dictionary.permissionType().then(list => {
|
|
|
|
// list.forEach(elem => {
|
|
|
|
// this.queryForm.queryObject.permissionType.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') });
|
|
|
|
// });
|
2019-08-19 18:42:53 +08:00
|
|
|
},
|
|
|
|
formatterDate(row, porpInfo) {
|
2019-09-02 11:04:23 +08:00
|
|
|
return row[porpInfo.property] ? row[porpInfo.property] : '---';
|
2019-08-19 18:42:53 +08:00
|
|
|
},
|
|
|
|
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,
|
|
|
|
title: this.$t('orderAuthor.privilegeTransferQRCode')
|
|
|
|
});
|
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox(this.$t('tip.getQRCodeFailure'));
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleRestore(index, row) {
|
|
|
|
this.$confirm(this.$t('tip.recoveryPrivilegeTip'), this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
restorePackagePermission(row.id).then(resp => {
|
|
|
|
this.reloadTable();
|
|
|
|
this.$message.success(this.$t('tip.recoveryPrivilegesSuccessful'));
|
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox(this.$t('tip.recoveryPrivilegesFailed'));
|
|
|
|
});
|
|
|
|
}).catch(() => { });
|
|
|
|
},
|
|
|
|
handleUnPackage(index, row) {
|
|
|
|
this.$confirm(this.$t('tip.unpackingTip'), this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
permissionDistributeUnPackage(row.id).then(resp => {
|
|
|
|
this.reloadTable();
|
|
|
|
this.$message.success(this.$t('tip.unpackingSuccessful'));
|
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox(this.$t('tip.unpackingFailed'));
|
|
|
|
});
|
|
|
|
}).catch(() => { });
|
|
|
|
},
|
|
|
|
handlePackage() {
|
|
|
|
this.$router.push({ path: `${UrlConfig.orderauthor.trainferPackage}` });
|
2019-08-30 17:00:18 +08:00
|
|
|
},
|
|
|
|
handlerPermission() {
|
|
|
|
this.$refs.qcode.doShow();
|
2019-08-19 18:42:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2019-08-12 18:54:32 +08:00
|
|
|
</script>
|