Merge branch 'test_dispaly' of https://git.code.tencent.com/lian-cbtc/jl-client into test_dispaly

This commit is contained in:
fan 2022-10-27 09:48:51 +08:00
commit d2050dacd8
23 changed files with 1444 additions and 55 deletions

View File

@ -0,0 +1,53 @@
import request from '@/utils/request';
/** 创建权限分发*/
export function createDistribute(data) {
return request({
url: `/api/v3/permission/distribute/create`,
method: 'post',
data
});
}
/** 分页获取权限分发列表*/
export function getDistributeList(data) {
return request({
url: `/api/v3/permission/distribute/paging`,
method: 'post',
data
});
}
// /** 设置权限分发立即失效*/
// export function setDistributeInvalidate(pdId) {
// return request({
// url: `/api/v2/permission/distribute/${pdId}/invalidate`,
// method: 'put'
// });
// }
/** 获取权限分发明细*/
export function getDistributeDetail(disId) {
return request({
url: `/api/v3/permission/distribute/list/distribute/${disId}`,
method: 'get'
});
}
/** 从权限分发,直接分发给指定主体*/
export function setDistributeToSubject(pdId, subjectType, subjectId) {
return request({
url: `/api/v3/permission/distribute/${pdId}/to/${subjectType}/${subjectId}`,
method: 'post'
});
}
/** 生成分发二维码*/
export function getDistributeQrCode(pdId) {
return request({
url: `/api/v3/permission/distribute/${pdId}/qrCode`,
method: 'get'
});
}

View File

@ -0,0 +1,27 @@
import request from '@/utils/request';
/** 设置权限失效或有效*/
export function setPermissonInValid(subjectId) {
return request({
url: `/api/v2/permission/subject/inValid/${subjectId}`,
method: 'get'
});
}
/** 用户权限列表*/
export function listPermision(params) {
return request({
url: `/api/v2/permission/subject/page`,
method: 'get',
params: params
});
}
/** 查看用户分发的下级所有用户权限*/
export function getPermissonInDistribute(subjectId) {
return request({
url: `/api/v2/permission/subject/distribute/${subjectId}`,
method: 'get'
});
}

View File

@ -93,7 +93,7 @@
:sort-by="column.sortBy"
>
<template slot-scope="scope">
<div v-html="scope.row[column.prop]" />
<div style="white-space: pre-wrap;" v-html="scope.row[column.prop]" />
</template>
</el-table-column>
<el-table-column

View File

