用户实训统计,用户仿真统计 产品类型修改

This commit is contained in:
joylink_cuiweidong 2019-12-26 16:32:03 +08:00
parent 8e82ceab27
commit cd5e923c52
4 changed files with 216 additions and 246 deletions

View File

@ -14,7 +14,6 @@ import ConstConfig from '@/scripts/ConstConfig';
import { postSimulationStats } from '@/api/simulation'; import { postSimulationStats } from '@/api/simulation';
import { getDimUserList } from '@/api/management/user'; import { getDimUserList } from '@/api/management/user';
import { getPublishMapList } from '@/api/jmap/map'; import { getPublishMapList } from '@/api/jmap/map';
import { getCommodityMapProduct } from '@/api/management/mapprd';
export default { export default {
name: 'UsersTrainingAdd', name: 'UsersTrainingAdd',
@ -35,7 +34,6 @@ export default {
duration: '' duration: ''
}, },
LessonList: [], LessonList: [],
mapPrdList: [],
UserList: [], UserList: [],
UserLoading: false UserLoading: false
}; };
@ -51,7 +49,7 @@ export default {
const form = { const form = {
labelWidth: '120px', labelWidth: '120px',
items: [ items: [
{ prop: 'mapId', label: this.$t('system.mapName'), type: 'select', required: true, options: this.LessonList, change: true, onChange: this.mapChange, placeholder: this.$t('rules.mapInput') }, { prop: 'mapId', label: this.$t('system.mapName'), type: 'select', required: true, options: this.LessonList, placeholder: this.$t('rules.mapInput') },
{ prop: 'prdType', label: this.$t('system.productType'), type: 'select', required: true, options: this.prdTypeList, placeholder: this.$t('rules.productTypeInput') }, { prop: 'prdType', label: this.$t('system.productType'), type: 'select', required: true, options: this.prdTypeList, placeholder: this.$t('rules.productTypeInput') },
{ prop: 'userName', label: this.$t('system.userName'), type: 'complete', required: false, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: this.$t('system.pleaseInputNames') }, { 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.trainingUseTime'), type: 'text', rightWidth: true, required: true, message: 's' } { prop: 'duration', label: this.$t('system.trainingUseTime'), type: 'text', rightWidth: true, required: true, message: 's' }
@ -131,21 +129,6 @@ export default {
prdSelect(item) { prdSelect(item) {
this.formModel.userId = item.id; this.formModel.userId = item.id;
}, },
async mapChange(val) {
this.mapPrdList = [];
this.formModel.prdType = '';
try {
const res = await getCommodityMapProduct(val);
const data = res.data;
if (data && data.length) {
data.forEach(elem => {
this.mapPrdList.push({ value: elem.id, label: elem.name });
});
}
} catch (error) {
console.error(error);
}
},
show(data) { show(data) {
this.dialogVisible = true; this.dialogVisible = true;
}, },

View File

@ -8,7 +8,6 @@
<script> <script>
import { getSimulationList, deleteSimulationStats } from '@/api/simulation'; import { getSimulationList, deleteSimulationStats } from '@/api/simulation';
import { getPublishLessonList } from '@/api/jmap/lesson';
import UsersTrainingEdit from './edit'; import UsersTrainingEdit from './edit';
import UsersTrainingAdd from './add'; import UsersTrainingAdd from './add';
@ -21,7 +20,6 @@ export default {
data() { data() {
return { return {
examResultList: [], examResultList: [],
LessonList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
@ -73,7 +71,7 @@ export default {
type: 'button', type: 'button',
title: this.$t('global.operate'), title: this.$t('global.operate'),
width: '250', width: '250',
hide: (row) => { return !row.fake; }, showControl: (row) => { return !row.fake; },
buttons: [ buttons: [
{ {
name: this.$t('global.edit'), name: this.$t('global.edit'),
@ -97,19 +95,8 @@ export default {
}; };
}, },
created() { created() {
this.loadInitData();
}, },
methods: { methods: {
async loadInitData() {
debugger;
const response = await getPublishLessonList();
const data = response.data;
if (data && data.length) {
data.forEach(elem => {
this.LessonList.push({ value: elem.prdId, name: elem.name });
});
}
},
createTraining() { createTraining() {
this.$refs.add.show(); this.$refs.add.show();
}, },

View File

@ -11,95 +11,95 @@
<script> <script>
import { putUserTraining } from '@/api/jmap/training'; import { putUserTraining } from '@/api/jmap/training';
export default { export default {
name: 'UsersTrainingEdit', name: 'UsersTrainingEdit',
props: { props: {
type: { type: {
type: String, type: String,
required: true required: true
} }
}, },
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
formModel: { formModel: {
id: '', id: '',
lessonName: '', lessonName: '',
userName: '', userName: '',
trainingName: '', trainingName: '',
duration: '' duration: ''
// trainingCount: '', // trainingCount: '',
} }
}; };
}, },
computed: { computed: {
form() { form() {
this.type === 'ADD'; this.type === 'ADD';
const form = { const form = {
labelWidth: '100px', labelWidth: '100px',
items: [ items: [
{ prop: 'lessonName', label: this.$t('system.lessonName'), type: 'text', required: false, disabled: true }, { prop: 'lessonName', label: this.$t('system.lessonName'), type: 'text', required: false, disabled: true },
{ prop: 'trainingName', label: this.$t('system.trainingName'), type: 'text', required: true, disabled: true }, { prop: 'trainingName', label: this.$t('system.trainingName'), type: 'text', required: true, disabled: true },
{ prop: 'userName', label: this.$t('system.userName'), type: 'text', required: true, disabled: true }, { prop: 'userName', label: this.$t('system.userName'), type: 'text', required: true, disabled: true },
{ prop: 'duration', label: this.$t('system.trainingTime'), type: 'text', required: true, rightWidth: true, message: 's' } { prop: 'duration', label: this.$t('system.trainingTime'), type: 'text', required: true, rightWidth: true, message: 's' }
] ]
}; };
return form; return form;
}, },
rules() { rules() {
const crules = { const crules = {
duration: [ duration: [
{ required: true, message: this.$t('rules.timeInput'), trigger: 'blur' } { required: true, message: this.$t('rules.timeInput'), trigger: 'blur' }
] ]
}; };
return crules; return crules;
}, },
title() { title() {
return this.$t('system.editTrainingDetail'); return this.$t('system.editTrainingDetail');
} }
}, },
methods: { methods: {
show(data) { show(data) {
this.dialogVisible = true; this.dialogVisible = true;
if (data && data.id) { if (data && data.id) {
this.formModel = { this.formModel = {
id: data.id, id: data.id,
lessonName: data.lessonName, lessonName: data.lessonName,
userName: data.userName, userName: data.userName,
trainingName: data.trainingName, trainingName: data.trainingName,
duration: data.duration duration: data.duration
}; };
} }
}, },
doSave() { doSave() {
const self = this; const self = this;
this.$refs.dataform.validateForm(() => { this.$refs.dataform.validateForm(() => {
self.update(); self.update();
}); });
}, },
update() { update() {
const self = this; const self = this;
const param = { const param = {
id: this.formModel.id, id: this.formModel.id,
duration: this.formModel.duration duration: this.formModel.duration
}; };
putUserTraining(param).then(response => { putUserTraining(param).then(response => {
self.$message.success(this.$t('system.updateSuccess')); self.$message.success(this.$t('system.updateSuccess'));
self.handleClose(); self.handleClose();
self.$emit('reloadTable'); self.$emit('reloadTable');
}).catch(error => { }).catch(error => {
self.$message.error(`${this.$t('error.updateFailed')}: ${error.message}`); self.$message.error(`${this.$t('error.updateFailed')}: ${error.message}`);
}); });
}, },
handleClose(done) { handleClose(done) {
this.formModel = { this.formModel = {
id: '', id: '',
lessonName: '', lessonName: '',
userName: '', userName: '',
trainingName: '', trainingName: '',
duration: '' duration: ''
}; };
this.dialogVisible = false; this.dialogVisible = false;
} }
} }
}; };
</script> </script>

View File

@ -11,134 +11,134 @@ import { getTrainingList, deleteUserTraining } from '@/api/jmap/training';
import UsersTrainingEdit from './edit'; import UsersTrainingEdit from './edit';
import UsersTrainingAdd from './add'; import UsersTrainingAdd from './add';
export default { export default {
name: 'UserTrainingEdit', name: 'UserTrainingEdit',
components: { components: {
UsersTrainingEdit, UsersTrainingEdit,
UsersTrainingAdd UsersTrainingAdd
}, },
data() { data() {
return { return {
examResultList: [], examResultList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
labelWidth: '120px', labelWidth: '120px',
reset: true, reset: true,
queryObject: { queryObject: {
trainingName: { trainingName: {
type: 'text', type: 'text',
label: this.$t('system.trainingName') label: this.$t('system.trainingName')
}, },
userName: { userName: {
type: 'text', type: 'text',
label: this.$t('system.userName') label: this.$t('system.userName')
} }
} }
}, },
queryList: { queryList: {
query: getTrainingList, query: getTrainingList,
selectCheckShow: false, selectCheckShow: false,
indexShow: true, indexShow: true,
columns: [ columns: [
{ {
title: this.$t('system.userName'), title: this.$t('system.userName'),
prop: 'userName' prop: 'userName'
}, },
{ {
title: this.$t('global.mobile'), title: this.$t('global.mobile'),
prop: 'userMobile' prop: 'userMobile'
}, },
{ {
title: this.$t('system.lessonName'), title: this.$t('system.lessonName'),
prop: 'lessonName' prop: 'lessonName'
}, },
{ {
title: this.$t('system.trainingUseTime'), title: this.$t('system.trainingUseTime'),
prop: 'duration', prop: 'duration',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.computation(row.duration); }, columnValue: (row) => { return this.computation(row.duration); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{ {
title: this.$t('system.trainingName'), title: this.$t('system.trainingName'),
prop: 'trainingName' prop: 'trainingName'
}, },
{ {
type: 'button', type: 'button',
title: this.$t('global.operate'), title: this.$t('global.operate'),
width: '250', width: '250',
buttons: [ buttons: [
{ {
name: this.$t('global.edit'), name: this.$t('global.edit'),
handleClick: this.edit, handleClick: this.edit,
showControl: (row) => { return row.fake != '0'; } showControl: (row) => { return row.fake != '0'; }
}, },
{ {
name: this.$t('global.delete'), name: this.$t('global.delete'),
handleClick: this.handleDelete, handleClick: this.handleDelete,
type: 'danger', type: 'danger',
showControl: (row) => { return row.fake != '0'; } showControl: (row) => { return row.fake != '0'; }
} }
] ]
} }
], ],
actions: [ actions: [
{ text: this.$t('global.add'), handler: this.createTraining } { text: this.$t('global.add'), handler: this.createTraining }
] ]
}, },
currentModel: {} currentModel: {}
}; };
}, },
created() { created() {
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
loadInitData() { loadInitData() {
}, },
createTraining() { createTraining() {
this.$refs.add.show(); this.$refs.add.show();
}, },
computation(fieldValue) { computation(fieldValue) {
if (fieldValue) { if (fieldValue) {
const f = parseInt(fieldValue / 60); const f = parseInt(fieldValue / 60);
const s = fieldValue % 60; const s = fieldValue % 60;
if (f > 0) { if (f > 0) {
return `${f} ${this.$t('system.minute')} ${s} ${this.$t('system.second')}`; return `${f} ${this.$t('system.minute')} ${s} ${this.$t('system.second')}`;
} else { } else {
return `${s} ${this.$t('system.second')}`; return `${s} ${this.$t('system.second')}`;
} }
} }
}, },
// //
edit(index, row) { edit(index, row) {
this.$refs.edit.show(row); this.$refs.edit.show(row);
}, },
// //
handleDelete(index, row) { handleDelete(index, row) {
this.$confirm(this.$t('system.wellDelExamResult'), this.$t('global.tips'), { this.$confirm(this.$t('system.wellDelExamResult'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'), confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'), cancelButtonText: this.$t('global.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
deleteUserTraining(row.id).then(response => { deleteUserTraining(row.id).then(response => {
this.$message.success(this.$t('system.deleteSuccess')); this.$message.success(this.$t('system.deleteSuccess'));
this.reloadTable(); this.reloadTable();
}).catch(() => { }).catch(() => {
this.reloadTable(); this.reloadTable();
this.$messageBox(this.$t('error.deleteFailed')); this.$messageBox(this.$t('error.deleteFailed'));
}); });
}); });
}, },
reloadTable() { reloadTable() {
this.queryList.reload(); this.queryList.reload();
} }
} }
}; };
</script> </script>