diff --git a/src/api/management/distribute.js b/src/api/management/distribute.js index b2ab482f6..73ca4a825 100644 --- a/src/api/management/distribute.js +++ b/src/api/management/distribute.js @@ -2,140 +2,159 @@ import request from '@/utils/request'; /** 权限转增*/ export function getLessons(data) { - return request({ - url: '/api/distribute/getLessons', - method: 'get', - data: data - }); + return request({ + url: '/api/distribute/getLessons', + method: 'get', + data: data + }); } /** 权限分发*/ export function giveLessons(data) { - return request({ - url: '/api/distribute/distribute', - method: 'post', - data: data - }); + return request({ + url: '/api/distribute/distribute', + method: 'post', + data: data + }); } /** 权限转增*/ export function permissionTurnAdd(data) { - return request({ - url: '/api/distribute/transfer', - method: 'post', - data: data - }); + return request({ + url: '/api/distribute/transfer', + method: 'post', + data: data + }); } /** 从订单分发权限(获取二维码)*/ export function postDistribute(data) { - return request({ - url: `/api/distribute/${data.code}/distribute`, - method: 'post', - data: data - }); + return request({ + url: `/api/distribute/${data.code}/distribute`, + method: 'post', + data: data + }); } /** 权限获取*/ export function getPermission(state) { - return request({ - url: `/api/distribute/getPermission?state=${state}`, - method: 'get' - }); + return request({ + url: `/api/distribute/getPermission?state=${state}`, + method: 'get' + }); } /** 接收课程权限*/ export function receiveLessons(data) { - return request({ - url: '/api/distribute/receiveLessons', - method: 'get', - data: data - }); + return request({ + url: '/api/distribute/receiveLessons', + method: 'get', + data: data + }); } /** 考试权限分发*/ export function giveExams(data) { - return request({ - url: `/api/distribute/giveExams`, - method: 'post', - data: data - }); + return request({ + url: `/api/distribute/giveExams`, + method: 'post', + data: data + }); } /** 权限打包分页查询*/ export function listPackagePermission(params) { - return request({ - url: '/api/distribute', - method: 'get', - params: params - }); + return request({ + url: '/api/distribute', + method: 'get', + params: params + }); } /** 打包权限*/ export function packagePermissionDistribute(data) { - return request({ - url: `/api/distribute/givePermission/package`, - method: 'post', - data: data - }); + return request({ + url: `/api/distribute/givePermission/package`, + method: 'post', + data: data + }); } /** 权限回收*/ export function restorePackagePermission(id) { - return request({ - url: `/api/distribute/${id}/restore`, - method: 'put' - }); + return request({ + url: `/api/distribute/${id}/restore`, + method: 'put' + }); } /** 生成打包权限二维码*/ export function getPackageQrCode(params) { - return request({ - url: `/api/distribute/package/qrCode`, - method: 'get', - params: params - }); + return request({ + url: `/api/distribute/package/qrCode`, + method: 'get', + params: params + }); } /** 权限分发打包详情*/ export function getPermissionPackageDetail(id, params) { - return request({ - url: `/api/distribute/package/${id}/detail`, - method: 'get', - params: params - }); + return request({ + url: `/api/distribute/package/${id}/detail`, + method: 'get', + params: params + }); } /** 权限分发打包*/ export function permissionDistributePackage(data) { - return request({ - url: `/api/distribute/package`, - method: 'post', - data: data - }); + return request({ + url: `/api/distribute/package`, + method: 'post', + data: data + }); } /** 权限分发解包*/ export function permissionDistributeUnPackage(permissionId) { - return request({ - url: `/api/distribute/${permissionId}/unPackage`, - method: 'delete' - }); + return request({ + url: `/api/distribute/${permissionId}/unPackage`, + method: 'delete' + }); } /** 查询可打包的权限分发*/ export function listCanPackagePermission(params) { - return request({ - url: `/api/distribute/package`, - method: 'get', - params: params - }); + return request({ + url: `/api/distribute/package`, + method: 'get', + params: params + }); } // 设置权限分发列表 权限失效 export function setCommodityStatus(id) { - return request({ - url: `/api/distribute/${id}/invalid`, - method: 'get' - }); + return request({ + url: `/api/distribute/${id}/invalid`, + method: 'get' + }); } + +/** 获取用户可以分发/转增的权限*/ +export function getAvailableUserPermission(params) { + return request({ + url: `/api/userPermission/getAvailableUserPermission`, + method: 'get', + params: params + }); +} + +/** 用户权限转增分发打包生成权限*/ +export function givePermission(data) { + return request({ + url: `/api/distribute/packageUserPermission`, + method: 'post', + data: data + }); +} + diff --git a/src/i18n/langs/en/global.js b/src/i18n/langs/en/global.js index 2abe53ab3..641c0111f 100644 --- a/src/i18n/langs/en/global.js +++ b/src/i18n/langs/en/global.js @@ -196,5 +196,6 @@ export default { america: 'America', companyInfo:'Beijing Jiulian Technology Co., Ltd', companyTel:'Tel: +86 13289398171', - companyICP:'Copyright ©2018 Beijing Jiulian Technology Co., Ltd ICP: 18028522' + companyICP:'Copyright ©2018 Beijing Jiulian Technology Co., Ltd ICP: 18028522', + enterPermissionNum:'please input permission number' }; diff --git a/src/i18n/langs/zh/global.js b/src/i18n/langs/zh/global.js index 7bd301538..3b88dfd34 100644 --- a/src/i18n/langs/zh/global.js +++ b/src/i18n/langs/zh/global.js @@ -196,5 +196,6 @@ export default { america: '美国', companyInfo:'北京玖琏科技有限公司', companyTel:'联系电话: 13289398171', - companyICP:'Copyright ©2018 北京玖琏科技有限公司 京ICP备18028522号' + companyICP:'Copyright ©2018 北京玖琏科技有限公司 京ICP备18028522号', + enterPermissionNum:'请输入权限数量' }; diff --git a/src/views/components/limits/distribute.vue b/src/views/components/limits/distribute.vue index c454346e3..0e9bc9b6c 100644 --- a/src/views/components/limits/distribute.vue +++ b/src/views/components/limits/distribute.vue @@ -1,6 +1,61 @@ - - + + + + + + + + + + + + + + + + + + + + + + {{ $t('global.confirm') }} {{ $t('global.cancel') }} @@ -9,194 +64,195 @@ diff --git a/src/views/components/limits/transfer.vue b/src/views/components/limits/transfer.vue index 892d8ac2d..ab6dea3d9 100644 --- a/src/views/components/limits/transfer.vue +++ b/src/views/components/limits/transfer.vue @@ -14,194 +14,194 @@ import { permissionTurnAdd } from '@/api/management/distribute'; import { PermissionType } from '@/scripts/ConstDic'; export default { - name: 'GoLsesson', - data() { - return { - dialogVisible: false, - maxTotal: 0, - formModel: { - lessonId: '', - lessonName: '', - total: 0, - startTime: '', - endTime: '', - date: '' - }, - prdCode: '', - mapId: '', - DatePicker: { - shortcuts: [{ - text: this.$t('global.today'), - onClick(picker) { - picker.$emit('pick', new Date()); - } - }] - }, - numberMessage: '', - PermissionType: '' - }; - }, - computed: { - form() { - const form = { - labelWidth: '80px', - items: [ - { prop: 'lessonName', label: this.$t('global.name'), type: 'text', required: false, readonly: true }, - { prop: 'date', label: this.$t('global.selectionTime'), type: 'daterange', required: false, viewFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd' }, - { prop: 'total', label: this.$t('global.permissionNumber'), type: 'number', required: false, min: 0, max: this.maxTotal, message: this.numberMessage } - ] - }; - return form; - }, - rules() { - const that = this; - const crules = { - total: [ - { required: true, message: this.$t('global.pleaseInputPermissionNumber'), trigger: 'change' }, - { - validator(rule, value, callback) { - if (Number.isInteger(Number(value)) && Number(value) > 0) { - callback(); - } else { - callback(new Error(that.$t('global.permissionGreaterThen0'))); - } - }, - trigger: 'blur' - } - ], - startTime: [ - { required: true, message: this.$t('global.enterStartTime'), trigger: 'change' } - ], - endTime: [ - { required: true, message: this.$t('global.enterEndTime'), trigger: 'change' } - ], - date: [ - { required: true, message: this.$t('global.enterDate'), trigger: 'blur' } - ] - }; - return crules; - }, - title() { - if (this.PermissionType == PermissionType.LESSON) { - return this.$t('global.transferLessonPermission'); - } else if (this.PermissionType == PermissionType.EXAM) { - return this.$t('global.transferExamPermission'); - } else if (this.PermissionType == PermissionType.SIMULATION) { - return this.$t('global.transferSimulationPermission'); - } else if (this.PermissionType == PermissionType.SCREEN) { - return this.$t('global.transferScreenPermission'); - } - return ''; - } - }, - watch: { - 'formModel.date': function (val, old) { - this.setTotalMax(); - } - }, - methods: { - setTotalMax() { - let endTime; - let startTime; - if (this.formModel.date) { - endTime = this.formModel.date[1]; - startTime = this.formModel.date[0]; - } - this.maxTotal = 0; - if (endTime && startTime) { - if (endTime > startTime) { - const model = { - startTime: `${startTime} 00:00:00`, - endTime: `${endTime} 23:59:59`, - permissionType: this.PermissionType - }; - if (this.PermissionType == PermissionType.LESSON || this.PermissionType == PermissionType.EXAM) { - model['lessonId'] = this.formModel.lessonId; - model['mapId'] = this.mapId; - model['prdCode'] = this.prdCode; - } else if (this.PermissionType == PermissionType.SIMULATION) { - model['mapId'] = this.mapId; - model['prdCode'] = this.prdCode; - } - getTotalRemains(model).then(response => { - this.maxTotal = response.data; - if (this.maxTotal == 0) { - this.numberMessage = this.$t('tip.theNumberOfPermissionsAvailableIsZero'); - } else { - this.numberMessage = `(${this.$t('global.remainPermissionNumber')}:${this.maxTotal})`; - } - }).catch(() => { - this.$messageBox(this.$t('error.obtainMaxNumberFailed')); - }); - } else { - this.numberMessage = this.$t('tip.endTimeRules'); - } - } else { - this.numberMessage = ''; - } - }, - doShow(data) { - this.dialogVisible = true; - if (data) { - this.formModel.lessonId = data.id; - this.formModel.lessonName = data.name; - this.prdCode = data.prdCode; - this.mapId = data.mapId; - this.PermissionType = data.PermissionType; - this.setTotalMax(); - } - }, - handleSure() { - this.$refs.dataform.validateForm(() => { - const model = { - startTime: `${this.formModel.date[0]} 00:00:00`, - endTime: `${this.formModel.date[1]} 23:59:59`, - amount: this.formModel.total, - permissionType: this.PermissionType - }; - if (this.PermissionType == PermissionType.LESSON || this.PermissionType == PermissionType.EXAM) { - model['lessonId'] = this.formModel.lessonId; - model['mapId'] = this.mapId; - model['prdCode'] = this.prdCode; - } else if (this.PermissionType == PermissionType.SIMULATION) { - model['mapId'] = this.mapId; - model['prdCode'] = this.prdCode; - } - // 转增 - permissionTurnAdd(model).then(response => { - const url = response.data; - this.$emit('QrCodeShow', { - url: url, - title: this.$t('global.transferQrcode') - }); - this.dialogVisible = false; - this.$emit('initLoadPage'); - this.handleClose(); - }).catch(() => { - this.$messageBox(this.$t('error.getTransferQrcodeFailed')); - }); - }); - }, - close() { - this.dialogVisible = false; - this.handleClose(); - }, - handleClose(done) { - this.maxTotal = 0; - this.formModel = { - lessonId: '', - lessonName: '', - total: 0, - startTime: '', - endTime: '' - }; - this.$refs.dataform.resetForm(); - if (done) { - done(); - } else { - this.dialogVisible = false; - } - } - } + name: 'GoLsesson', + data() { + return { + dialogVisible: false, + maxTotal: 0, + formModel: { + lessonId: '', + lessonName: '', + total: 0, + startTime: '', + endTime: '', + date: '' + }, + prdCode: '', + mapId: '', + DatePicker: { + shortcuts: [{ + text: this.$t('global.today'), + onClick(picker) { + picker.$emit('pick', new Date()); + } + }] + }, + numberMessage: '', + PermissionType: '' + }; + }, + computed: { + form() { + const form = { + labelWidth: '80px', + items: [ + { prop: 'lessonName', label: this.$t('global.name'), type: 'text', required: false, readonly: true }, + { prop: 'date', label: this.$t('global.selectionTime'), type: 'daterange', required: false, viewFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd' }, + { prop: 'total', label: this.$t('global.permissionNumber'), type: 'number', required: false, min: 0, max: this.maxTotal, message: this.numberMessage } + ] + }; + return form; + }, + rules() { + const that = this; + const crules = { + total: [ + { required: true, message: this.$t('global.pleaseInputPermissionNumber'), trigger: 'change' }, + { + validator(rule, value, callback) { + if (Number.isInteger(Number(value)) && Number(value) > 0) { + callback(); + } else { + callback(new Error(that.$t('global.permissionGreaterThen0'))); + } + }, + trigger: 'blur' + } + ], + startTime: [ + { required: true, message: this.$t('global.enterStartTime'), trigger: 'change' } + ], + endTime: [ + { required: true, message: this.$t('global.enterEndTime'), trigger: 'change' } + ], + date: [ + { required: true, message: this.$t('global.enterDate'), trigger: 'blur' } + ] + }; + return crules; + }, + title() { + if (this.PermissionType == PermissionType.LESSON) { + return this.$t('global.transferLessonPermission'); + } else if (this.PermissionType == PermissionType.EXAM) { + return this.$t('global.transferExamPermission'); + } else if (this.PermissionType == PermissionType.SIMULATION) { + return this.$t('global.transferSimulationPermission'); + } else if (this.PermissionType == PermissionType.SCREEN) { + return this.$t('global.transferScreenPermission'); + } + return ''; + } + }, + watch: { + 'formModel.date': function (val, old) { + this.setTotalMax(); + } + }, + methods: { + setTotalMax() { + let endTime; + let startTime; + if (this.formModel.date) { + endTime = this.formModel.date[1]; + startTime = this.formModel.date[0]; + } + this.maxTotal = 0; + if (endTime && startTime) { + if (endTime > startTime) { + const model = { + startTime: `${startTime} 00:00:00`, + endTime: `${endTime} 23:59:59`, + permissionType: this.PermissionType + }; + if (this.PermissionType == PermissionType.LESSON || this.PermissionType == PermissionType.EXAM) { + model['lessonId'] = this.formModel.lessonId; + model['mapId'] = this.mapId; + model['prdCode'] = this.prdCode; + } else if (this.PermissionType == PermissionType.SIMULATION) { + model['mapId'] = this.mapId; + model['prdCode'] = this.prdCode; + } + getTotalRemains(model).then(response => { + this.maxTotal = response.data; + if (this.maxTotal == 0) { + this.numberMessage = this.$t('tip.theNumberOfPermissionsAvailableIsZero'); + } else { + this.numberMessage = `(${this.$t('global.remainPermissionNumber')}:${this.maxTotal})`; + } + }).catch(() => { + this.$messageBox(this.$t('error.obtainMaxNumberFailed')); + }); + } else { + this.numberMessage = this.$t('tip.endTimeRules'); + } + } else { + this.numberMessage = ''; + } + }, + doShow(data) { + this.dialogVisible = true; + if (data) { + this.formModel.lessonId = data.id; + this.formModel.lessonName = data.name; + this.prdCode = data.prdCode; + this.mapId = data.mapId; + this.PermissionType = data.PermissionType; + this.setTotalMax(); + } + }, + handleSure() { + this.$refs.dataform.validateForm(() => { + const model = { + startTime: `${this.formModel.date[0]} 00:00:00`, + endTime: `${this.formModel.date[1]} 23:59:59`, + amount: this.formModel.total, + permissionType: this.PermissionType + }; + if (this.PermissionType == PermissionType.LESSON || this.PermissionType == PermissionType.EXAM) { + model['lessonId'] = this.formModel.lessonId; + model['mapId'] = this.mapId; + model['prdCode'] = this.prdCode; + } else if (this.PermissionType == PermissionType.SIMULATION) { + model['mapId'] = this.mapId; + model['prdCode'] = this.prdCode; + } + // 转增 + permissionTurnAdd(model).then(response => { + const url = response.data; + this.$emit('QrCodeShow', { + url: url, + title: this.$t('global.transferQrcode') + }); + this.dialogVisible = false; + this.$emit('initLoadPage'); + this.handleClose(); + }).catch(() => { + this.$messageBox(this.$t('error.getTransferQrcodeFailed')); + }); + }); + }, + close() { + this.dialogVisible = false; + this.handleClose(); + }, + handleClose(done) { + this.maxTotal = 0; + this.formModel = { + lessonId: '', + lessonName: '', + total: 0, + startTime: '', + endTime: '' + }; + this.$refs.dataform.resetForm(); + if (done) { + done(); + } else { + this.dialogVisible = false; + } + } + } }; diff --git a/src/views/planMonitor/detail.vue b/src/views/planMonitor/detail.vue index e5387f859..042721dee 100644 --- a/src/views/planMonitor/detail.vue +++ b/src/views/planMonitor/detail.vue @@ -50,6 +50,7 @@ import CreateEmptyPlan from './editTool/menus/createEmptyPlan'; import { getRpListByUserMapId, publishRunPlan, releaseOrCancelRunPlan, previewRunPlan} from '@/api/designPlatform'; import { getRpListByMapId, deleteRunPlan } from '@/api/runplan'; import { launchFullscreen } from '@/utils/screen'; +import { UrlConfig } from '@/router/index'; export default { name: 'UserRunPlanList', components: {