|
@@ -20,12 +20,12 @@
|
|
|
class="plan-table">
|
|
|
<!-- :loading="loading" -->
|
|
|
<template slot="expandedRowRender" slot-scope="record">
|
|
|
- <div v-if="record.type === '巡检路线'" class="line-spot-container">
|
|
|
+ <div v-if="record.tasktype === '巡检路线'" class="line-spot-container">
|
|
|
<a-table
|
|
|
size="middle"
|
|
|
rowKey="id"
|
|
|
- :columns="columns"
|
|
|
- :dataSource="record.sonList"
|
|
|
+ :columns="spotColumns"
|
|
|
+ :dataSource="record.inspectLineVo.detailList"
|
|
|
:pagination="false"
|
|
|
:showHeader="false"
|
|
|
class="line-spot-table">
|
|
@@ -35,7 +35,7 @@
|
|
|
size="middle"
|
|
|
rowKey="id"
|
|
|
:columns="contentColumns"
|
|
|
- :dataSource="record.sonList"
|
|
|
+ :dataSource="record.inspectContentList"
|
|
|
:pagination="false"
|
|
|
class="spot-content-table">
|
|
|
<template slot="expandedRowRender" slot-scope="record">
|
|
@@ -57,12 +57,12 @@
|
|
|
</template>
|
|
|
</a-table>
|
|
|
</div>
|
|
|
- <div v-if="record.type === '巡检点'" class="spot-content-container">
|
|
|
+ <div v-if="record.tasktype === '巡检点'" class="spot-content-container">
|
|
|
<a-table
|
|
|
size="middle"
|
|
|
rowKey="id"
|
|
|
:columns="contentColumns"
|
|
|
- :dataSource="record.sonList"
|
|
|
+ :dataSource="record.inspectSpotVo.inspectContentList"
|
|
|
:pagination="false"
|
|
|
class="spot-content-table">
|
|
|
<template slot="expandedRowRender" slot-scope="record">
|
|
@@ -84,8 +84,8 @@
|
|
|
</template>
|
|
|
</a-table>
|
|
|
|
|
|
- <inspect-plan-modal-add-line ref="addLineRef" :selectData="inspectLineList" @ok="handleOk"></inspect-plan-modal-add-line>
|
|
|
- <inspect-plan-modal-add-spot ref="addSpotRef" :selectData="inspectSpotList" @ok="handleOk"></inspect-plan-modal-add-spot>
|
|
|
+ <inspect-plan-modal-add-line ref="addLineRef" :selectData="inspectLineList" @ok="handleLineOk"></inspect-plan-modal-add-line>
|
|
|
+ <inspect-plan-modal-add-spot ref="addSpotRef" :selectData="inspectSpotList" @ok="handleSpotOk"></inspect-plan-modal-add-spot>
|
|
|
</div>
|
|
|
</a-spin>
|
|
|
</template>
|
|
@@ -115,7 +115,6 @@
|
|
|
return {
|
|
|
inspectLineList: [],
|
|
|
inspectSpotList: [],
|
|
|
- addType: '巡检点',
|
|
|
// model:{
|
|
|
// },
|
|
|
labelCol: {
|
|
@@ -135,7 +134,7 @@
|
|
|
queryById: "/cmmsInspectPlan/cmmsInspectPlan/queryById",
|
|
|
queryTreeById: "/cmmsInspectPlan/cmmsInspectPlan/queryTreeById"
|
|
|
},
|
|
|
- tableData: [],
|
|
|
+ tableData: [], // 获取或页面展示的数据和格式
|
|
|
columns: [
|
|
|
// {
|
|
|
// title: '序号',
|
|
@@ -150,21 +149,36 @@
|
|
|
{
|
|
|
title:'巡检类型',
|
|
|
align:"center",
|
|
|
- dataIndex: 'type'
|
|
|
+ dataIndex: 'tasktype'
|
|
|
},
|
|
|
{
|
|
|
title:'名称',
|
|
|
align:"center",
|
|
|
- dataIndex: 'title',
|
|
|
- // dataIndex: 'inspectLineVo',
|
|
|
- // customRender:function (scope) {
|
|
|
- // return scope.linename
|
|
|
- // }
|
|
|
+ // dataIndex: 'title',
|
|
|
+ dataIndex: 'linename',
|
|
|
+ customRender:function (t,r,index) {
|
|
|
+ // console.log(t,r,index)
|
|
|
+ if(r.tasktype === '巡检路线'){
|
|
|
+ return r.inspectLineVo.linename
|
|
|
+ }
|
|
|
+ if(r.tasktype === '巡检点'){
|
|
|
+ return r.inspectSpotVo.contentname
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title:'编号',
|
|
|
align:"center",
|
|
|
- dataIndex: ''
|
|
|
+ ddataIndex: 'linecode',
|
|
|
+ customRender:function (t,r,index) {
|
|
|
+ // console.log(t,r,index)
|
|
|
+ if(r.tasktype === '巡检路线'){
|
|
|
+ return r.inspectLineVo.linecode
|
|
|
+ }
|
|
|
+ if(r.tasktype === '巡检点'){
|
|
|
+ return r.inspectSpotVo.contentcode
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
// {
|
|
|
// title:'是否必须执行',
|
|
@@ -174,9 +188,35 @@
|
|
|
{
|
|
|
title:'备注',
|
|
|
align:"center",
|
|
|
- dataIndex: 'remark'
|
|
|
+ dataIndex: 'remark',
|
|
|
+ customRender:function (t,r,index) {
|
|
|
+ // console.log(t,r,index)
|
|
|
+ if(r.tasktype === '巡检路线'){
|
|
|
+ return r.inspectLineVo.remark
|
|
|
+ }
|
|
|
+ if(r.tasktype === '巡检点'){
|
|
|
+ return r.inspectSpotVo.remark
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
],
|
|
|
+ spotColumns: [
|
|
|
+ {
|
|
|
+ title:'巡检点编号',
|
|
|
+ align:"center",
|
|
|
+ dataIndex: 'contentcode'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title:'巡检点名称',
|
|
|
+ align:"center",
|
|
|
+ dataIndex: 'contentname'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title:'备注',
|
|
|
+ align:"center",
|
|
|
+ dataIndex: 'remark'
|
|
|
+ },
|
|
|
+ ],
|
|
|
contentColumns: [
|
|
|
{
|
|
|
title:'巡检内容编号',
|
|
@@ -269,10 +309,10 @@
|
|
|
},
|
|
|
methods: {
|
|
|
setRowClassName(record){
|
|
|
- if(record.type === '巡检路线'){
|
|
|
+ if(record.tasktype === '巡检路线'){
|
|
|
return 'line-bg'
|
|
|
}
|
|
|
- if(record.type === '巡检点'){
|
|
|
+ if(record.tasktype === '巡检点'){
|
|
|
return 'spot-bg'
|
|
|
}
|
|
|
},
|
|
@@ -284,26 +324,77 @@
|
|
|
this.confirmLoading = true
|
|
|
// this.model = Object.assign({}, record);
|
|
|
getAction(this.url.queryById, {id: record.id}).then((res) => {
|
|
|
- this.tableData = res.result.sonList
|
|
|
- console.log(res)
|
|
|
- this.confirmLoading = false
|
|
|
+ if(res.success){
|
|
|
+ this.tableData = JSON.parse(JSON.stringify(res.result.taskList))
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ this.confirmLoading = false;
|
|
|
})
|
|
|
},
|
|
|
// 维护巡检路线
|
|
|
handleAddLine(){
|
|
|
+ this.inspectLineList = this.tableData.filter(item => item.tasktype === '巡检路线').map(i => i.inspectLineVo)
|
|
|
+ this.$refs.addLineRef.add();
|
|
|
+ this.$refs.addLineRef.title = "选择巡检路线";
|
|
|
+ },
|
|
|
+ handleLineOk(data){
|
|
|
+ // console.log(data) // 新获取的巡检路线数据
|
|
|
+ // console.log(this.inspectLineList) // 原来巡检路线数据
|
|
|
+ // 添加--获取最新巡检路线数据中原来巡检点没有的数据
|
|
|
+ var addData = data.filter(item => !this.inspectLineList.some(i=>i.id === item.id))
|
|
|
+ console.log(addLines)
|
|
|
+ var addLines = addData.map(item=>{
|
|
|
+ return {
|
|
|
+ inspectLineVo: item,
|
|
|
+ tasktype: '巡检路线'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.tableData.push(...addLines)
|
|
|
+ // 删除--原来的数据最新的数据中没有了
|
|
|
+ var delLines = this.inspectLineList.filter(item => !data.some(i=>i.id === item.id))
|
|
|
+ console.log('delLines', delLines)
|
|
|
+
|
|
|
+ delLines.forEach(item => {
|
|
|
+ var i = this.tableData.findIndex(t => t.tasktype === '巡检路线' && t.inspectLineVo.id === item.id)
|
|
|
+ this.tableData.splice(i, 1)
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(this.tableData)
|
|
|
},
|
|
|
// 维护巡检点
|
|
|
handleAddSpot(){
|
|
|
- this.addType = '巡检点'
|
|
|
+ this.inspectSpotList = this.tableData.filter(item => item.tasktype === '巡检点').map(i => i.inspectSpotVo)
|
|
|
this.$refs.addSpotRef.add();
|
|
|
this.$refs.addSpotRef.title = "选择巡检点";
|
|
|
+ console.log(this.inspectSpotList)
|
|
|
+ },
|
|
|
+ handleSpotOk(data){
|
|
|
+ // console.log(data) // 新获取的巡检点数据
|
|
|
+ // console.log(this.inspectSpotList) // 原来巡检点数据
|
|
|
+ // 添加--获取最新巡检点数据中原来巡检点没有的数据
|
|
|
+ var addData = data.filter(item => !this.inspectSpotList.some(i=>i.id === item.id))
|
|
|
+ console.log(addSpots)
|
|
|
+ var addSpots = addData.map(item=>{
|
|
|
+ return {
|
|
|
+ inspectSpotVo: item,
|
|
|
+ tasktype: '巡检点'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.tableData.push(...addSpots)
|
|
|
+ // 删除--原来的数据最新的数据中没有了
|
|
|
+ var delSpots = this.inspectSpotList.filter(item => !data.some(i=>i.id === item.id))
|
|
|
+ console.log('delSpots', delSpots)
|
|
|
+
|
|
|
+ delSpots.forEach(item => {
|
|
|
+ var i = this.tableData.findIndex(t => t.tasktype === '巡检点' && t.inspectSpotVo.id === item.id)
|
|
|
+ this.tableData.splice(i, 1)
|
|
|
+ });
|
|
|
+
|
|
|
+ // this.tableData.filter(item => item.tasktype === '巡检路线' || (item.tasktype === '巡检点' && !delSpots.some(i=>i.id === item.inspectSpotVo.id)))
|
|
|
+ console.log(this.tableData)
|
|
|
},
|
|
|
- handleOk(data){
|
|
|
- console.log(data)
|
|
|
- if(this.addType === '巡检点'){
|
|
|
- this.inspectSpotList = data
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
</script>
|