rt-sim-training-client/src/views/publish/runPlanCommon/index.vue

120 lines
2.8 KiB
Vue
Raw Normal View History

2019-07-26 13:32:43 +08:00
<template>
2019-08-08 14:32:32 +08:00
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
2019-07-26 13:32:43 +08:00
</template>
<script>
2019-08-08 14:32:32 +08:00
import { superAdmin } from '@/router';
import { getRunPlanLoadList, runPlanTemplateList } from '@/api/runplan';
import { UrlConfig } from '@/router/index';
2019-07-26 13:32:43 +08:00
2019-08-08 14:32:32 +08:00
export default {
name: 'RunPlanCommon',
data() {
return {
skinStyleList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '140px',
reset: true,
queryObject: {
mapName: {
type: 'text',
label: '地图名称'
},
runPlanName: {
type: 'text',
label: '运行图名称'
}
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '地图名称',
prop: 'mapName'
},
{
title: '运行图名称',
prop: 'runPlanName'
},
{
type: 'button',
title: '操作',
width: '350',
hide: () => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; },
buttons: [
// {
// name: '删除',
// handleClick: this.handleDelete,
// type: 'danger',
// },
{
name: '预览',
handleClick: this.handleView,
type: ''
}
]
}
],
actions: [
{ text: '创建', btnCode: 'employee_insert', handler: this.handleCreateCommonPlan }
]
},
2019-07-26 13:32:43 +08:00
2019-08-08 14:32:32 +08:00
currentModel: {}
};
},
methods: {
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
const value = converFormat[0];
const label = converFormat[1];
for (let i = 0; i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
queryFunction(params) {
params['userId'] = '';
return getRunPlanLoadList(params);
},
handleCreateCommonPlan() {
this.$router.push({ path: `${UrlConfig.publish.runPlanCommon}/add` });
},
// 删除
// handleDelete(index, row) {
// this.$confirm('此操作将删除此通用运行图, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
2019-07-26 13:32:43 +08:00
2019-08-08 14:32:32 +08:00
// }).catch(() => { })
// },
// 预览
handleView(index, row) {
runPlanTemplateList({ pageSize: 10000 }).then(resp => {
const list = resp.data.list || [];
const index = list.findIndex(elem => { return list.id == row.templateId; });
if (index >= 0) {
this.$router.push({ path: `${UrlConfig.publish.runPlanView}/common`, query: { skinStyle: list[index].skinStyle, planId: list[index].id } });
}
});
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>