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/specialDevice.vue | 1156 +++++++++++++++++++++++++++++++-------------------------- 1 files changed, 636 insertions(+), 520 deletions(-) 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