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

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 { getDimUserList } from '@/api/management/user';
import { getPublishMapList } from '@/api/jmap/map';
import { getCommodityMapProduct } from '@/api/management/mapprd';
export default {
name: 'UsersTrainingAdd',
@ -35,7 +34,6 @@ export default {
duration: ''
},
LessonList: [],
mapPrdList: [],
UserList: [],
UserLoading: false
};
@ -51,7 +49,7 @@ export default {
const form = {
labelWidth: '120px',
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: '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' }
@ -131,21 +129,6 @@ export default {
prdSelect(item) {
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) {
this.dialogVisible = true;
},

View File

@ -8,7 +8,6 @@
<script>
import { getSimulationList, deleteSimulationStats } from '@/api/simulation';
import { getPublishLessonList } from '@/api/jmap/lesson';
import UsersTrainingEdit from './edit';
import UsersTrainingAdd from './add';
@ -21,7 +20,6 @@ export default {
data() {
return {
examResultList: [],
LessonList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
@ -73,7 +71,7 @@ export default {
type: 'button',
title: this.$t('global.operate'),
width: '250',
hide: (row) => { return !row.fake; },
showControl: (row) => { return !row.fake; },
buttons: [
{
name: this.$t('global.edit'),
@ -97,19 +95,8 @@ export default {
};
},
created() {
this.loadInitData();
},
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() {
this.$refs.add.show();
},

View File

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

View File

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