Merge branch 'dev' of https://git.cloud.tencent.com/joylink/jl-nclient into dev
This commit is contained in:
commit
d54ed0329b
@ -3,7 +3,7 @@
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
<edit ref="edit" :map-list="mapList" :permission-type-list="PermissionTypeList" @refresh="reloadTable" />
|
||||
<create ref="create" :map-list="mapList" @refresh="reloadTable" />
|
||||
<detail ref="detail" :permission-type-list="PermissionTypeList"/>
|
||||
<detail ref="detail" :permission-type-list="PermissionTypeList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -16,11 +16,16 @@ export default {
|
||||
name: 'Author',
|
||||
components: {
|
||||
},
|
||||
props:{
|
||||
permissionTypeList:{
|
||||
required:true,
|
||||
type:Array
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
id: '',
|
||||
PermissionTypeList: [],
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
@ -45,7 +50,7 @@ export default {
|
||||
title: this.$t('orderAuthor.permissionType'),
|
||||
prop: 'type',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']); },
|
||||
columnValue: (row) => { return this.$convertField(row.type, this.permissionTypeList, ['value', 'label']); },
|
||||
tagType: (row) => { return ''; }
|
||||
}
|
||||
],
|
||||
@ -54,17 +59,7 @@ export default {
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.loadInitData();
|
||||
},
|
||||
methods: {
|
||||
loadInitData() {
|
||||
this.$Dictionary.permissionType().then(list => {
|
||||
this.$convertList(list, this.PermissionTypeList, elem => {
|
||||
return true;
|
||||
});
|
||||
});
|
||||
},
|
||||
doShow(id) {
|
||||
this.id = id;
|
||||
this.dialogShow = true;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
<detail ref="detail" />
|
||||
<detail ref="detail" :permission-type-list="PermissionTypeList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -50,7 +50,6 @@ 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: {
|
||||
|
@ -16,185 +16,186 @@ import OnceGenerate from './generate';
|
||||
import createMapSystem from './create';
|
||||
|
||||
export default {
|
||||
name: 'SystemGenerate',
|
||||
components: {
|
||||
OnceGenerate,
|
||||
createMapSystem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
prdTypeList: [],
|
||||
mapId: '',
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '100px',
|
||||
reset: true,
|
||||
queryObject: {
|
||||
mapId: {
|
||||
type: 'select',
|
||||
label: this.$t('systemGenerate.map'),
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
},
|
||||
'name': {
|
||||
type: 'text',
|
||||
label: this.$t('systemGenerate.name')
|
||||
},
|
||||
'type': {
|
||||
type: 'select',
|
||||
label: this.$t('systemGenerate.type'),
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('systemGenerate.name'),
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: this.$t('systemGenerate.type'),
|
||||
type: 'tag',
|
||||
prop: 'type',
|
||||
columnValue: (row) => { return this.$convertField(row.type, this.prdTypeList, ['value', 'label']); },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
title: this.$t('systemGenerate.mapName'),
|
||||
type: 'tag',
|
||||
prop: 'mapName',
|
||||
columnValue: (row) => { return row.mapName; },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
title: this.$t('systemGenerate.prdName'),
|
||||
prop: 'prdName'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '400',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('systemGenerate.updateData'),
|
||||
handleClick: this.updateData,
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: this.$t('systemGenerate.deleteData'),
|
||||
handleClick: this.deleteData,
|
||||
type: 'danger',
|
||||
showControl: (row) => { return Boolean(row.customized); }
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{ text: this.$t('systemGenerate.commission'), handler: this.handleAdd },
|
||||
{ text: this.$t('systemGenerate.generate'), handler: this.generate }
|
||||
]
|
||||
}
|
||||
name: 'SystemGenerate',
|
||||
components: {
|
||||
OnceGenerate,
|
||||
createMapSystem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
prdTypeList: [],
|
||||
mapList:[],
|
||||
mapId: '',
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '100px',
|
||||
reset: true,
|
||||
queryObject: {
|
||||
mapId: {
|
||||
type: 'select',
|
||||
label: this.$t('systemGenerate.map'),
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
},
|
||||
'name': {
|
||||
type: 'text',
|
||||
label: this.$t('systemGenerate.name')
|
||||
},
|
||||
'type': {
|
||||
type: 'select',
|
||||
label: this.$t('systemGenerate.type'),
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('systemGenerate.name'),
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: this.$t('systemGenerate.type'),
|
||||
type: 'tag',
|
||||
prop: 'type',
|
||||
columnValue: (row) => { return this.$convertField(row.type, this.prdTypeList, ['value', 'label']); },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
title: this.$t('systemGenerate.mapName'),
|
||||
type: 'tag',
|
||||
prop: 'mapName',
|
||||
columnValue: (row) => { return row.mapName; },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
title: this.$t('systemGenerate.prdName'),
|
||||
prop: 'prdName'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '400',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('systemGenerate.updateData'),
|
||||
handleClick: this.updateData,
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: this.$t('systemGenerate.deleteData'),
|
||||
handleClick: this.deleteData,
|
||||
type: 'danger',
|
||||
showControl: (row) => { return Boolean(row.customized); }
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{ text: this.$t('systemGenerate.commission'), handler: this.handleAdd },
|
||||
{ text: this.$t('systemGenerate.generate'), handler: this.generate }
|
||||
]
|
||||
}
|
||||
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
height() {
|
||||
return this.$store.state.app.height - 50;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadInitData();
|
||||
},
|
||||
methods: {
|
||||
updateData(index, row) {
|
||||
getSubSystemInfo(row.id).then(response => {
|
||||
this.$refs.modifyMapSystem.doShow(response.data);
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.getSubSystemInfoFail'));
|
||||
});
|
||||
},
|
||||
deleteData(index, row) {
|
||||
this.$confirm(this.$t('systemGenerate.deleteMapSystemTip'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteSubSystem(row.id).then(response => {
|
||||
this.$message.success(this.$t('systemGenerate.deleteMapSystemSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.deleteMapSystemFail'));
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
handleCreate(data) {
|
||||
delete data.id;
|
||||
createMapSubSystem(data).then(response => {
|
||||
this.$message.success(this.$t('systemGenerate.createMapSystemSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.createMapSystemFail'));
|
||||
});
|
||||
},
|
||||
handleModify(data) {
|
||||
const datainfo={'name': data.name};
|
||||
updateSubSystem(data.id, datainfo).then(response => {
|
||||
this.$message.success(this.$t('systemGenerate.updateMapSystemSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.updateMapSystemFail'));
|
||||
});
|
||||
},
|
||||
handleAdd() {
|
||||
this.$refs.createMapSystem.doShow();
|
||||
},
|
||||
reloadTable() {
|
||||
if (this.queryList && this.queryList.reload) {
|
||||
this.queryList.reload();
|
||||
}
|
||||
},
|
||||
async loadInitData() {
|
||||
try {
|
||||
// 获取地图
|
||||
this.mapList = [];
|
||||
const res = await listPublishMap();
|
||||
this.allMapList=res.data;
|
||||
res.data.forEach(elem => {
|
||||
this.queryForm.queryObject.mapId.config.data.push({ value: elem.id, label: elem.name });
|
||||
});
|
||||
const productTypeList=ConstConfig.ConstSelect.productType;
|
||||
this.prdTypeList=Cookies.get('user_lang')=='en'
|
||||
?productTypeList.map(elem => { return { value: elem.value, label: elem.enlabel }; })
|
||||
:productTypeList.map(elem => { return { value: elem.value, label: elem.label }; });
|
||||
this.queryForm.queryObject.type.config.data=this.prdTypeList;
|
||||
} catch (error) {
|
||||
console.error(error, '获取发布地图');
|
||||
}
|
||||
},
|
||||
generate() {
|
||||
this.$refs.generate.doShow();
|
||||
},
|
||||
generateMapSystem(data) {
|
||||
generateMapSystem(data.mapId).then(response => {
|
||||
this.reloadTable();
|
||||
this.$message.success(this.$t('systemGenerate.generateSuccess'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.generateFail'));
|
||||
});
|
||||
},
|
||||
queryFunction(params) {
|
||||
return getMapSystemPageList(params);
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
height() {
|
||||
return this.$store.state.app.height - 50;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadInitData();
|
||||
},
|
||||
methods: {
|
||||
updateData(index, row) {
|
||||
getSubSystemInfo(row.id).then(response => {
|
||||
this.$refs.modifyMapSystem.doShow(response.data);
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.getSubSystemInfoFail'));
|
||||
});
|
||||
},
|
||||
deleteData(index, row) {
|
||||
this.$confirm(this.$t('systemGenerate.deleteMapSystemTip'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteSubSystem(row.id).then(response => {
|
||||
this.$message.success(this.$t('systemGenerate.deleteMapSystemSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.deleteMapSystemFail'));
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
handleCreate(data) {
|
||||
delete data.id;
|
||||
createMapSubSystem(data).then(response => {
|
||||
this.$message.success(this.$t('systemGenerate.createMapSystemSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.createMapSystemFail'));
|
||||
});
|
||||
},
|
||||
handleModify(data) {
|
||||
const datainfo = {'name': data.name};
|
||||
updateSubSystem(data.id, datainfo).then(response => {
|
||||
this.$message.success(this.$t('systemGenerate.updateMapSystemSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.updateMapSystemFail'));
|
||||
});
|
||||
},
|
||||
handleAdd() {
|
||||
this.$refs.createMapSystem.doShow();
|
||||
},
|
||||
reloadTable() {
|
||||
if (this.queryList && this.queryList.reload) {
|
||||
this.queryList.reload();
|
||||
}
|
||||
},
|
||||
async loadInitData() {
|
||||
try {
|
||||
// 获取地图
|
||||
this.mapList = [];
|
||||
const res = await listPublishMap();
|
||||
this.allMapList = res.data;
|
||||
res.data.forEach(elem => {
|
||||
this.queryForm.queryObject.mapId.config.data.push({ value: elem.id, label: elem.name });
|
||||
});
|
||||
const productTypeList = ConstConfig.ConstSelect.productType;
|
||||
this.prdTypeList = Cookies.get('user_lang') == 'en'
|
||||
? productTypeList.map(elem => { return { value: elem.value, label: elem.enlabel }; })
|
||||
: productTypeList.map(elem => { return { value: elem.value, label: elem.label }; });
|
||||
this.queryForm.queryObject.type.config.data = this.prdTypeList;
|
||||
} catch (error) {
|
||||
console.error(error, '获取发布地图');
|
||||
}
|
||||
},
|
||||
generate() {
|
||||
this.$refs.generate.doShow();
|
||||
},
|
||||
generateMapSystem(data) {
|
||||
generateMapSystem(data.mapId).then(response => {
|
||||
this.reloadTable();
|
||||
this.$message.success(this.$t('systemGenerate.generateSuccess'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.generateFail'));
|
||||
});
|
||||
},
|
||||
queryFunction(params) {
|
||||
return getMapSystemPageList(params);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -18,159 +18,160 @@ import { getDimUserList } from '@/api/management/user';
|
||||
import AddTraining from './addTraining';
|
||||
|
||||
export default {
|
||||
name: 'UsersTrainingAdd',
|
||||
components: {
|
||||
AddTraining
|
||||
},
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
formModel: {
|
||||
lessonId: '',
|
||||
trainingId: '',
|
||||
trainingName: '',
|
||||
userId: '',
|
||||
userName: '',
|
||||
duration: ''
|
||||
},
|
||||
LessonList: [],
|
||||
UserList: [],
|
||||
UserLoading: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
form() {
|
||||
this.type === 'ADD';
|
||||
const form = {
|
||||
labelWidth: '150px',
|
||||
items: [
|
||||
{ prop: 'lessonId', label: this.$t('system.lessonName'), type: 'select', required: true, options: this.LessonList },
|
||||
{ prop: 'trainingName', label: this.$t('system.trainingName'), type: 'text', required: true, rightWidth: true, disabled: true, buttontip: this.$t('system.selectTraining'), buttonClick: this.buttonClick, placeholder: this.$t('rules.pleaseSelectTraining') },
|
||||
{ prop: 'userName', label: this.$t('system.userName'), type: 'complete', required: false, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: this.$t('system.pleaseInputNames') },
|
||||
{ prop: 'duration', label: this.$t('system.trainingTime'), type: 'text', required: true, rightWidth: true, message: 's' }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const crules = {
|
||||
lessonId: [
|
||||
{ required: true, message: this.$t('rules.pleaseInputLessonName'), trigger: 'change' }
|
||||
],
|
||||
trainingName: [
|
||||
{ required: true, message: this.$t('rules.pleaseSelectTraining'), trigger: 'change' }
|
||||
],
|
||||
userName: [
|
||||
{ required: true, message: this.$t('rules.userNameInput'), trigger: 'change' }
|
||||
],
|
||||
duration: [
|
||||
{ required: true, message: this.$t('rules.timeInput'), trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
return crules;
|
||||
},
|
||||
title() {
|
||||
return this.$t('system.createUserTraining');
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initLoadPage();
|
||||
},
|
||||
methods: {
|
||||
initLoadPage() {
|
||||
// 加载发布课程列表
|
||||
this.LessonList.length = 0;
|
||||
this.UserList.length = 0;
|
||||
getPublishLessonList().then(response => {
|
||||
const data = response.data;
|
||||
if (data && data.length) {
|
||||
data.forEach(elem => {
|
||||
this.LessonList.push({ value: elem.id, label: elem.name });
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 搜索查询input
|
||||
async querySearchAsync(queryString, cb) {
|
||||
// 根据queryString 查询用户 并显示
|
||||
const results = [];
|
||||
if (queryString) {
|
||||
try {
|
||||
const params = {
|
||||
fuzzyParam: queryString
|
||||
};
|
||||
const res = await getDimUserList(params);
|
||||
const list = res.data;
|
||||
list.forEach(item => {
|
||||
const value = {
|
||||
id: item.id,
|
||||
value: `${item.nickname}(${item.name})${item.mobile}`
|
||||
};
|
||||
results.push(value);
|
||||
});
|
||||
cb(results);
|
||||
} catch (error) {
|
||||
console.error(error, '查询用户list');
|
||||
cb(results);
|
||||
}
|
||||
} else {
|
||||
cb(results);
|
||||
}
|
||||
},
|
||||
prdSelect(item) {
|
||||
this.formModel.userId = item.id;
|
||||
},
|
||||
selectTrain(data) {
|
||||
this.formModel.trainingId = data.id;
|
||||
this.formModel.trainingName = data.name;
|
||||
},
|
||||
buttonClick() {
|
||||
if (this.formModel.lessonId) {
|
||||
this.$refs.addTraining.show(this.formModel.lessonId);
|
||||
} else {
|
||||
this.$message.error(this.$t('rules.selectTheCourseNameFirst'));
|
||||
}
|
||||
},
|
||||
show(data) {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
doSave() {
|
||||
const self = this;
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
self.save();
|
||||
});
|
||||
},
|
||||
save() {
|
||||
const self = this;
|
||||
if (this.formModel.userId) {
|
||||
addUserTraining(this.formModel).then(response => {
|
||||
self.$message.success(this.$t('system.addSuccess'));
|
||||
self.handleClose();
|
||||
self.$emit('reloadTable');
|
||||
}).catch(error => {
|
||||
self.$message.error(this.$t('error.addFailed') + error.message);
|
||||
});
|
||||
} else {
|
||||
self.$message.error(this.$t('rules.chooseUser'));
|
||||
}
|
||||
},
|
||||
handleClose(done) {
|
||||
this.formModel = {
|
||||
lessonId: '',
|
||||
trainingId: '',
|
||||
trainingName: '',
|
||||
userId: '',
|
||||
userName: '',
|
||||
duration: ''
|
||||
};
|
||||
this.dialogVisible = false;
|
||||
}
|
||||
}
|
||||
name: 'UsersTrainingAdd',
|
||||
components: {
|
||||
AddTraining
|
||||
},
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
formModel: {
|
||||
lessonId: '',
|
||||
trainingId: '',
|
||||
trainingName: '',
|
||||
userId: '',
|
||||
userName: '',
|
||||
duration: ''
|
||||
},
|
||||
LessonList: [],
|
||||
UserList: [],
|
||||
UserLoading: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
form() {
|
||||
this.type === 'ADD';
|
||||
const form = {
|
||||
labelWidth: '150px',
|
||||
items: [
|
||||
{ prop: 'lessonId', label: this.$t('system.lessonName'), type: 'select', required: true, options: this.LessonList },
|
||||
{ prop: 'trainingName', label: this.$t('system.trainingName'), type: 'text', required: true, rightWidth: true, disabled: true, buttontip: this.$t('system.selectTraining'), buttonClick: this.buttonClick, placeholder: this.$t('rules.pleaseSelectTraining') },
|
||||
{ prop: 'userName', label: this.$t('system.userName'), type: 'complete', required: false, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: this.$t('system.pleaseInputNames') },
|
||||
{ prop: 'duration', label: this.$t('system.trainingTime'), type: 'text', required: true, rightWidth: true, message: 's' }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const crules = {
|
||||
lessonId: [
|
||||
{ required: true, message: this.$t('rules.pleaseInputLessonName'), trigger: 'change' }
|
||||
],
|
||||
trainingName: [
|
||||
{ required: true, message: this.$t('rules.pleaseSelectTraining'), trigger: 'change' }
|
||||
],
|
||||
userName: [
|
||||
{ required: true, message: this.$t('rules.userNameInput'), trigger: 'change' }
|
||||
],
|
||||
duration: [
|
||||
{ required: true, message: this.$t('rules.timeInput'), trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
return crules;
|
||||
},
|
||||
title() {
|
||||
return this.$t('system.createUserTraining');
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initLoadPage();
|
||||
},
|
||||
methods: {
|
||||
initLoadPage() {
|
||||
// 加载发布课程列表
|
||||
this.LessonList.length = 0;
|
||||
this.UserList.length = 0;
|
||||
getPublishLessonList().then(response => {
|
||||
const data = response.data;
|
||||
if (data && data.length) {
|
||||
data.forEach(elem => {
|
||||
this.LessonList.push({ value: elem.id, label: elem.name });
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 搜索查询input
|
||||
async querySearchAsync(queryString, cb) {
|
||||
// 根据queryString 查询用户 并显示
|
||||
const results = [];
|
||||
if (queryString) {
|
||||
try {
|
||||
const params = {
|
||||
fuzzyParam: queryString
|
||||
};
|
||||
const res = await getDimUserList(params);
|
||||
const list = res.data;
|
||||
list.forEach(item => {
|
||||
const value = {
|
||||
id: item.id,
|
||||
value: `${item.nickname}(${item.name})${item.mobile}`
|
||||
};
|
||||
results.push(value);
|
||||
});
|
||||
cb(results);
|
||||
} catch (error) {
|
||||
console.error(error, '查询用户list');
|
||||
cb(results);
|
||||
}
|
||||
} else {
|
||||
cb(results);
|
||||
}
|
||||
},
|
||||
prdSelect(item) {
|
||||
this.formModel.userId = item.id;
|
||||
},
|
||||
selectTrain(data) {
|
||||
this.formModel.trainingId = data.id;
|
||||
this.formModel.trainingName = data.name;
|
||||
},
|
||||
buttonClick() {
|
||||
if (this.formModel.lessonId) {
|
||||
this.$refs.addTraining.show(this.formModel.lessonId);
|
||||
} else {
|
||||
this.$message.error(this.$t('rules.selectTheCourseNameFirst'));
|
||||
}
|
||||
},
|
||||
show(data) {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
doSave() {
|
||||
const self = this;
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
self.save();
|
||||
});
|
||||
},
|
||||
save() {
|
||||
const self = this;
|
||||
if (this.formModel.userId) {
|
||||
addUserTraining(this.formModel).then(response => {
|
||||
self.$message.success(this.$t('system.addSuccess'));
|
||||
self.handleClose();
|
||||
self.$emit('reloadTable');
|
||||
}).catch(error => {
|
||||
self.$message.error(this.$t('error.addFailed') + error.message);
|
||||
});
|
||||
} else {
|
||||
self.$message.error(this.$t('rules.chooseUser'));
|
||||
}
|
||||
},
|
||||
handleClose(done) {
|
||||
this.formModel = {
|
||||
lessonId: '',
|
||||
trainingId: '',
|
||||
trainingName: '',
|
||||
userId: '',
|
||||
userName: '',
|
||||
duration: ''
|
||||
};
|
||||
this.$refs.dataform.resetForm();
|
||||
this.dialogVisible = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -24,75 +24,64 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPublishLessonDetail } from '@/api/jmap/lesson';
|
||||
// getPublishLessonDetail
|
||||
import { getPublishLessonTree } from '@/api/jmap/lesson';
|
||||
|
||||
export default {
|
||||
name: 'AddTraining',
|
||||
props: {
|
||||
name: 'AddTraining',
|
||||
props: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisibles: false,
|
||||
title: this.$t('system.selectTraining'),
|
||||
treeData: [{
|
||||
children: [],
|
||||
name: ''
|
||||
}],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
training: {},
|
||||
disabled: true
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisibles: false,
|
||||
title: this.$t('system.selectTraining'),
|
||||
treeData: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
training: {},
|
||||
disabled: true
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
clickEvent(data) {
|
||||
if (data.trainingSelect) {
|
||||
this.training = {
|
||||
name: data.name,
|
||||
id: data.id
|
||||
};
|
||||
this.disabled = false;
|
||||
} else {
|
||||
this.disabled = true;
|
||||
}
|
||||
},
|
||||
async show(lessonId) {
|
||||
this.dialogVisibles = true;
|
||||
try {
|
||||
const res = await getPublishLessonDetail({ id: lessonId });
|
||||
this.treeData[0].children = res.data.chapters;
|
||||
this.treeData[0].name = res.data.name;
|
||||
this.treeData[0].children.forEach(ele => {
|
||||
ele.children = ele.trainingVos;
|
||||
ele.children.forEach(item => {
|
||||
item.trainingSelect = true;
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
doSave() {
|
||||
this.$emit('selectTrain', this.training);
|
||||
this.handleClose();
|
||||
},
|
||||
handleClose() {
|
||||
this.treeData = [{
|
||||
children: [],
|
||||
name: ''
|
||||
}];
|
||||
this.trainingId = '';
|
||||
this.training = {};
|
||||
this.dialogVisibles = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
clickEvent(data) {
|
||||
|
||||
if (data.type == 'Training') {
|
||||
this.training = {
|
||||
name: data.name,
|
||||
id: data.id
|
||||
};
|
||||
this.disabled = false;
|
||||
} else {
|
||||
this.disabled = true;
|
||||
}
|
||||
},
|
||||
async show(lessonId) {
|
||||
this.dialogVisibles = true;
|
||||
try {
|
||||
const res = await getPublishLessonTree(lessonId);
|
||||
this.treeData = res.data.tree;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
doSave() {
|
||||
this.$emit('selectTrain', this.training);
|
||||
this.handleClose();
|
||||
},
|
||||
handleClose() {
|
||||
this.treeData = [];
|
||||
this.trainingId = '';
|
||||
this.training = {};
|
||||
this.dialogVisibles = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user