@ -105,7 +105,7 @@ export default {
selectScope: '请选择范围',
questionNumbers: '题数',
allNumberTipOne: '此类型有',
allNumberTipTwo: '题',
allNumberTipTwo: '题',
scorePerQuestion: '每题分值',
inputQuestionNumber: '请输入题数',
inputQuestionNumberError: '输入的题数大于0',

View File

@ -47,8 +47,10 @@ const DisplayBaSiDi = () => import('@/views/newMap/displayBaSiDi/index');
const Display = () => import('@/views/newMap/display/index');
const TrainingDesign = () => import('@/views/designPlatform/trainingDesign');
const TrainingPreview = () => import('@/views/designPlatform/trainingPreview');
// const TrainingDesign = () => import('@/views/designPlatform/trainingDesign');
// const TrainingPreview = () => import('@/views/designPlatform/trainingPreview');
const TrainingDesign = () => import('@/views/organization/trainingDesign/index');
const TrainingManage = () => import('@/views/organization/trainingManage/index');
const TestRunplan = () => import('@/views/designPlatform/testRunplan');
const PracticeDisplay = () => import('@/views/newMap/displayNew/practiceDisplay');
@ -95,7 +97,7 @@ const NewDesignPlatformUser = () => import('@/views/newMap/newDesignUser/index')
const Taskmanage = () => import('@/views/lesson/taskmanage/list');
const TrainingRuleList = () => import('@/views/lesson/trainingRule/list');
const TrainingRuleEdit = () => import('@/views/lesson/trainingRule/detail/index');
const Trainingmanage = () => import('@/views/lesson/trainingmanage/index');
const TrainingmanageOld = () => import('@/views/lesson/trainingmanage/index');
const LessonEdit = () => import('@/views/lesson/lessoncategory/index');
const LessonHome = () => import('@/views/lesson/home');
const Lesson3d = () => import('@/views/lesson/lesson3d');
@ -226,6 +228,10 @@ const ThirdPartyAccounts = () => import('@/views/thirdPartyAccounts/index');
const FunctionManage = () => import('@/views/functionManage/index');
const PermissionManage = () => import('@/views/permissionManage/index');
const UserRulesManage = () => import('@/views/userRulesManage/index');
const AuthorityTransfer = () => import('@/views/authorityTransfer/index');
const CreateDistribute = () => import('@/views/authorityTransfer/create/index');
const DistributeDetail = () => import('@/views/authorityTransfer/detail');
// import { GenerateRouteProjectList } from '@/scripts/ProjectConfig';
// import { getSessionStorage } from '@/utils/auth';
@ -511,16 +517,6 @@ export const publicAsyncRoute = [
component: BigSplitScreen,
hidden: true
},
{ // 实训设计
path: '/trainingDesign',
component: TrainingDesign,
hidden: true
},
{
path: '/trainingPreview',
component: TrainingPreview,
hidden: true
},
// {
// path: '/jointTrainingNew',
// component: JointTrainingNew,
@ -806,7 +802,7 @@ export const asyncRouter = [
},
{ // 实训管理
path: 'lesson/trainingManage',
component: Trainingmanage,
component: TrainingmanageOld,
hidden: true
},
{ // 创建课程
@ -1609,9 +1605,19 @@ export const asyncRouter = [
component: Temporary,
hidden: true
},
{ // 实训教学管理
// { // 实训教学管理
// path: 'trainingManage',
// component: Temporary,
// hidden: true
// },
{ // 实训设计
path: 'trainingDesign',
component: TrainingDesign,
hidden: true
},
{ // 实训管理
path: 'trainingManage',
component: Temporary,
component: TrainingManage,
hidden: true
},
{ // 理论题目管理
@ -1696,7 +1702,7 @@ export const asyncRouter = [
},
{ // 实训管理
path: 'lesson/trainingManage',
component: Trainingmanage,
component: TrainingmanageOld,
hidden: true
},
{ // 创建课程
@ -2100,7 +2106,8 @@ export const asyncRouter = [
{
// 权限分发管理
path: 'authorityTransferManage',
component: Permission,
component: AuthorityTransfer,
// component: Permission,
meta: {
i18n: 'newRouter.authorityTransferManage'
}
@ -2108,10 +2115,17 @@ export const asyncRouter = [
{
// 用户权限管理
path: 'userRulesManage',
component: UserRules,
component: UserRulesManage,
// component: UserRules,
meta: {
i18n: 'newRouter.userRulesManage'
}
},
{
// 权限分发管理-创建
path: 'createDistribute',
component: CreateDistribute,
hidden: true
}
]
},

View File

@ -61,7 +61,7 @@ function handle(state, data) {
case 'Simulation_AutoFault_Trigger': // 自动故障触发操作推送消息
state.autoFaultTrigger++;
break;
case 'Simulation_RunFact': // 仿真-列车实际到发车站消息
case 'Simulation_RunFact': // 仿真-列车实际到 发车站消息
if (!Array.isArray(msg)) {
state.trainStationList = [msg];
} else {

View File

@ -23,13 +23,13 @@ export function handlerUrl() {
let OSS_URL;
if (process.env.NODE_ENV === 'development') {
// 开发分支
// BASE_API = 'http://192.168.3.233/rtss-server';
BASE_API = 'http://192.168.3.233/rtss-server';
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://114.116.51.125/jlcloud';
// BASE_API = 'http://192.168.3.90:9000'; // 周寅
// BASE_API = 'http://192.168.3.94:9000'; // 旭强
BASE_API = 'http://192.168.3.15:9000'; // 张赛
// BASE_API = 'http://192.168.3.15:9000'; // 张赛
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
// BASE_API = 'http://192.168.3.37:9000'; // 卫志宏
// BASE_API = 'http://b29z135112.zicp.vip';

View File

@ -0,0 +1,30 @@
<template>
<el-dialog v-dialogDrag title="选择权限" :visible.sync="dialogShow" width="1400px" :before-close="close">
<PermissionList :only-select="true" table-height="450" v-bind="$attrs" v-on="$listeners" />
</el-dialog>
</template>
<script>
import PermissionList from '@/views/permissionManage/index';
export default {
name: 'AddPermission',
components: {
PermissionList
},
data() {
return {
dialogShow: false
};
},
methods: {
doShow() {
this.dialogShow = true;
},
close() {
this.dialogShow = false;
}
}
};
</script>

View File

@ -0,0 +1,201 @@
<template>
<div>
<div class="forms pack-rule">
<el-form ref="dataform" label-position="right" :model="formModel" label-width="80px" :rules="rules" size="mini" @submit.native.prevent>
<el-form-item label="关联权限" prop="permissionIds">
<div>
<el-button size="mini" style="margin-bottom:10px" @click="buttonClick">添加权限</el-button>
<el-table :data="formModel.permissionIds" size="mini" border class="table_item" max-height="400">
<el-table-column prop="permissionId" label="权限id" width="80" />
<el-table-column prop="permissionName" :label="$t('orderAuthor.permissionName')" />
<el-table-column :label="$t('orderAuthor.totalPermissions')" width="160">
<template slot-scope="scope">
<el-input-number v-model="scope.row.amount" :step="1" :min="1" :precision="0" />
</template>
</el-table-column>
<el-table-column :label="$t('global.operate')" width="80">
<template slot-scope="scope">
<el-button type="text" size="small" @click="removePermissions(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-form-item>
<el-form-item :label="$t('orderAuthor.permanenceOrNot')" prop="forever">
<el-radio v-model="formModel.forever" :label="false"></el-radio>
<el-radio v-model="formModel.forever" :label="true"></el-radio>
</el-form-item>
<el-form-item :label="$t('orderAuthor.startTime')" prop="startTime">
<el-date-picker v-model="formModel.startTime" type="datetime" placeholder="选择日期时间" align="right" :picker-options="pickerOptions" value-format="yyyy-MM-dd HH:mm:ss" />
</el-form-item>
<el-form-item v-if="noForever" :label="$t('orderAuthor.endTime')">
<el-date-picker v-model="formModel.endTime" type="datetime" placeholder="选择日期时间" align="right" :picker-options="pickerOptions" value-format="yyyy-MM-dd HH:mm:ss" />
</el-form-item>
<el-form-item label="备注" prop="dsc">
<el-input v-model="formModel.dsc" placeholder="请输入" />
</el-form-item>
</el-form>
</div>
<div class="draft">
<el-button @click="turnback">{{ $t('global.back') }}</el-button>
<el-button type="primary" @click="saveAs">{{ $t('map.confirm') }}</el-button>
</div>
<addPermission ref="addPermission" :select-ids="formModel.permissionIds" @handleSelect="addPermissions" />
</div>
</template>
<script>
import addPermission from '@/views/authorityTransfer/create/addPermission';
import { createDistribute } from '@/api/authorityTransfer';
export default {
name: 'OrderForm',
components: {
addPermission
},
data() {
return {
errorTip: '请输入数量',
errorIntTip: '数量必须为整数',
formModel: {
forever: false,
startTime: '',
endTime: '',
dsc: '',
permissionIds:[]
},
pickerOptions: {
shortcuts: [{
text: '今天',
onClick(picker) {
picker.$emit('pick', new Date());
}
}, {
text: '昨天',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit('pick', date);
}
}, {
text: '一周前',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', date);
}
}]
}
};
},
computed: {
noForever() {
return !this.formModel.forever;
},
rules() {
const _this = this;
const baseRules = {
permissionIds: [
{ required: true, message: '请添加权限', trigger: 'change' },
{
validator(rule, value, callback) {
if (Array.isArray(value) && value.length > 0) {
callback();
} else {
callback(new Error('请添加权限'));
}
},
trigger: 'blur'
}
],
forever: [
{ required: true, message: this.$t('rules.pleaseSelect'), trigger: 'change' }
],
amount: [
{ required: true, message: this.$t('rules.authorAmountInput'), trigger: 'change' },
{
validator(rule, value, callback) {
if (Number.isInteger(Number(value)) && Number(value) > 0) {
callback();
} else {
callback(new Error(_this.$t('rules.authorAmountInputError')));
}
},
trigger: 'blur'
}
],
startTime: [
{ required: true, message: this.$t('rules.startTimePick'), trigger: 'change' }
],
dsc: [
{ required: true, message: '请输入备注', trigger: 'change' }
]
};
//
this.$nextTick(function () {
this.$refs.dataform.clearValidate();
});
return baseRules;
}
},
methods: {
buttonClick() {
this.$refs.addPermission.doShow();
},
validateChoose(rule, value, callback) {
if (value || value === 0) {
if (Number.isInteger(value)) {
callback();
} else {
callback(new Error(this.errorIntTip));
}
} else {
callback(new Error(this.errorTip));
}
},
addPermissions(row) {
const data = {
'permissionId': row.id,
'permissionName': row.name,
'amount': 1
};
this.formModel.permissionIds.push(data);
},
removePermissions(data) {
this.formModel.permissionIds = this.formModel.permissionIds.filter(({ permissionId }) => permissionId !== data.permissionId);
},
turnback() {
this.$router.go(-1);
},
saveAs() {
this.$refs['dataform'].validate((valid) => {
if (!valid) { return; }
this.loading = true;
createDistribute(this.formModel).then(response => {
this.loading = false;
this.$message.success('创建成功!');
this.turnback();
}).catch(() => {
this.loading = false;
this.$message.error('创建失败!');
});
});
}
}
};
</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

@ -0,0 +1,82 @@
<template>
<el-dialog v-dialogDrag title="权限详情" :visible.sync="dialogShow" width="800px" :before-close="handleClose">
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<div slot="footer">
<el-button type="primary" @click="handleClose">{{ $t('global.return') }}</el-button>
</div>
</el-dialog>
</template>
<script>
import { getDistributeDetail } from '@/api/authorityTransfer';
export default {
name: 'DistributeDetail',
data() {
return {
dialogShow: false,
height: 0,
disId: '',
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
show: false
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
paginationHiden: true,
indexShow: true,
columns: [
{
title: '权限id',
width: '80',
prop: 'permissionId'
},
{
title: '权限名称',
prop: 'permissionName'
},
{
title: '总数量',
width: '80',
prop: 'amount'
},
{
title: '剩余数量',
width: '80',
prop: 'remains'
}
]
}
};
},
methods: {
doShow(row) {
this.disId = row.id || '';
this.reloadTable();
this.dialogShow = true;
},
queryFunction(params) {
return getDistributeDetail(this.disId);
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
handleClose() {
this.dialogShow = false;
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
</style>

View File

@ -0,0 +1,186 @@
<template>
<el-dialog title="权限分发到指定用户" :visible.sync="dialogVisible" width="1200px" :before-close="doClose" center :close-on-click-modal="false">
<QueryListPage ref="queryListPage1" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</el-dialog>
</template>
<script>
import { getUserList } from '@/api/management/user';
import { setDistributeToSubject } from '@/api/authorityTransfer';
import { getCompanyList } from '@/api/company';
export default {
name:'DistributePackage',
data() {
return {
packageId:'',
dialogVisible:false,
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
companyMap: {},
companyList: [],
countTypeList:[
{label:'个人账户', value:'1'},
{label:'企业账户', value:'2'},
{label:'企业账户下子账户', value:'3'}
],
queryForm: {
labelWidth: '80px',
reset: true,
queryObject: {
name: {
type: 'text',
label: this.$t('system.name')
},
id: {
type: 'text',
label: 'id'
},
roles: {
type: 'select',
label: this.$t('system.roles'),
config: {
data: this.$ConstSelect.roleList
}
},
nickname: {
type: 'text',
label: '昵称'
},
mobile: {
type: 'text',
label: '手机号'
},
email: {
type: 'text',
label: '邮箱'
},
companyId: {
type: 'select',
label: '组织',
config: {
data: []
}
},
type:{
type: 'select',
label: '类型',
config: {
data: []
}
}
}
},
queryList: {
query: getUserList,
selectCheckShow: false,
height: '420',
indexShow: true,
columns: [
{
title: 'id',
prop: 'id',
width: 80
},
{
title: this.$t('system.name'),
prop: 'name'
},
{
title: this.$t('system.nickname'),
prop: 'nickname'
},
{
title: '类型',
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.getCountType(row.type); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('global.mobile'),
prop: 'mobile'
},
{
title: this.$t('global.email'),
prop: 'email'
},
{
title: '组织',
prop: 'companyId',
type: 'tag',
columnValue: (row) => { return this.getCompanyName(row.companyId); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.roles'),
prop: 'roles',
type: 'tagMore',
columnValue: (row) => { return this.$convertField(row.roles, this.$ConstSelect.roleList, ['value', 'label'], true); },
tagType: (row) => { return 'success'; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '90',
buttons: [
{
name: '选择',
handleClick: this.distributePackage
}
]
}
]
}
};
},
created() {
this.companyMap = {};
this.companyList = [];
getCompanyList().then(resp => {
if (resp && resp.data && resp.data.length) {
resp.data.forEach(item => {
this.companyMap[item.id] = item.name;
this.companyList.push({label: item.name, value: parseInt(item.id)});
});
this.queryForm.queryObject.companyId.config.data = this.companyList;
this.queryForm.queryObject.type.config.data = this.countTypeList;
}
}).catch((error) => {
console.error(error);
});
},
methods:{
doShow(data) {
this.packageId = data.id;
this.dialogVisible = true;
},
doClose() {
this.dialogVisible = false;
},
getCountType(type) {
const countType = this.countTypeList.find(each=>{ return each.value == type; });
return countType ? countType.label : '';
},
getCompanyName(companyId) {
return this.companyMap[companyId];
},
distributePackage(index, row) {
if (this.packageId) {
const accountId = row.id;
const subjectType = row.type == '1' ? 'user' : 'org';
setDistributeToSubject(this.packageId, subjectType, accountId).then(resp=> {
this.$message.success('权限分发给指定账户成功!');
this.$emit('reloadTable');
this.doClose();
}).catch(() => {
this.$messageBox('权限分发给指定账户失败');
});
}
}
}
};
</script>

View File

@ -0,0 +1,152 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<qr-code ref="qrCode" />
<distribute-package ref="distributePackage" @reloadTable="reloadTable" />
<Detail ref="detail" />
</div>
</template>
<script>
import { admin } from '@/router/index';
import { getDistributeList, getDistributeQrCode } from '@/api/authorityTransfer';
import QrCode from '@/components/QrCode';
import DistributePackage from './distributePackage';
import Detail from './detail';
export default {
name: 'Author',
components: {
QrCode,
Detail,
DistributePackage
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '100px',
reset: false,
queryObject: {
dsc: {
type: 'text',
label: '备注'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '权限分发Id',
width: '100',
prop: 'id'
},
{
title: '备注',
prop: 'dsc'
},
{
title: this.$t('orderAuthor.founder'),
prop: 'nickName'
},
{
title: this.$t('orderAuthor.permanenceOrNot'),
prop: 'forever',
width: '80',
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: this.$t('orderAuthor.startTime'),
prop: 'startTime',
width: '160'
},
{
title: this.$t('orderAuthor.endTime'),
prop: 'endTime',
width: '160'
},
{
title: '创建时间',
prop: 'createTime',
width: '160'
},
{
title: '更新时间',
prop: 'updateTime',
width: '160'
},
{
type: 'button',
title: this.$t('global.operate'),
width: this.$i18n.locale == 'en' ? '400' : '300',
hide: (row) => { return this.$store.state.user.roles.indexOf(admin) < 0; },
buttons: [
{
name: this.$t('orderAuthor.obtainQrCode'),
handleClick: this.handleRtCodeShow,
type: ''
},
{
name: '权限详情',
handleClick: this.handleDetailShow,
type: ''
},
{
name: '领取到',
handleClick: this.distributePackage,
type: ''
}
]
}
],
actions: [
{ text: '创建权限分发', handler: this.handleCreatePackage }
]
}
};
},
methods: {
queryFunction(params) {
return getDistributeList(params);
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
handleDetailShow(index, row) {
this.$refs.detail.doShow(row);
},
handleRtCodeShow(index, row) {
getDistributeQrCode(row.id).then(resp => {
this.$refs.qrCode.doShow({
url: resp.data,
title: this.$t('orderAuthor.privilegeTransferQRCode')
});
}).catch(() => {
this.$message.error('获取二维码失败!');
});
},
handleCreatePackage() {
this.$router.push({ path: `/systemManagement/permissionDataManage/createDistribute` });
},
distributePackage(index, row) {
this.$refs.distributePackage.doShow(row);
}
}
};
</script>

View File

@ -119,8 +119,4 @@ export default {
};
</script>
<style lang="scss" scoped>
/deep/
.el-row .el-button+.el-button{
margin-top: 10px;
}
</style>

View File

@ -187,7 +187,7 @@ export default {
} else if (this.roles === 'DISPATCHER') {
if (this.$route.query.lineCode === '16') {
this.changePictureShow('dispatcherManage');
this.$store.dispatch('app/animationsClose');
this.$store.dispatch('app/ animationsClose');
} else {
this.changePictureShow('dispatchWork');
}

View File

@ -39,7 +39,7 @@ export default {
},
findState: {
type: 'select',
label: '分类:',
label: '状态:',
value: 1,
config: {
data: paperStateQueryArr.map((v, i) => ({ value: i + 1, label: v })),

View File

@ -15,9 +15,13 @@
</el-menu-item>
<el-menu-item index="6" @click="clickMenu">
<img :src="ruleIcon" class="teachMenu">
<span class="teachMenuTitle" :style="{color: $route.path.includes('trainingManage')?'#5BDBFF': '#000'}">实训教学管理</span>
<span class="teachMenuTitle" :style="{color: $route.path.includes('trainingDesign')?'#5BDBFF': '#000'}">实训设计</span>
</el-menu-item>
<el-menu-item index="7" @click="clickMenu">
<img :src="ruleIcon" class="teachMenu">
<span class="teachMenuTitle" :style="{color: $route.path.includes('trainingManage')?'#5BDBFF': '#000'}">实训管理</span>
</el-menu-item>
<el-menu-item index="8" @click="clickMenu">
<img :src="lessonIcon" class="teachMenu">
<span class="teachMenuTitle" :style="{color: $route.path.includes('theoryManage')?'#5BDBFF': '#000'}">理论题目管理</span>
</el-menu-item>
@ -95,8 +99,10 @@ export default {
} else if (val.index === '5') {
this.$router.replace('/teaching/organization/studentManage');
} else if (val.index === '6') {
this.$router.push('/teaching/design/home');
this.$router.push('/teaching/organization/trainingDesign'); //
} else if (val.index === '7') {
this.$router.replace('/teaching/organization/trainingManage'); //
} else if (val.index === '8') {
this.$router.replace('/teaching/organization/theoryManage');
}
},

View File

@ -0,0 +1,5 @@
<template>
<div style="width: 100%;height: 100%;">
{{}}
</div>
</template>

View File

@ -0,0 +1,148 @@
<template>
<div style="width: 100%;height: 100%;">
<QueryListPage ref="queryListPage" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
</template>
<script>
import {queryMapListByUser} from '@/api/jmap/map';
import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig';
import { getPublishSingleList, getPublishScenesList } from '@/api/jmap/training';
// getPublishTrainingDetail, loadPublishTraining,
export default {
name:'TrainingManage',
data() {
return {
mapList:[],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '100px',
reset: true,
initLoadCallback: this.initLoadCallback,
queryObject: {
mapId: {
type: 'select',
label: '地图名称',
config: {
noClear:true,
data: []
}
},
trainingType: {
type: 'select',
label: '实训类型',
config: {
noClear:true,
data: [
{label: '单操实训', value: 'training'},
{label: '场景实训', value: 'scene'}
]
}
}
}
},
queryList:{
query: this.queryFunction,
selectCheckShow: false,
paginationHiden: true,
indexShow: true,
height: 500,
columns: [
{
title: this.$t('trainingManage.name'),
prop: 'name'
},
{
title: this.$t('trainingManage.description'),
prop: 'description'
},
{
title: this.$t('trainingManage.type'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.covertData(row); },
tagType: (row) => { return ''; }
},
{
title: this.$t('trainingManage.labelJson'),
prop: 'labelJson'
},
{
type: 'button',
title: this.$t('trainingManage.operate'),
width: '150',
buttons: [
{
name: '加载',
handleClick: this.loadScript,
type: 'primary',
showControl:(row) => { return row.id; }
}
]
}
]
}
};
},
created() {
queryMapListByUser().then(res=>{
this.mapList = [];
res.data.forEach(element => {
this.mapList.push({label:element.name, value:element.id});
});
this.queryForm.queryObject.mapId.config.data = [...this.mapList];
// this.queryForm.queryObject.mapId.config.default = this.mapList[0].value;
});
},
methods: {
initLoadCallback(form) {
if (!form.trainingType) {
form.trainingType = 'training';
}
// if (!form.mapId) {
// form.mapId = this.mapList[0].value;
// }
},
queryFunction(param) {
if (param.mapId) {
if (param.trainingType == 'training') {
return getPublishSingleList(param.mapId);
} else if (param.trainingType == 'scene') {
return getPublishScenesList(param.mapId);
}
} else {
return new Promise((resolve, reject)=>{
const result = {data:[]};
resolve(result);
});
}
},
covertData(row) {
const releaseReview = ConstConfig.ConstSelect.trainingType;
const lastData = Object.assign({}, row);
if (Cookies.get('user_lang') == 'en') {
releaseReview.forEach(function(element) {
const rolename = element.value;
if (lastData.type == rolename) {
lastData.type = element.enlabel;
}
});
} else {
releaseReview.forEach(function(element) {
const rolename = element.value;
if (lastData.type == rolename) {
lastData.type = element.label;
}
});
}
return lastData.type;
},
loadScript(index, data) {
}
}
};
</script>

View File

@ -15,6 +15,22 @@ export default {
components: {
Create
},
props: {
onlySelect: {
type: Boolean,
default: false
},
selectIds: {
type: Array,
default: () => {
return [];
}
},
tableHeight: {
type: String,
default: ''
}
},
data() {
return {
// PermissionTypeList: [],
@ -82,13 +98,21 @@ export default {
{
name: this.$t('global.edit'),
handleClick: this.handleEdit,
showControl: (row) => { return !this.onlySelect; },
type: ''
},
{
name: '选择',
handleClick: this.handleSelect,
showControl: (row) => { return this.onlySelect; },
isDisabled: this.selectDisabled,
type: ''
}
]
}
],
actions: [
{ text: this.$t('orderAuthor.createPermission'), handler: this.create }
{ text: this.$t('orderAuthor.createPermission'), handler: this.create, show: !this.onlySelect }
]
}
};
@ -96,8 +120,21 @@ export default {
created() {
this.getAllAbility();
if (this.tableHeight) {
this.queryList.height = this.tableHeight;
}
},
methods: {
selectDisabled(index, row) {
let s = false;
const findObj = this.selectIds.find(item => {
return item.permissionId == row.id;
});
if (findObj) {
s = true;
}
return s;
},
getAllAbility() {
getAllAbility().then(res => {
res.data && res.data.forEach(item => {
@ -130,6 +167,9 @@ export default {
handleEdit(index, row) {
this.$refs.create.doShow(row);
},
handleSelect(index, row) {
this.$emit('handleSelect', row);
},
create() {
this.$refs.create.doShow();
}
@ -137,8 +177,4 @@ export default {
};
</script>
<style lang="scss" scoped>
/deep/
.el-row .el-button+.el-button{
margin-top: 10px;
}
</style>

View File

@ -32,7 +32,7 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="标签" prop="tags">
<el-form-item label="分类" prop="tags">
<el-select multiple v-model="form.tags" @change="getQuestionAmount">
<el-option v-for="label in labels" :key="label" :label="label" :value="label"></el-option>
</el-select>
@ -40,12 +40,12 @@
<el-form-item label="题目数量" prop="amount">
<el-input-number
v-model="form.amount"
:precision="0"
:min="0"
style="width: calc(100% - 280px); float: left; margin-right: 10px;"
/>
<span v-if="this.form.type === 1" style="width: 190px; float: left;">
{{ $t('publish.allNumberTipOne') }} {{ topicNum }} {{ $t('publish.allNumberTipTwo') }}
{{ $t('publish.allNumberTipOne') }} {{ topicNum }} {{ $t('publish.allNumberTipTwo') }}, 剩余
{{ remainNum }}
</span>
</el-form-item>
<el-form-item :label="$t('publish.scorePerQuestion')" prop="score">
@ -64,7 +64,11 @@ import { getQuestionAmount } from '@/api/management/exam'
import { getLabelList } from '@/api/questionBank'
export default {
name: 'EditRule',
props: {},
props: {
ruleList: {
type: Array,
},
},
computed: {
types() {
return [{ value: 1, label: '理论题' }, { value: 2, label: '实训题' }]
@ -90,7 +94,7 @@ export default {
message(new Error(this.$t('publish.inputQuestionNumberError')))
} else if (!Number(value)) {
message(new Error(this.$t('publish.inputValidNumber')))
} else if (Number(value) > this.topicNum && this.form.type === 1) {
} else if (Number(value) > this.remainNum && this.form.type === 1) {
message(new Error(this.$t('publish.inputNumberError')))
} else {
message()
@ -115,6 +119,8 @@ export default {
},
labels: [],
topicNum: 0,
remainNum: 0,
index: -1,
dialogShow: false,
rules: {
type: [{ required: true, message: this.$t('publish.selectTestType'), trigger: 'change' }],
@ -137,22 +143,42 @@ export default {
this.$refs.form.resetFields()
if (detail) {
this.isEditMode = true
this.index = detail.index
this.form = {
type: detail.type,
subtype: detail.subtype,
amount: detail.amount,
score: detail.score,
id: detail.id || '',
tags: detail.tags
}
this.topicNum = detail.topicNum
this.remainNum = detail.remainNum
} else {
this.isEditMode = false
this.remainNum = 0
}
})
},
isDuplicated() {
const isDuplicated =
this.ruleList.length > 0 &&
this.ruleList.some(
rule =>
rule.type === this.form.type &&
rule.subtype === this.form.subtype &&
rule.tags.length === this.form.tags.length &&
rule.tags.every(tag => this.form.tags.includes(tag))
)
return isDuplicated
},
getQuestionAmount(e) {
if (!(this.form.type && this.form.subtype)) return
if (this.form.type === 2) return //
// if (this.isDuplicated()) {
// this.$message.warning(', ')
// return
// }
const param = {
orgId: this.$store.state.user.companyId,
groupType: this.form.type,
@ -160,7 +186,37 @@ export default {
tags: this.form.tags,
}
getQuestionAmount(param).then(resp => {
this.topicNum = resp.data
const num = resp.data
this.topicNum = num
const { type, subtype, tags } = this.form
if (this.ruleList.length > 0) {
const smallerRangeRules = this.ruleList.filter(
(rule, i) =>
rule.type === type &&
rule.subtype === subtype &&
rule.tags.length >= tags.length &&
(tags.every(tag => rule.tags.includes(tag)) || tags.length === 0) &&
(this.isEditMode ? this.index !== i : true) //
)
//()
const amount1 = smallerRangeRules.reduce((prev, curr) => prev + curr.amount, 0)
const largerRangeRules = this.ruleList.filter(
(rule, i) =>
rule.type === type &&
rule.subtype === subtype &&
rule.tags.length < tags.length &&
(rule.tags.every(tag => tags.includes(tag)) || rule.tags.length === 0) &&
(this.isEditMode ? this.index !== i : true)
)
//
const amount2 = largerRangeRules.reduce(
(prev, curr) => (curr.topicNum - curr.amount < prev ? curr.topicNum - curr.amount : prev),
num
)
this.remainNum = amount2 - amount1
} else {
this.remainNum = num
}
})
},
clearSubtype() {
@ -169,7 +225,17 @@ export default {
handleOk() {
this.$refs['form'].validate(valid => {
if (valid) {
this.$emit('submit', { ...this.form, topicNum: this.topicNum }, this.isEditMode)
if (this.ruleList.length > 0 && !this.isEditMode) {
if (this.isDuplicated()) {
this.$message.warning('与已有规则重复, 请重新选择')
return
}
}
this.$emit(
'submit',
{ ...this.form, topicNum: this.topicNum, remainNum: this.remainNum },
this.isEditMode
)
this.handleCancel()
}
})

View File

@ -19,23 +19,23 @@
<span>{{ subtypes[scope.row.subtype] }}</span>
</template>
</el-table-column>
<el-table-column prop="amount" label="题目数量" width="100">
<template slot-scope="scope">
<span>{{ scope.row.amount }}</span>
</template>
</el-table-column>
<el-table-column prop="score" :label="$t('publish.eachScore')" width="100" />
<el-table-column :label="$t('publish.totalScore')" width="90">
<template slot-scope="scope">
<span>{{ Number(scope.row.amount) * Number(scope.row.score) }}</span>
</template>
</el-table-column>
<el-table-column prop="amount" label="题目数量" width="100">
<template slot-scope="scope">
<span>{{ scope.row.amount }}</span>
</template>
</el-table-column>
<el-table-column label="题库题数">
<template slot-scope="scope">
<span>{{ scope.row.topicNum }}</span>
</template>
</el-table-column>
<el-table-column label="标签">
<el-table-column label="分类">
<template slot-scope="scope">
<el-tag v-for="tag in scope.row.tags" :key="tag">{{ tag }}</el-tag>
</template>
@ -47,7 +47,7 @@
</template>
</el-table-column>
</el-table>
<edit-rule @submit="handleRuleSubmit" ref="addRule" />
<edit-rule @submit="handleRuleSubmit" :ruleList="ruleList" ref="addRule" />
</div>
</template>
@ -105,6 +105,8 @@ export default {
amount: formData.amount,
score: formData.score,
topicNum: formData.topicNum,
remainNum: formData.remainNum,
tags: formData.tags,
}
if (isEdit) {
this.$set(this.ruleList, this.editingIndex, data)
@ -116,7 +118,7 @@ export default {
const index = data.$index
this.ruleList.splice(index, 1)
},
checkTotolScores() {
return this.currentTotalScore === this.examData.fullScore
},
@ -124,7 +126,7 @@ export default {
this.editingIndex = data.$index
const list = JSON.stringify(data.row)
const detail = JSON.parse(list)
this.$refs.addRule.show(detail)
this.$refs.addRule.show({ ...detail, index: data.$index })
},
getSummaries({ columns, data }) {
const sums = []
@ -142,9 +144,9 @@ export default {
return prev
}
}, 0)
} else if (index === 4) {
} else if (index === 3) {
const values = data.map(item => Number(item.amount) * Number(item.score))
this.currentTotalScore = sums[4] = values.reduce((prev, curr) => {
this.currentTotalScore = sums[3] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr

View File

@ -0,0 +1,203 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<PermissionList ref="list" :effective-type-list="EffectiveTypeList" :sub-type-list="subTypeList" />
</div>
</template>
<script>
import { listPermision, setPermissonInValid } from '@/api/userRulesManage';
import PermissionList from './permissionList';
export default {
name: 'UserRulesManage',
components: {
PermissionList
},
data() {
return {
PermissionTypeList: [],
belongForm: {},
EffectiveTypeList: [
{ value: '1', label: '有效'},
{ value: '2', label: '无效'}
],
subTypeList: [
{ value: 'user', label: '个人'},
{ value: 'org', label: '组织'}
],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
reset: true,
queryObject: {
named: {
type: 'text',
label: '主体名称'
},
subType: {
type: 'select',
label: '主体类型',
config: {
data: []
}
},
status: {
type: 'select',
label: this.$t('permission.statusType'),
config: {
data: []
}
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
defaultSort:{prop:'sortOrder', order:''},
columns: [
{
title: '主体名称',
prop: 'named'
},
{
title: this.$t('permission.nickName'),
prop: 'nickName'
},
{
title: this.$t('permission.permissionName'),
prop: 'permissionName'
},
{
title: '主体类型',
prop: 'subjectType',
width: '80',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.subjectType, this.subTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('permission.isForever'),
width: '80',
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: this.$t('permission.permissionTotal'),
width: '80',
prop: 'amount'
},
{
title: this.$t('permission.permissionRemains'),
width: '80',
prop: 'remains'
},
{
title:this.$t('global.startTime'),
prop: 'startTime',
width: '160'
},
{
title: this.$t('permission.endTime'),
prop: 'endTime',
width: '160'
},
{
title: this.$t('permission.permissionStatus'),
prop: 'status',
width: '80',
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'),
width: '200',
buttons: [
{
name: this.$t('orderAuthor.setupFailure'), //
handleClick: this.handleEfficacy,
showControl: (row) => { return row.status === '1'; },
type: 'warning'
},
{
name: '权限流向',
handleClick: this.handleRestoreList,
showControl: (row) => { return row.amount !== row.remains; },
type: ''
}
]
}
],
actions: [
]
}
};
},
mounted() {
this.loadInitData();
},
methods: {
loadInitData() {
this.EffectiveTypeList.forEach(elem => {
this.queryForm.queryObject.status.config.data.push(elem);
});
this.subTypeList.forEach(elem => {
this.queryForm.queryObject.subType.config.data.push(elem);
});
},
formatterDate(row, porpInfo) {
return row[porpInfo.property] ? row[porpInfo.property] : this.$t('global.perpetual');
},
handleRestoreList(index, row) {
this.$refs.list.doShow(index, row);
},
queryFunction(params) {
// params.distributeId = this.$route.query.distributeId;
return listPermision(params);
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
handleEfficacy(index, row) {
this.$confirm(this.$t('tip.modifyTheUserPermissionStatus'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
setPermissonInValid(row.id).then(res => {
this.$message.success(this.$t('tip.operationSuccessfully'));
this.reloadTable();
}).catch(() => {
this.$messageBox(this.$t('tip.operationFailed'));
this.reloadTable();
});
}).catch(() => { });
}
}
};
</script>
<style lang="scss" scoped>
</style>

View File

@ -0,0 +1,182 @@
<template>
<el-dialog v-dialogDrag title="权限流向" :visible.sync="dialogShow" width="1000px" :before-close="close">
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="close">{{ $t('map.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getPermissonInDistribute } from '@/api/userRulesManage';
export default {
name: 'PermissionList',
components: {
},
props: {
effectiveTypeList: {
required: true,
type: Array
},
subTypeList:{
required:true,
type:Array
}
},
data() {
return {
dialogShow: false,
id: '',
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '140px',
reset: true,
show: false,
queryObject: {
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
paginationHiden: true,
indexShow: true,
columns: [
{
title: '主体名称',
prop: 'named'
},
{
title: this.$t('permission.nickName'),
prop: 'nickName'
},
{
title: this.$t('permission.permissionName'),
prop: 'permissionName'
},
{
title: '主体类型',
prop: 'subjectType',
width: '80',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.subjectType, this.subTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('permission.isForever'),
prop: 'forever',
width: '80',
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: this.$t('permission.permissionTotal'),
width: '80',
prop: 'amount'
},
{
title: this.$t('permission.permissionRemains'),
width: '80',
prop: 'remains'
},
{
title:this.$t('global.startTime'),
prop: 'startTime',
width: '160'
},
{
title: this.$t('permission.endTime'),
prop: 'endTime',
width: '160'
},
{
title: this.$t('permission.permissionStatus'),
prop: 'status',
width: '80',
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'),
// buttons: [
// {
// name: '',
// handleClick: this.handleRestore,
// type: 'danger',
// showControl: (row) => {
// return row.status === '1';
// }
// }
// ]
// }
],
actions: [
]
}
};
},
methods: {
doShow(index, row) {
if (!row.id) { return; }
this.id = row.id;
this.dialogShow = true;
this.reloadTable();
},
close() {
this.id = '';
this.dialogShow = false;
},
// handleRestore(index, row) {
// this.$confirm('', this.$t('global.tips'), {
// confirmButtonText: this.$t('global.confirm'),
// cancelButtonText: this.$t('global.cancel'),
// type: 'warning'
// }).then(() => {
// putUserPermissionBackUser(row.id).then(resp => {
// this.reloadTable();
// this.$message.success(this.$t('tip.recoveryPrivilegesSuccessful'));
// }).catch(() => {
// this.$messageBox(this.$t('tip.recoveryPrivilegesFailed'));
// });
// }).catch(() => { });
// },
queryFunction() {
if (this.id) {
return getPermissonInDistribute(this.id);
}
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.draft {
width: 400px;
text-align: center;
margin: 20px auto;
}
</style>