2020-03-13 18:19:04 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="joylink-card">
|
|
|
|
|
<div class="scriptHeader">
|
|
|
|
|
<div class="scriptList">IBP盘列表</div>
|
2020-10-09 17:27:46 +08:00
|
|
|
|
<el-button size="small" type="primary" class="createScript" style="margin-top: 5px" @click="handleCreate">{{ $t('scriptRecord.scriptCreate') }}</el-button>
|
|
|
|
|
<el-button size="small" type="primary" class="createScript" @click="createByPublish">发布数据创建</el-button>
|
2020-03-13 18:19:04 +08:00
|
|
|
|
</div>
|
2020-12-17 13:19:12 +08:00
|
|
|
|
<QueryListPage ref="queryListPage" :card-padding="50" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;" />
|
2020-03-13 18:19:04 +08:00
|
|
|
|
<create-ibp ref="createScript" :title="'创建数据'" @reloadTable="reloadTable" />
|
2020-04-24 11:25:30 +08:00
|
|
|
|
<create-ibp ref="modifyScript" :title="'修改数据'" @reloadTable="reloadTable" />
|
2020-10-09 17:27:46 +08:00
|
|
|
|
<copy-ibp ref="copyIbp" @reloadTable="reloadTable" />
|
2020-03-13 18:19:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-03-13 19:04:28 +08:00
|
|
|
|
// import Cookies from 'js-cookie';
|
2020-03-13 19:01:59 +08:00
|
|
|
|
import { getStationList } from '@/api/runplan';
|
2020-03-13 19:04:28 +08:00
|
|
|
|
// import ConstConfig from '@/scripts/ConstConfig';
|
2020-03-13 18:19:04 +08:00
|
|
|
|
import { postIbpPublish, getIbpAllList, deleteIbpInfo } from '@/api/ibp';
|
|
|
|
|
import CreateIbp from './create';
|
2020-10-09 17:27:46 +08:00
|
|
|
|
import CopyIbp from './copy';
|
2020-03-13 18:19:04 +08:00
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'ScriptDraft',
|
|
|
|
|
components: {
|
2020-10-09 17:27:46 +08:00
|
|
|
|
CreateIbp,
|
|
|
|
|
CopyIbp
|
2020-03-13 18:19:04 +08:00
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
pagerConfig: {
|
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
|
},
|
|
|
|
|
queryForm: {
|
|
|
|
|
labelWidth: '100px',
|
|
|
|
|
reset: true,
|
|
|
|
|
show:false
|
|
|
|
|
},
|
2020-03-13 19:01:59 +08:00
|
|
|
|
stationList: [],
|
2020-03-13 18:19:04 +08:00
|
|
|
|
queryList: {
|
|
|
|
|
query: this.queryFunction,
|
|
|
|
|
selectCheckShow: false,
|
|
|
|
|
indexShow: true,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
title: '关联站台',
|
2020-03-13 19:01:59 +08:00
|
|
|
|
prop: 'stationCode',
|
2020-03-13 18:19:04 +08:00
|
|
|
|
type: 'tag',
|
|
|
|
|
columnValue: (row) => { return this.covertData(row); },
|
|
|
|
|
tagType: (row) => { return ''; }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '创建时间',
|
|
|
|
|
prop: 'createTime'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'button',
|
|
|
|
|
title: this.$t('scriptRecord.operate'),
|
|
|
|
|
width: '400',
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
name: '修改基础信息',
|
|
|
|
|
handleClick: this.editInfo,
|
|
|
|
|
type: 'primary'
|
|
|
|
|
},
|
|
|
|
|
{
|
2020-03-16 11:02:33 +08:00
|
|
|
|
name: '绘图',
|
2020-03-13 18:19:04 +08:00
|
|
|
|
handleClick: this.handleModify,
|
|
|
|
|
type: 'primary'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '删除',
|
|
|
|
|
handleClick: this.deleteScript,
|
|
|
|
|
type: 'danger'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '发布',
|
|
|
|
|
handleClick: this.publishScript,
|
2020-09-16 17:53:33 +08:00
|
|
|
|
type: 'primary'
|
|
|
|
|
// showControl: (row) => { return !row.publish; }
|
2020-03-13 18:19:04 +08:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
'$route' () {
|
|
|
|
|
this.reloadTable();
|
2020-12-22 10:27:14 +08:00
|
|
|
|
this.getStationLists();
|
2020-03-13 18:19:04 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2020-03-13 19:01:59 +08:00
|
|
|
|
async created () {
|
2020-12-22 10:27:14 +08:00
|
|
|
|
this.getStationLists();
|
2020-03-13 19:01:59 +08:00
|
|
|
|
},
|
2020-03-13 18:19:04 +08:00
|
|
|
|
methods: {
|
2020-12-22 10:27:14 +08:00
|
|
|
|
async getStationLists() {
|
|
|
|
|
try {
|
|
|
|
|
const res = await getStationList(this.$route.params.mapId);
|
|
|
|
|
this.stationList = [];
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
res.data.forEach(station => {
|
|
|
|
|
const param = {
|
|
|
|
|
name: station.name,
|
|
|
|
|
code: station.code
|
|
|
|
|
};
|
|
|
|
|
this.stationList.push(param);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
},
|
2020-03-13 18:19:04 +08:00
|
|
|
|
queryFunction(params) {
|
2020-03-13 19:01:59 +08:00
|
|
|
|
const param = {
|
|
|
|
|
...params,
|
|
|
|
|
mapId: this.$route.params.mapId,
|
|
|
|
|
stationCode: ''
|
|
|
|
|
};
|
|
|
|
|
return getIbpAllList(param);
|
2020-03-13 18:19:04 +08:00
|
|
|
|
},
|
|
|
|
|
reloadTable() {
|
|
|
|
|
if (this.queryList && this.queryList.reload) {
|
|
|
|
|
this.queryList.reload();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
covertData(row) {
|
2020-12-17 13:19:12 +08:00
|
|
|
|
if (!row.stationCode) {
|
|
|
|
|
return '公共数据';
|
|
|
|
|
}
|
2020-03-13 19:01:59 +08:00
|
|
|
|
const staitonlist = this.stationList.filter(element => {
|
|
|
|
|
return row.stationCode == element.code;
|
|
|
|
|
});
|
2020-03-16 14:47:59 +08:00
|
|
|
|
if (staitonlist.length) {
|
|
|
|
|
return staitonlist[0].name;
|
|
|
|
|
} else {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
2020-03-13 18:19:04 +08:00
|
|
|
|
},
|
|
|
|
|
// 进入绘图数据
|
|
|
|
|
handleModify(index, row) {
|
2020-03-16 11:02:33 +08:00
|
|
|
|
const query = { mapId: this.$route.params.mapId, stationCode: row.stationCode, ibpId: row.id };
|
2020-03-13 18:19:04 +08:00
|
|
|
|
this.$router.push({ path: `/design/ibp/edit`, query: query });
|
|
|
|
|
},
|
|
|
|
|
// 更新
|
|
|
|
|
editInfo(index, row) {
|
2020-03-13 19:01:59 +08:00
|
|
|
|
this.$refs.modifyScript.doShow(row);
|
2020-03-13 18:19:04 +08:00
|
|
|
|
},
|
|
|
|
|
// 创建
|
|
|
|
|
handleCreate() {
|
|
|
|
|
this.$refs.createScript.doShow(null);
|
|
|
|
|
},
|
|
|
|
|
// 发布
|
|
|
|
|
publishScript(index, row) {
|
|
|
|
|
this.$confirm('您确定发布,此条IBP盘数据', this.$t('global.tips'), {
|
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
postIbpPublish(row.id).then(response => {
|
|
|
|
|
this.$message.success('发布成功');
|
|
|
|
|
this.reloadTable();
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.$messageBox('发布失败');
|
|
|
|
|
});
|
|
|
|
|
}).catch(() => { });
|
|
|
|
|
},
|
|
|
|
|
// 删除此条数据
|
|
|
|
|
deleteScript(index, row) {
|
|
|
|
|
this.$confirm('您确定是否删除,此条IBP盘数据', this.$t('global.tips'), {
|
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
deleteIbpInfo(row.id).then(response => {
|
|
|
|
|
this.$message.success('删除成功');
|
|
|
|
|
this.reloadTable();
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.$messageBox('删除失败');
|
|
|
|
|
});
|
|
|
|
|
}).catch(() => { });
|
2020-10-09 17:27:46 +08:00
|
|
|
|
},
|
|
|
|
|
createByPublish() {
|
|
|
|
|
this.$refs.copyIbp.doShow(null);
|
2020-03-13 18:19:04 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
|
.joylink-card{
|
|
|
|
|
height: 100%;
|
|
|
|
|
overflow: auto;
|
|
|
|
|
}
|
|
|
|
|
.createScript{
|
|
|
|
|
float: right;
|
|
|
|
|
margin-right:20px;
|
|
|
|
|
}
|
|
|
|
|
.scriptHeader{
|
|
|
|
|
display:inline-block;margin-top:40px;width: 90%;margin-left:5%;
|
|
|
|
|
}
|
|
|
|
|
.scriptList{
|
|
|
|
|
display:inline-block;padding:7px 0px
|
|
|
|
|
}
|
|
|
|
|
/deep/.el-button+.el-button {
|
|
|
|
|
margin-left: 5px;
|
|
|
|
|
margin-top: 5px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|