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/list/devicesBasic.vue | 46 src/views/list/specialDevice.vue | 1156 +++++++------ src/views/list/devicesVersion.vue | 166 + src/views/device/areaConfiguration.vue | 987 ++++++----- src/views/list/Unit.vue | 647 ++++---- src/views/list/devicesMonitorPoint.vue | 1023 +++++++----- src/views/device/govMonitorPoint.vue | 744 ++++++-- 7 files changed, 2,680 insertions(+), 2,089 deletions(-) diff --git a/src/views/device/areaConfiguration.vue b/src/views/device/areaConfiguration.vue index 9287d34..594a87b 100644 --- a/src/views/device/areaConfiguration.vue +++ b/src/views/device/areaConfiguration.vue @@ -3,89 +3,101 @@ <div class="tableList"> <div class="tableListForm"> <a-form-model layout="horizontal"> - <a-row :gutter="15"> + <a-row :gutter="15"> <a-col :span="5"> <a-button - icon="plus" - type="primary" - @click="() => this.handleModalVisible(true)" - style="margin-left: 25px;" - >������</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 + placeholder="������������" + style="width: 240px;margin-top:4px" + @change="handleChange" + allow-clear + show-search > - <a-select-option v-for="(item,index) in orgData" :key="index" :value="item.id"> + <a-select-option + v-for="(item, index) in orgData" + :key="index" + :value="item.id" + > {{ item.name }} </a-select-option> </a-select> </a-form-model-item> </a-col> - <a-col :span="5" > - <a-form-model-item - :wrapperCol="wrapperCol"> - <a-input v-model="searchName" placeholder="���������������������" allow-clear /> + <a-col :span="5"> + <a-form-model-item :wrapperCol="wrapperCol"> + <a-input + v-model="searchName" + placeholder="���������������������" + allow-clear + /> </a-form-model-item> </a-col> </a-row> - </a-form-model - > + </a-form-model> </div> <av-standard-table - :dataSource="dataSource" - :columns="columns" - :loading="tableLoading" - :paginationProps="pagination" - @tableChange="handlerTableChange" + :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="������" + title="���������������������" + destroyOnClose + :visible="addShowOrHiddenFlag" + @ok="addOK" + @cancel="addCancel" + okText="������" > <a-form-model - style="margin-top: 8px" - :model="addForm" - :rules="rules" - ref="addRulesForm" + style="margin-top: 8px" + :model="addForm" + :rules="rules" + ref="addRulesForm" > - - <a-form-model-item has-feedback - :labelCol="{ span: 5 }" - :wrapperCol="{ span: 15 }" - label="������" - prop="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" + placeholder="������������" + type="string" + v-model="addForm.name" /> </a-form-model-item> <a-form-model-item - :labelCol="{ span: 5 }" - :wrapperCol="{ span: 15 }" - label="������" - has-feedback - prop="orgId" + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + has-feedback + prop="orgId" > <a-select - placeholder="���������������" - type="string" - allow-clear - show-search - v-model="addForm.orgId" + placeholder="���������������" + type="string" + allow-clear + show-search + v-model="addForm.orgId" > - <a-select-option v-for="(item,index) in orgData" :key="index" :value="item.id"> + <a-select-option + v-for="(item, index) in orgData" + :key="index" + :value="item.id" + > {{ item.name }} </a-select-option> </a-select> @@ -93,515 +105,585 @@ </a-form-model> </a-modal> <a-modal - title="���������������������" - destroyOnClose - :visible="editShowOrHiddenFlag" - @ok="editSave" - @cancel="editCancel" - okText="������" + title="���������������������" + destroyOnClose + :visible="editShowOrHiddenFlag" + @ok="editSave" + @cancel="editCancel" + okText="������" > <a-form-model - style="margin-top: 8px" - :model="editForm" - :rules="rules" - ref="editRulesForm" + style="margin-top: 8px" + :model="editForm" + :rules="rules" + ref="editRulesForm" > - <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 }" - :wrapperCol="{ span: 15 }" - label="������" - has-feedback + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + has-feedback > <a-input - placeholder="������" - type="string" - disabled="disabled" - v-model="editForm.orgName" + placeholder="������" + type="string" + disabled="disabled" + v-model="editForm.orgName" /> </a-form-model-item> - - </a-form-model> </a-modal> <a-modal - title="������������" - width="70%" - destroyOnClose - :visible="areaPointConfigurationFlag" - @ok="editAreaPoint" - @cancel="editCancelMap" - okText="������" - class="areaStyle" + title="������������" + width="70%" + destroyOnClose + :visible="areaPointConfigurationFlag" + @ok="editAreaPoint" + @cancel="editCancelMap" + okText="������" + class="areaStyle" > <div> - <a-layout> <a-layout> <a-layout-sider> <a-tree - v-model="checkedKeys" - checkable - @select="onSelect" - :tree-data="treeData" - @check="onCheck" + v-model="checkedKeys" + checkable + @select="onSelect" + :tree-data="treeData" + @check="onCheck" /> </a-layout-sider> <a-layout-content> <div style="position: relative"> - <baidu-map - @ready="handler" - :center="map.center" - :zoom="map.zoom" - :scroll-wheel-zoom="true" - @click="mapClick" - style="height: 600px;width: 100%; z-index: 9"> + @ready="handler" + :center="map.center" + :zoom="map.zoom" + :scroll-wheel-zoom="true" + @click="mapClick" + style="height: 600px;width: 100%; z-index: 9" + > <bm-control> - - <a-button type="primary" style="margin-top: 20px; margin-left: 10px; border: none" @click="toggle">{{ polyline.editing ? '������������' : '������������' }}</a-button> - <a-button type="primary" style="margin-top: 20px; margin-left: 10px; border: none" @click="chooseCenter">{{ !map.chooseCenter.flag ? '���������������' : '������������' }}</a-button> - <p style="position: absolute;top: 20px;left: 240px;z-index: 10; width: 400px"> - <a-input disabled="disabled" placeholder="���������������" v-model="map.chooseCenter.point.lng" style="display: inline; width: 160px;height: 32px"/> - <a-input disabled="disabled" placeholder="���������������" v-model="map.chooseCenter.point.lat" style="display: inline; width: 160px;height: 32px;margin-left: 10px"/> + <a-button + type="primary" + style="margin-top: 20px; margin-left: 10px; border: none" + @click="toggle" + >{{ + polyline.editing ? "������������" : "������������" + }}</a-button + > + <a-button + type="primary" + style="margin-top: 20px; margin-left: 10px; border: none" + @click="chooseCenter" + >{{ + !map.chooseCenter.flag ? "���������������" : "������������" + }}</a-button + > + <p + style="position: absolute;top: 20px;left: 240px;z-index: 10; width: 400px" + > + <a-input + disabled="disabled" + placeholder="���������������" + v-model="map.chooseCenter.point.lng" + style="display: inline; width: 160px;height: 32px" + /> + <a-input + disabled="disabled" + placeholder="���������������" + v-model="map.chooseCenter.point.lat" + style="display: inline; width: 160px;height: 32px;margin-left: 10px" + /> </p> </bm-control> <!-- <bm-local-search :keyword="keyword" :auto-viewport="true" style="display: none" ></bm-local-search>--> - <bm-marker v-for="item in map.points" :position="item.point" ></bm-marker> - <bm-circle v-for="item in map.points" :center="item.point" :radius="2000" stroke-color="red" :stroke-opacity="0.5" :stroke-weight="1" :editing="false"></bm-circle> - <bm-polygon :path="polyline.points" stroke-color="blue" :stroke-opacity="0.5" :stroke-weight="2" :editing="polyline.editing" @lineupdate="updatePolygonPath"/> - <bm-marker v-if="map.chooseCenter.flag || (map.chooseCenter.point.lat !== '')" :position="map.chooseCenter.point" color="blue" :dragging="true" animation="BMAP_ANIMATION_BOUNCE"></bm-marker> + <bm-marker + v-for="item in map.points" + :position="item.point" + ></bm-marker> + <bm-circle + v-for="item in map.points" + :center="item.point" + :radius="2000" + stroke-color="red" + :stroke-opacity="0.5" + :stroke-weight="1" + :editing="false" + ></bm-circle> + <bm-polygon + :path="polyline.points" + stroke-color="blue" + :stroke-opacity="0.5" + :stroke-weight="2" + :editing="polyline.editing" + @lineupdate="updatePolygonPath" + /> + <bm-marker + v-if=" + map.chooseCenter.flag || map.chooseCenter.point.lat !== '' + " + :position="map.chooseCenter.point" + color="blue" + :dragging="true" + animation="BMAP_ANIMATION_BOUNCE" + ></bm-marker> </baidu-map> </div> - </a-layout-content> </a-layout> </a-layout> - </div> </a-modal> </a-card> - </template> <script lang="tsx"> -import {Component, Vue, Watch} from "vue-property-decorator"; -import org from '@/util/org' +import { Component, Vue, Watch } from "vue-property-decorator"; +import org from "@/util/org"; import { get, post } from "@/util/request"; import axios from "axios"; @Component({ - components: { - } + components: {}, }) export default class areaConfiguration extends Vue { // ������������ private wrapperCol: any = { - sm: {span: 16}//������������������������ - } - private orgData: any = [] + sm: { span: 16 }, //������������������������ + }; + private orgData: any = []; // ������ private columns: any[] = [ - + { + title: "������", + dataIndex: "key", + key: "key", + align: "center", + customRender: (text: any, record: any, index: any) => `${index + 1}`, + width: 60, + }, { title: "������", - dataIndex: "name" + dataIndex: "name", }, { title: "������������", - dataIndex: "organization_name" + dataIndex: "organization_name", }, { title: "���������������", - dataIndex: "centerLongitude" + dataIndex: "centerLongitude", }, { title: "���������������", - dataIndex: "centerLatitude" + dataIndex: "centerLatitude", }, { title: "������������", - dataIndex: "createTime" + dataIndex: "createTime", }, { 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[] = []; // ���������������id - private queryId: any = undefined + private queryId: any = undefined; // ������������������������ - private addShowOrHiddenFlag: boolean = false + private addShowOrHiddenFlag: boolean = false; // ������������������������ - private editShowOrHiddenFlag: boolean = false + private editShowOrHiddenFlag: boolean = false; // ���������������������flag - private areaPointConfigurationFlag: boolean = false + private areaPointConfigurationFlag: boolean = false; // ��������� - private treeData: any = [] + private treeData: any = []; // ��������������������� - private checkedKeys: any = [] + private checkedKeys: any = []; // ��������������������������������� - private mapRecord: any = {} + private mapRecord: any = {}; // ��������� private polyline: any = { editing: false, - points: [] - } + points: [], + }; // ��������������������������� private rules: any = { name: [ - {required: true, message: '������������������', trigger: ['change', 'blur']}, + { required: true, message: "������������������", trigger: ["change", "blur"] }, ], orgId: [ - {required: true, message: '���������������', trigger: ['change', 'blur']}, - ] - } + { required: true, message: "���������������", trigger: ["change", "blur"] }, + ], + }; // ������������������������record - private editBeforeRecord: any = null + private editBeforeRecord: any = null; // ������������������ private addForm: any = { - name: '', - orgId: undefined - } + name: "", + orgId: undefined, + }; private handleChange(val: any) { - this.pagination.current = 1 - this.queryId = val - this.getDataByCondition() + this.pagination.current = 1; + this.queryId = val; + this.getDataByCondition(); } // ������������������ private editForm: any = { - name: '', + name: "", orgId: undefined, - orgName: '' - } + orgName: "", + }; // ������������ private pagination: any = { total: 0, current: 1, - pageSize: 8, - showSizeChanger: false, - showQuickJumper: false + pageSize: 10, + showSizeChanger: true, + showQuickJumper: true, + pageSizeOptions: ["10", "30", "60", "100"], + showTotal: (total: number) => `������ ${this.pagination.total} ���������`, //��������������������������� }; // ������������ - private monitorPoints: any = [] + private monitorPoints: any = []; // ���������������id - private deviceIds: any = [] + private deviceIds: any = []; // ������������ private map: any = { - center: {lng: 116.404, lat: 39.915}, + center: { lng: 116.404, lat: 39.915 }, zoom: 14, points: [], chooseCenter: { - point: {lng: '', lat: ''}, - flag: false - } - } + point: { lng: "", lat: "" }, + flag: false, + }, + }; // ������������������������ - @Watch('searchName', { + @Watch("searchName", { deep: true, - immediate:true + immediate: true, }) private watchName() { - this.pagination.current = 1 - this.getDataByCondition() + this.pagination.current = 1; + this.getDataByCondition(); } // ������������������ private created() { - this.getAllOrg() - this.getDataByCondition() + this.getAllOrg(); + this.getDataByCondition(); } // ������������������������������ private handlerTableChange(pagination: any, filter: any, sorter: any): void { - this.pagination.current = pagination.current - this.getDataByCondition() + this.pagination.current = pagination.current; + this.pagination.pageSize = pagination.pageSize; + this.pagination.total = pagination.total; + this.getDataByCondition(); } // ������������������ - private getAllOrg(){ - get("organization/queryNames", {} - ).then(res => { - this.orgData = res.data.data.organizationVOs.reverse() - }) + private getAllOrg() { + get("organization/queryNames", {}).then((res) => { + this.orgData = res.data.data.organizationVOs.reverse(); + }); } // ������������������������������ private getDataByCondition() { - let params = {} + let params = {}; if (this.queryId === undefined) { params = { name: this.searchName, current: this.pagination.current, - size: this.pagination.pageSize - } + size: this.pagination.pageSize, + }; } else { params = { orgId: this.queryId, name: this.searchName, current: this.pagination.current, - size: this.pagination.pageSize - } + size: this.pagination.pageSize, + }; } - get('servicesScope/getDataByCondition', params).then((res: any) => { - if(res.data.code === 0) { - this.dataSource = res.data.data.servicesScopes - this.pagination.total = res.data.data.totalNumber + get("servicesScope/getDataByCondition", params).then((res: any) => { + if (res.data.code === 0) { + this.dataSource = res.data.data.servicesScopes; + this.pagination.total = res.data.data.totalNumber; } else { - console.log('���������������������������������') + console.log("���������������������������������"); } - }) + }); } // ������������ private addOK() { - post('servicesScope/insert', - { - name: this.addForm.name, - organizationId: this.addForm.orgId - } - ).then((res: any) => { - if (res.data.code === 0) { - this.getDataByCondition() - this.addShowOrHiddenFlag = false - this.addForm.name = '' - this.addForm.orgId = undefined - this.$message.success(res.data.message) - } else { - this.$message.warning(res.data.message) - } - }).catch((err: any) => { - this.$message.error('���������������') + post("servicesScope/insert", { + name: this.addForm.name, + organizationId: this.addForm.orgId, }) + .then((res: any) => { + if (res.data.code === 0) { + this.getDataByCondition(); + this.addShowOrHiddenFlag = false; + this.addForm.name = ""; + this.addForm.orgId = undefined; + this.$message.success(res.data.message); + } else { + this.$message.warning(res.data.message); + } + }) + .catch((err: any) => { + this.$message.error("���������������"); + }); } // ������������ private handleModalVisible(flag: boolean) { - this.addShowOrHiddenFlag = flag + this.addShowOrHiddenFlag = flag; } // ������������ private addCancel() { - this.addForm.name = '' - this.addForm.orgId = undefined - this.addShowOrHiddenFlag = false + this.addForm.name = ""; + this.addForm.orgId = undefined; + this.addShowOrHiddenFlag = false; } // ������������ - private editShow(flag:boolean, record: any) { - this.editBeforeRecord = record - this.editShowOrHiddenFlag = flag - this.editForm.name = record.name - this.editForm.orgId = record.organizationId - this.editForm.orgName = record.organization_name - this.editBeforeRecord = record + private editShow(flag: boolean, record: any) { + this.editBeforeRecord = record; + this.editShowOrHiddenFlag = flag; + this.editForm.name = record.name; + this.editForm.orgId = record.organizationId; + this.editForm.orgName = record.organization_name; + this.editBeforeRecord = record; } // ������������ private editSave() { this.$refs.editRulesForm.validate((valid: any) => { if (valid) { - const name = this.editForm.name === this.editBeforeRecord.name ? null : this.editForm.name - const organizationId = this.editForm.orgId === this.editBeforeRecord.organizationId ? null : this.editForm.orgId + const name = + this.editForm.name === this.editBeforeRecord.name + ? null + : this.editForm.name; + const organizationId = + this.editForm.orgId === this.editBeforeRecord.organizationId + ? null + : this.editForm.orgId; if (name === null && organizationId === null) { - this.$message.warning('���������') + this.$message.warning("���������"); } else { - post('servicesScope/update', { - id: this.editBeforeRecord.id, - name: name, - organizationId: organizationId - } - ).then((res: any) => { + post("servicesScope/update", { + id: this.editBeforeRecord.id, + name: name, + organizationId: organizationId, + }).then((res: any) => { if (res.data.code === 0) { - this.getDataByCondition() - this.editShowOrHiddenFlag = false - this.editBeforeRecord = null - this.$message.success(res.data.message) + this.getDataByCondition(); + this.editShowOrHiddenFlag = false; + this.editBeforeRecord = null; + this.$message.success(res.data.message); } else { - this.$message.warning(res.data.message) + this.$message.warning(res.data.message); } - }) + }); } } - }) + }); } // ������������ private editCancel() { - this.editShowOrHiddenFlag = false + this.editShowOrHiddenFlag = false; } // ��������������������� private areaPointConfiguration(flag: boolean, record: any) { - this.areaPointConfigurationFlag = flag - this.mapRecord = record - get("device/selectMonitorPiontAndDeviceByOrgId",{ - organization_id:record.organizationId, - }).then(res=>{ - if (res.data.code === 0) { - this.monitorPoints = res.data.data - if (this.monitorPoints.length > 0) { - this.map.center.lng = this.monitorPoints[0].longitude - this.map.center.lat = this.monitorPoints[0].latitude + this.areaPointConfigurationFlag = flag; + this.mapRecord = record; + get("device/selectMonitorPiontAndDeviceByOrgId", { + organization_id: record.organizationId, + }).then((res) => { + if (res.data.code === 0) { + this.monitorPoints = res.data.data; + if (this.monitorPoints.length > 0) { + this.map.center.lng = this.monitorPoints[0].longitude; + this.map.center.lat = this.monitorPoints[0].latitude; + } + this.treeData = this.monitorPoints.map((item: any) => { + let devices = []; + if (item.devices.length > 0) { + devices = item.devices.map((device: any) => { + const d = { + key: item.id + "-" + device.id, + title: device.name, + value: { + longitude: device.longitude, + latitude: device.latitude, + }, + }; + return d; + }); } - this.treeData = this.monitorPoints.map((item: any) => { - let devices = [] - if (item.devices.length > 0) { - devices = item.devices.map((device: any) => { - const d = { - key: item.id + '-' + device.id, - title: device.name, - value: { - longitude: device.longitude, - latitude: device.latitude + const obj = { + key: item.id, + title: item.name, + value: { + longitude: item.longitude, + latitude: item.latitude, + }, + children: devices, + }; + return obj; + }); + if (this.treeData.length > 0) { + if (record.boundary !== null) { + const points = record.boundary.split(";").map((item) => { + const point = item.split(","); + const obj = { lng: point[0], lat: point[1] }; + return obj; + }); + this.polyline.points = points; + } + if ( + !( + record.boundary === null && + record.centerLatitude === null && + record.centerLongitude === null + ) + ) { + this.map.chooseCenter.point.lat = record.centerLatitude; + this.map.chooseCenter.point.lng = record.centerLongitude; + get("servicesScopeDevice/getDevicesAndMonitorPoint", { + servicesScopeId: record.id, + }).then((res: any) => { + if (res.data.code === 0) { + const selectDevices = res.data.data; + this.map.center.lat = record.centerLatitude; + this.map.center.lng = record.centerLongitude; + const devicesExit = selectDevices.map((item: any) => { + if (item.devices.length > 0) { + const children = item.devices.map((device: any) => { + const treeDevice = { + key: item.id + "-" + device.id, + title: device.name, + value: { + longitude: device.longitude, + latitude: device.latitude, + }, + }; + return treeDevice; + }); + const treeDevices = { + key: item.id, + title: item.name, + children: children, + }; + return treeDevices; } + }); + if (devicesExit.length > 0) { + const points = new Array(); + devicesExit.forEach((item: any) => { + item.children.forEach((child: any) => { + this.checkedKeys.push(child.key); + const point = { + lng: child.value.longitude, + lat: child.value.latitude, + }; + const deviceId = child.key.substr( + child.key.indexOf("-") + 1, + child.key.length + ); + const obj = { + point: point, + deviceId: deviceId, + }; + points.push(obj); + }); + }); + this.map.points = points; } - return d - }) - } - const obj = { - key: item.id, - title: item.name, - value: { - longitude: item.longitude, - latitude: item.latitude - }, - children: devices - } - return obj - }) - if (this.treeData.length > 0) { - if (record.boundary !== null) { - const points = record.boundary.split(';').map(item => { - const point = item.split(',') - const obj = {lng: point[0], lat: point[1]} - return obj - }) - this.polyline.points = points - } - if (!(record.boundary === null && record.centerLatitude === null && record.centerLongitude === null)) { - this.map.chooseCenter.point.lat = record.centerLatitude - this.map.chooseCenter.point.lng = record.centerLongitude - get('servicesScopeDevice/getDevicesAndMonitorPoint', { - servicesScopeId: record.id - }).then((res: any) => { - if (res.data.code === 0) { - const selectDevices = res.data.data - this.map.center.lat = record.centerLatitude - this.map.center.lng = record.centerLongitude - const devicesExit = selectDevices.map((item: any) => { - if (item.devices.length > 0) { - const children = item.devices.map((device: any) => { - const treeDevice = { - key: item.id + '-' + device.id, - title: device.name, - value: { - longitude: device.longitude, - latitude: device.latitude - } - } - return treeDevice - }) - const treeDevices = { - key: item.id, - title: item.name, - children: children - } - return treeDevices - } - }) - if (devicesExit.length > 0) { - const points = new Array() - devicesExit.forEach((item: any) => { - item.children.forEach((child: any) => { - this.checkedKeys.push(child.key) - const point = { - lng: child.value.longitude, - lat: child.value.latitude - } - const deviceId = child.key.substr(child.key.indexOf('-') + 1, child.key.length) - const obj = { - point: point, - deviceId: deviceId - } - points.push(obj) - }) - }) - this.map.points = points - } - } - }) - } + } + }); } } - }) + } + }); } // ��������������� - private handler({BMap, map}) { - this.map.zoom = 14 + private handler({ BMap, map }) { + this.map.zoom = 14; } // ��������������������� private editCancelMap() { - this.areaPointConfigurationFlag = false - this.map.points = [] - this.polyline.points = [] - this.polyline.editing = false - this.map.chooseCenter.point.lng = '' - this.map.chooseCenter.point.lat = '' - this.map.chooseCenter.flag = false - this.checkedKeys = [] + this.areaPointConfigurationFlag = false; + this.map.points = []; + this.polyline.points = []; + this.polyline.editing = false; + this.map.chooseCenter.point.lng = ""; + this.map.chooseCenter.point.lat = ""; + this.map.chooseCenter.flag = false; + this.checkedKeys = []; } // ������������������������ private editAreaPoint() { let lnglat = this.polyline.points.map((point: any) => { - return point.lng + ',' + point.lat - }) - const boundary = lnglat.join(';') - if(boundary === '') { - this.$message.warning('������������������������') - return + return point.lng + "," + point.lat; + }); + const boundary = lnglat.join(";"); + if (boundary === "") { + this.$message.warning("������������������������"); + return; } - if ((this.map.chooseCenter.point.lat === '' || this.map.chooseCenter.point.lat === null) && (this.map.chooseCenter.point.lng === '' || this.map.chooseCenter.point.lng === null)) { - this.$message.warning('���������������������') - return + if ( + (this.map.chooseCenter.point.lat === "" || + this.map.chooseCenter.point.lat === null) && + (this.map.chooseCenter.point.lng === "" || + this.map.chooseCenter.point.lng === null) + ) { + this.$message.warning("���������������������"); + return; } - post('servicesScope/addBoundaryBindDevice', - { - devices: this.deviceIds.join(','), - servicesScope: { - id: this.mapRecord.id, - name: null, - organizationId: null, - centerLongitude: this.map.chooseCenter.point.lng, - centerLatitude: this.map.chooseCenter.point.lat, - boundary: boundary - } - }).then((res: any) => { - if (res.data.code === 0) { - this.getDataByCondition() - this.areaPointConfigurationFlag = false - this.map.points = [] - this.polyline.points = [] - this.polyline.editing = false - this.map.chooseCenter.point.lng = '' - this.map.chooseCenter.point.lat = '' - this.checkedKeys = [] - this.map.chooseCenter.flag = false - this.$message.success(res.data.message) - } else { - this.$message.warning(res.data.message) - } - }) + post("servicesScope/addBoundaryBindDevice", { + devices: this.deviceIds.join(","), + servicesScope: { + id: this.mapRecord.id, + name: null, + organizationId: null, + centerLongitude: this.map.chooseCenter.point.lng, + centerLatitude: this.map.chooseCenter.point.lat, + boundary: boundary, + }, + }).then((res: any) => { + if (res.data.code === 0) { + this.getDataByCondition(); + this.areaPointConfigurationFlag = false; + this.map.points = []; + this.polyline.points = []; + this.polyline.editing = false; + this.map.chooseCenter.point.lng = ""; + this.map.chooseCenter.point.lat = ""; + this.checkedKeys = []; + this.map.chooseCenter.flag = false; + this.$message.success(res.data.message); + } else { + this.$message.warning(res.data.message); + } + }); } // ��������������������� // private onSelect(selectedKeys: any, info: any) { @@ -610,126 +692,125 @@ // } // ������������������������ private onCheck(checkedKeys: any, info: any) { - this.deviceIds = checkedKeys.filter((item: any) => { - if (typeof item === 'string') { - return item - } - }).map((item: any) => { - return item.substr(item.indexOf('-') + 1, item.length) - }) + this.deviceIds = checkedKeys + .filter((item: any) => { + if (typeof item === "string") { + return item; + } + }) + .map((item: any) => { + return item.substr(item.indexOf("-") + 1, item.length); + }); - let infos = info.checkedNodes + let infos = info.checkedNodes; if (infos.length > 0) { infos = infos.filter((item: any) => { - if (typeof item.key === 'string') { - return item + if (typeof item.key === "string") { + return item; } - }) + }); this.map.points = infos.map((item: any) => { - const point = { - lng: item.data.props.value.longitude, - lat: item.data.props.value.latitude - } - const index = item.key.indexOf('-'); + const point = { + lng: item.data.props.value.longitude, + lat: item.data.props.value.latitude, + }; + const index = item.key.indexOf("-"); const pointObj = { - point: point, - deviceId: item.key.substring(index+1,item.key.length) - } - return pointObj - // const id = item.key.substr() - }) + point: point, + deviceId: item.key.substring(index + 1, item.key.length), + }; + return pointObj; + // const id = item.key.substr() + }); } else { - this.map.points = [] + this.map.points = []; } } // ��������������������� - private toggle(){ + private toggle() { if (this.map.points.length === 0) { - this.$message.warning('������������������������������������������') + this.$message.warning("������������������������������������������"); return; } if (this.map.points.length === 1) { - this.$message.warning('���������������������������') + this.$message.warning("���������������������������"); return; } - this.polyline.editing = !this.polyline.editing + this.polyline.editing = !this.polyline.editing; if (this.polyline.editing) { if (this.polyline.points.length === 0) { const lngMaxOrMin = this.map.points.sort((item1: any, item2: any) => { - return item1.point.lng - item2.point.lng - }) - const lngMin = lngMaxOrMin[0] - const lngMax = lngMaxOrMin[lngMaxOrMin.length - 1] + return item1.point.lng - item2.point.lng; + }); + const lngMin = lngMaxOrMin[0]; + const lngMax = lngMaxOrMin[lngMaxOrMin.length - 1]; const latMaxOrMin = this.map.points.sort((item1: any, item2: any) => { - return item1.point.lat - item2.point.lat - }) - const latMin = latMaxOrMin[0] - const latMax = latMaxOrMin[latMaxOrMin.length - 1] + return item1.point.lat - item2.point.lat; + }); + const latMin = latMaxOrMin[0]; + const latMax = latMaxOrMin[latMaxOrMin.length - 1]; const points = [ - {lng: lngMax.point.lng, lat:latMax.point.lat }, - {lng: lngMax.point.lng, lat:latMin.point.lat }, - {lng: lngMin.point.lng, lat:latMin.point.lat }, - {lng: lngMin.point.lng, lat:latMax.point.lat } - ] - this.polyline.points = points + { lng: lngMax.point.lng, lat: latMax.point.lat }, + { lng: lngMax.point.lng, lat: latMin.point.lat }, + { lng: lngMin.point.lng, lat: latMin.point.lat }, + { lng: lngMin.point.lng, lat: latMax.point.lat }, + ]; + this.polyline.points = points; } } } // ��������������� private updatePolygonPath(e: any) { - this.polyline.points = e.target.getPath() + this.polyline.points = e.target.getPath(); } // ��������������� private chooseCenter() { - this.map.chooseCenter.flag = !this.map.chooseCenter.flag + this.map.chooseCenter.flag = !this.map.chooseCenter.flag; } // ��������������������������� private mapClick(e: any) { if (this.map.chooseCenter.flag) { - const { lng, lat } = e.point - this.map.chooseCenter.point.lng = lng - this.map.chooseCenter.point.lat = lat + const { lng, lat } = e.point; + this.map.chooseCenter.point.lng = lng; + this.map.chooseCenter.point.lat = lat; } } // ������������ private delete(record: any) { - post('servicesScope/delete', { - id: record.id + post("servicesScope/delete", { + id: record.id, }).then((res: any) => { if (res.data.code === 0) { - this.pagination.current = 1 - this.getDataByCondition() - this.$message.success(res.data.message) + this.pagination.current = 1; + this.getDataByCondition(); + this.$message.success(res.data.message); } - }) + }); } // ������������������ private opRender(text: string, record: any, index: number) { return ( - <div> - <a onClick={() => this.editShow(true, record)}> - {" "} - ������{" "} - </a> - <a-divider type="vertical"/> - <a onClick={() => this.areaPointConfiguration(true, record)}> - {" "} - ������������������������{" "} - </a> - <a-divider type="vertical"/> - <a-popconfirm - title="������������������" - ok-text="������" - cancel-text="������" - onConfirm={() => this.delete(record)} - > - <a href="#">������</a> - </a-popconfirm> - </div> - ) + <div> + <a onClick={() => this.editShow(true, record)}> ������ </a> + <a-divider type="vertical" /> + <a onClick={() => this.areaPointConfiguration(true, record)}> + {" "} + ������������������������{" "} + </a> + <a-divider type="vertical" /> + <a-popconfirm + title="������������������" + ok-text="������" + cancel-text="������" + onConfirm={() => this.delete(record)} + > + <a href="#">������</a> + </a-popconfirm> + </div> + ); } } </script> 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> diff --git a/src/views/list/Unit.vue b/src/views/list/Unit.vue index 68bb462..06d199a 100644 --- a/src/views/list/Unit.vue +++ b/src/views/list/Unit.vue @@ -159,400 +159,399 @@ </template> <script lang="tsx"> -import { - Component, - Prop, - Vue, - Model, - Watch, -} from 'vue-property-decorator'; -import moment from 'moment'; +import { Component, Prop, Vue, Model, Watch } from "vue-property-decorator"; +import moment from "moment"; import { get, post } from "@/util/request"; -import * as _ from 'lodash'; +import * as _ from "lodash"; @Component({ - components: { - }, + components: {}, }) export default class QueryList extends Vue { - //������������ + //������������ private rules: any = { - unitName:[ - { required: true, message: '������������������', trigger: 'blur' }, - { message: '������������������������20������', max: 19 }, + unitName: [ + { required: true, message: "������������������", trigger: "blur" }, + { message: "������������������������20������", max: 19 }, ], - parentCode:[{ required: true, message: '������������' }], - areaCode:[{ required: true, message: '������������' }], - state:[{ required: true, message: '������������' }] - } - private formLayout = { - labelCol: { - span: 5, - }, - wrapperCol: { - span: 15, - }, - }; - private serch:any = { - name:'', - parentCode: [], - areaCode:'' - } - private editForm: any = { - unitName:'', - parentCode: [], - areaCode:'', - state:'0', - } - - private pagination:any={ - total:0, - current:1, - pageSize:10, - showSizeChanger: true, - showQuickJumper: true, - pageSizeOptions: ['10', '30', '60', '100'], - showTotal: (total:number) => `������ ${this.pagination.total} ���������`, //��������������������������� + parentCode: [{ required: true, message: "������������" }], + areaCode: [{ required: true, message: "������������" }], + state: [{ required: true, message: "������������" }], + }; + private formLayout = { + labelCol: { + span: 5, + }, + wrapperCol: { + span: 15, + }, + }; + private serch: any = { + name: "", + parentCode: [], + areaCode: "", + }; + private editForm: any = { + unitName: "", + parentCode: [], + areaCode: "", + state: "0", }; - @Watch('serch.name') - private watchsearchInform(newVal:string,oldval:string){ - if (newVal !== '' && oldval === '') { - this.pagination.current = 1 - } - this.handleSearch() + private pagination: any = { + total: 0, + current: 1, + pageSize: 10, + showSizeChanger: true, + showQuickJumper: true, + pageSizeOptions: ["10", "30", "60", "100"], + showTotal: (total: number) => `������ ${this.pagination.total} ���������`, //��������������������������� + }; + + @Watch("serch.name") + private watchsearchInform(newVal: string, oldval: string) { + if (newVal !== "" && oldval === "") { + this.pagination.current = 1; } + this.handleSearch(); + } - private expandForm: boolean = false; + private expandForm: boolean = false; - private selectedRows: any[] = []; - - private parentListOptions: any[] = []; - private newParentListOptions: any[] = []; + private selectedRows: any[] = []; - private tableLoading: boolean = false; - private visibleInvalidityModal: boolean = false; + private parentListOptions: any[] = []; + private newParentListOptions: any[] = []; - private moment: any = moment; - private pageState: String = 'add'; + private tableLoading: boolean = false; + private visibleInvalidityModal: boolean = false; - private dataSource: any[] = []; - - private areaCodeList: any[] = []; - - private newAreaCodeList: any[] = []; + private moment: any = moment; + private pageState: String = "add"; - private visibleCreateModal: boolean = false; + private dataSource: any[] = []; + + private areaCodeList: any[] = []; + + private newAreaCodeList: any[] = []; + + private visibleCreateModal: boolean = false; private createForm: any = null; - - private title: any = null; + + private title: any = null; private columns: any[] = [ - { + { title: "������", dataIndex: "key", key: "key", align: "center", - customRender: (text,record,index) => `${index+1}`, + customRender: (text, record, index) => `${index + 1}`, width: 60, }, { - title: '������', - align: "center", - dataIndex: 'unitName', - }, - { - title: '������������', - align: "center", - dataIndex: 'parentName', - }, - { - title: '������������', - align: "center", - dataIndex: 'areaName', - }, - { - title: '������������', - dataIndex: 'updateTime', - }, - { - title: '���������', - align: "center", - dataIndex: 'createName', - }, - { - title: '������', - dataIndex: 'state', - align: "center", - customRender: this.progressStateRender, + title: "������", + align: "center", + dataIndex: "unitName", }, - { - title: '������������', - dataIndex: 'isInvalid', - align: "center", - customRender: this.progressIsInvalidRender, - }, - { - title: '������', - align: "center", - customRender: this.opRender, - }, - ]; + { + title: "������������", + align: "center", + dataIndex: "parentName", + }, + { + title: "������������", + align: "center", + dataIndex: "areaName", + }, + { + title: "������������", + dataIndex: "updateTime", + }, + { + title: "���������", + align: "center", + dataIndex: "createName", + }, + { + title: "������", + dataIndex: "state", + align: "center", + customRender: this.progressStateRender, + }, + { + title: "������������", + dataIndex: "isInvalid", + align: "center", + customRender: this.progressIsInvalidRender, + }, + { + title: "������", + align: "center", + customRender: this.opRender, + }, + ]; - - private handleModalVisible(isVisible: boolean): void { - this.visibleCreateModal = isVisible; - this.pageState='add' - this.title='������������������' - } + private handleModalVisible(isVisible: boolean): void { + this.visibleCreateModal = isVisible; + this.pageState = "add"; + this.title = "������������������"; + } private handleSearch(): void { - console.log(this.serch) - const data = this.serch.parentCode - let code =data[data.length-1] - - get("unit/selectUint",{ - name:this.serch.name, - parentCode:code, - parentCodeList:this.serch.parentCode, - areaCode:this.serch.areaCode, - page:this.pagination.current, - size: this.pagination.pageSize - }).then(res=>{ - this.dataSource = res.data.data.item - this.pagination.total = res.data.data.total - }) - .catch(err=>{ - console.log(err); - }) - } + console.log(this.serch); + const data = this.serch.parentCode; + let code = data[data.length - 1]; + + get("unit/selectUint", { + name: this.serch.name, + parentCode: code, + parentCodeList: this.serch.parentCode, + areaCode: this.serch.areaCode, + page: this.pagination.current, + size: this.pagination.pageSize, + }) + .then((res) => { + this.dataSource = res.data.data.item; + this.pagination.total = res.data.data.total; + }) + .catch((err) => { + console.log(err); + }); + } private handlerTableChange(pagination: any, filter: any, sorter: any): void { - console.log('pagination',pagination) - this.pagination.current = pagination.current - this.pagination.pageSize = pagination.pageSize - this.pagination.total = pagination.total - this.handleSearch() - } + console.log("pagination", pagination); + this.pagination.current = pagination.current; + this.pagination.pageSize = pagination.pageSize; + this.pagination.total = pagination.total; + this.handleSearch(); + } private handleCreateModalOk() { - let api ='unit/insert' - if (this.pageState === 'edit') { - api='unit/update' + let api = "unit/insert"; + if (this.pageState === "edit") { + api = "unit/update"; } this.$refs.ruleForm.validate((valid: any) => { console.log(valid); if (valid) { - const data = this.editForm.parentCode - let code =data[data.length-1] + const data = this.editForm.parentCode; + let code = data[data.length - 1]; console.log(this.editForm); // ������������ post(api, { - unitId: this.editForm.unitId, - unitName:this.editForm.unitName, - parentCode: code, - parentCodeList:this.editForm.parentCode, - areaCode: this.editForm.areaCode, - state:parseInt(this.editForm.state) - }).then((res: any) => { - this.handleSearch() - this.visibleCreateModal = false - this.editForm = { - unitName:'', - parentCode: [], - areaCode:'', - state: '0', - parentCodeList:[] - } - }).catch((err)=>{ - console.log(err); + unitId: this.editForm.unitId, + unitName: this.editForm.unitName, + parentCode: code, + parentCodeList: this.editForm.parentCode, + areaCode: this.editForm.areaCode, + state: parseInt(this.editForm.state), }) + .then((res: any) => { + this.handleSearch(); + this.visibleCreateModal = false; + this.editForm = { + unitName: "", + parentCode: [], + areaCode: "", + state: "0", + parentCodeList: [], + }; + }) + .catch((err) => { + console.log(err); + }); } else { - console.log('error submit!!'); + console.log("error submit!!"); return false; } }); - console.log('editForm',this.editForm) - } + console.log("editForm", this.editForm); + } - private handleCreateModalCancel(): any { - this.visibleCreateModal = false; - this.editForm = { - unitName:'', - parentCode: [], - areaCode:'', - state: '0', - parentCodeList:[] - } - } + private handleCreateModalCancel(): any { + this.visibleCreateModal = false; + this.editForm = { + unitName: "", + parentCode: [], + areaCode: "", + state: "0", + parentCodeList: [], + }; + } private handleInvalidityModalCancel(): any { - this.editForm = { - unitName:'', - parentCode: [], - areaCode:'', - state: '0', - parentCodeList:[] - } - this.visibleInvalidityModal = false; - } + this.editForm = { + unitName: "", + parentCode: [], + areaCode: "", + state: "0", + parentCodeList: [], + }; + this.visibleInvalidityModal = false; + } - private cityData() { - get("system/area/queryCity",{ - - }).then(res => { - console.log('00000000000000', res); - let org = res.data.data; - let lists = JSON.stringify(org); + private cityData() { + get("system/area/queryCity", {}) + .then((res) => { + console.log("00000000000000", res); + let org = res.data.data; + let lists = JSON.stringify(org); - lists = lists.replace(/"areaCode"/g, '"value"'); + lists = lists.replace(/"areaCode"/g, '"value"'); - lists = lists.replace(/"areaName"/g, '"label"'); + lists = lists.replace(/"areaName"/g, '"label"'); - const treeLists = JSON.parse(lists) - this.parentListOptions = JSON.parse(JSON.stringify(treeLists)) - this.newParentListOptions = JSON.parse(JSON.stringify(treeLists)) - }) - .catch(err=>{ - console.log(err); - }) - } + const treeLists = JSON.parse(lists); + this.parentListOptions = JSON.parse(JSON.stringify(treeLists)); + this.newParentListOptions = JSON.parse(JSON.stringify(treeLists)); + }) + .catch((err) => { + console.log(err); + }); + } - private positionLevel(val: any) { - this.serch.areaCode = '' - this.editForm.areaCode = '' - let code =val[val.length-1] - get("system/area/code",{ - code:code - }).then(res => { - console.log('00000000000000', res); - this.areaCodeList= res.data.data; - this.newAreaCodeList= res.data.data; - }) - .catch(err=>{ - console.log(err); - }) - } + private positionLevel(val: any) { + this.serch.areaCode = ""; + this.editForm.areaCode = ""; + let code = val[val.length - 1]; + get("system/area/code", { + code: code, + }) + .then((res) => { + console.log("00000000000000", res); + this.areaCodeList = res.data.data; + this.newAreaCodeList = res.data.data; + }) + .catch((err) => { + console.log(err); + }); + } - private mounted() { + private mounted() { + this.handleSearch(); + this.cityData(); + } + + private updatedAtRender(text: string) { + return <span> {moment(text).format("YYYY-MM-DD HH:mm:ss")} </span>; + } + + private handleAssert(record: any) { + get("unit/state", { + unitId: record.unitId, + }) + .then((res) => { this.handleSearch(); - this.cityData() - } + this.$message.success("������������"); + }) + .catch((err) => { + console.log(err); + }); + } + private recordTableData: any = null; + private handleInvalidity(record: any) { + this.visibleInvalidityModal = true; + this.recordTableData = record; + } - private updatedAtRender(text: string) { - return <span> { - moment(text).format('YYYY-MM-DD HH:mm:ss') - } </span>; - } - - private handleAssert(record: any){ - get("unit/state",{ - unitId: record.unitId, - - }).then(res => { - this.handleSearch() - this.$message.success('������������') - }) - .catch(err=>{ - console.log(err); - }) - } - private recordTableData: any = null; - private handleInvalidity(record: any) { - this.visibleInvalidityModal = true - this.recordTableData=record - } - private handleInvalidityModalOk(record: any) { - this.createForm.validateFields((err: any, fieldsValue: any) => { - if (err) { - return; - } - get("unit/invalid",{ - unitId: this.recordTableData.unitId, - invalidReason:this.createForm.getFieldValue('code') - }).then(res => { - this.$message.success('������������') - this.visibleInvalidityModal = false - this.handleSearch() - }) - .catch(err=>{ - console.log(err); - }) + this.createForm.validateFields((err: any, fieldsValue: any) => { + if (err) { + return; + } + get("unit/invalid", { + unitId: this.recordTableData.unitId, + invalidReason: this.createForm.getFieldValue("code"), + }) + .then((res) => { + this.$message.success("������������"); + this.visibleInvalidityModal = false; + this.handleSearch(); + }) + .catch((err) => { + console.log(err); }); + }); } - + private progressIsInvalidRender(text: Number) { - if (text === 0) { - return <a-badge status = 'success' text = '���������' />; - } - return <a-badge status = 'error' text = '���������' />; + if (text === 0) { + return <a-badge status="success" text="���������" />; + } + return <a-badge status="error" text="���������" />; } - + private progressStateRender(text: string) { - if (text === '0') { - return <a-badge status = 'success' text = '������' />; - } - return <a-badge status = 'processing' text = '���������' />; + if (text === "0") { + return <a-badge status="success" text="������" />; + } + return <a-badge status="processing" text="���������" />; } - private async handleUpdateModalVisible(visible: boolean, record: any): void { - this.visibleCreateModal = true; - await this.positionLevel(record.parentCodeList) - this.title = '������������������' - let params = _.cloneDeep(record) - console.log(params) - params.parentCode=record.parentCodeList - this.editForm = params - this.pageState='edit' - console.log('editForm',record) - } - private async handleDetailModalVisible(visible: boolean, record: any): void { - this.visibleCreateModal = true; - await this.positionLevel(record.parentCodeList) - this.title = '������������������' - let params = _.cloneDeep(record) - console.log(params) - params.parentCode=record.parentCodeList - this.editForm = params - this.pageState='view' - } + private async handleUpdateModalVisible(visible: boolean, record: any): void { + this.visibleCreateModal = true; + await this.positionLevel(record.parentCodeList); + this.title = "������������������"; + let params = _.cloneDeep(record); + console.log(params); + params.parentCode = record.parentCodeList; + this.editForm = params; + this.pageState = "edit"; + console.log("editForm", record); + } + private async handleDetailModalVisible(visible: boolean, record: any): void { + this.visibleCreateModal = true; + await this.positionLevel(record.parentCodeList); + this.title = "������������������"; + let params = _.cloneDeep(record); + console.log(params); + params.parentCode = record.parentCodeList; + this.editForm = params; + this.pageState = "view"; + } private opRender(text: string, record: any, index: number) { // ������console - console.log('record',record) - if (record.state === '0') { + console.log("record", record); + if (record.state === "0") { if (Number(record.isInvalid) === 0) { - return <div> - <a onClick = { - () => this.handleDetailModalVisible(true, record) - } > ������ </a> - <a-divider type = 'vertical' /> - <a onClick = { - () => this.handleInvalidity(record) - } >������</a> - </div> + return ( + <div> + <a onClick={() => this.handleDetailModalVisible(true, record)}> + {" "} + ������{" "} + </a> + <a-divider type="vertical" /> + <a onClick={() => this.handleInvalidity(record)}>������</a> + </div> + ); } else { - return <div> - <a onClick = { - () => this.handleDetailModalVisible(true, record) - } > ������ </a> - </div> + return ( + <div> + <a onClick={() => this.handleDetailModalVisible(true, record)}> + {" "} + ������{" "} + </a> + </div> + ); } - } else { - return <div> - <a onClick = { - () => this.handleDetailModalVisible(true, record) - } > ������ </a> - <a-divider type='vertical' /> - <a onClick = { - () => this.handleUpdateModalVisible(true, record) - } > ������ </a> - </div> - } - this.handleSearch(); + } else { + return ( + <div> + <a onClick={() => this.handleDetailModalVisible(true, record)}> + {" "} + ������{" "} + </a> + <a-divider type="vertical" /> + <a onClick={() => this.handleUpdateModalVisible(true, record)}> + {" "} + ������{" "} + </a> + </div> + ); } - + } } </script> -<style lang="less" scoped> -</style> +<style lang="less" scoped></style> diff --git a/src/views/list/devicesBasic.vue b/src/views/list/devicesBasic.vue index fab16c4..2da62a4 100644 --- a/src/views/list/devicesBasic.vue +++ b/src/views/list/devicesBasic.vue @@ -1205,12 +1205,15 @@ private createForm: any = null; private editRecord: any = {}; + private pagination: any = { total: 0, current: 1, - pageSize: 5, - showSizeChanger: false, - showQuickJumper: false + pageSize: 10, + showSizeChanger: true, + showQuickJumper: true, + pageSizeOptions: ["10", "30", "60", "100"], + showTotal: (total: number) => `������ ${this.pagination.total} ���������`, //��������������������������� }; private updateRecord1: any = {}; @@ -1347,7 +1350,7 @@ // agehou:'' // } ] - + private rowSelectionChange(selectedRowKeys: string[], selectedRows: DataType[]){ // console.log(selectedRows); this.selectedtable=selectedRows @@ -1380,6 +1383,14 @@ } private columns: any[] = [ + { + title: "������", + dataIndex: "key", + key: "key", + align: "center", + customRender: (text:any, record:any, index:any) => `${index + 1}`, + width: 60, + }, { title: "������", dataIndex: "name" @@ -1641,6 +1652,9 @@ private current: number = 1 private handlerTableChange(pagination: any, filter: any, sorter: any): void { this.current = pagination.current + this.pagination.current = pagination.current; + this.pagination.pageSize = pagination.pageSize; + this.pagination.total = pagination.total; this.loadRuleData(pagination.current) } @@ -1686,7 +1700,7 @@ console.log(21323); for(var i=0;i<this.datatable.length;i++){ if(this.ceAQIvalue==='+'){ - this.datatable[i].cel=((this.datatable[i].cel-0) + (this.ceAQIvaluein-0)).toFixed(2) + this.datatable[i].cel=((this.datatable[i].cel-0) + (this.ceAQIvaluein-0)).toFixed(2) }else if(this.ceAQIvalue==='-'){ this.datatable[i].cel=Number((this.datatable[i].cel - this.ceAQIvaluein).toFixed(2)) }else if(this.ceAQIvalue==='*'){ @@ -1702,16 +1716,16 @@ // this.datatable[i].cel=parseFloat(this.datatable[i].cel+this.ceAQIvaluein).toFixed(2) // this.datatable[i].agehou='aqi*'+this.datatable[i].aqi+'+'+'ce1*'+this.datatable[i].cel if(this.AQIvalue1==='+'){ - this.datatable[i].aqi=((this.datatable[i].aqi-0) + (this.AQIvalue-0)).toFixed(2) + this.datatable[i].aqi=((this.datatable[i].aqi-0) + (this.AQIvalue-0)).toFixed(2) }else if(this.AQIvalue1==='-'){ this.datatable[i].aqi=Number((this.datatable[i].aqi - this.AQIvalue)).toFixed(2) } else if(this.AQIvalue1==='*'){ this.datatable[i].aqi=Number((this.datatable[i].aqi * this.AQIvalue)).toFixed(2) }else if(this.AQIvalue1==='/'){ this.datatable[i].aqi=Number((this.datatable[i].aqi / this.AQIvalue).toFixed(3)) - } + } if(this.ceAQIvalue==='+'){ - this.datatable[i].cel=((this.datatable[i].cel-0) + (this.ceAQIvaluein-0)).toFixed(2) + this.datatable[i].cel=((this.datatable[i].cel-0) + (this.ceAQIvaluein-0)).toFixed(2) }else if(this.ceAQIvalue==='-'){ this.datatable[i].cel=Number((this.datatable[i].cel - this.ceAQIvaluein)).toFixed(2) }else if(this.ceAQIvalue==='*'){ @@ -1951,11 +1965,11 @@ // ���������������������id private selectMt: any = null - + private loading: boolean=false - + private handleCancel(){ - + } //������������ private handleCreateModalOk() { @@ -2097,7 +2111,7 @@ name: this.serch.name, mac: this.serch.name, page: pageSize, - size: 8 + size: this.pagination.pageSize, }) .then(res => { if(res.data.code === 0) { @@ -2200,13 +2214,13 @@ } // ������������������������ private receiveLomLat(lonLat: any) { - + this.addLL = lonLat this.getTownData(lonLat) } - + private getTownData(lonLat: any) { - console.log(lonLat,'dsasa'); + console.log(lonLat,'dsasa'); let self=this var geocoder = new AMap.Geocoder({ // city ������������������������������������������������������������adcode ��� citycode @@ -2248,7 +2262,7 @@ // result������������������������������������ } }) - + // jsonp('/proxy/reverse_geocoding/v3/', { // jsonp('https://api.map.baidu.com/reverse_geocoding/v3/', { // ak: 'e5ig9Z7AKFjv8wbkqDbuLkUMzBev0tgT', diff --git a/src/views/list/devicesMonitorPoint.vue b/src/views/list/devicesMonitorPoint.vue index 72a390a..94c2db9 100644 --- a/src/views/list/devicesMonitorPoint.vue +++ b/src/views/list/devicesMonitorPoint.vue @@ -1,543 +1,644 @@ <template> - <div> - <a-card :bordered="false" style="margin-top:24px"> - <div class="tableList"> - <div class="tableListForm"> - <a-form @submit="handleSearch" layout="horizontal" :form="searchForm"> - <a-row :gutter="{ md: 8, lg: 24, xl: 48 }"> - <a-button icon="plus" type="primary" @click="() => this.handleModalVisible(true)" style="margin-left: 25px;"> - ������ - </a-button> - <div style="float:right;display:flex"> - <span style="margin-top:10px;margin-right:10px;font-size:14px">������: </span> - <a-select - placeholder="������������(������������������)" - :value="selectedItems" - style="width: 240px;margin-top:4px" - @change="handleChange" - :filter-option="filteredOptions" - allow-clear - show-search - > - <a-select-option v-for="(item,index) in orgData" :key="index" :value="item.id"> - {{ item.name }} - </a-select-option> - </a-select> - <a-form-item v-bind="searchFormLayout" style="width: 240px"> - <a-input v-model="serch.name" placeholder="���������������������" allow-clear /> - </a-form-item> - </div> - </a-row> - </a-form> - </div> - <av-standard-table :dataSource="dataSource" - :selectedRows="selectedRows" - :columns="columns" - :loading="tableLoading" - :paginationProps="pagination" - @tableChange="handlerTableChange" - @selectChange="handlerSelectChange"> - <!-- <template slot="organizationId" > + <div> + <a-card :bordered="false" style="margin-top:24px"> + <div class="tableList"> + <div class="tableListForm"> + <a-form @submit="handleSearch" layout="horizontal" :form="searchForm"> + <a-row :gutter="{ md: 8, lg: 24, xl: 48 }"> + <a-button + icon="plus" + type="primary" + @click="() => this.handleModalVisible(true)" + style="margin-left: 25px;" + > + ������ + </a-button> + <div style="float:right;display:flex"> + <span style="margin-top:10px;margin-right:10px;font-size:14px" + >������: + </span> + <a-select + placeholder="������������(������������������)" + :value="selectedItems" + style="width: 240px;margin-top:4px" + @change="handleChange" + :filter-option="filteredOptions" + allow-clear + show-search + > + <a-select-option + v-for="(item, index) in orgData" + :key="index" + :value="item.id" + > + {{ item.name }} + </a-select-option> + </a-select> + <a-form-item v-bind="searchFormLayout" style="width: 240px"> + <a-input + v-model="serch.name" + placeholder="���������������������" + allow-clear + /> + </a-form-item> + </div> + </a-row> + </a-form> + </div> + <av-standard-table + :dataSource="dataSource" + :selectedRows="selectedRows" + :columns="columns" + :loading="tableLoading" + :paginationProps="pagination" + @tableChange="handlerTableChange" + @selectChange="handlerSelectChange" + > + <!-- <template slot="organizationId" > <div v-for="(item,index) in orgData" :key="index">{{item.name}}</div> </template> --> - <!-- <template slot="region" > + <!-- <template slot="region" > <div v-for="(item,index) in regionData" :key="index"> {{item}} </div> </template> --> - </av-standard-table> - </div> + </av-standard-table> + </div> </a-card> - <a-modal title="������-������" destroyOnClose :visible="visibleCreateModal" @ok="handleCreateModalOk" @cancel="handleCreateModalCancel"> - <a-form style="margin-top: 8px" :form="createForm"> - <a-form-item :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������" has-feedback> - <a-input placeholder="���������" v-decorator="['name', { rules: [{ required: true, message: '������������������', min: 1 }] }]"/> - </a-form-item> - <a-form-item :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������" has-feedback > - <a-select - v-decorator="['organizationId', { rules: [{ required: true, message: '������������������' }] }]" - placeholder="������������(������������������)" - style="width: 240px;margin-top:4px" - :filter-option="filteredOptions" - allow-clear - show-search - > - <a-select-option v-for="(item,index) in orgData" :key="index" :value="item.id"> - {{ item.name }} - </a-select-option> - </a-select> - </a-form-item> - <a-form-item :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="���/���/���" has-feedback > - <a-cascader v-decorator="['provinceCode', { rules: [{ required: true, message: '������������������'}] }]" :options="region" placeholder="������������" @change="onChangeReginon" /> - </a-form-item> - <a-form-item :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������������"> - <a-input v-decorator="['address']" placeholder="���������" /> - </a-form-item> - <a-form-item :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������"> - <a-input v-decorator="['longitude']" placeholder="���������" /> - </a-form-item> - <a-form-item :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������"> - <a-input v-decorator="['latitude']" placeholder="���������" /> - </a-form-item> - <a-form-item :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������"> - <a-input v-decorator="['desc']" placeholder="���������" /> - </a-form-item> - </a-form> + <a-modal + title="������-������" + destroyOnClose + :visible="visibleCreateModal" + @ok="handleCreateModalOk" + @cancel="handleCreateModalCancel" + > + <a-form style="margin-top: 8px" :form="createForm"> + <a-form-item + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + has-feedback + > + <a-input + placeholder="���������" + v-decorator="[ + 'name', + { rules: [{ required: true, message: '������������������', min: 1 }] }, + ]" + /> + </a-form-item> + <a-form-item + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + has-feedback + > + <a-select + v-decorator="[ + 'organizationId', + { rules: [{ required: true, message: '������������������' }] }, + ]" + placeholder="������������(������������������)" + style="width: 240px;margin-top:4px" + :filter-option="filteredOptions" + allow-clear + show-search + > + <a-select-option + v-for="(item, index) in orgData" + :key="index" + :value="item.id" + > + {{ item.name }} + </a-select-option> + </a-select> + </a-form-item> + <a-form-item + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="���/���/���" + has-feedback + > + <a-cascader + v-decorator="[ + 'provinceCode', + { rules: [{ required: true, message: '������������������' }] }, + ]" + :options="region" + placeholder="������������" + @change="onChangeReginon" + /> + </a-form-item> + <a-form-item + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������������" + > + <a-input v-decorator="['address']" placeholder="���������" /> + </a-form-item> + <a-form-item + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + > + <a-input v-decorator="['longitude']" placeholder="���������" /> + </a-form-item> + <a-form-item + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + > + <a-input v-decorator="['latitude']" placeholder="���������" /> + </a-form-item> + <a-form-item + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + > + <a-input v-decorator="['desc']" placeholder="���������" /> + </a-form-item> + </a-form> </a-modal> - <update-task-form :visible.sync="updateTaskFormVisible" :record="updateRecord" @ok="handleUpdateOk"></update-task-form> + <update-task-form + :visible.sync="updateTaskFormVisible" + :record="updateRecord" + @ok="handleUpdateOk" + ></update-task-form> - <distribution-monitor :width="modelSize.width" :height="modelSize.height" :visible.sync="distributionMenuVisible" :record="updateRecord1" @ok="handleUpdateOk"></distribution-monitor> + <distribution-monitor + :width="modelSize.width" + :height="modelSize.height" + :visible.sync="distributionMenuVisible" + :record="updateRecord1" + @ok="handleUpdateOk" + ></distribution-monitor> - <pick-coordinate :mapUrl="mapUrl" :mapRecord="mapRecord" v-if="!mapFlag" @mapFlag="receiveFlag"/> - -</div> + <pick-coordinate + :mapUrl="mapUrl" + :mapRecord="mapRecord" + v-if="!mapFlag" + @mapFlag="receiveFlag" + /> + </div> </template> <script lang="tsx"> -import { - Component, - Prop, - Vue, - Model, - Watch -} from 'vue-property-decorator'; +import { Component, Prop, Vue, Model, Watch } from "vue-property-decorator"; - -import moment from 'moment'; +import moment from "moment"; import { get, post } from "@/util/request"; -import org from '@/util/org' +import org from "@/util/org"; -import { Observable, Subscription, BehaviorSubject } from 'rxjs'; +import { Observable, Subscription, BehaviorSubject } from "rxjs"; -import UpdateTaskForm from './components/UpdateTaskFormMonitor.vue'; -import DistributionMonitor from './components/DistributionMonitor.vue' +import UpdateTaskForm from "./components/UpdateTaskFormMonitor.vue"; +import DistributionMonitor from "./components/DistributionMonitor.vue"; -import TestModal from './components/TestModal.vue'; +import TestModal from "./components/TestModal.vue"; import PickCoordinate from "@/components/map/pickCoordinate.vue"; -const statusMap = ['default', 'processing', 'success', 'error']; -const status = ['������', '���������', '���������', '������']; -const OPTIONS = ['Apples', 'Nails', 'Bananas', 'Helicopters']; +const statusMap = ["default", "processing", "success", "error"]; +const status = ["������", "���������", "���������", "������"]; +const OPTIONS = ["Apples", "Nails", "Bananas", "Helicopters"]; @Component({ - components: { - UpdateTaskForm, - DistributionMonitor, - PickCoordinate - }, + components: { + UpdateTaskForm, + DistributionMonitor, + PickCoordinate, + }, }) export default class QueryList extends Vue { - private region:any + private region: any; - private searchForm: any; + private searchForm: any; private pagination: any = { total: 0, current: 1, - pageSize: 8, - showSizeChanger: false, - showQuickJumper: false + pageSize: 10, + showSizeChanger: true, + showQuickJumper: true, + pageSizeOptions: ["10", "30", "60", "100"], + showTotal: (total: number) => `������ ${this.pagination.total} ���������`, //��������������������������� }; - private serch:any = { - name:'' - } - // ������������������ - private regionCode:number[] = [] - private searchFormLayout: any = { - labelCol: { - span: 5, - }, - wrapperCol: { - span: 18, - offset: 1, - }, - }; + private serch: any = { + name: "", + }; + // ������������������ + private regionCode: number[] = []; + private searchFormLayout: any = { + labelCol: { + span: 5, + }, + wrapperCol: { + span: 18, + offset: 1, + }, + }; - private modelSize:any={ - width:500, - height:500 - } + private modelSize: any = { + width: 500, + height: 500, + }; - private saveData:any={ - name:'', - organizationId:'', - provinceCode:'', - cityCode:'', - areaCode:'', - longitude:'', - latitude:'', - address:'', - desc: '', - } + private saveData: any = { + name: "", + organizationId: "", + provinceCode: "", + cityCode: "", + areaCode: "", + longitude: "", + latitude: "", + address: "", + desc: "", + }; - private mapRecord: any = {} + private mapRecord: any = {}; - private mapUrl:string = 'monitorPoint/updateMonitorPoint' + private mapUrl: string = "monitorPoint/updateMonitorPoint"; - // ������������������������ - private onChangeReginon(value: any){ - this.regionCode = value - } + // ������������������������ + private onChangeReginon(value: any) { + this.regionCode = value; + } - // ��������������������� - private selectedItems:any[]=[] + // ��������������������� + private selectedItems: any[] = []; - // ��������������� - private filteredOptions(input:any,option:any) { - return ( - option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 - ); - } + // ��������������� + private filteredOptions(input: any, option: any) { + return ( + option.componentOptions.children[0].text + .toLowerCase() + .indexOf(input.toLowerCase()) >= 0 + ); + } - //��������������������� - private handleChange(selectedItems:any) { - this.selectedItems = selectedItems; - this.handleSearch() - } + //��������������������� + private handleChange(selectedItems: any) { + this.selectedItems = selectedItems; + this.handleSearch(); + } - // ������������ - private orgData:any = {} + // ������������ + private orgData: any = {}; - // ������������������ - private getAllOrg(){ - get("organization/queryNames", {} - ).then(res => { - this.orgData = res.data.data.organizationVOs.reverse() - }) - } + // ������������������ + private getAllOrg() { + get("organization/queryNames", {}).then((res) => { + this.orgData = res.data.data.organizationVOs.reverse(); + }); + } - @Watch('serch.name') - private watchsearchInform(newVal:string,oldval:string){ - this.pagination.current = 1 - this.handleSearch() - } + @Watch("serch.name") + private watchsearchInform(newVal: string, oldval: string) { + this.pagination.current = 1; + this.handleSearch(); + } - private created() { - this.createForm = this.$form.createForm(this, {name: "devicesMonitorPoint"}); - this.searchForm = this.$form.createForm(this, {name: "devicesMonitorPoint"}); - this.getAllOrg() - this.region = org - } - private expandForm: boolean = false; + private created() { + this.createForm = this.$form.createForm(this, { + name: "devicesMonitorPoint", + }); + this.searchForm = this.$form.createForm(this, { + name: "devicesMonitorPoint", + }); + this.getAllOrg(); + this.region = org; + } + private expandForm: boolean = false; - private selectedRowKeys: any[] = []; + private selectedRowKeys: any[] = []; - private selectedRows: any[] = []; + private selectedRows: any[] = []; - private tableLoading: boolean = false; + private tableLoading: boolean = false; - private moment: any = moment; + private moment: any = moment; - private dataSource: any[] = []; + private dataSource: any[] = []; - private regionData:number[]=[] + private regionData: number[] = []; - private visibleCreateModal: boolean = false; + private visibleCreateModal: boolean = false; - private updateTaskFormVisible: boolean = false; + private updateTaskFormVisible: boolean = false; - private distributionMenuVisible: boolean = false; + private distributionMenuVisible: boolean = false; - private createForm: any = null; + private createForm: any = null; - private updateRecord: any = {}; + private updateRecord: any = {}; - private updateRecord1: any = {}; - // ��������������������� - private monitorPoints:any = {} + private updateRecord1: any = {}; + // ��������������������� + private monitorPoints: any = {}; - private columns: any[] = [{ - title: '������', - dataIndex: 'name', - }, - { - title: '������', - dataIndex: 'organizationName', - width: '10%', - // scopedSlots: { customRender: 'organizationId' }, - }, - { - title: '���������', - dataIndex: 'tempRegionData', - // scopedSlots: { customRender: 'region' }, - }, - { - title: '������', - dataIndex: 'address', - }, - { - title: '������', - dataIndex: 'longitude', - }, - { - title: '������', - dataIndex: 'latitude', - }, - { - title: '������', - dataIndex: 'desc', - }, - { - title: '������', - customRender: this.opRender, - }, + private columns: any[] = [ + { + title: "������", + dataIndex: "key", + key: "key", + align: "center", + customRender: (text: any, record: any, index: any) => `${index + 1}`, + width: 60, + }, + { + title: "������", + dataIndex: "name", + }, + { + title: "������", + dataIndex: "organizationName", + width: "10%", + // scopedSlots: { customRender: 'organizationId' }, + }, + { + title: "���������", + dataIndex: "tempRegionData", + // scopedSlots: { customRender: 'region' }, + }, + { + title: "������", + dataIndex: "address", + }, + { + title: "������", + dataIndex: "longitude", + }, + { + title: "������", + dataIndex: "latitude", + }, + { + title: "������", + dataIndex: "desc", + }, + { + title: "������", + customRender: this.opRender, + }, + ]; + + constructor() { + super(); + } + + get status() { + return status; + } + + get statusMap() { + return statusMap; + } + + get statuFilters() { + return [ + { + text: status[0], + value: 0, + }, + { + text: status[1], + value: 1, + }, + { + text: status[2], + value: 2, + }, + { + text: status[3], + value: 3, + }, ]; + } - constructor() { - super(); - } + private regionFilters(value: any) { + if (!value) return ""; + return org[value]; + } - get status() { - return status; - } + private handleModalVisible(isVisible: boolean): void { + this.visibleCreateModal = isVisible; + } - get statusMap() { - return statusMap; - } + private handleSearch(): void { + get("monitorPoint/getMonitorPointByFuzzy", { + name: this.serch.name, + organization_id: this.selectedItems, + current: this.pagination.current, + size: this.pagination.pageSize, + orderType: 1, + }) + .then((res) => { + this.dataSource = res.data.data.monitorPoints; + let tempMonitor = res.data.data.monitorPoints; + this.pagination.total = res.data.data.totalNumber; + this.pagination.current = res.data.data.current; + for (let i = 0; i < tempMonitor.length; i++) { + tempMonitor[i].tempRegionData = + tempMonitor[i].provinceCode[1] + + tempMonitor[i].cityCode[1] + + tempMonitor[i].areaCode[1]; + tempMonitor[i].organizationName = tempMonitor[i].organizationId[1]; + tempMonitor[i].organizationId = tempMonitor[i].organizationId[0]; + } + }) + .catch((err) => { + console.log(err); + }); + } - get statuFilters() { - return [{ - text: status[0], - value: 0, - }, - { - text: status[1], - value: 1, - }, - { - text: status[2], - value: 2, - }, - { - text: status[3], - value: 3, - }, - ]; - } + private handlerTableChange(pagination: any, filter: any, sorter: any): void { + this.pagination.current = pagination.current; + this.pagination.pageSize = pagination.pageSize; + this.pagination.total = pagination.total; + this.loadRuleData(); + } + private testCallback(param: any) {} + private handleUpdateModalVisible(visible: boolean, record: any): void { + this.updateTaskFormVisible = true; + this.updateRecord = record; + } - private regionFilters(value:any) { - if (!value) return '' - return org[value] - } + private handleUpdateModalVisible1(visible: boolean, record: any): void { + this.updateRecord1 = record; + setTimeout(() => { + this.distributionMenuVisible = true; + }, 500); + } - private handleModalVisible(isVisible: boolean): void { - this.visibleCreateModal = isVisible; - } - - private handleSearch(): void { - get("monitorPoint/getMonitorPointByFuzzy",{ - name: this.serch.name, - organization_id:this.selectedItems, - current: this.pagination.current, - size: this.pagination.pageSize, - orderType:1 + private handleCreateModalOk() { + this.createForm.validateFields((err: any, fieldsValue: any) => { + if (err) { + return; + } + const name = this.createForm.getFieldValue("name"); + // const organizationId = this.selectedItems[0].id + const organizationId = this.createForm.getFieldValue("organizationId"); + const provinceCode = this.regionCode[0] ? this.regionCode[0] : ""; + const cityCode = this.regionCode[1] ? this.regionCode[1] : ""; + const areaCode = this.regionCode[2] ? this.regionCode[2] : ""; + const longitude = this.createForm.getFieldValue("longitude"); + const latitude = this.createForm.getFieldValue("latitude"); + const address = this.createForm.getFieldValue("address"); + const desc = this.createForm.getFieldValue("desc"); + post("monitorPoint/insertOneMonitorPoint", { + name: name, + organizationId: organizationId, + provinceCode: provinceCode, + cityCode: cityCode, + areaCode: areaCode, + longitude: longitude, + latitude: latitude, + address: address, + desc: desc, + }) + .then((res: any) => { + if (res.data.code !== 0) { + this.$message.warning(res.data.message, 2); + return; + } + this.createForm.resetFields(); + this.visibleCreateModal = false; + this.$message.success(res.data.message, 2); + this.loadRuleData(); }) - .then(res=>{ - this.dataSource = res.data.data.monitorPoints; - let tempMonitor = res.data.data.monitorPoints - this.pagination.total = res.data.data.totalNumber + .catch((err) => { + console.log(err); + }); + }); + } + + private handleUpdateOk() { + this.loadRuleData(); + } + + private handleCreateModalCancel(): any { + this.visibleCreateModal = false; + } + + private handlerSelectChange(arr1: any, arr2: any) { + this.selectedRows = arr2; + } + + private handleMenuClick(e: any) {} + + private mounted() { + this.loadRuleData(); + // this.menuData() + } + + // ������������ + private showMap(flag: boolean, record: any) { + this.mapFlag = flag; + this.mapRecord = record; + } + + private mapFlag: boolean = true; + + private receiveFlag(flag: boolean) { + this.mapFlag = true; + } + + @Watch("mapFlag") + private monitorMapFlag(newVal: boolean, oldVal: boolean) { + this.mapFlag = newVal; + } + + private loadRuleData() { + this.tableLoading = true; + get("monitorPoint/getAllMonitorPoint", { + current: this.pagination.current, + size: this.pagination.pageSize, + orderType: 1, + }) + .then((res) => { + if (res.data.code === 0) { + this.dataSource = res.data.data.monitorPoints; + let tempMonitor = res.data.data.monitorPoints; + this.pagination.total = res.data.data.totalNumber; this.pagination.current = res.data.data.current; - for (let i = 0; i < tempMonitor.length; i++) { - tempMonitor[i].tempRegionData = tempMonitor[i].provinceCode[1] + tempMonitor[i].cityCode[1] + tempMonitor[i].areaCode[1] - tempMonitor[i].organizationName = tempMonitor[i].organizationId[1] - tempMonitor[i].organizationId = tempMonitor[i].organizationId[0] - } - }) - .catch(err=>{ - console.log(err); - }) - } - - private handlerTableChange(pagination: any, filter: any, sorter: any): void { - this.pagination.current = pagination.current - this.loadRuleData() - } - - private testCallback(param: any) { - } - - private handleUpdateModalVisible(visible: boolean, record: any): void { - this.updateTaskFormVisible = true; - this.updateRecord = record; - } - - private handleUpdateModalVisible1(visible: boolean, record: any): void { - this.updateRecord1 = record; - setTimeout(()=>{ - this.distributionMenuVisible = true; - },500) - } - - private handleCreateModalOk() { - this.createForm.validateFields((err: any, fieldsValue: any) => { - if (err) { - return; - } - const name = this.createForm.getFieldValue('name'); - // const organizationId = this.selectedItems[0].id - const organizationId = this.createForm.getFieldValue('organizationId') - const provinceCode = this.regionCode[0]?this.regionCode[0]:'' - const cityCode = this.regionCode[1]?this.regionCode[1]:'' - const areaCode = this.regionCode[2]?this.regionCode[2]:'' - const longitude = this.createForm.getFieldValue('longitude'); - const latitude = this.createForm.getFieldValue('latitude'); - const address = this.createForm.getFieldValue('address'); - const desc = this.createForm.getFieldValue('desc'); - post('monitorPoint/insertOneMonitorPoint', { - name:name, - organizationId:organizationId, - provinceCode:provinceCode, - cityCode:cityCode, - areaCode:areaCode, - longitude:longitude, - latitude:latitude, - address:address, - desc: desc, - }).then((res: any) => { - if(res.data.code !== 0){ - this.$message.warning(res.data.message,2) - return;; - } - this.createForm.resetFields(); - this.visibleCreateModal = false; - this.$message.success(res.data.message, 2); - this.loadRuleData(); - }).catch((err)=>{ - console.log(err); - }) - }); - } - - private handleUpdateOk() { - this.loadRuleData(); - } - - private handleCreateModalCancel(): any { - this.visibleCreateModal = false; - } - - private handlerSelectChange(arr1: any, arr2: any) { - this.selectedRows = arr2; - } - - private handleMenuClick(e: any) { - } - - private mounted() { - this.loadRuleData(); - // this.menuData() - } - - // ������������ - private showMap(flag: boolean, record: any) { - this.mapFlag = flag - this.mapRecord = record - } - - - private mapFlag: boolean = true - - private receiveFlag(flag: boolean) { - this.mapFlag = true - } - - @Watch('mapFlag') - private monitorMapFlag(newVal: boolean, oldVal: boolean) { - this.mapFlag = newVal - } - - private loadRuleData() { - this.tableLoading = true; - get('monitorPoint/getAllMonitorPoint',{ - current: this.pagination.current, - size: this.pagination.pageSize, - orderType:1 - }) - .then((res) => { - if (res.data.code === 0) { - this.dataSource = res.data.data.monitorPoints; - let tempMonitor = res.data.data.monitorPoints - this.pagination.total = res.data.data.totalNumber - this.pagination.current = res.data.data.current; - let tempRegionData - for (let i = 0; i < tempMonitor.length; i++) { - tempMonitor[i].tempRegionData = tempMonitor[i].provinceCode[1] + tempMonitor[i].cityCode[1] + tempMonitor[i].areaCode[1] - tempMonitor[i].organizationName = tempMonitor[i].organizationId[1] - tempMonitor[i].organizationId = tempMonitor[i].organizationId[0] - } + let tempRegionData; + for (let i = 0; i < tempMonitor.length; i++) { + tempMonitor[i].tempRegionData = + tempMonitor[i].provinceCode[1] + + tempMonitor[i].cityCode[1] + + tempMonitor[i].areaCode[1]; + tempMonitor[i].organizationName = tempMonitor[i].organizationId[1]; + tempMonitor[i].organizationId = tempMonitor[i].organizationId[0]; } - - }) - .finally(() => { - this.tableLoading = false; - }); - } - - - - private rightRender(text: string) { - return `${text} ���`; - } - - private statusRender(text: any, record: any, index: number) { - return <a-badge status = { - statusMap[text] } - text = { - status[text] + }) + .finally(() => { + this.tableLoading = false; + }); + } + + private rightRender(text: string) { + return `${text} ���`; + } + + private statusRender(text: any, record: any, index: number) { + return <a-badge status={statusMap[text]} text={status[text]} />; + } + + private updatedAtRender(text: string) { + return <span> {moment(text).format("YYYY-MM-DD HH:mm:ss")} </span>; + } + + private deleteManageRole(record: any) { + post("monitorPoint/deleteMonitorPoint", { id: record.id }) + .then((res) => { + if (res.data.code === 0) { + this.$message.success("������������"); + this.loadRuleData(); + } else { + this.$message.warning(res.data.message); } - />; - } + }) + .catch((error) => { + this.$message.warning(error); + }); + } - private updatedAtRender(text: string) { - return <span> { - moment(text).format('YYYY-MM-DD HH:mm:ss') - } </span>; - } - - private deleteManageRole(record: any){ - post('monitorPoint/deleteMonitorPoint',{id:record.id} - ).then((res)=>{ - if (res.data.code === 0) { - this.$message.success('������������') - this.loadRuleData() - } else { - this.$message.warning(res.data.message) - } - }) - .catch((error)=> { - this.$message.warning(error) - }) - } - - private opRender(text: string, record: any, index: number) { - return <div> - <a onClick = { - () => this.handleUpdateModalVisible(true, record) - } > ������ </a> - <a-divider type = 'vertical' /> - <a-popconfirm title="������������������" ok-text="������" cancel-text="������" onConfirm={()=>this.deleteManageRole(record)}> - <a href="#">������</a> - </a-popconfirm> - <a-divider type = 'vertical' /> - <a onClick={() => this.showMap(false, record)}>������������</a> - </div>; - } + private opRender(text: string, record: any, index: number) { + return ( + <div> + <a onClick={() => this.handleUpdateModalVisible(true, record)}> + {" "} + ������{" "} + </a> + <a-divider type="vertical" /> + <a-popconfirm + title="������������������" + ok-text="������" + cancel-text="������" + onConfirm={() => this.deleteManageRole(record)} + > + <a href="#">������</a> + </a-popconfirm> + <a-divider type="vertical" /> + <a onClick={() => this.showMap(false, record)}>������������</a> + </div> + ); + } } </script> <style lang="less"> .tableList { - .tableListOperator { - margin-bottom: 16px; + .tableListOperator { + margin-bottom: 16px; - button { - margin-right: 8px; - } + button { + margin-right: 8px; } + } } .mapShow { display: none; diff --git a/src/views/list/devicesVersion.vue b/src/views/list/devicesVersion.vue index 8f830a4..057dc27 100644 --- a/src/views/list/devicesVersion.vue +++ b/src/views/list/devicesVersion.vue @@ -3,23 +3,24 @@ <a-card :bordered="false" style="margin-top:24px"> <div class="tableList"> <div class="tableListForm"> - <a-form - @submit="handleSearch" - layout="horizontal" - :form="searchForm" - > + <a-form @submit="handleSearch" layout="horizontal" :form="searchForm"> <a-row :gutter="{ md: 8, lg: 24, xl: 48 }"> <a-button icon="plus" type="primary" @click="() => this.handleModalVisible(true)" style="margin-left: 25px;" - >������</a-button> + >������</a-button + > <a-form-item v-bind="searchFormLayout" style="width: 240px;float: right;" > - <a-input v-model="serch.name" placeholder="���������������������" allow-clear /> + <a-input + v-model="serch.name" + placeholder="���������������������" + allow-clear + /> </a-form-item> </a-row> </a-form> @@ -45,19 +46,21 @@ @cancel="handleCreateModalCancel" okText="������" > - - <a-form style="margin-top: 8px" :form="createForm"> + <a-form style="margin-top: 8px" :form="createForm"> <a-form-item :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������" has-feedback > - <a-input - placeholder="������������" - type="string" - v-decorator="['deviceName', { rules: [{ required: true, message: '������������������' }] }]" - /> + <a-input + placeholder="������������" + type="string" + v-decorator="[ + 'deviceName', + { rules: [{ required: true, message: '������������������' }] }, + ]" + /> </a-form-item> <a-form-item @@ -90,14 +93,11 @@ <script lang="tsx"> import { Component, Prop, Vue, Model, Watch } from "vue-property-decorator"; - import moment from "moment"; import { get, post } from "@/util/request"; - import UpdateTaskForm from "./components/UpdateTaskFormVersion.vue"; import DistributionVersion from "./components/DistributionVersion.vue"; - import modalService from "@/core/ModalService.ts"; @@ -107,24 +107,24 @@ @Component({ components: { UpdateTaskForm, - DistributionVersion - } + DistributionVersion, + }, }) export default class QueryList extends Vue { private searchForm: any; private serch: any = { - name: "" + name: "", }; private searchFormLayout: any = { labelCol: { - span: 5 + span: 5, }, wrapperCol: { span: 18, - offset: 1 - } + offset: 1, + }, }; private form: any = {}; @@ -159,30 +159,40 @@ private columns: any[] = [ { + title: "������", + dataIndex: "key", + key: "key", + align: "center", + customRender: (text: any, record: any, index: any) => `${index + 1}`, + width: 60, + }, + { title: "������", - dataIndex: "name" + dataIndex: "name", }, { title: "������������", - dataIndex: "createTime" + dataIndex: "createTime", }, { title: "������", - dataIndex: "desc" + dataIndex: "desc", }, { title: "������", - customRender: this.opRender - } + customRender: this.opRender, + }, ]; private pagination: any = { total: 0, - current: 0, - pageSize: 5, - showSizeChanger: false, - showQuickJumper: false + current: 1, + pageSize: 10, + showSizeChanger: true, + showQuickJumper: true, + pageSizeOptions: ["10", "30", "60", "100"], + showTotal: (total: number) => `������ ${this.pagination.total} ���������`, //��������������������������� }; constructor() { super(); @@ -200,20 +210,20 @@ return [ { text: status[0], - value: 0 + value: 0, }, { text: status[1], - value: 1 + value: 1, }, { text: status[2], - value: 2 + value: 2, }, { text: status[3], - value: 3 - } + value: 3, + }, ]; } @@ -233,20 +243,23 @@ private handleSearch(): void { get("manageRole/getManageRoleByNameFuzzy", { - name: this.serch.name, - current: 1, - size: 100 - }) - .then(res => { + name: this.serch.name, + current: 1, + size: 100, + }) + .then((res) => { this.dataSource = res.data.data.manageRoles; }) - .catch(err => { + .catch((err) => { console.log(err); }); } private handlerTableChange(pagination: any, filter: any, sorter: any): void { - this.loadRuleData(pagination.current) + this.pagination.current = pagination.current; + this.pagination.pageSize = pagination.pageSize; + this.pagination.total = pagination.total; + this.loadRuleData(pagination.current); } private testCallback(param: any) {} @@ -287,7 +300,7 @@ private handleUpdateModalVisible1(visible: boolean, record: any): void { this.updateRecord1 = record; - this.distributionMenuVisible = true; + this.distributionMenuVisible = true; } private handleCreateModalOk() { @@ -295,23 +308,21 @@ if (err) { return; } - post("version/insert", - { - name: this.createForm.getFieldValue("deviceName"), - desc: this.createForm.getFieldValue("desc") - } - ) + post("version/insert", { + name: this.createForm.getFieldValue("deviceName"), + desc: this.createForm.getFieldValue("desc"), + }) .then((res: any) => { if (res.data.code !== 0) { this.$message.warning(res.data.message, 2); - return + return; } this.createForm.resetFields(); this.$message.success(res.data.message, 2); this.visibleCreateModal = false; this.loadRuleData(1); }) - .catch(err => { + .catch((err) => { console.log(err); }); }); @@ -333,44 +344,41 @@ private created() { this.createForm = this.$form.createForm(this, { name: "devicesVersion" }); - this.searchForm = this.$form.createForm(this, {name: "devicesVersion"}); + this.searchForm = this.$form.createForm(this, { name: "devicesVersion" }); this.loadRuleData(1); } - private loadRuleData(page:number) { + private loadRuleData(page: number) { this.tableLoading = true; get("version/query", { - name: this.serch.name, - orderType: 1, - order: 'createTime', - page: page, - size: 8 - }) - .then(res => { - if (res.data.code !== 0) { - this.$message.error(res.data.message, 2); - } else { - this.tableLoading = false; - this.pagination.current = res.data.data.current; - this.pagination.total = res.data.data.total; - this.pagination.pageSize = res.data.data.size; - this.dataSource = res.data.data.versions; - } - }); + name: this.serch.name, + orderType: 1, + order: "createTime", + page: page, + size: this.pagination.pageSize, + }).then((res) => { + if (res.data.code !== 0) { + this.$message.error(res.data.message, 2); + } else { + this.tableLoading = false; + this.pagination.current = res.data.data.current; + this.pagination.total = res.data.data.total; + this.pagination.pageSize = res.data.data.size; + this.dataSource = res.data.data.versions; + } + }); } private deleteManageRole(record: any) { - post("version/delete", - { id: record.id }, - ) - .then(res => { + post("version/delete", { id: record.id }) + .then((res) => { if (res.data.code === 0) { - this.$message.success('������������',2) + this.$message.success("������������", 2); this.loadRuleData(1); } }) - .catch(err=> { - this.$message.warning(err,2) + .catch((err) => { + this.$message.warning(err, 2); }); } diff --git a/src/views/list/specialDevice.vue b/src/views/list/specialDevice.vue index b0aa651..0e36871 100644 --- a/src/views/list/specialDevice.vue +++ b/src/views/list/specialDevice.vue @@ -3,352 +3,239 @@ <a-card :bordered="false" style="margin-top:24px"> <div class="tableList"> <div class="tableListForm"> - <a-form-model layout="horizontal"> - <a-row :gutter="[8,0]"> + <a-form-model layout="horizontal"> + <a-row :gutter="[8, 0]"> <a-col :span="2"> - <a-button + <a-button icon="plus" type="primary" @click="() => this.handleModalVisible(true)" style="margin-left: 25px;" - >������ - </a-button> + >������ + </a-button> </a-col> - <a-col :span="12"> - <a-button - icon="search" - type="primary" - @click="() => this.handleModalHistoryVisible(true)" - style="margin-left: 25px;" + <a-col :span="12"> + <a-button + icon="search" + type="primary" + @click="() => this.handleModalHistoryVisible(true)" + style="margin-left: 25px;" >������������������������ - </a-button> - </a-col> - <a-col :span="4"> - <a-form-model-item :labelCol="{span:16}" :wrapperCol="{span:20}"> - <a-select + </a-button> + </a-col> + <a-col :span="4"> + <a-form-model-item + :labelCol="{ span: 16 }" + :wrapperCol="{ span: 20 }" + > + <a-select placeholder="������������(������������������)" allow-clear show-search style="width:200px" :filter-option="filterOption" @change="handleChange" - > -<!-- @change="handleChange" --> - <a-select-option v-for="(item,index) in orgData" :key="index" :value="item.id"> - {{ item.name }} - </a-select-option> - </a-select> - </a-form-model-item> - </a-col> - <a-col :span="6"> - <a-form-model-item - :labelCol="{span:2}" :wrapperCol="{span:10}" + > + <!-- @change="handleChange" --> + <a-select-option + v-for="(item, index) in orgData" + :key="index" + :value="item.id" + > + {{ item.name }} + </a-select-option> + </a-select> + </a-form-model-item> + </a-col> + <a-col :span="6"> + <a-form-model-item + :labelCol="{ span: 2 }" + :wrapperCol="{ span: 10 }" fieldDecoratorId="name" - > - <a-input v-model="serchName" placeholder="���������������������������mac"/> - </a-form-model-item> - </a-col> + > + <a-input + v-model="serchName" + placeholder="���������������������������mac" + /> + </a-form-model-item> + </a-col> </a-row> </a-form-model> </div> <av-standard-table - :dataSource="dataSource" - :columns="columns" - :paginationProps="pagination" - @tableChange="handlerTableChange" + :dataSource="dataSource" + :columns="columns" + :paginationProps="pagination" + @tableChange="handlerTableChange" ></av-standard-table> <!-- :loading="tableLoading" :paginationProps="pagination" @tableChange="handlerTableChange" @selectChange="handlerSelectChange"--> </div> - </a-card> <a-modal - title="������������������" - destroyOnClose - :visible="visibleCreateModal" - @ok="handleCreateModalOk" - @cancel="handleCreateModalCancel" - okText="������" + title="������������������" + destroyOnClose + :visible="visibleCreateModal" + @ok="handleCreateModalOk" + @cancel="handleCreateModalCancel" + okText="������" > <a-form-model - style="margin-top: 8px" - :model="addData" - :rules="rules" - ref="addRulesForm" + style="margin-top: 8px" + :model="addData" + :rules="rules" + ref="addRulesForm" > - <a-form-model-item has-feedback - :labelCol="{ span: 5 }" - :wrapperCol="{ span: 15 }" - label="������" - prop="name"> + <a-form-model-item + has-feedback + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + prop="name" + > <a-input - placeholder="������������" - type="string" - v-model="addData.name" + placeholder="������������" + type="string" + v-model="addData.name" /> </a-form-model-item> <a-form-model-item - :labelCol="{ span: 5 }" - has-feedback - :wrapperCol="{ span: 15 }" - label="mac" - prop="mac" + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="mac" + prop="mac" > - <a-input - placeholder="mac������" - type="string" - v-model="addData.mac" - /> + <a-input placeholder="mac������" type="string" v-model="addData.mac" /> </a-form-model-item> <a-form-model-item - :labelCol="{ span: 5 }" - has-feedback - :wrapperCol="{ span: 15 }" - label="������" - prop="organization" + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������" + prop="organization" > <a-select - placeholder="������������������������������������" - type="string" - allow-clear - show-search - :filter-option="filterOption" - v-model="addData.organization" - > - <a-select-option v-for="(item,index) in orgData" :key="index" :value = 'item.id'>{{ item.name }}</a-select-option> - </a-select> - </a-form-model-item> - <a-form-model-item - :labelCol="{ span: 5 }" - has-feedback - :wrapperCol="{ span: 15 }" - label="������������" - prop="version" - > - <a-select - placeholder="������������������������������������" - type="string" - allow-clear - :filter-option="filterOption" - show-search - v-model="addData.version" - > - <a-select-option v-for="(item,index) in versions" :key="index" :value = 'item.id'>{{ item.name }}</a-select-option> - </a-select> - </a-form-model-item> - <a-form-model-item - :labelCol="{ span: 5 }" - has-feedback - :wrapperCol="{ span: 15 }" - label="������������" - prop="type" - > - <a-select - placeholder="������������" - type="string" - allow-clear - :filter-option="filterOption" - show-search - v-model="addData.type" - > - <a-select-option v-for="(item,index) in dictDeviceType" :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="���������" - > - <a-select - placeholder="���������������" - mode="multiple" - type="string" - allow-clear - :filter-option="filterOption" - v-model="addData.operators" + placeholder="������������������������������������" + type="string" + allow-clear + show-search + :filter-option="filterOption" + v-model="addData.organization" > <a-select-option - v-for="(item,index) in operators" - :key="index" - :value = 'item.id' - >{{ item.user_name }} + v-for="(item, index) in orgData" + :key="index" + :value="item.id" + >{{ item.name }}</a-select-option + > + </a-select> + </a-form-model-item> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������������" + prop="version" + > + <a-select + placeholder="������������������������������������" + type="string" + allow-clear + :filter-option="filterOption" + show-search + v-model="addData.version" + > + <a-select-option + v-for="(item, index) in versions" + :key="index" + :value="item.id" + >{{ item.name }}</a-select-option + > + </a-select> + </a-form-model-item> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������������" + prop="type" + > + <a-select + placeholder="������������" + type="string" + allow-clear + :filter-option="filterOption" + show-search + v-model="addData.type" + > + <a-select-option + v-for="(item, index) in dictDeviceType" + :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="���������" + > + <a-select + placeholder="���������������" + mode="multiple" + type="string" + allow-clear + :filter-option="filterOption" + v-model="addData.operators" + > + <a-select-option + v-for="(item, index) in operators" + :key="index" + :value="item.id" + >{{ item.user_name }} </a-select-option> </a-select> </a-form-model-item> - <a-form-model-item :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������" prop="positionBack"> - <a-cascader :options="areaData" placeholder="������������������(���������������������������������)" change-on-select - @change="positionLevel" labelInValue/> - </a-form-model-item> <a-form-model-item - :labelCol="{ span: 5 }" - has-feedback - :wrapperCol="{ span: 15 }" - label="������������" + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + prop="positionBack" > - <a-select - placeholder="������������" - v-model="addData.guid" - allow-clear - :filter-option="filterOption" - show-search - > - <a-select-option - v-for="(item,index) in govMonitors" - :key="index" - :value="item.guid" - >{{ item.name }} - </a-select-option> - </a-select> - </a-form-model-item> - </a-form-model> - -<!-- <pick-coordinate :mapUrl="mapUrl" :mapRecord="mapRecord" v-if="!mapFlag" @mapFlag="receiveFlag"/>--> - </a-modal> - - <a-modal - title="������������������" - destroyOnClose - :visible="editFlag" - @ok="handleEditModalOk" - @cancel="handleEditModalCancel" - okText="������" - > - <a-form-model - style="margin-top: 8px" - :form="form" - :model="editData" - :rules="rules" - ref="editRulesForm" - > - <a-form-model-item has-feedback - :labelCol="{ span: 5 }" - :wrapperCol="{ span: 15 }" - label="������" - prop="name"> - <a-input - placeholder="������������" - type="string" - v-model="editData.name" - /> - </a-form-model-item> - - <a-form-model-item - :labelCol="{ span: 5 }" - has-feedback - :wrapperCol="{ span: 15 }" - label="mac" - prop="mac" - > - <a-input - placeholder="mac������" - type="string" - v-model="editData.mac" + <a-cascader + :options="areaData" + placeholder="������������������(���������������������������������)" + change-on-select + @change="positionLevel" + labelInValue /> </a-form-model-item> <a-form-model-item - :labelCol="{ span: 5 }" - has-feedback - :wrapperCol="{ span: 15 }" - label="������" - prop="organization" + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������������" > <a-select - placeholder="������������������������������������" - type="string" - allow-clear - show-search - :filter-option="filterOption" - v-model="editData.organization" - > - <a-select-option v-for="(item,index) in orgData" :key="index" :value = 'item.id'>{{ item.name }}</a-select-option> - </a-select> - </a-form-model-item> - <a-form-model-item - :labelCol="{ span: 5 }" - has-feedback - :wrapperCol="{ span: 15 }" - label="������������" - prop="version" - > - <a-select - placeholder="������������������������������������" - type="string" - allow-clear - :filter-option="filterOption" - show-search - v-model="editData.version" - > - <a-select-option v-for="(item,index) in versions" :key="index" :value = 'item.id'>{{ item.name }}</a-select-option> - </a-select> - </a-form-model-item> - <a-form-model-item - :labelCol="{ span: 5 }" - has-feedback - :wrapperCol="{ span: 15 }" - label="������������" - prop="type" - > - <a-select - placeholder="������������" - type="string" - allow-clear - :filter-option="filterOption" - show-search - v-model="editData.type" - > - <a-select-option v-for="(item,index) in dictDeviceType" :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="���������" - > - <a-select - placeholder="���������������" - mode="multiple" - type="string" - allow-clear - :filter-option="filterOption" - v-model="editData.operators" + placeholder="������������" + v-model="addData.guid" + allow-clear + :filter-option="filterOption" + show-search > <a-select-option - v-for="(item,index) in operators" - :key="index" - :value = 'item.id' - >{{ item.user_name }} - </a-select-option> - </a-select> - </a-form-model-item> - <a-form-model-item :labelCol="{ span: 5 }" :wrapperCol="{ span: 15 }" label="������" prop="positionBack"> - <a-cascader :options="areaData" placeholder="������������������(���������������������������������)" change-on-select - @change="positionLevel" labelInValue/> - </a-form-model-item> - <a-form-model-item - :labelCol="{ span: 5 }" - has-feedback - :wrapperCol="{ span: 15 }" - label="������������" - > - <a-select - placeholder="������������" - v-model="editData.guid" - allow-clear - :filter-option="filterOption" - show-search - > - <a-select-option - v-for="(item,index) in govMonitors" - :key="index" - :value="item.guid" - >{{ item.name }} + v-for="(item, index) in govMonitors" + :key="index" + :value="item.guid" + >{{ item.name }} </a-select-option> </a-select> </a-form-model-item> @@ -356,21 +243,196 @@ <!-- <pick-coordinate :mapUrl="mapUrl" :mapRecord="mapRecord" v-if="!mapFlag" @mapFlag="receiveFlag"/>--> </a-modal> - <Calibration :caliRecord="caliRecord" :wFlag="visibleFlag" @cFlag="turnFlag"/> - <history-table :visible="historyFlag" :orgData="orgData" @hFlag="turnHFlag"/> + <a-modal + title="������������������" + destroyOnClose + :visible="editFlag" + @ok="handleEditModalOk" + @cancel="handleEditModalCancel" + okText="������" + > + <a-form-model + style="margin-top: 8px" + :form="form" + :model="editData" + :rules="rules" + ref="editRulesForm" + > + <a-form-model-item + has-feedback + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + prop="name" + > + <a-input + placeholder="������������" + type="string" + v-model="editData.name" + /> + </a-form-model-item> + + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="mac" + prop="mac" + > + <a-input placeholder="mac������" type="string" v-model="editData.mac" /> + </a-form-model-item> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������" + prop="organization" + > + <a-select + placeholder="������������������������������������" + type="string" + allow-clear + show-search + :filter-option="filterOption" + v-model="editData.organization" + > + <a-select-option + v-for="(item, index) in orgData" + :key="index" + :value="item.id" + >{{ item.name }}</a-select-option + > + </a-select> + </a-form-model-item> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������������" + prop="version" + > + <a-select + placeholder="������������������������������������" + type="string" + allow-clear + :filter-option="filterOption" + show-search + v-model="editData.version" + > + <a-select-option + v-for="(item, index) in versions" + :key="index" + :value="item.id" + >{{ item.name }}</a-select-option + > + </a-select> + </a-form-model-item> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������������" + prop="type" + > + <a-select + placeholder="������������" + type="string" + allow-clear + :filter-option="filterOption" + show-search + v-model="editData.type" + > + <a-select-option + v-for="(item, index) in dictDeviceType" + :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="���������" + > + <a-select + placeholder="���������������" + mode="multiple" + type="string" + allow-clear + :filter-option="filterOption" + v-model="editData.operators" + > + <a-select-option + v-for="(item, index) in operators" + :key="index" + :value="item.id" + >{{ item.user_name }} + </a-select-option> + </a-select> + </a-form-model-item> + <a-form-model-item + :labelCol="{ span: 5 }" + :wrapperCol="{ span: 15 }" + label="������" + prop="positionBack" + > + <a-cascader + :options="areaData" + placeholder="������������������(���������������������������������)" + change-on-select + @change="positionLevel" + labelInValue + /> + </a-form-model-item> + <a-form-model-item + :labelCol="{ span: 5 }" + has-feedback + :wrapperCol="{ span: 15 }" + label="������������" + > + <a-select + placeholder="������������" + v-model="editData.guid" + allow-clear + :filter-option="filterOption" + show-search + > + <a-select-option + v-for="(item, index) in govMonitors" + :key="index" + :value="item.guid" + >{{ item.name }} + </a-select-option> + </a-select> + </a-form-model-item> + </a-form-model> + + <!-- <pick-coordinate :mapUrl="mapUrl" :mapRecord="mapRecord" v-if="!mapFlag" @mapFlag="receiveFlag"/>--> + </a-modal> + <Calibration + :caliRecord="caliRecord" + :wFlag="visibleFlag" + @cFlag="turnFlag" + /> + <history-table + :visible="historyFlag" + :orgData="orgData" + @hFlag="turnHFlag" + /> </div> - </template> <script lang="tsx"> -import {Component, Prop, Vue, Model, Watch} from "vue-property-decorator"; +import { Component, Prop, Vue, Model, Watch } from "vue-property-decorator"; import { get, post } from "@/util/request"; import UpdateTaskForm from "./components/UpdateTaskFormRole.vue"; import DistributionMenu from "./components/DistributionMenu.vue"; -import Calibration from '@/components/device/calibration.vue'; -import HistoryTable from '@/components/specialDevice/historyTable.vue'; +import Calibration from "@/components/device/calibration.vue"; +import HistoryTable from "@/components/specialDevice/historyTable.vue"; import org from "@/util/org"; const statusMap = ["default", "processing", "success", "error"]; @@ -381,365 +443,427 @@ UpdateTaskForm, DistributionMenu, Calibration, - HistoryTable - } + HistoryTable, + }, }) export default class SpecialDevice extends Vue { - // ������������������������ - private govMonitors: any[] = [] + private govMonitors: any[] = []; // ��������������������� - private areaData: any = JSON.parse(JSON.stringify(org)) - private form: any = null + private areaData: any = JSON.parse(JSON.stringify(org)); + private form: any = null; private columns: any[] = [ { + title: "������", + dataIndex: "key", + key: "key", + align: "center", + customRender: (text: any, record: any, index: any) => `${index + 1}`, + width: 60, + }, + { title: "������", - dataIndex: "name" + dataIndex: "name", }, { title: "mac", - dataIndex: "mac" + dataIndex: "mac", }, { title: "������", - dataIndex: "version.name" + dataIndex: "version.name", }, { title: "������������", - dataIndex: "organization.name" + dataIndex: "organization.name", }, { title: "������������", - dataIndex: "govMonitorPoint.name" + dataIndex: "govMonitorPoint.name", }, { title: "���������", - dataIndex: "operates" + dataIndex: "operates", }, { title: "������������", - dataIndex: "specialType.name" + dataIndex: "specialType.name", }, { title: "������", - customRender: this.opRender - } + customRender: this.opRender, + }, ]; // ������������������ private positionLevel(val: any) { - var code = val[val.length-1] - this.getGovPointByArea(code) + var code = val[val.length - 1]; + this.getGovPointByArea(code); } // ������������������������������������ private getGovPointByArea(code: any) { - get('govMonitorPoint/govMonitorPoints', { - regionCode: code + get("govMonitorPoint/govMonitorPoints", { + regionCode: code, }).then((res: any) => { if (res.data.code === 0) { - this.govMonitors = res.data.data + this.govMonitors = res.data.data; } - }) + }); } //������������������ private pagination: any = { total: 0, current: 1, - pageSize: 8, - showSizeChanger: false, - showQuickJumper: false + pageSize: 10, + showSizeChanger: true, + showQuickJumper: true, + pageSizeOptions: ["10", "30", "60", "100"], + showTotal: (total: number) => `������ ${this.pagination.total} ���������`, //��������������������������� }; // ���������������������id - private orgId: any = null + private orgId: any = null; // ���������������add������ private addData: any = { - name: '', - mac: '', + name: "", + mac: "", organization: undefined, version: undefined, type: undefined, operators: [], - guid: undefined - } + guid: undefined, + }; // ���������������edit������ private editData: any = { - name: '', - mac: '', + name: "", + mac: "", organization: undefined, version: undefined, type: undefined, operators: [], - guid: undefined - } + guid: undefined, + }; // ������������������ - private serchName: string = '' + private serchName: string = ""; // ������������ - private orgData: any = [] + private orgData: any = []; // ������������������������ - private visibleCreateModal: boolean = false + private visibleCreateModal: boolean = false; // ������������������������������ - private historyFlag: boolean = false - + private historyFlag: boolean = false; // ������������������ - private dataSource: any[] = [] + private dataSource: any[] = []; // ������������������������ - private dictDeviceType: any = {} + private dictDeviceType: any = {}; //��������� private operators: any[] = []; // ������ - private versions: any[] =[] + private versions: any[] = []; //������������ private rules: any = { name: [ - {required: true, message: '������������������', trigger: ['change', 'blur']}, + { required: true, message: "������������������", trigger: ["change", "blur"] }, ], mac: [ - {required: true, message: 'mac������������', trigger: ['change', 'blur']}, + { required: true, message: "mac������������", trigger: ["change", "blur"] }, ], organization: [ - {required: true, message: '������������������������', trigger: ['change', 'blur']}, - ], + { + required: true, + message: "������������������������", + trigger: ["change", "blur"], + }, + ], version: [ - {required: true, message: '������������������������', trigger: ['change', 'blur']}, - ], + { + required: true, + message: "������������������������", + trigger: ["change", "blur"], + }, + ], type: [ - {required: true, message: '������������������������', trigger: ['change', 'blur']}, - ] - } + { + required: true, + message: "������������������������", + trigger: ["change", "blur"], + }, + ], + }; // ������������������������������ private handlerTableChange(pagination: any, filter: any, sorter: any): void { - this.pagination.current = pagination.current - this.getCurrentOrgData() + this.pagination.current = pagination.current; + this.pagination.pageSize = pagination.pageSize; + this.pagination.total = pagination.total; + this.getCurrentOrgData(); } //������������������ - private handleChange(selectedItems:any) { + private handleChange(selectedItems: any) { if (selectedItems === undefined) { - this.orgId = null - }else { + this.orgId = null; + } else { this.orgId = selectedItems; } - this.getCurrentOrgData() + this.getCurrentOrgData(); } private filterOption(input: any, option: any) { return ( - option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 + option.componentOptions.children[0].text + .toLowerCase() + .indexOf(input.toLowerCase()) >= 0 ); } - @Watch('serchName',{ - deep: true -}) + @Watch("serchName", { + deep: true, + }) private watchSerchName(newVal: string, oldVal: string) { - this.pagination.current = 1 - this.getCurrentOrgData() + this.pagination.current = 1; + this.getCurrentOrgData(); } // ������������������ private created() { // this.form = this.$form.createForm(this, { name: "specialDevice" }); // this.getAllOrg() - this.getCurrentOrgData() - this.getDropDownData() + this.getCurrentOrgData(); + this.getDropDownData(); } - //������ ������������������������������������ - private getDropDownData(){ + private getDropDownData() { //������������������������������ get("dict/data/query?type=specialDeviceType ", {}) - .then(res => { - if (res.data.code === 0) { - this.dictDeviceType = res.data.data - } - }) - .catch(err => { - console.log(err); - }); + .then((res) => { + if (res.data.code === 0) { + this.dictDeviceType = res.data.data; + } + }) + .catch((err) => { + console.log(err); + }); //������������������ get("device/versions", {}) - .then(res => { - this.versions = res.data.data.reverse(); - }) - .catch(err => { - console.log(err); - }); + .then((res) => { + this.versions = res.data.data.reverse(); + }) + .catch((err) => { + console.log(err); + }); //��������������������� get("device/operators", {}) - .then(res => { - this.operators = res.data.data; - }) - .catch(err => { - console.log(err); - }); + .then((res) => { + this.operators = res.data.data; + }) + .catch((err) => { + console.log(err); + }); // ������������������������ - get("organization/queryNames", {}).then(res => { - this.orgData = res.data.data.organizationVOs.reverse() - }) + get("organization/queryNames", {}).then((res) => { + this.orgData = res.data.data.organizationVOs.reverse(); + }); } // ������������ private handleModalVisible(flag: any) { - this.getGovPointByArea('') - this.visibleCreateModal = flag + this.getGovPointByArea(""); + this.visibleCreateModal = flag; } - // ������������������������ private handleModalHistoryVisible(flag: boolean) { - this.historyFlag = flag + this.historyFlag = flag; } // ������������������������ private getCurrentOrgData() { - get('specialDevice/getSpecialDeviceByCondition',{ - current: this.pagination.current, - size:this.pagination.pageSize, - organization_id: this.orgId, - keyword: this.serchName + get("specialDevice/getSpecialDeviceByCondition", { + current: this.pagination.current, + size: this.pagination.pageSize, + organization_id: this.orgId, + keyword: this.serchName, }).then((res: any) => { if (res.data.code === 0) { - const specialDevices = res.data.data.specialDevices + const specialDevices = res.data.data.specialDevices; // ������������������������������������������������ specialDevices.forEach((item: any) => { - let operates = '' + let operates = ""; if (item.operates) { for (let i = 0; i < item.operates.length; i++) { - operates += item.operates[i].name+'���' + operates += item.operates[i].name + "���"; } } - if (operates.length > 0) { + if (operates.length > 0) { operates = operates.substr(0, operates.length - 1); } - item.operates = operates - }) + item.operates = operates; + }); this.pagination.total = res.data.data.totalNumber; this.pagination.current = res.data.data.current; - this.dataSource = specialDevices + this.dataSource = specialDevices; } - }) + }); } // ������������ private handleCreateModalOk() { this.$refs.addRulesForm.validate((valid: any) => { if (valid) { - post('specialDevice/insert', - { + post("specialDevice/insert", { name: this.addData.name, mac: this.addData.mac, organizationId: this.addData.organization, deviceVersionId: this.addData.version, specialType: this.addData.type, - operateIds: this.addData.operators.length === 0 ? null : JSON.stringify(this.addData.operators).substr(1,JSON.stringify(this.addData.operators).length-2), - guid: this.addData.guid + operateIds: + this.addData.operators.length === 0 + ? null + : JSON.stringify(this.addData.operators).substr( + 1, + JSON.stringify(this.addData.operators).length - 2 + ), + guid: this.addData.guid, }).then((res: any) => { if (res.data.code === 0) { - this.pagination.current = 1 - this.getCurrentOrgData() - this.$message.success(res.data.message) - this.visibleCreateModal = false + this.pagination.current = 1; + this.getCurrentOrgData(); + this.$message.success(res.data.message); + this.visibleCreateModal = false; this.addData = { - name: '', - mac: '', + name: "", + mac: "", organization: undefined, version: undefined, type: undefined, - operators: [] - } + operators: [], + }; } else { - this.$message.warning(res.data.message) + this.$message.warning(res.data.message); } - }) + }); - this.visibleCreateModal = false + this.visibleCreateModal = false; // ���������������add������ - this.addData = { - name: '', - mac: '', + this.addData = { + name: "", + mac: "", organization: undefined, version: undefined, type: undefined, - operators: [] - } - }else { + operators: [], + }; + } else { return; } - }) + }); } // ������������ private handleCreateModalCancel() { - this.visibleCreateModal = false - this.addData = { - name: '', - mac: '', + this.visibleCreateModal = false; + this.addData = { + name: "", + mac: "", organization: undefined, version: undefined, type: undefined, - operators: [] - } + operators: [], + }; } // ������������ - private editFlag: boolean = false - private editRecord: any = {} + private editFlag: boolean = false; + private editRecord: any = {}; private handleEditModalVisible(flag: boolean, record: any) { - this.getGovPointByArea('') - this.editRecord = record - this.editData.name = record.name - this.editData.mac = record.mac - this.editData.organization = record.organizationId - this.editData.type = record.specialType.dataKey - this.editData.version = record.deviceVersionId - if (record.operates !== '') { - const operateIds = record.operateIds.split(',') - const ops = [] + this.getGovPointByArea(""); + this.editRecord = record; + this.editData.name = record.name; + this.editData.mac = record.mac; + this.editData.organization = record.organizationId; + this.editData.type = record.specialType.dataKey; + this.editData.version = record.deviceVersionId; + if (record.operates !== "") { + const operateIds = record.operateIds.split(","); + const ops = []; for (let i = 0; i < operateIds.length; i++) { - ops.push(Number(operateIds[i])) + ops.push(Number(operateIds[i])); } - this.editData.operators = ops + this.editData.operators = ops; } else { - this.editData.operators = [] + this.editData.operators = []; } - this.editData.guid = record.govMonitorPoint.guid - this.editFlag = flag + this.editData.guid = record.govMonitorPoint.guid; + this.editFlag = flag; } // ������������ private handleEditModalOk() { this.$refs.editRulesForm.validate((valid: any) => { if (valid) { - let name = this.editData.name === this.editRecord.name ? null : this.editData.name - let mac = this.editData.mac === this.editRecord.mac ? null : this.editData.mac - let organizationId = this.editData.organization === this.editRecord.organizationId ? null : this.editData.organization - let deviceVersionId = this.editData.version === this.editRecord.deviceVersionId ? null : this.editData.version - let specialType = this.editData.type === this.editRecord.specialType.dataKey ? null : this.editData.type - let operateIds = null + let name = + this.editData.name === this.editRecord.name + ? null + : this.editData.name; + let mac = + this.editData.mac === this.editRecord.mac ? null : this.editData.mac; + let organizationId = + this.editData.organization === this.editRecord.organizationId + ? null + : this.editData.organization; + let deviceVersionId = + this.editData.version === this.editRecord.deviceVersionId + ? null + : this.editData.version; + let specialType = + this.editData.type === this.editRecord.specialType.dataKey + ? null + : this.editData.type; + let operateIds = null; if (this.editRecord.operateIds || this.editData.operators.length > 0) { - operateIds = JSON.stringify(this.editData.operators).substr(1,JSON.stringify(this.editData.operators).length - 2) === this.editRecord.operateIds - ? null : JSON.stringify(this.editData.operators).substr(1,JSON.stringify(this.editData.operators).length - 2) + operateIds = + JSON.stringify(this.editData.operators).substr( + 1, + JSON.stringify(this.editData.operators).length - 2 + ) === this.editRecord.operateIds + ? null + : JSON.stringify(this.editData.operators).substr( + 1, + JSON.stringify(this.editData.operators).length - 2 + ); } - let guid = this.editData.guid === this.editRecord.govMonitorPoint.guid ? null : this.editData.guid - if (!(name || mac || organizationId || deviceVersionId || specialType || (operateIds === '' || operateIds) || guid)) { - this.$message.warning('������������') - }else { - post('specialDevice/update',{ + let guid = + this.editData.guid === this.editRecord.govMonitorPoint.guid + ? null + : this.editData.guid; + if ( + !( + name || + mac || + organizationId || + deviceVersionId || + specialType || + operateIds === "" || + operateIds || + guid + ) + ) { + this.$message.warning("������������"); + } else { + post("specialDevice/update", { id: this.editRecord.id, name, mac, @@ -747,93 +871,87 @@ deviceVersionId, specialType, operateIds, - guid + guid, }).then((res: any) => { if (res.data.code === 0) { - this.getCurrentOrgData() - this.$message.success(res.data.message) + this.getCurrentOrgData(); + this.$message.success(res.data.message); } else { - this.$message.warning(res.data.message) + this.$message.warning(res.data.message); } - }) - this.editFlag = false + }); + this.editFlag = false; } - }else { - return + } else { + return; } - }) + }); } // ������������ private handleEditModalCancel() { - this.editFlag = false + this.editFlag = false; } // ������������ private deleteDevice(record: any) { - post('specialDevice/delete',{ - id: record.id - }).then((res: any) => { - if (res.data.code === 0) { - this.$message.success(res.data.message) - this.pagination.current = 1 - this.getCurrentOrgData() - } else { - this.$message.warning(res.data.message) - } - }) + post("specialDevice/delete", { + id: record.id, + }).then((res: any) => { + if (res.data.code === 0) { + this.$message.success(res.data.message); + this.pagination.current = 1; + this.getCurrentOrgData(); + } else { + this.$message.warning(res.data.message); + } + }); } // ��������������� - private visibleFlag: boolean = false - private caliRecord: any = null + private visibleFlag: boolean = false; + private caliRecord: any = null; private showCalibration(record: any) { - this.visibleFlag = true - this.caliRecord = record + this.visibleFlag = true; + this.caliRecord = record; } // ��������������� private turnFlag(flag: boolean) { - this.visibleFlag = false + this.visibleFlag = false; } // ��������������� private turnHFlag(flag: boolean) { - this.historyFlag = flag + this.historyFlag = flag; } - private opRender(text: string, record: any, index: number) { return ( - <div> - <a onClick={() => this.handleEditModalVisible(true, record)}> - {" "} - ������{" "} + <div> + <a onClick={() => this.handleEditModalVisible(true, record)}> ������ </a> + <a-divider type="vertical" /> + <a-popconfirm + title="������������������" + ok-text="������" + cancel-text="������" + onConfirm={() => this.deleteDevice(record)} + > + <a href="#">������</a> + </a-popconfirm> + <a-divider type="vertical" /> + + <a-dropdown> + <a class="ant-dropdown-link"> + ������ <a-icon type="down" /> </a> - <a-divider type="vertical"/> - <a-popconfirm - title="������������������" - ok-text="������" - cancel-text="������" - onConfirm={() => this.deleteDevice(record)} - > - <a href="#">������</a> - </a-popconfirm> - <a-divider type="vertical"/> - - <a-dropdown> - <a class="ant-dropdown-link"> - ������ <a-icon type="down"/></a> - <a-menu slot="overlay"> - <a-menu-item> - <a onClick={() =>this.showCalibration(record) }>���������������</a> - </a-menu-item> - </a-menu> - </a-dropdown> - </div> - ) - ; + <a-menu slot="overlay"> + <a-menu-item> + <a onClick={() => this.showCalibration(record)}>���������������</a> + </a-menu-item> + </a-menu> + </a-dropdown> + </div> + ); } - - } </script> @@ -866,6 +984,4 @@ min-height: 0; } } - - </style> -- Gitblit v1.8.0