You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
5.3 KiB

2 years ago
<template>
<div style="padding: 0 20px">
<lx-header
icon="md-apps"
:text="$route.meta.title"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
>
<div slot="content"></div>
<slot>
<span style="padding: 0 6px; word-break: keep-all">关键字</span>
<span>
<Input
v-model="select.keyword"
placeholder="请输入关键字"
style="width: 180px"
></Input>
</span>
<Button type="primary" style="margin-left: 10px" ghost @click=""
>重置</Button
>
2 years ago
<Button type="primary" style="margin-left: 10px" @click="getList"></Button>
2 years ago
<Button
2 years ago
v-if="false"
2 years ago
type="primary"
style="margin-left: 10px"
@click="
$refs['addPropertyPlan'].setType('add'),
$refs['addPropertyPlan'].show()
"
>新增</Button
>
</slot>
</lx-header>
2 years ago
<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">
2 years ago
<template #default="{ row }">
2 years ago
<Button ghost size="small" type="primary" @click="$refs['addPropertyPlan'].setType('editor'),$refs['addPropertyPlan'].pid = row.pid,$refs['addPropertyPlan'].setId(row.id),$refs['addPropertyPlan'].show()">编辑
2 years ago
</Button>
2 years ago
<Poptip v-if="role == 0" transfer confirm placement="bottom" title="确认要删除吗"
@on-ok="destroy(row)">
2 years ago
<Button style="margin-left: 4px;" ghost size="small" type="error">删除
</Button>
</Poptip>
</template>
</el-table-column>
2 years ago
<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>
2 years ago
</template>
2 years ago
</xy-table>
<div style="display: flex; justify-content: flex-end; margin-top: 10px">
<Page
:total="total"
show-elevator
@on-change="
(e) => {
select.page = e;
getList();
}
"
/>
</div>
2 years ago
<addPropertyPlan ref="addPropertyPlan" :role="role" @refresh="getList"></addPropertyPlan>
<remark ref="remark"></remark>
<file ref="file"></file>
2 years ago
</div>
</template>
<script>
2 years ago
import { mergeTableRow } from "@/utils/mergeTableRow";
import { index, destroy, save } from "@/api/propertyPlan";
2 years ago
import addPropertyPlan from "@/views/finance/components/addPropertyPlan.vue";
2 years ago
import remark from "./components/remark.vue";
import file from "./components/file.vue";
2 years ago
export default {
components: {
2 years ago
file,
remark,
2 years ago
addPropertyPlan,
},
data() {
return {
2 years ago
role: -1,//0业务1财务
2 years ago
select: {
page: 1,
page_size: 10,
},
2 years ago
originalList: [],
2 years ago
list: [],
table: [
2 years ago
{
prop: 'index',
width: 60,
sortable: false,
},
2 years ago
{
label: "项目名称",
2 years ago
minWidth: 220,
2 years ago
align: "left",
2 years ago
prop: 'contract.name'
2 years ago
},
{
2 years ago
prop: "plan_date",
2 years ago
label: "计划评审时间",
width: 200,
},
{
2 years ago
prop: "actually_date",
2 years ago
label: "实际评审时间",
width: 200,
},
],
total: 0,
};
},
methods: {
2 years ago
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()
})
},
2 years ago
async getList() {
const res = await index(this.select);
2 years ago
this.originalList = res.data;
2 years ago
this.total = res.total;
2 years ago
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];
}
2 years ago
},
},
computed: {},
2 years ago
created() {
this.getList();
},
2 years ago
beforeRouteEnter(to, from, next) {
next((vm) => {
2 years ago
vm.role = to.path.split("_")[1] ? Number(to.path.split("_")[1]) : -1;
2 years ago
});
},
};
</script>
2 years ago
<style scoped lang="scss">
Button + Button {
margin-left: 4px;
}
</style>