This commit is contained in:
庞东林
2021-12-08 18:11:44 +08:00
parent fd65e985b1
commit bafaf600af
2 changed files with 98 additions and 59 deletions

View File

@@ -12,37 +12,7 @@
:visiable="visiable"
:loading="loading"
/>
<!-- 表格 -->
<!-- <ele-pro-table
v-model:selection="selectionList"
ref="table"
row-key="drinkingWaterId"
:datasource="url"
:columns="columns"
:where="where"
:scroll="{ x: 'max-content' }"
@done="(d) => (data = d.data)"
>
<template #county="{text}">
{{text="市区"}}
</template>
<template #enumber="{ text, record }">
<div class="editable-cell">
<div v-if="editableData[record.key]" class="editable-cell-input-wrapper">
<a-input v-model:value="editableData[record.key].name" @pressEnter="save(record.key)" />
<check-outlined class="editable-cell-icon-check" @click="save(record.key)" />
</div>
<div v-else class="editable-cell-text-wrapper">
{{ text || ' ' }}
<edit-outlined class="editable-cell-icon" @click="edit(record.key)" />
</div>
</div>
</template>
</ele-pro-table> -->
<ele-pro-table ref="table" row-key="drinkingWaterId" :datasource="datasource" :columns="columns" :where="where"
:scroll="{ x: 'max-content' }" @done="(d) => (data = d.data)">
<template #county="{text}">
@@ -50,18 +20,58 @@
</template>
<template #enumber="{ text, record ,index }">
<div class="editable-cell">
<div v-if="editableData[index]" class="editable-cell-input-wrapper">
<a-input v-model:value="editableData[index].place" @pressEnter="save(record,index)" />
<check-outlined class="editable-cell-icon-check" @click="save(record,index)" />
<div v-if="editableData[index] && editableData[index].edable=='index1'" class="editable-cell-input-wrapper">
<a-input v-model:value="editableData[index][index3]" @pressEnter="save(editableData[index],index)" />
<check-outlined class="editable-cell-icon-check" @click="save(editableData[index],index)" />
</div>
<div v-else class="editable-cell-text-wrapper">
{{ text || ' ' }}
<edit-outlined class="editable-cell-icon" @click="edit(record,index)" />
<edit-outlined class="editable-cell-icon" @click="edit(record,index,'index3')" />
</div>
</div>
</template>
</template>
<template #wnumber="{ text, record ,index }">
<div class="editable-cell">
<div v-if="editableData[index] && editableData[index].edable=='index2'" class="editable-cell-input-wrapper">
<a-input v-model:value="editableData[index][index4]" @pressEnter="save(editableData[index],index)" />
<check-outlined class="editable-cell-icon-check" @click="save(editableData[index],index)" />
</div>
<div v-else class="editable-cell-text-wrapper">
{{ text || ' ' }}
<edit-outlined class="editable-cell-icon" @click="edit(record,index,'index4')" />
</div>
</div>
</template>
<template #desc="{ text, record ,index }">
<div class="editable-cell">
<div v-if="editableData[index] && editableData[index].edable=='index6'" class="editable-cell-input-wrapper">
<a-input v-model:value="editableData[index][index6]" @pressEnter="save(editableData[index],index)" />
<check-outlined class="editable-cell-icon-check" @click="save(editableData[index],index)" />
</div>
<div v-else class="editable-cell-text-wrapper">
{{ text || ' ' }}
<edit-outlined class="editable-cell-icon" @click="edit(record,index,'index6')" />
</div>
</div>
</template>
<template #remark="{ text, record ,index }">
<div class="editable-cell">
<div v-if="editableData[index] && editableData[index].edable=='remark'" class="editable-cell-input-wrapper">
<a-input v-model:value="editableData[index][remark]" @pressEnter="save(editableData[index],index)" />
<check-outlined class="editable-cell-icon-check" @click="save(editableData[index],index)" />
</div>
<div v-else class="editable-cell-text-wrapper">
{{ text || ' ' }}
<edit-outlined class="editable-cell-icon" @click="edit(record,index,'remark')" />
</div>
</div>
</template>
</ele-pro-table>
</a-card>
@@ -120,10 +130,11 @@ export default {
{key: "index",title:"序号",dataIndex: "index",width: 48,align: "center",customRender: ({ index }) => index + 1,},
{title:"城市",dataIndex:"city",},
{title:"县城",dataIndex:"county",slots:{customRender:'county'}},
{title:"水源地名称",dataIndex:"place",},
{title:"水源地名称",dataIndex:"sourceWaterName",},
{title:"类型",dataIndex:"waterSourceProperty",},
{title:"监测时间",dataIndex:"reportTime",customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY/MM/DD")},
{title:"应当监测项目个数",dataIndex:'',filters:[
{title:"监测时间",dataIndex:"reportTime"},
// {title:"监测时间",dataIndex:"reportTime",customRender: ({text}) => moment(text, "YYYY/MM/DD HH:mm:ss").format("YYYY/MM/DD")},
{title:"应当监测项目个数",dataIndex:'index1',filters:[
{
text: '61',
value: '61',
@@ -137,16 +148,22 @@ export default {
value: '64',
},
]},
{title:"未测个数",dataIndex:"",},
{title:"独立分析项目个数",dataIndex:"place",
{title:"未测个数",dataIndex:"index2",},
{title:"独立分析项目个数",dataIndex:"index3",
slots: {
customRender: 'enumber',
},
},
},
{title:"外送分析项目个数",dataIndex:"",},
{title:"超标项目",dataIndex:"",},
{title:"情况说明或原因",dataIndex:""},
{title:"备注",dataIndex:"remark"},
{title:"外送分析项目个数",dataIndex:"index4", slots: {
customRender: 'wnumber',
},},
{title:"超标项目",dataIndex:"index5",},
{title:"情况说明或原因",dataIndex:"index6", slots: {
customRender: 'desc',
}},
{title:"备注",dataIndex:"remark",slots: {
customRender: 'remark',
},},
],
@@ -182,15 +199,16 @@ export default {
},
//编辑单元格
edit(item,index){
edit(item,index,key){
this.editableData[index] = item
this.editableData[index].edable=key
},
save(item,index){
console.log('item',item)
this.datasource[index] = item
this.editableData = []
console.log('item.remark', item.remark)
this.datasource[index] = item
this.editableData = []
},