可编辑单元格

This commit is contained in:
庞东林
2021-12-08 14:43:30 +08:00
parent e72f3d6109
commit c76fce1651
3 changed files with 46 additions and 48 deletions

View File

@@ -10,16 +10,23 @@ export const analysePageData = function (data) {
//市级—报送情况说明表
export const pageDescListUrl = '/drinkingWater/drinkingWater/getDescripForm';
export const getDescripForm = function (data) {
return axios.post(pageDescListUrl,data)
}
//市级—取水量统计
export const pageanalyseListUrl = '/drinkingWater/drinkingWater/AnalysePage';
export const getPageDescList = function (data) {
return axios.get("/drinkingWater/drinkingWater/getDescripForm",{params:data})
// return axios.get("/drinkingWater/drinkingWater/AnalysePage",{params:data})
export const getWaterCount = function (data) {
return axios.post(pageanalyseListUrl,data)
}
// 县级
//监测数据报送表
export const countyPageBsaeListUrl = '/drinkingWater/drinkingWater/CountyAnalysePage';
export const countyPageBsaeData = function (data) {
return axios.post(countyPageBsaeListUrl,data)
}

View File

@@ -50,10 +50,11 @@
</template>
<template #enumber="{ text, record ,index }">
<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 v-if="editableData.length && editableData[index].drinkingWaterId" class="editable-cell-input-wrapper">
<a-input v-model:value="editableData[index].place" @pressEnter="save(record)" />
<check-outlined class="editable-cell-icon-check" @click="save(record)" />
</div>
<div v-else class="editable-cell-text-wrapper">
{{ text || ' ' }}
@@ -71,9 +72,7 @@
<script>
import XLSX from "xlsx";
import {
// pageDescListUrl,.0
pageBsaeListUrl,
getPageDescList
getDescripForm
} from "@/api/ecology/new-drinking-water";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
@@ -115,7 +114,6 @@ export default {
bill: {},
editableData:[],
// 表格数据接口
url: pageBsaeListUrl,
datasource:{},
selection: [],
columns:[
@@ -164,31 +162,32 @@ export default {
};
},
mounted() {
// this.loadOptionData();
this.reload()
},
methods: {
// // 获取列表数据
// getPageData(){
// this.loading = true;
// cityAverageNutrition(this.where).then(res=>{
// this.loading = false;
// if(res.data.code){
// this.$message.error(res.data.msg);
// this.datasource = []
// }else{
// this.datasource = res.data.data
// }
// }).catch(()=>{
// this.loading = false;
// })
// },
// 获取列表数据
getPageData(){
this.loading = true;
getDescripForm(this.where).then(res=>{
this.loading = false;
if(res.data.code){
this.$message.error(res.data.msg);
this.datasource = []
}else{
this.datasource = res.data.data
}
}).catch(()=>{
this.loading = false;
})
},
//编辑单元格
edit(item,index){
console.log('key',item.drinkingWaterId)
console.log('index',index)
edit(item,index){
this.editableData[index] = item
},
save(item){
console.log('item',item)
},
JumpFieldClick(record, column) {
@@ -206,20 +205,10 @@ export default {
},
/* 刷新表格 */
reload() {
this.getPageData()
// this.$refs.table.reload({
// where: this.where,
// });
getPageDescList(this.where).then((res) => {
console.log(res.data.data);
if (res.data.code == 0) {
// this.$message.success(res.data.msg);
this.datasource = res.data.data
} else {
this.$message.error(res.data.msg);
}
});
},

View File

@@ -7,7 +7,7 @@
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="水源类型:">
<a-select v-model:value="where.waterSourceType" allowClear showSearch>
<a-select v-model:value="where.drinkingWaterAnalyse.waterSourceType" allowClear showSearch>
<a-select-option :value="'1'">地表水</a-select-option>
<a-select-option :value="'2'">地下水</a-select-option>
</a-select>
@@ -15,7 +15,7 @@
</a-col>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="水源状态:">
<a-select v-model:value="where.drinkingWaterType" allowClear showSearch>
<a-select v-model:value="where.drinkingWaterAnalyse.drinkingWaterType" allowClear showSearch>
<a-select-option :value="'1'">在用</a-select-option>
<a-select-option :value="'2'">备用</a-select-option>
</a-select>
@@ -48,7 +48,7 @@
<a-row>
<a-col :lg="6" :md="12" :sm="24" :xs="24">
<a-form-item label="断面名称:">
<a-select v-model:value="where.sectionName" allowClear showSearch>
<a-select v-model:value="where.drinkingWaterAnalyse.sectionName" mode="multiple" allowClear showSearch>
<a-select-option v-for="item in sectionInfo" :key="item.sectionName">{{ item.sectionName }}
</a-select-option>
</a-select>
@@ -136,7 +136,9 @@ export default {
return {
indeterminate:false,
checkAll: true,
where: {},
where: {
drinkingWaterAnalyse:{}
},
filter:[],
columnsKey:[],
locale,