From a4831debee63c7071a261c5f6ecfa62fd535b2ab Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Thu, 25 Jan 2024 16:21:18 +0800 Subject: [PATCH] 分页修改 --- src/views/device/govMonitorPoint.vue | 744 +++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 508 insertions(+), 236 deletions(-) diff --git a/src/views/device/govMonitorPoint.vue b/src/views/device/govMonitorPoint.vue index 0472908..21932a3 100644 --- a/src/views/device/govMonitorPoint.vue +++ b/src/views/device/govMonitorPoint.vue @@ -5,14 +5,28 @@ <a-form-model layout="horizontal"> <a-row :gutter="15"> <a-col :span="5"> - <a-button icon="plus" type="primary" @click="() => this.handleModalVisible(true)" - style="margin-left: 25px;">������</a-button> + <a-button + icon="plus" + type="primary" + @click="() => this.handleModalVisible(true)" + style="margin-left: 25px;" + >������</a-button + > </a-col> <a-col :span="5" style="margin-left: 37%"> <a-form-model-item :wrapperCol="wrapperCol"> - <a-select placeholder="������������������" style="width: 240px;margin-top:4px" @change="handleChange" allow-clear - show-search> - <a-select-option v-for="(item, index) in stationLevel" :key="index" :value="index"> + <a-select + placeholder="������������������" + style="width: 240px;margin-top:4px" + @change="handleChange" + allow-clear + show-search + > + <a-select-option + v-for="(item, index) in stationLevel" + :key="index" + :value="index" + > {{ item }} </a-select-option> </a-select> @@ -20,84 +34,281 @@ </a-col> <a-col :span="5"> <a-form-model-item :wrapperCol="wrapperCol"> - <a-input v-model="searchName" placeholder="���������������������" allow-clear /> + <a-input + v-model="searchName" + placeholder="���������������������" + allow-clear + /> </a-form-model-item> </a-col> </a-row> </a-form-model> </div> - <av-standard-table :dataSource="dataSource" :columns="columns" :loading="tableLoading" :paginationProps="pagination" - @tableChange="handlerTableChange"></av-standard-table> + <av-standard-table + :dataSource="dataSource" + :columns="columns" + :loading="tableLoading" + :paginationProps="pagination" + @tableChange="handlerTableChange" + ></av-standard-table> </div> - <a-modal title="������������������" destroyOnClose :visible="addShowOrHiddenFlag" @ok="addOK" @cancel="addCancel" okText="������"> - <a-form-model style="margin-top: 8px" :model="addForm" :rules="rules" ref="addRulesForm"> - <a-form-model-item has-feedback :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������������" prop="guid"> - <a-input placeholder="���������������������" type="string" v-model="addForm.guid" /> + <a-modal + title="������������������" + destroyOnClose + :visible="addShowOrHiddenFlag" + @ok="addOK" + @cancel="addCancel" + okText="������" + > + <a-form-model + style="margin-top: 8px" + :model="addForm" + :rules="rules" + ref="addRulesForm" + > + <a-form-model-item + has-feedback + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������������" + prop="guid" + > + <a-input + placeholder="���������������������" + type="string" + v-model="addForm.guid" + /> </a-form-model-item> - <a-form-model-item has-feedback :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������" prop="name"> - <a-input placeholder="������������" type="string" v-model="addForm.name" /> + <a-form-model-item + has-feedback + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + prop="name" + > + <a-input + placeholder="������������" + type="string" + v-model="addForm.name" + /> </a-form-model-item> - <a-form-model-item :labelCol="{ span: 5 }" has-feedback :wrapperCol="{ span: 15 }" label="������" prop="longitude"> - <a-input placeholder="���������������" type="string" v-model="addForm.longitude" /> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������" + prop="longitude" + > + <a-input + placeholder="���������������" + type="string" + v-model="addForm.longitude" + /> </a-form-model-item> - <a-form-model-item :labelCol="{ span: 5 }" has-feedback :wrapperCol="{ span: 15 }" label="������" prop="latitude"> - <a-input placeholder="���������������" type="string" v-model="addForm.latitude" /> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������" + prop="latitude" + > + <a-input + placeholder="���������������" + type="string" + v-model="addForm.latitude" + /> </a-form-model-item> - <a-form-model-item :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������" has-feedback prop="position"> + <a-form-model-item + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + has-feedback + prop="position" + > <!-- v-decorator="['position', { rules: [{ required: true, message: '������������������������' }] }]"--> - <a-cascader :options="areaData" placeholder="������������" @change="positionLevel" labelInValue /> + <a-cascader + :options="areaData" + placeholder="������������" + @change="positionLevel" + labelInValue + /> </a-form-model-item> - <a-form-model-item :labelCol="{ span: 5 }" has-feedback :wrapperCol="{ span: 15 }" label="������������" - prop="stationLevel"> - <a-select placeholder="������������������" type="string" allow-clear show-search v-model="addForm.stationLevel"> - <a-select-option v-for="(item, index) in stationLevel" :key="index" :value='index'>{{ item - }}</a-select-option> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������������" + prop="stationLevel" + > + <a-select + placeholder="������������������" + type="string" + allow-clear + show-search + v-model="addForm.stationLevel" + > + <a-select-option + v-for="(item, index) in stationLevel" + :key="index" + :value="index" + >{{ item }}</a-select-option + > </a-select> </a-form-model-item> - <a-form-model-item :labelCol="{ span: 5 }" has-feedback :wrapperCol="{ span: 15 }" label="������" prop="desc"> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������" + prop="desc" + > <a-input placeholder="������" type="string" v-model="addForm.desc" /> </a-form-model-item> </a-form-model> </a-modal> - <a-modal title="������������������" destroyOnClose :visible="editShowOrHiddenFlag" @ok="editSave" @cancel="editCancel" - okText="������"> - <a-form-model style="margin-top: 8px" :model="editForm" :rules="rules" ref="editRulesForm"> - <a-form-model-item has-feedback :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������������" prop="guid"> - <a-input placeholder="���������������������" type="string" v-model="editForm.guid" /> + <a-modal + title="������������������" + destroyOnClose + :visible="editShowOrHiddenFlag" + @ok="editSave" + @cancel="editCancel" + okText="������" + > + <a-form-model + style="margin-top: 8px" + :model="editForm" + :rules="rules" + ref="editRulesForm" + > + <a-form-model-item + has-feedback + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������������" + prop="guid" + > + <a-input + placeholder="���������������������" + type="string" + v-model="editForm.guid" + /> </a-form-model-item> - <a-form-model-item has-feedback :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������" prop="name"> - <a-input placeholder="������������" type="string" v-model="editForm.name" /> + <a-form-model-item + has-feedback + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + prop="name" + > + <a-input + placeholder="������������" + type="string" + v-model="editForm.name" + /> </a-form-model-item> - <a-form-model-item :labelCol="{ span: 5 }" has-feedback :wrapperCol="{ span: 15 }" label="������" prop="longitude"> - <a-input placeholder="���������������" type="string" v-model="editForm.longitude" /> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������" + prop="longitude" + > + <a-input + placeholder="���������������" + type="string" + v-model="editForm.longitude" + /> </a-form-model-item> - <a-form-model-item :labelCol="{ span: 5 }" has-feedback :wrapperCol="{ span: 15 }" label="������" prop="latitude"> - <a-input placeholder="���������������" type="string" v-model="editForm.latitude" /> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������" + prop="latitude" + > + <a-input + placeholder="���������������" + type="string" + v-model="editForm.latitude" + /> </a-form-model-item> - <a-form-model-item :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������" has-feedback prop="position"> + <a-form-model-item + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + has-feedback + prop="position" + > <!-- v-decorator="['position', { rules: [{ required: true, message: '������������������������' }] }]"--> - <a-cascader v-model="editForm.position" :options="areaData" placeholder="������������������" @change="positionLevel" - labelInValue /> + <a-cascader + v-model="editForm.position" + :options="areaData" + placeholder="������������������" + @change="positionLevel" + labelInValue + /> </a-form-model-item> - <a-form-model-item :labelCol="{ span: 5 }" has-feedback :wrapperCol="{ span: 15 }" label="������������" - prop="stationLevel"> - <a-select placeholder="������������������" type="string" allow-clear show-search v-model="editForm.stationLevel"> - <a-select-option v-for="(item, index) in stationLevel" :key="index" :value='index'>{{ item - }}</a-select-option> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������������" + prop="stationLevel" + > + <a-select + placeholder="������������������" + type="string" + allow-clear + show-search + v-model="editForm.stationLevel" + > + <a-select-option + v-for="(item, index) in stationLevel" + :key="index" + :value="index" + >{{ item }}</a-select-option + > </a-select> </a-form-model-item> - <a-form-model-item :labelCol="{ span: 5 }" has-feedback :wrapperCol="{ span: 15 }" label="������" prop="desc"> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������" + prop="desc" + > <a-input placeholder="������" type="string" v-model="editForm.desc" /> </a-form-model-item> </a-form-model> </a-modal> - <a-modal title="������������������" destroyOnClose :visible="editSiteShowOrHiddenFlag" :rules="siteRules" @ok="editSiteSave" - @cancel="editSiteCancel" okText="������"> - <a-form-model style="margin-top: 8px" :model="editSiteForm" ref="editSiteRulesForm"> - <a-form-model-item has-feedback :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������������" prop="guid"> - <a-input placeholder="���������������������" type="string" v-model="editSiteForm.guid" /> + <a-modal + title="������������������" + destroyOnClose + :visible="editSiteShowOrHiddenFlag" + :rules="siteRules" + @ok="editSiteSave" + @cancel="editSiteCancel" + okText="������" + > + <a-form-model + style="margin-top: 8px" + :model="editSiteForm" + ref="editSiteRulesForm" + > + <a-form-model-item + has-feedback + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������������" + prop="guid" + > + <a-input + placeholder="���������������������" + type="string" + v-model="editSiteForm.guid" + /> </a-form-model-item> <p class="errInfor">���������������������������������������������45-50���������!</p> </a-form-model> @@ -107,215 +318,245 @@ <script lang="tsx"> import { Component, Vue, Watch } from "vue-property-decorator"; -import org from '@/util/org' +import org from "@/util/org"; import { get, post } from "@/util/request"; @Component({ - components: { - } + components: {}, }) export default class govMonitorPoint extends Vue { // ������������ private wrapperCol: any = { - sm: { span: 16 }//������������������������ - } + sm: { span: 16 }, //������������������������ + }; // ������id������������ - private stationLevelId: any = '' + private stationLevelId: any = ""; // ������ private columns: any[] = [ { + title: "������", + dataIndex: "key", + key: "key", + align: "center", + customRender: (text: any, record: any, index: any) => `${index + 1}`, + width: 60, + }, + { title: "������������", - dataIndex: "guid" + dataIndex: "guid", }, { title: "������", - dataIndex: "name" + dataIndex: "name", }, { title: "������", - dataIndex: "longitude" + dataIndex: "longitude", }, { title: "������", - dataIndex: "latitude" + dataIndex: "latitude", }, { title: "������", - dataIndex: "position" + dataIndex: "position", }, { title: "������������", - dataIndex: "stationLevelName" + dataIndex: "stationLevelName", }, { title: "������", - dataIndex: "desc" + dataIndex: "desc", }, { title: "������", - customRender: this.opRender - } + customRender: this.opRender, + }, ]; // ������������������������������ - private searchName: string = '' + private searchName: string = ""; // ��������������������������� - private tableLoading: boolean = false + private tableLoading: boolean = false; // ������ - private dataSource: any[] = [] + private dataSource: any[] = []; // ������������������������ - private addShowOrHiddenFlag: boolean = false + private addShowOrHiddenFlag: boolean = false; // ������������������������ - private editShowOrHiddenFlag: boolean = false + private editShowOrHiddenFlag: boolean = false; - private editSiteShowOrHiddenFlag: boolean = false + private editSiteShowOrHiddenFlag: boolean = false; // ������������������������ - private areaData: any = JSON.parse(JSON.stringify(org)) + private areaData: any = JSON.parse(JSON.stringify(org)); // ��������������������������� private rules: any = { guid: [ - { required: true, message: '������������������������', trigger: ['change', 'blur'] }, + { + required: true, + message: "������������������������", + trigger: ["change", "blur"], + }, ], name: [ - { required: true, message: '������������������', trigger: ['change', 'blur'] }, + { required: true, message: "������������������", trigger: ["change", "blur"] }, ], longitude: [ - { required: true, message: '������������������', trigger: ['change', 'blur'] }, + { required: true, message: "������������������", trigger: ["change", "blur"] }, ], latitude: [ - { required: true, message: '������������������', trigger: ['change', 'blur'] }, + { required: true, message: "������������������", trigger: ["change", "blur"] }, ], position: [ - { required: true, message: '���������������������', trigger: ['change', 'blur'] }, + { + required: true, + message: "���������������������", + trigger: ["change", "blur"], + }, ], stationLevel: [ - { required: true, message: '���������������������', trigger: ['change', 'blur'] }, - ] - } + { + required: true, + message: "���������������������", + trigger: ["change", "blur"], + }, + ], + }; private siteRules: any = { guid: [ - { required: true, message: '������������������������', trigger: ['change', 'blur'] }, - ] - } + { + required: true, + message: "������������������������", + trigger: ["change", "blur"], + }, + ], + }; // ������������������ - private stationLevel: any = {} + private stationLevel: any = {}; // ������������������������record - private editBeforeRecord: any = null - private editBeforeSiteRecord: any = null + private editBeforeRecord: any = null; + private editBeforeSiteRecord: any = null; // ������������������ private addForm: any = { - guid: '', - name: '', - longitude: '', - latitude: '', + guid: "", + name: "", + longitude: "", + latitude: "", position: [], stationLevel: undefined, - desc: '' - } + desc: "", + }; // ������������������ private editForm: any = { id: -1, - guid: '', - name: '', - longitude: '', - latitude: '', + guid: "", + name: "", + longitude: "", + latitude: "", position: [], stationLevel: undefined, - desc: '' - } + desc: "", + }; // ������������������ private editSiteForm: any = { id: -1, - guid: '' - } + guid: "", + }; // ������������ private pagination: any = { total: 0, - current: 0, - pageSize: 8, - showSizeChanger: false, - showQuickJumper: false + current: 1, + pageSize: 10, + showSizeChanger: true, + showQuickJumper: true, + pageSizeOptions: ["10", "30", "60", "100"], + showTotal: (total: number) => `������ ${this.pagination.total} ���������`, //��������������������������� }; // ������������������������ - @Watch('searchName', { + @Watch("searchName", { deep: true, - immediate: true + immediate: true, }) private watchName(newVal: string, oldVal: string) { - this.searchName = newVal - this.pagination.current = 1 - this.queryGovDatas() + this.searchName = newVal; + this.pagination.current = 1; + this.queryGovDatas(); } // ������������������ private created() { - this.selectDatas() - this.queryGovDatas() + this.selectDatas(); + this.queryGovDatas(); } // ������������������������������ private handlerTableChange(pagination: any, filter: any, sorter: any): void { - this.pagination.current = pagination.current - this.queryGovDatas() + this.pagination.current = pagination.current; + this.pagination.pageSize = pagination.pageSize; + this.pagination.total = pagination.total; + this.queryGovDatas(); } //��������������������� private handleChange(selectedItems: any) { if (selectedItems) { - this.stationLevelId = selectedItems + this.stationLevelId = selectedItems; } else { - this.stationLevelId = '' + this.stationLevelId = ""; } - this.pagination.current = 1 - this.queryGovDatas() + this.pagination.current = 1; + this.queryGovDatas(); } // ������������������ private positionLevel(val: any, selectedOptions: any) { if (selectedOptions && selectedOptions.length > 0) { - this.addForm.position = selectedOptions + this.addForm.position = selectedOptions; } else { - this.addForm.position = undefined + this.addForm.position = undefined; } } // ��������������������� private selectDatas() { - get("dict/data/query?type=stationLevel ", {}).then(res => { - if (res.data.code === 0) { - this.stationLevel = res.data.data - } - }) - .catch(err => { + get("dict/data/query?type=stationLevel ", {}) + .then((res) => { + if (res.data.code === 0) { + this.stationLevel = res.data.data; + } + }) + .catch((err) => { console.log(err); }); } // ������������������������ private queryGovDatas() { - get('govMonitorPoint/getGovMonitorPointByCondition', { + get("govMonitorPoint/getGovMonitorPointByCondition", { current: this.pagination.current, size: this.pagination.pageSize, name: this.searchName, - stationLevel: this.stationLevelId + stationLevel: this.stationLevelId, }).then((res: any) => { if (res.data.code === 0) { this.pagination.total = res.data.data.totalNumber; this.pagination.current = res.data.data.current; - const govDatas = res.data.data.govMonitorPointList + const govDatas = res.data.data.govMonitorPointList; if (govDatas.length > 0) { for (let i = 0; i < govDatas.length; i++) { for (let j = 0; j < govDatas[i].position.length; j++) { - govDatas[i].stationLevelName = this.stationLevel[govDatas[i].stationLevel] + govDatas[i].stationLevelName = this.stationLevel[ + govDatas[i].stationLevel + ]; } } } - this.dataSource = govDatas + this.dataSource = govDatas; } - }) + }); } // ������������ private handleModalVisible(flag: boolean) { - this.addShowOrHiddenFlag = flag + this.addShowOrHiddenFlag = flag; } // ������������ private addOK() { this.$refs.addRulesForm.validate((valid: any) => { if (valid) { - post('govMonitorPoint/insert', { + post("govMonitorPoint/insert", { guid: this.addForm.guid, //������������������ name: this.addForm.name, //������ longitude: this.addForm.longitude, //������ @@ -324,51 +565,51 @@ cityCode: this.addForm.position[1].value, areaCode: this.addForm.position[2].value, stationLevel: this.addForm.stationLevel, - desc: this.addForm.desc //������ + desc: this.addForm.desc, //������ }).then((res: any) => { if (res.data.code === 0) { - this.pagination.current = 1 - this.$message.success(res.data.message) - this.queryGovDatas() + this.pagination.current = 1; + this.$message.success(res.data.message); + this.queryGovDatas(); } else { - this.$message.warning(res.data.message) + this.$message.warning(res.data.message); } - }) - this.addShowOrHiddenFlag = false + }); + this.addShowOrHiddenFlag = false; this.addForm = { - guid: '', - name: '', - longitude: '', - latitude: '', + guid: "", + name: "", + longitude: "", + latitude: "", position: [], stationLevel: undefined, - desc: '' - } - this.addShowOrHiddenFlag = false + desc: "", + }; + this.addShowOrHiddenFlag = false; } - }) + }); } // ������������ private addCancel() { this.addForm = { - guid: '', - name: '', - longitude: '', - latitude: '', + guid: "", + name: "", + longitude: "", + latitude: "", position: [], stationLevel: undefined, - desc: '' - } - this.addShowOrHiddenFlag = false + desc: "", + }; + this.addShowOrHiddenFlag = false; } // ������������ private editShow(flag: boolean, record: any) { - this.editShowOrHiddenFlag = flag - this.editBeforeRecord = record - const positon = [] - positon.push(record.provinceCode) - positon.push(record.cityCode) - positon.push(record.areaCode) + this.editShowOrHiddenFlag = flag; + this.editBeforeRecord = record; + const positon = []; + positon.push(record.provinceCode); + positon.push(record.cityCode); + positon.push(record.areaCode); this.editForm = { id: record.id, guid: record.guid, @@ -377,75 +618,112 @@ latitude: record.latitude, position: positon, stationLevel: record.stationLevel, - desc: record.desc === undefined ? '' : record.desc - } + desc: record.desc === undefined ? "" : record.desc, + }; } // ������������ private editSiteShow(flag: boolean, record: any) { - this.editSiteShowOrHiddenFlag = flag - this.editBeforeSiteRecord = record - const positon = [] - positon.push(record.provinceCode) - positon.push(record.cityCode) - positon.push(record.areaCode) + this.editSiteShowOrHiddenFlag = flag; + this.editBeforeSiteRecord = record; + const positon = []; + positon.push(record.provinceCode); + positon.push(record.cityCode); + positon.push(record.areaCode); this.editSiteForm = { id: record.id, - guid: record.guid - } + guid: record.guid, + }; } // ������������������ private editSiteSave() { this.$refs.editSiteRulesForm.validate((valid: any) => { if (valid) { - const guid = this.editSiteForm.guid === this.editBeforeSiteRecord.guid ? null : this.editSiteForm.guid - if (!(guid)) { - this.$message.warning('������������') + const guid = + this.editSiteForm.guid === this.editBeforeSiteRecord.guid + ? null + : this.editSiteForm.guid; + if (!guid) { + this.$message.warning("������������"); } else { - get('govMonitorPoint/updateGuid', { + get("govMonitorPoint/updateGuid", { id: this.editSiteForm.id, - guid + guid, }).then((res: any) => { if (res.data.code === 0) { - this.$message.success(res.data.message) + this.$message.success(res.data.message); this.editSiteForm = { id: -1, - guid: '' - } - this.editSiteShowOrHiddenFlag = false - this.queryGovDatas() + guid: "", + }; + this.editSiteShowOrHiddenFlag = false; + this.queryGovDatas(); } else { - this.$message.warning(res.data.message) + this.$message.warning(res.data.message); } - }) + }); } } - }) + }); } private editSiteCancel() { this.editForm = { id: -1, - guid: '' - } - this.editSiteShowOrHiddenFlag = false + guid: "", + }; + this.editSiteShowOrHiddenFlag = false; } // ������������ private editSave() { this.$refs.editRulesForm.validate((valid: any) => { if (valid) { - const name = this.editForm.name === this.editBeforeRecord.name ? null : this.editForm.name - const guid = this.editForm.guid === this.editBeforeRecord.guid ? null : this.editForm.guid - const longitude = this.editForm.longitude === this.editBeforeRecord.longitude ? null : this.editForm.longitude - const latitude = this.editForm.latitude === this.editBeforeRecord.latitude ? null : this.editForm.latitude - const position = (this.editForm.position[0] === this.editBeforeRecord.provinceCode && + const name = + this.editForm.name === this.editBeforeRecord.name + ? null + : this.editForm.name; + const guid = + this.editForm.guid === this.editBeforeRecord.guid + ? null + : this.editForm.guid; + const longitude = + this.editForm.longitude === this.editBeforeRecord.longitude + ? null + : this.editForm.longitude; + const latitude = + this.editForm.latitude === this.editBeforeRecord.latitude + ? null + : this.editForm.latitude; + const position = + this.editForm.position[0] === this.editBeforeRecord.provinceCode && this.editForm.position[1] === this.editBeforeRecord.cityCode && - this.editForm.position[2] === this.editBeforeRecord.areaCode) ? null : this.editForm.position - const stationLevel = this.editForm.stationLevel === this.editBeforeRecord.stationLevel ? null : this.editForm.stationLevel - const desc = this.editBeforeRecord.desc === undefined ? (this.editForm.desc === '' ? null : this.editForm.desc) : - this.editForm.desc === this.editBeforeRecord.desc ? null : this.editForm.desc - if (!(name || guid || longitude || latitude || position || stationLevel || desc)) { - this.$message.warning('������������') + this.editForm.position[2] === this.editBeforeRecord.areaCode + ? null + : this.editForm.position; + const stationLevel = + this.editForm.stationLevel === this.editBeforeRecord.stationLevel + ? null + : this.editForm.stationLevel; + const desc = + this.editBeforeRecord.desc === undefined + ? this.editForm.desc === "" + ? null + : this.editForm.desc + : this.editForm.desc === this.editBeforeRecord.desc + ? null + : this.editForm.desc; + if ( + !( + name || + guid || + longitude || + latitude || + position || + stationLevel || + desc + ) + ) { + this.$message.warning("������������"); } else { - post('govMonitorPoint/update', { + post("govMonitorPoint/update", { id: this.editForm.id, guid, name, @@ -455,66 +733,63 @@ cityCode: position === null ? null : position[1], areaCode: position === null ? null : position[2], stationLevel, - desc + desc, }).then((res: any) => { if (res.data.code === 0) { - this.$message.success(res.data.message) + this.$message.success(res.data.message); this.editForm = { id: -1, - guid: '', - name: '', - longitude: '', - latitude: '', + guid: "", + name: "", + longitude: "", + latitude: "", position: [], stationLevel: undefined, - desc: '' - } - this.editShowOrHiddenFlag = false - this.queryGovDatas() + desc: "", + }; + this.editShowOrHiddenFlag = false; + this.queryGovDatas(); } else { - this.$message.warning(res.data.message) + this.$message.warning(res.data.message); } - }) + }); } } - }) + }); } // ������������ private editCancel() { this.editForm = { id: -1, - guid: '', - name: '', - longitude: '', - latitude: '', + guid: "", + name: "", + longitude: "", + latitude: "", position: [], stationLevel: undefined, - desc: '' - } - this.editShowOrHiddenFlag = false + desc: "", + }; + this.editShowOrHiddenFlag = false; } // ������ private delete(record: any) { - post('govMonitorPoint/delete', { - id: record.id + post("govMonitorPoint/delete", { + id: record.id, }).then((res: any) => { if (res.data.code === 0) { - this.$message.success(res.data.message) - this.pagination.current = 1 - this.queryGovDatas() + this.$message.success(res.data.message); + this.pagination.current = 1; + this.queryGovDatas(); } else { - this.$message.warning(res.data.message) + this.$message.warning(res.data.message); } - }) + }); } // ������������������ private opRender(text: string, record: any, index: number) { return ( <div> - <a onClick={() => this.editShow(true, record)}> - {" "} - ������{" "} - </a> + <a onClick={() => this.editShow(true, record)}> ������ </a> <a-divider type="vertical" /> <a-popconfirm title="������������������" @@ -525,12 +800,9 @@ <a href="#">������</a> </a-popconfirm> <a-divider type="vertical" /> - <a onClick={() => this.editSiteShow(true, record)}> - {" "} - ������������������{" "} - </a> + <a onClick={() => this.editSiteShow(true, record)}> ������������������ </a> </div> - ) + ); } } </script> -- Gitblit v1.8.0