fix:分页

feature1.0
kongyeqing 2023-07-04 15:23:01 +08:00
parent 78828cc127
commit dc642f0f1c
17 changed files with 167 additions and 64 deletions

View File

@ -9,8 +9,8 @@
</div> </div>
<div class="table-box flex-1"> <div class="table-box flex-1">
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)" <TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @actionCallback="callback($event)" @pageNumberChange="callback($event,'pageNum')"
@pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event,'pageSize')" :footerActions="footerActions" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">

View File

@ -54,7 +54,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
datas: [] datas: []
} as any; } as any;
public showUpdate = false; public showUpdate = false;
public updateParams = { public updateParams = {
@ -104,7 +104,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
key: "unitName", key: "unitName",
type: "text", type: "text",
}]; }];
public updateOptions: FormOption<BtnOption>[] = [] as any; public updateOptions: FormOption<BtnOption>[] = [] as any;
public buildUpdateForm() { public buildUpdateForm() {
@ -202,20 +202,20 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
} }
public updateActions = [] as any; public updateActions = [] as any;
public buildActionsForm(){ public buildActionsForm() {
this.updateActions = [{ this.updateActions = [{
name: "取消", name: "取消",
value: "cancel" value: "cancel"
}, { }, {
name: "保存并继续添加", name: "保存并继续添加",
value: "saveAndContinue", value: "saveAndContinue",
type: "primary", type: "primary",
hide:this.updateParams.id hide: this.updateParams.id
}, { }, {
name: "保存", name: "保存",
value: "save", value: "save",
type: "primary" type: "primary"
}]; }];
} }
public projectOptions: FormOption<BtnOption>[] = [ public projectOptions: FormOption<BtnOption>[] = [
@ -360,7 +360,12 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
} }
} }
public callback(data) { public callback(data, type) {
if (type) {
this.params[type] = data;
this.getTableData();
return
}
// //
if (data.value === "search") { if (data.value === "search") {
this.getTableData() this.getTableData()
@ -398,7 +403,12 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
} as any; } as any;
} }
//
public getTableData() {
this.tableService.selectByPage(this.params).then(res => {
this.tableData = res.data as any;
})
}
public showUpdateModel(row, isReadonly) { public showUpdateModel(row, isReadonly) {
this.updateParams = { items: [], } as any; this.updateParams = { items: [], } as any;

View File

@ -9,8 +9,8 @@
</div> </div>
<div class="table-box flex-1"> <div class="table-box flex-1">
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)" <TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @actionCallback="callback($event)" @pageNumberChange="callback($event,'pageNum')"
@pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event,'pageSize')" :footerActions="footerActions" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">

View File

