master
xy 2 years ago
parent 8fee6f4f9d
commit 20b267179d

@ -12,6 +12,10 @@ export default {
type:Array, type:Array,
default:()=> [] default:()=> []
}, },
rowKey: {
type: String,
default: 'id'
},
indent:{ indent:{
type:Number, type:Number,
default:18 default:18
@ -150,7 +154,7 @@ export default {
height={height ?? tableHeight} height={height ?? tableHeight}
class="v-table" class="v-table"
style={tableStyle} style={tableStyle}
row-key="id" row-key={this.rowKey}
border border
default-expand-all={defaultExpandAll} default-expand-all={defaultExpandAll}
tree-props={treeProps} tree-props={treeProps}
@ -240,7 +244,7 @@ export default {
prop={item.prop} prop={item.prop}
label-class-name={item.labelClassName} label-class-name={item.labelClassName}
sortable={item.sortable ?? true} sortable={item.sortable ?? true}
type={item.type ?? ''} type={item.type}
selectable={item.selectable} selectable={item.selectable}
scopedSlots={{ scopedSlots={{
header(scope){ header(scope){

@ -9,7 +9,29 @@
:rules="rules" :rules="rules"
@submit="submit" @submit="submit"
> >
<template v-slot:project_id> <template #pid>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>
父级
</div>
<div class="xy-table-item-content">
<el-cascader
:options="[{children:lists,project_name:'根节点',id:0}]"
:props="{ checkStrictly: true, label: 'project_name', value: 'id' }"
:value="form.pid"
clearable
style="width: 300px"
@change="(e) => {
form.pid = e.at(-1)
}"
/>
</div>
</div>
</template>
<template v-slot:project_name>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px" <span style="color: red; font-weight: 600; padding-right: 4px"
@ -19,14 +41,18 @@
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-input <el-input
readonly
:disabled="type === 'editor'" :disabled="type === 'editor'"
:value="rowName" :value="form.project_name"
clearable
placeholder="请输入项目" placeholder="请输入项目"
style="width: 300px" style="width: 300px"
@focus="isShowModal = true" >
></el-input> <el-button
icon="el-icon-arrow-right"
type="primary"
slot="suffix"
@click="isShowModal = true">
</el-button>
</el-input>
</div> </div>
</div> </div>
</template> </template>
@ -174,6 +200,7 @@ export default {
type: Number, type: Number,
default: 0, default: 0,
}, },
lists: Array
}, },
data() { data() {
return { return {
@ -304,7 +331,8 @@ export default {
rowName: "", rowName: "",
tempRow: {}, tempRow: {},
form: { form: {
project_id: "", pid: '',
project_name: "",
state: 0, state: 0,
item_list: [], item_list: [],
content_list: [], content_list: [],
@ -580,10 +608,10 @@ export default {
rowPick(row) { rowPick(row) {
if (this.isShow) { if (this.isShow) {
this.form.project_id = row.id; this.form.project_name = row.name;
this.rowName = row.name; } else {
this.$emit('rowPick', row)
} }
this.$emit('rowPick', row)
}, },
}, },
watch: { watch: {
@ -625,4 +653,7 @@ export default {
margin-left: 6px; margin-left: 6px;
} }
} }
::v-deep .el-input__suffix {
right: 0;
}
</style> </style>

@ -65,10 +65,11 @@
</lx-header> </lx-header>
<xy-table <xy-table
:cell-style="{ 'height': '1px' }"
:show-index="false" :show-index="false"
:list="list" row-key="id"
:list="originalList"
:table-item="table" :table-item="table"
:object-span-method="objectSpanMethod"
> >
<template #btns> <template #btns>
<el-table-column <el-table-column
@ -76,19 +77,21 @@
prop="more" prop="more"
header-align="center" header-align="center"
align="left" align="left"
fixed="right"
width="220"
v-if="role === 1 || role === 0" v-if="role === 1 || role === 0"
> >
<template #default="{ row }"> <template #default="{ row }">
<Button <Button
size="small" size="small"
type="primary" type="primary"
@click="$refs['file'].setId(row.pid), $refs['file'].show()" @click="$refs['file'].setId(row.id), $refs['file'].show()"
>附件 >附件
</Button> </Button>
<Button <Button
size="small" size="small"
type="primary" type="primary"
@click="$refs['remark'].setId(row.pid), $refs['remark'].show()" @click="$refs['remark'].setId(row.id), $refs['remark'].show()"
>备注 >备注
</Button> </Button>
<Button <Button
@ -97,7 +100,7 @@
type="primary" type="primary"
@click=" @click="
$refs['addPropertyPlan'].setType('editor'), $refs['addPropertyPlan'].setType('editor'),
($refs['addPropertyPlan'].pid = row.pid), ($refs['addPropertyPlan'].pid = row.id),
$refs['addPropertyPlan'].setId(row.id), $refs['addPropertyPlan'].setId(row.id),
$refs['addPropertyPlan'].show() $refs['addPropertyPlan'].show()
" "
@ -130,13 +133,13 @@
<Button <Button
size="small" size="small"
type="primary" type="primary"
@click="$refs['file'].setId(row.pid), $refs['file'].show()" @click="$refs['file'].setId(row.id), $refs['file'].show()"
>附件查看</Button >附件查看</Button
> >
<Button <Button
size="small" size="small"
type="primary" type="primary"
@click="$refs['remark'].setId(row.pid), $refs['remark'].show()" @click="$refs['remark'].setId(row.id), $refs['remark'].show()"
>备注 >备注
</Button> </Button>
</template> </template>
@ -161,6 +164,7 @@
ref="addPropertyPlan" ref="addPropertyPlan"
:departments="departments" :departments="departments"
:role="role" :role="role"
:lists="originalList"
@refresh="getList" @refresh="getList"
@rowPick=" @rowPick="
(row) => { (row) => {
@ -197,6 +201,7 @@ export default {
department_id: "", department_id: "",
projectName: "", projectName: "",
project_id: "", project_id: "",
show_tree: 1
}, },
departments: [], departments: [],
@ -204,50 +209,96 @@ export default {
list: [], list: [],
table: [ table: [
{ {
prop: "index", label: ' ',
width: 60, type: 'index',
sortable: false, width: 56
}, },
{ {
label: "项目名称", label: "项目名称",
minWidth: 220, minWidth: 220,
align: "left", align: "left",
prop: "project.name", prop: "project_name",
}, },
{ {
prop: "content", prop: "content",
label: "评审内容", label: "评审内容",
width: 220, width: 220,
customFn:row => {
return (
<div class="my-td">
{
row.item.map(i => {
return (
<div class="my-cell">{i.content}</div>
)
})
}
</div>
)
}
}, },
{ {
prop: "plan_date", prop: "plan_date",
label: "计划送审时间", label: "计划送审时间",
width: 170, width: 170,
formatter: (cell, data, value) => { customFn:row => {
return value return (
? this.$moment(new Date(value)).format("YYYY年MM月") <div class="my-td">
: "未完成"; {
}, row.item.map(i => {
return (
<div class="my-cell">{
i.plan_date
? this.$moment(new Date(i.plan_date)).format("YYYY年MM月")
: "未完成"}</div>
)
})
}
</div>
)
}
}, },
{ {
prop: "actually_date", prop: "actually_date",
label: "实际送审时间", label: "实际送审时间",
width: 170, width: 170,
formatter: (cell, data, value) => { customFn:row => {
return value return (
? this.$moment(new Date(value)).format("YYYY年MM月DD") <div class="my-td">
: "未完成"; {
}, row.item.map(i => {
return (
<div class="my-cell">{
i.actually_date
? this.$moment(new Date(i.actually_date)).format("YYYY年MM月")
: "未完成"}</div>
)
})
}
</div>
)
}
}, },
{ {
prop: 'date', prop: 'date',
label: '出具报告时间', label: '出具报告时间',
width: 170, width: 170,
formatter: (cell, data, value) => { customFn:row => {
return value return (
? this.$moment(new Date(value)).format("YYYY年MM月DD") <div class="my-td">
: "未完成"; {
}, row.item.map(i => {
return (
<div class="my-cell">{
i.date
? this.$moment(new Date(i.date)).format("YYYY年MM月")
: "未完成"}</div>
)
})
}
</div>
)
}
} }
], ],
total: 0, total: 0,
@ -261,9 +312,8 @@ export default {
}, },
destroy(row) { destroy(row) {
console.log(row);
destroy({ destroy({
id: row.pid, id: row.id,
}).then((res) => { }).then((res) => {
this.$message({ this.$message({
type: "success", type: "success",
@ -274,38 +324,9 @@ export default {
}, },
async getList() { async getList() {
const res = await index(this.select); const res = await index(this.select);
this.originalList = res.data; this.list = res;
this.total = res.total; this.originalList = res;
let list = []; console.log(res)
res.data.forEach((i, index) => {
if (i.item && i.item.length > 0) {
i.item.forEach((item) => {
list.push({
type: 0,
index: index + 1,
project: i.project,
pid: i.id,
...item,
});
});
} else {
list.push({
pid: i.id,
index: index + 1,
type: 1,
...i,
});
}
});
this.list = mergeTableRow({
data: list,
mergeColNames: ["index", "project.name", "more"],
firstMergeColNames: ["index", "pid", "pid"], // firstMerge
firstMerge: "index",
});
console.log(this.list);
}, },
// //
objectSpanMethod({ row, column, rowIndex, columnIndex }) { objectSpanMethod({ row, column, rowIndex, columnIndex }) {
@ -335,4 +356,30 @@ export default {
Button + Button { Button + Button {
margin-left: 4px; margin-left: 4px;
} }
.my-td {
height: 100%;
display: flex;
flex-direction: column;
}
.my-cell {
flex: 1;
border-bottom: 1px solid #EBEEF5;
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
}
.my-cell:nth-child(1) {
padding-top: 0;
}
.my-cell:nth-last-child(1) {
border-bottom: none;
padding-bottom: 0;
}
::v-deep td > .cell {
height: 100%;
}
</style> </style>

Loading…
Cancel
Save