master
xy 2 years ago
parent 8fee6f4f9d
commit 20b267179d

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

@ -9,7 +9,29 @@
:rules="rules"
@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-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
@ -19,14 +41,18 @@
</div>
<div class="xy-table-item-content">
<el-input
readonly
:disabled="type === 'editor'"
:value="rowName"
clearable
:value="form.project_name"
placeholder="请输入项目"
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>
</template>
@ -174,6 +200,7 @@ export default {
type: Number,
default: 0,
},
lists: Array
},
data() {
return {
@ -304,7 +331,8 @@ export default {
rowName: "",
tempRow: {},
form: {
project_id: "",
pid: '',
project_name: "",
state: 0,
item_list: [],
content_list: [],
@ -580,10 +608,10 @@ export default {
rowPick(row) {
if (this.isShow) {
this.form.project_id = row.id;
this.rowName = row.name;
this.form.project_name = row.name;
} else {
this.$emit('rowPick', row)
}
this.$emit('rowPick', row)
},
},
watch: {
@ -625,4 +653,7 @@ export default {
margin-left: 6px;
}
}
::v-deep .el-input__suffix {
right: 0;
}
</style>

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

Loading…
Cancel
Save