|
|
|
|
@ -20,7 +20,7 @@
|
|
|
|
|
>
|
|
|
|
|
<Button type="primary" style="margin-left: 10px" @click="getList">查询</Button>
|
|
|
|
|
<Button
|
|
|
|
|
v-if="role === 0"
|
|
|
|
|
v-if="false"
|
|
|
|
|
type="primary"
|
|
|
|
|
style="margin-left: 10px"
|
|
|
|
|
@click="
|
|
|
|
|
@ -32,24 +32,27 @@
|
|
|
|
|
</slot>
|
|
|
|
|
</lx-header>
|
|
|
|
|
|
|
|
|
|
<xy-table :list="list" :table-item="table">
|
|
|
|
|
<template v-if="role !== 0" #btns> </template>
|
|
|
|
|
<template v-else #btns>
|
|
|
|
|
<el-table-column label="操作" header-align="center" align="left">
|
|
|
|
|
<xy-table :show-index="false" :list="list" :table-item="table" :object-span-method="objectSpanMethod">
|
|
|
|
|
<template #btns>
|
|
|
|
|
<el-table-column label="操作" header-align="center" align="left" v-if="role == 1 || role == 0">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<Button size="small" type="primary" @click="$refs['file'].setId(row.id),$refs['file'].show()">附件
|
|
|
|
|
<Button ghost size="small" type="primary" @click="$refs['addPropertyPlan'].setType('editor'),$refs['addPropertyPlan'].pid = row.pid,$refs['addPropertyPlan'].setId(row.id),$refs['addPropertyPlan'].show()">编辑
|
|
|
|
|
</Button>
|
|
|
|
|
<Button size="small" type="primary" @click="$refs['remark'].setId(row.id),$refs['remark'].show()">备注
|
|
|
|
|
</Button>
|
|
|
|
|
<Button ghost size="small" type="primary" @click="$refs['addPropertyPlan'].setType('editor'),$refs['addPropertyPlan'].setId(row.id),$refs['addPropertyPlan'].show()">编辑
|
|
|
|
|
</Button>
|
|
|
|
|
<Poptip transfer confirm placement="bottom" title="确认要删除吗"
|
|
|
|
|
@on-ok="destroy({ id: row.id }).then(_ => { $message({ type: 'success',message: '删除成功' });getList(); })">
|
|
|
|
|
<Poptip v-if="role == 0" transfer confirm placement="bottom" title="确认要删除吗"
|
|
|
|
|
@on-ok="destroy(row)">
|
|
|
|
|
<Button style="margin-left: 4px;" ghost size="small" type="error">删除
|
|
|
|
|
</Button>
|
|
|
|
|
</Poptip>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="更多" prop="more" header-align="center" align="left" v-if="role == 1 || role == 0" >
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<Button size="small" type="primary" @click="$refs['file'].setId(row.pid),$refs['file'].show()">附件
|
|
|
|
|
</Button>
|
|
|
|
|
<Button size="small" type="primary" @click="$refs['remark'].setId(row.pid),$refs['remark'].show()">备注
|
|
|
|
|
</Button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</template>
|
|
|
|
|
</xy-table>
|
|
|
|
|
|
|
|
|
|
@ -73,7 +76,8 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { index, destroy } from "@/api/propertyPlan";
|
|
|
|
|
import { mergeTableRow } from "@/utils/mergeTableRow";
|
|
|
|
|
import { index, destroy, save } from "@/api/propertyPlan";
|
|
|
|
|
|
|
|
|
|
import addPropertyPlan from "@/views/finance/components/addPropertyPlan.vue";
|
|
|
|
|
import remark from "./components/remark.vue";
|
|
|
|
|
@ -86,16 +90,22 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
role: 0,//0业务,1财务
|
|
|
|
|
role: -1,//0业务,1财务
|
|
|
|
|
select: {
|
|
|
|
|
page: 1,
|
|
|
|
|
page_size: 10,
|
|
|
|
|
},
|
|
|
|
|
originalList: [],
|
|
|
|
|
list: [],
|
|
|
|
|
table: [
|
|
|
|
|
{
|
|
|
|
|
prop: 'index',
|
|
|
|
|
width: 60,
|
|
|
|
|
sortable: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "项目名称",
|
|
|
|
|
width: 220,
|
|
|
|
|
minWidth: 220,
|
|
|
|
|
align: "left",
|
|
|
|
|
prop: 'contract.name'
|
|
|
|
|
},
|
|
|
|
|
@ -114,11 +124,52 @@ export default {
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
destroy,
|
|
|
|
|
destroy (row) {
|
|
|
|
|
let temp = this.originalList.find(i => i.id === row.pid)
|
|
|
|
|
let index = temp?.item?.indexOf(temp?.item?.find(o => o.id === row.id))
|
|
|
|
|
temp.item.splice(index,1)
|
|
|
|
|
save({
|
|
|
|
|
...temp,
|
|
|
|
|
item_list: temp.item
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'success',
|
|
|
|
|
message: '删除成功'
|
|
|
|
|
})
|
|
|
|
|
this.getList()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
async getList() {
|
|
|
|
|
const res = await index(this.select);
|
|
|
|
|
this.originalList = res.data;
|
|
|
|
|
this.total = res.total;
|
|
|
|
|
this.list = res.data;
|
|
|
|
|
let list = [];
|
|
|
|
|
res.data.forEach((i,index) => {
|
|
|
|
|
i.item.forEach(item => {
|
|
|
|
|
list.push({
|
|
|
|
|
index: index+1,
|
|
|
|
|
contract: i.contract,
|
|
|
|
|
pid: i.id,
|
|
|
|
|
...item
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.list = mergeTableRow({
|
|
|
|
|
data: list,
|
|
|
|
|
mergeColNames: ['index','contract.name','more'],
|
|
|
|
|
firstMergeColNames: ['index',"pid",'pid'], // 受影响的列,只合并以firstMerge为首的同类型数据
|
|
|
|
|
firstMerge: "index",
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
console.log(this.list)
|
|
|
|
|
},
|
|
|
|
|
//合并行
|
|
|
|
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
|
|
const span = column["property"] + "-span";
|
|
|
|
|
if (row[span]) {
|
|
|
|
|
return row[span];
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
computed: {},
|
|
|
|
|
@ -127,7 +178,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
|
next((vm) => {
|
|
|
|
|
vm.role = to.path.split("_")[1] ? Number(to.path.split("_")[1]) : '';
|
|
|
|
|
vm.role = to.path.split("_")[1] ? Number(to.path.split("_")[1]) : -1;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|