@ -595,7 +595,12 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
}); });
} }
public callback(data) { public callback(data, type) {
if (type) {
this.params[type] = data;
this.getTableData();
return
}
// //
if (data.value === "search") { if (data.value === "search") {
this.getTableData() this.getTableData()
@ -668,6 +673,14 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
} as any; } as any;
} }
//
public getTableData() {
this.tableService.selectByPage(this.params).then(res => {
this.tableData = res.data as any;
})
}
public changes(data, item) { public changes(data, item) {
// //
if (item && item.key === "areaId") { if (item && item.key === "areaId") {

View File

@ -474,7 +474,7 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
this.updateParams.stepNum = this.updateParams.steps.length; this.updateParams.stepNum = this.updateParams.steps.length;
this.updateParams.postCode = this.updateParams.postCode.join(";") this.updateParams.postCode = this.updateParams.postCode.join(";")
this.tableService.addOrUpdate(this.updateParams, !this.updateParams.id).then((res) => { this.tableService.addOrUpdate(this.updateParams, !this.updateParams.id).then((res) => {
this.$message.success(!this.updateParams.id? "新增成功!" : "编辑成功!"); this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!");
this.updateParams = { this.updateParams = {
postCode: [], postCode: [],
safetyFactor: [] safetyFactor: []
@ -494,7 +494,12 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
} as any; } as any;
} }
//
public getTableData() {
this.tableService.selectByPage(this.params).then(res => {
this.tableData = res.data as any;
})
}
public showUpdateModel(row?, isRead?) { public showUpdateModel(row?, isRead?) {
this.isReadonly = !!isRead; this.isReadonly = !!isRead;
@ -519,7 +524,7 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
} else { } else {
this.updateParams.safetyFactor = this.updateParams.safetyFactor.split(",").map(item => +item); this.updateParams.safetyFactor = this.updateParams.safetyFactor.split(",").map(item => +item);
this.updateParams.safetyFactorName = this.updateParams.safetyFactor.map(item => this.$store.getters.prevention_safe_reason_map[item]).join(",") this.updateParams.safetyFactorName = this.updateParams.safetyFactor.map(item => this.$store.getters.prevention_safe_reason_map[item]).join(",")
} }
} }
this.buildUpdateForm() this.buildUpdateForm()

View File

@ -9,8 +9,8 @@
</div> </div>
<div class="table-box flex-1"> <div class="table-box flex-1">
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)" <TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @actionCallback="callback($event)" @pageNumberChange="callback($event,'pageNum')"
@pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event,'pageSize')" :footerActions="footerActions" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" fixed label="全选" width="40"> <el-table-column type="selection" fixed label="全选" width="40">

View File

@ -589,7 +589,13 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
}); });
} }
public callback(data) {
public callback(data, type) {
if (type) {
this.params[type] = data;
this.getTableData();
return
}
// //
if (data.value === "search") { if (data.value === "search") {
this.getTableData() this.getTableData()
@ -653,6 +659,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
} }
} }
} }
// //
public reset() { public reset() {
this.params = { this.params = {
@ -661,6 +668,13 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
} as any; } as any;
} }
//
public getTableData() {
this.tableService.selectByPage(this.params).then(res => {
this.tableData = res.data as any;
})
}
public changes(data, item) { public changes(data, item) {
// //
if (item && item.key === "areaId") { if (item && item.key === "areaId") {

View File

@ -9,8 +9,8 @@
</div> </div>
<div class="table-box flex-1"> <div class="table-box flex-1">
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)" <TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @actionCallback="callback($event)" @pageNumberChange="callback($event,'pageNum')"
@pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event,'pageSize')" :footerActions="footerActions" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">
@ -46,11 +46,13 @@
<el-dialog :close-on-click-modal="false" :title="'排查信息'" :visible.sync="showUpdate" width="800px" <el-dialog :close-on-click-modal="false" :title="'排查信息'" :visible.sync="showUpdate" width="800px"
:before-close="handleClose"> :before-close="handleClose">
<FormComponent :options="subUpdateOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams" <FormComponent :options="subUpdateOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
:actions="subActions" @actionCallback="subActionCallback" @change="changes" :full-btn="true" btnPosition="center"> :actions="subActions" @actionCallback="subActionCallback" @change="changes" :full-btn="true"
btnPosition="center">
</FormComponent> </FormComponent>
</el-dialog> </el-dialog>
<el-dialog v-if="showFile" :close-on-click-modal="false" title="查看图片" :visible.sync="showFile" destroy-on-close width="680px"> <el-dialog v-if="showFile" :close-on-click-modal="false" title="查看图片" :visible.sync="showFile" destroy-on-close
width="680px">
<img :src="currentUrl" style="width: 100%;" alt=""> <img :src="currentUrl" style="width: 100%;" alt="">
</el-dialog> </el-dialog>
</div> </div>

View File

@ -267,7 +267,12 @@ export default class DutyManagerComponent extends BaseRecordComponent<any> {
}); });
} }
public callback(data) { public callback(data, type) {
if (type) {
this.params[type] = data;
this.getTableData();
return
}
// //
if (data.value === "search") { if (data.value === "search") {
this.getTableData() this.getTableData()
@ -285,6 +290,13 @@ export default class DutyManagerComponent extends BaseRecordComponent<any> {
} }
} }
//
public getTableData() {
this.tableService.selectByPage(this.params).then(res => {
this.tableData = res.data as any;
})
}
public subActionCallback(data) { public subActionCallback(data) {
if (data.value === "cancel") { if (data.value === "cancel") {
this.showUpdate = false this.showUpdate = false

View File

@ -1,4 +1,4 @@
<div class="common-box dis-flex " > <div class="common-box dis-flex ">
<div class="common-tree-box"> <div class="common-tree-box">
<UnitTreeComponent @callback="handleNodeClick"></UnitTreeComponent> <UnitTreeComponent @callback="handleNodeClick"></UnitTreeComponent>
</div> </div>
@ -9,9 +9,9 @@
</div> </div>
<div class="table-box flex-1"> <div class="table-box flex-1">
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)" <TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @pageSizeChange="callback($event)" @actionCallback="callback($event)" @pageNumberChange="callback($event,'pageNum')"
:footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event,'pageSize')" :footerActions="footerActions" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" fixed label="全选" width="60"> <el-table-column type="selection" fixed label="全选" width="60">
@ -34,19 +34,21 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</TableComponent> </TableComponent>
</div> </div>
</div> </div>
<el-dialog :close-on-click-modal="false" :title="'排查信息'" :visible.sync="showUpdate" width="800px" <el-dialog :close-on-click-modal="false" :title="'排查信息'" :visible.sync="showUpdate" width="800px"
:before-close="handleClose"> :before-close="handleClose">
<FormComponent :options="subUpdateOptions" :isReadonly="true" labelWidth="110px" labelAlign="right" :data.sync="updateParams" <FormComponent :options="subUpdateOptions" :isReadonly="true" labelWidth="110px" labelAlign="right"
:actions="subActions" @actionCallback="subActionCallback" @change="changes" :full-btn="true" btnPosition="center"> :data.sync="updateParams" :actions="subActions" @actionCallback="subActionCallback" @change="changes"
:full-btn="true" btnPosition="center">
</FormComponent> </FormComponent>
</el-dialog> </el-dialog>
<el-dialog v-if="showFile" :close-on-click-modal="false" title="查看图片" :visible.sync="showFile" destroy-on-close width="680px"> <el-dialog v-if="showFile" :close-on-click-modal="false" title="查看图片" :visible.sync="showFile" destroy-on-close
width="680px">
<img :src="currentUrl" style="width: 100%;" alt=""> <img :src="currentUrl" style="width: 100%;" alt="">
</el-dialog> </el-dialog>
</div> </div>

View File

@ -230,7 +230,12 @@ export default class DutyRecordsManagerComponent extends BaseRecordComponent<any
} }
public callback(data) { public callback(data, type) {
if (type) {
this.params[type] = data;
this.getTableData();
return
}
// //
if (data.value === "search") { if (data.value === "search") {
this.getTableData() this.getTableData()
@ -254,9 +259,12 @@ export default class DutyRecordsManagerComponent extends BaseRecordComponent<any
pageSize: 20, pageSize: 20,
} as any; } as any;
} }
// //
public getTableData() {
this.tableService.selectByPage2(this.params).then(res => {
this.tableData = res.data as any;
})
}
public showUpdateModel(id) { public showUpdateModel(id) {
this.showUpdate = true this.showUpdate = true

View File

@ -9,8 +9,8 @@
</div> </div>
<div class="table-box flex-1"> <div class="table-box flex-1">
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)" <TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @actionCallback="callback($event)" @pageNumberChange="callback($event,'pageNum')"
@pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event,'pageSize')" :footerActions="footerActions" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">

View File

@ -26,8 +26,8 @@ export default class IdentifyManagerComponent extends BaseRecordComponent<any> {
public tableService = new IdentifyService(); public tableService = new IdentifyService();
public params = { public params = {
areaId:null, areaId: null,
unitId:null, unitId: null,
} as any; } as any;
public formActions = [{ public formActions = [{
@ -334,7 +334,7 @@ export default class IdentifyManagerComponent extends BaseRecordComponent<any> {
} }
}); });
this.tableColumn.push({ this.tableColumn.push({
name: '风险等级', key: "riskLevel",width:"150px", render: (data) => { name: '风险等级', key: "riskLevel", width: "150px", render: (data) => {
return "<span class='color_" + data.riskLevel + "'>" + (data.riskLevel ? (this.$store.getters.prevention_risk_level_map[data.riskLevel]) : '') + "</span>" return "<span class='color_" + data.riskLevel + "'>" + (data.riskLevel ? (this.$store.getters.prevention_risk_level_map[data.riskLevel]) : '') + "</span>"
}, },
filters: this.$store.state.prevention_risk_level.map(item => { filters: this.$store.state.prevention_risk_level.map(item => {
@ -355,7 +355,13 @@ export default class IdentifyManagerComponent extends BaseRecordComponent<any> {
this.tableColumn.push({ name: '评估时间', key: "appraiseTime", width: "150px" }); this.tableColumn.push({ name: '评估时间', key: "appraiseTime", width: "150px" });
} }
public callback(data) {
public callback(data, type) {
if (type) {
this.params[type] = data;
this.getTableData();
return
}
// //
if (data.value === "search") { if (data.value === "search") {
this.getTableData() this.getTableData()
@ -380,7 +386,12 @@ export default class IdentifyManagerComponent extends BaseRecordComponent<any> {
} as any; } as any;
} }
//
public getTableData() {
this.tableService.selectByPage(this.params).then(res => {
this.tableData = res.data as any;
})
}
public showUpdateModel(row) { public showUpdateModel(row) {
this.showUpdate = true this.showUpdate = true

View File

@ -9,8 +9,8 @@
</div> </div>
<div class="table-box flex-1"> <div class="table-box flex-1">
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)" <TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @actionCallback="callback($event)" @pageNumberChange="callback($event,'pageNum')"
@pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event,'pageSize')" :footerActions="footerActions" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">

View File

@ -133,7 +133,7 @@ export default class MeasuresManagerComponent extends BaseRecordComponent<any> {
// //
this.proTableColumn.push({ name: '序号', key: "index",width:"80px" }); this.proTableColumn.push({ name: '序号', key: "index", width: "80px" });
this.proTableColumn.push({ this.proTableColumn.push({
name: '措施类型一', key: "firstTypeName", render: (data) => { name: '措施类型一', key: "firstTypeName", render: (data) => {
if (data.firstType) { if (data.firstType) {
@ -151,10 +151,15 @@ export default class MeasuresManagerComponent extends BaseRecordComponent<any> {
} }
}); });
this.proTableColumn.push({ name: '措施类型三', key: "thirdType" }); this.proTableColumn.push({ name: '措施类型三', key: "thirdType" });
this.proTableColumn.push({ name: '管控措施', key: "description" ,width:"300px"}); this.proTableColumn.push({ name: '管控措施', key: "description", width: "300px" });
} }
public callback(data) { public callback(data, type) {
if (type) {
this.params[type] = data;
this.getTableData();
return
}
// //
if (data.value === "search") { if (data.value === "search") {
this.getTableData() this.getTableData()
@ -171,6 +176,12 @@ export default class MeasuresManagerComponent extends BaseRecordComponent<any> {
this.deleteData(this.selectData.map((item: any) => item.id)) this.deleteData(this.selectData.map((item: any) => item.id))
} }
} }
//
public getTableData() {
this.tableService.selectByPage(this.params).then(res => {
this.tableData = res.data as any;
})
}
// //
public reset() { public reset() {
this.params = { this.params = {

View File

@ -9,13 +9,17 @@
</div> </div>
<div class="table-box flex-1"> <div class="table-box flex-1">
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)" <TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @actionCallback="callback($event)" @pageNumberChange="callback($event,'pageNum')"
@pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event,'pageSize')" :footerActions="footerActions" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
@selection-change="handleSelectionChange" style="width: 100%" highlight-current-row> @selection-change="handleSelectionChange" style="width: 100%" highlight-current-row>
<el-table-column type="selection" fixed label="全选" width="60"> <el-table-column type="selection" fixed label="全选" width="60">
</el-table-column> </el-table-column>
<el-table-column label="序号" width="60">
<template slot-scope="scope">
{{scope.$index+1}}
</template>
</el-table-column>
<template v-for="item in tableColumn"> <template v-for="item in tableColumn">
<el-table-column class="cursor td-content" v-if="item.render" :label="item.name" <el-table-column class="cursor td-content" v-if="item.render" :label="item.name"
:width="item.width" :key="item.key" :filters="item.filters" :filter-multiple="false" :width="item.width" :key="item.key" :filters="item.filters" :filter-multiple="false"

View File

@ -295,7 +295,12 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent<
}) })
} }
public callback(data) { public callback(data, type) {
if (type) {
this.params[type] = data;
this.getTableData();
return
}
// //
if (data.value === "search") { if (data.value === "search") {
this.getTableData() this.getTableData()
@ -315,6 +320,12 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent<
this.doUpdate() this.doUpdate()
} }
} }
//
public getTableData() {
this.tableService.selectByPage(this.params).then(res => {
this.tableData = res.data as any;
})
}
//-- //--
public doUpdate() { public doUpdate() {
if (this.selectData && this.selectData.length > 0) { if (this.selectData && this.selectData.length > 0) {