From fd32a3a1f5e10249f037d32dc2097b46c1ec4f85 Mon Sep 17 00:00:00 2001 From: 唐耀东 <18861537@qq.com> Date: 星期四, 12 五月 2022 17:42:58 +0800 Subject: [PATCH] 提交代码 --- src/views/construction/iot/index.vue | 534 ++++++++++++++++++++++++++++++++++++++ src/views/construction/constructionList/index.vue | 8 src/views/components/peripheralUnit/list.vue | 123 ++++++++ src/api/oa/iot.js | 52 +++ src/views/components/peripheralUnit/index.vue | 83 +++++ 5 files changed, 798 insertions(+), 2 deletions(-) diff --git a/src/api/oa/iot.js b/src/api/oa/iot.js new file mode 100644 index 0000000..f5fb219 --- /dev/null +++ b/src/api/oa/iot.js @@ -0,0 +1,52 @@ +import request from '@/utils/request' + +// 鏌ヨIoT璁惧鍒楄〃 +export function listIot(query) { + return request({ + url: '/oa/iot/list', + method: 'get', + params: query + }) +} + +// 鏌ヨIoT璁惧璇︾粏 +export function getIot(id) { + return request({ + url: '/oa/iot/' + id, + method: 'get' + }) +} + +// 鏂板IoT璁惧 +export function addIot(data) { + return request({ + url: '/oa/iot', + method: 'post', + data: data + }) +} + +// 淇敼IoT璁惧 +export function updateIot(data) { + return request({ + url: '/oa/iot', + method: 'put', + data: data + }) +} + +// 鍒犻櫎IoT璁惧 +export function delIot(id) { + return request({ + url: '/oa/iot/' + id, + method: 'delete' + }) +} +// 鏌ヨIoT璁惧澶栬鏁伴噺 +export function numberList(query) { + return request({ + url: '/oa/iot/number', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/src/views/components/peripheralUnit/index.vue b/src/views/components/peripheralUnit/index.vue new file mode 100644 index 0000000..d4090a5 --- /dev/null +++ b/src/views/components/peripheralUnit/index.vue @@ -0,0 +1,83 @@ +<template> + <div> + <el-input placeholder="璇烽�夋嫨" :value="name" disabled> + <el-button slot="append" icon="el-icon-thumb" @click="handleClick"></el-button> + </el-input> + <el-dialog title="澶栬鍗曞厓" :visible.sync="open" width="800px" :append-to-body="true" :destroy-on-close="true"> + <peripheral-unit-list v-if="open" ref="peripheralRef"></peripheral-unit-list> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="open = false">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import peripheralUnitList from "./list"; +import {getPeripheralUnit} from "@/api/oa/peripheralUnit"; + +/** + * 澶栬鍗曞厓 + */ +export default { + name: "manufacturerInput", + components: { + peripheralUnitList + }, + model: { + prop: 'value', + event: 'change' + }, + props: { + value: { + type: [Number], + default: undefined + } + }, + data() { + return { + open: false, + name: '' + } + }, + watch: { + 'value': function (v) { + if (v) { + getPeripheralUnit(v).then(response => { + this.name = response.data.name; + }); + } else { + this.name = ''; + } + } + }, + created() { + if (this.value) { + getPeripheralUnit(this.value).then(response => { + this.name = response.data.name; + }); + } + }, + methods: { + handleClick() { + this.open = true; + }, + submitForm() { + const row = this.$refs.peripheralRef.currentRow; + if (!row) { + this.$message.warning("璇烽�夋嫨涓�鏉℃暟鎹�") + this.buttonLoading = false; + return; + } + this.name = row.name; + this.open = false; + this.$emit("change", row.id); + } + } +} +</script> + +<style scoped> + +</style> \ No newline at end of file diff --git a/src/views/components/peripheralUnit/list.vue b/src/views/components/peripheralUnit/list.vue new file mode 100644 index 0000000..eed3928 --- /dev/null +++ b/src/views/components/peripheralUnit/list.vue @@ -0,0 +1,123 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="澶栬浠g爜" prop="code"> + <el-input + v-model="queryParams.code" + placeholder="璇疯緭鍏ュ璁句唬鐮�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="澶栬鍚嶇О" prop="name"> + <el-input + v-model="queryParams.name" + placeholder="璇疯緭鍏ュ璁惧悕绉�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-table v-loading="loading" :data="peripheralUnitList" highlight-current-row + @current-change="handleCurrentChange"> + <el-table-column label="搴忓彿" align="center" width="50"> + <template slot-scope="scope"> + <span>{{ scope.$index + (queryParams.pageNum - 1) * queryParams.pageSize + 1 }} </span> + </template> + </el-table-column> + <el-table-column label="澶栬浠g爜" width="80" align="center" prop="code"/> + <el-table-column label="澶栬鍚嶇О" align="center" prop="name" show-overflow-tooltip/> + <el-table-column label="瑙勬牸鍨嬪彿" align="center" prop="model" min-width="60"/> + <el-table-column label="鐢熶骇鍘傚晢" align="center" prop="manufacturer_dictText"/> + <el-table-column label="鍘傚晢浠g爜" width="100" align="center" prop="vendorCode_dictText"/> + <el-table-column label="娉㈢壒鐜�" width="100" align="center" prop="baudRate"> + <template slot-scope="scope"> + <dict-tag :options="dict.type.DICT103" :value="scope.row.baudRate"/> + </template> + </el-table-column> + <el-table-column label="闂鎸囦护" align="center" width="220" prop="readInstruction"/> + <el-table-column label="鎸囦护闀垮害" width="80" align="center" prop="orderLength"/> + <el-table-column label="杩斿洖闀垮害" width="80" align="center" prop="loopLength"/> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + </div> +</template> + +<script> +import { listPeripheralUnit} from "@/api/oa/peripheralUnit"; + +export default { + name: "PeripheralUnit", + dicts: ['DICT103'], + data() { + return { + // 鎸夐挳loading + buttonLoading: false, + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 澶栬鍗曞厓琛ㄦ牸鏁版嵁 + peripheralUnitList: [], + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + code: undefined, + name: undefined + }, + currentRow: undefined + }; + }, + created() { + this.getList(); + + }, + methods: { + /** 鏌ヨ澶栬鍗曞厓鍒楄〃 */ + getList() { + this.loading = true; + listPeripheralUnit(this.queryParams).then(response => { + this.peripheralUnitList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + handleCurrentChange(v) { + this.currentRow = v; + } + } +}; +</script> diff --git a/src/views/construction/constructionList/index.vue b/src/views/construction/constructionList/index.vue index 346d4a5..c4b0adf 100644 --- a/src/views/construction/constructionList/index.vue +++ b/src/views/construction/constructionList/index.vue @@ -13,7 +13,9 @@ <el-tab-pane label="NVR璁惧" name="third"> <nvr v-if="activeName === 'third'" :schoolId="schoolId"></nvr> </el-tab-pane> - <el-tab-pane label="IoT璁惧" name="fourth">IoT璁惧</el-tab-pane> + <el-tab-pane label="IoT璁惧" name="fourth"> + <iot v-if="activeName === 'fourth'" :schoolId="schoolId"></iot> + </el-tab-pane> <el-tab-pane label="AI璁惧" name="five">AI璁惧</el-tab-pane> <el-tab-pane label="浜ゆ崲璁惧" name="six">浜ゆ崲璁惧</el-tab-pane> <el-tab-pane label="鏈嶅姟鍣�" name="seven">鏈嶅姟鍣�</el-tab-pane> @@ -41,6 +43,7 @@ import reserveIp from '../reserveIp' import nvr from '../nvr' import ipc from '../ipc' +import iot from '../iot' export default { name: "constructionList", @@ -49,7 +52,8 @@ constructionBatch, reserveIp, nvr, - ipc + ipc, + iot }, data() { return { diff --git a/src/views/construction/iot/index.vue b/src/views/construction/iot/index.vue new file mode 100644 index 0000000..7485690 --- /dev/null +++ b/src/views/construction/iot/index.vue @@ -0,0 +1,534 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="閮ㄧ讲鍚嶇О" prop="deploymentName"> + <el-input + v-model="queryParams.deploymentName" + placeholder="璇疯緭鍏ラ儴缃插悕绉�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐗堟湰" prop="edition"> + <el-select v-model="queryParams.edition" placeholder="璇烽�夋嫨鐗堟湰"> + <el-option + v-for="dict in dict.type.DICT110" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> + </el-form-item> + <el-form-item label="瀹夎浣嶇疆" prop="buildingId"> + <building v-model="queryParams.buildingId" :schoolId="schoolId"></building> + </el-form-item> + <el-form-item label="鎵�灞炲崟浣�" prop="organizationId"> + <organization v-model="queryParams.organizationId" :schoolId="schoolId"></organization> + </el-form-item> + <el-form-item label="鏂藉伐鎵规" prop="constructionBatchId"> + <construction-batch v-model="queryParams.constructionBatchId" :schoolId="schoolId"></construction-batch> + </el-form-item> + <el-form-item label="鐩戞帶瀵硅薄" prop="monitorObject"> + <el-input + v-model="queryParams.monitorObject" + placeholder="璇疯緭鍏ョ洃鎺у璞�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="閫氶亾" prop="passageway"> + <el-select v-model="queryParams.passageway" placeholder="璇烽�夋嫨閫氶亾" clearable size="small"> + <el-option + v-for="dict in dict.type.DICT111" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> + </el-form-item> + <el-form-item label="澶栬" prop="peripheralUnit"> + <peripheralUnit v-model="queryParams.peripheralUnit"></peripheralUnit> + </el-form-item> + <el-form-item label="澶栬鏁伴噺"> + <el-input v-model="sum" disabled/> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['oa:iot:add']" + >鏂板 + </el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['oa:iot:edit']" + >淇敼 + </el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['oa:iot:remove']" + >鍒犻櫎 + </el-button> + </el-col> + </el-row> + + <el-table v-loading="loading" :data="iotList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center"/> + <el-table-column label="搴忓彿" align="center" width="50"> + <template slot-scope="scope"> + <span>{{ scope.$index + (queryParams.pageNum - 1) * queryParams.pageSize + 1 }} </span> + </template> + </el-table-column> + <el-table-column label="閮ㄧ讲鍚嶇О" align="center" prop="deploymentName"/> + <el-table-column label="鐗堟湰" align="center" prop="edition"> + <template slot-scope="scope"> + <dict-tag :options="dict.type.DICT110" :value="scope.row.edition"/> + </template> + </el-table-column> + <el-table-column label="LAN" align="center" prop="lan"/> + <el-table-column label="IP" align="center" prop="ip"/> + <el-table-column label="閫氶亾1" align="center" prop="passagewayOne_dictText"/> + <el-table-column label="閫氶亾2" align="center" prop="passagewayTwo_dictText"/> + <el-table-column label="閫氶亾3" align="center" prop="passagewayThree_dictText"/> + <el-table-column label="閫氶亾4" align="center" prop="passagewayFour_dictText"/> + <el-table-column label="瀹夎浣嶇疆" align="center" prop="buildingId_dictText"/> + <el-table-column label="鎵�灞炲崟浣�" align="center" prop="organizationId_dictText"/> + <el-table-column label="鏂藉伐鎵规" align="center" prop="constructionBatchId_dictText"/> +<!-- <el-table-column label="搴忓垪鍙�" align="center" prop="serialNumber"/>--> +<!-- <el-table-column label="鍨嬪彿" align="center" prop="model"/>--> + <el-table-column label="鐢熶骇鍘傚晢" align="center" prop="manufacturerId_dictText"/> + <el-table-column label="鐩戞帶瀵硅薄" align="center" prop="monitorObject"/> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-view" + @click="handleInfo(scope.row)" + v-hasPermi="['oa:iot:edit']" + >鏌ョ湅 + </el-button> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['oa:iot:edit']" + >淇敼 + </el-button> + <el-button + size="mini" + type="text" + class="del-btn" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['oa:iot:remove']" + >鍒犻櫎 + </el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + + <!-- 娣诲姞鎴栦慨鏀笽oT璁惧瀵硅瘽妗� --> + <el-dialog :title="title" :visible.sync="open" width="700px" :append-to-body="true" :close-on-click-modal="false"> + <el-form ref="form" :model="form" :rules="rules" label-width="80px" :disabled="disabled"> + <el-row> + <el-col :span="12"> + <el-form-item label="閮ㄧ讲鍚嶇О" prop="deploymentName"> + <el-input v-model="form.deploymentName" maxlength="64" show-word-limit placeholder="璇疯緭鍏ラ儴缃插悕绉�"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鐗堟湰" prop="edition"> + <el-select v-model="form.edition" placeholder="璇烽�夋嫨鐗堟湰"> + <el-option + v-for="dict in dict.type.DICT110" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="LAN" prop="lan"> + <el-input v-model="form.lan" placeholder="璇疯緭鍏AN"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="IP" prop="ip"> + <el-input v-model="form.ip" placeholder="璇疯緭鍏P"/> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="閫氶亾1" prop="passagewayOne"> + <peripheralUnit v-if="open" v-model="form.passagewayOne"></peripheralUnit> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="閫氶亾2" prop="passagewayTwo"> + <peripheralUnit v-if="open" v-model="form.passagewayTwo"></peripheralUnit> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="閫氶亾3" prop="passagewayThree"> + <peripheralUnit v-if="open" v-model="form.passagewayThree"></peripheralUnit> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="閫氶亾4" prop="passagewayFour"> + <peripheralUnit v-if="open" v-model="form.passagewayFour"></peripheralUnit> + </el-form-item> + </el-col> + </el-row> + <el-form-item label="瀹夎浣嶇疆" prop="buildingId"> + <building v-if="open" v-model="form.buildingId" :schoolId="schoolId"></building> + </el-form-item> + <el-form-item label="鎵�灞炲崟浣�" prop="organizationId"> + <organization v-if="open" v-model="form.organizationId" :schoolId="schoolId"></organization> + </el-form-item> + <el-form-item label="鏂藉伐鎵规" prop="constructionBatchId"> + <constructionBatch v-if="open" v-model="form.constructionBatchId" :schoolId="schoolId"></constructionBatch> + </el-form-item> + <el-form-item label="搴忓垪鍙�" prop="serialNumber"> + <el-input v-model="form.serialNumber" maxlength="64" show-word-limit placeholder="璇疯緭鍏ュ簭鍒楀彿"/> + </el-form-item> + <el-row> + <el-col :span="12"> + <el-form-item label="鍨嬪彿" prop="model"> + <el-input v-model="form.model" maxlength="64" show-word-limit placeholder="璇疯緭鍏ュ瀷鍙�"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鐢熶骇鍘傚晢" prop="manufacturerId"> + <manufacturer v-if="open" v-model="form.manufacturerId"></manufacturer> + </el-form-item> + </el-col> + </el-row> + <el-form-item label="鐩戞帶瀵硅薄" prop="monitorObject"> + <el-input v-model="form.monitorObject" type="textarea" maxlength="512" show-word-limit :rows="8" placeholder="璇疯緭鍏ュ唴瀹�"/> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button :loading="buttonLoading" type="primary" @click="submitForm" :disabled="disabled">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import {listIot, getIot, delIot, addIot, updateIot, numberList} from "@/api/oa/iot"; +import building from "../../components/building"; +import organization from "../../components/organization"; +import constructionBatch from "../../components/constructionBatch"; +import manufacturer from "../../components/manufacturer"; +import peripheralUnit from '../../components/peripheralUnit' + +export default { + name: "Iot", + dicts: ['DICT111', 'DICT110'], + props: { + schoolId: { + type: Number, + default: undefined + } + }, + components: { + building, + organization, + constructionBatch, + manufacturer, + peripheralUnit + }, + data() { + return { + // 鎸夐挳loading + buttonLoading: false, + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // IoT璁惧琛ㄦ牸鏁版嵁 + iotList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + deploymentName: undefined, + edition: undefined, + buildingId: undefined, + organizationId: undefined, + constructionBatchId: undefined, + monitorObject: undefined, + passageway: undefined, + peripheralUnit: undefined, + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + id: [ + {required: true, message: "涓嶈兘涓虹┖", trigger: "blur"} + ], + deploymentName: [ + {required: true, message: "閮ㄧ讲鍚嶇О涓嶈兘涓虹┖", trigger: "blur"} + ], + edition: [ + {required: true, message: "鐗堟湰涓嶈兘涓虹┖", trigger: "blur"} + ], + lan: [ + {required: true, message: "LAN涓嶈兘涓虹┖", trigger: "blur"}, + { + pattern: /^[A-F0-9]{2}(-[A-F0-9]{2}){5}$|^[A-F0-9]{2}(:[A-F0-9]{2}){5}$|^[A-F0-9]{12}$|^[A-F0-9]{4}(\.[A-F0-9]{4}){2}$/, + message: "璇疯緭鍏ユ纭殑LAN", + trigger: "blur" + } + ], + ip: [ + {required: true, message: "IP涓嶈兘涓虹┖", trigger: "blur"}, + { + pattern: /^(\d|[1-9]\d|1\d{2}|2[0-5][0-5])\.(\d|[1-9]\d|1\d{2}|2[0-5][0-5])\.(\d|[1-9]\d|1\d{2}|2[0-5][0-5])\.(\d|[1-9]\d|1\d{2}|2[0-5][0-5])$/, + message: "璇疯緭鍏ユ纭殑ip鍦板潃", + trigger: "blur" + } + ], + buildingId: [ + {required: true, message: "瀹夎浣嶇疆涓嶈兘涓虹┖", trigger: "blur"} + ], + organizationId: [ + {required: true, message: "鎵�灞炲崟浣嶄笉鑳戒负绌�", trigger: "blur"} + ], + constructionBatchId: [ + {required: true, message: "鏂藉伐鎵规涓嶈兘涓虹┖", trigger: "blur"} + ], + }, + disabled: false, + sum: undefined + }; + }, + computed: { + getPassageway() { + return this.queryParams.passageway + }, + getPeripheralUnit() { + return this.queryParams.peripheralUnit + } + }, + watch: { + 'schoolId': function () { + this.getList() + }, + getPassageway: function (v) { + if (v && this.queryParams.peripheralUnit) { + this.getNum(); + } + }, + getPeripheralUnit: function (v) { + if (v && this.queryParams.passageway) { + this.getNum(); + } + } + }, + created() { + this.getList(); + }, + methods: { + /** 鏌ヨIoT璁惧鍒楄〃 */ + getList() { + this.loading = true; + listIot(Object.assign({}, this.queryParams, {schoolId: this.schoolId})).then(response => { + this.iotList = response.rows; + this.total = response.total; + this.loading = false; + }); + if (this.queryParams.peripheralUnit && this.queryParams.passageway) { + this.getNum(); + } + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: undefined, + deploymentName: undefined, + edition: undefined, + lan: undefined, + ip: undefined, + buildingId: undefined, + organizationId: undefined, + constructionBatchId: undefined, + serialNumber: undefined, + model: undefined, + manufacturerId: undefined, + monitorObject: undefined, + passagewayOne: undefined, + passagewayTwo: undefined, + passagewayThree: undefined, + passagewayFour: undefined, + createBy: undefined, + createTime: undefined, + updateBy: undefined, + updateTime: undefined, + delFlag: undefined + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.id) + this.single = selection.length !== 1 + this.multiple = !selection.length + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.disabled = false; + this.open = true; + this.title = "娣诲姞IoT璁惧"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.loading = true; + this.disabled = false; + this.reset(); + const id = row.id || this.ids + getIot(id).then(response => { + this.loading = false; + this.form = response.data; + this.open = true; + this.title = "淇敼IoT璁惧"; + }); + }, + handleInfo(row) { + this.loading = true; + this.disabled = true; + this.reset(); + getIot(row.id).then(response => { + this.loading = false; + this.form = response.data; + this.open = true; + this.title = "IoT璁惧璇︽儏"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate(valid => { + if (valid) { + this.buttonLoading = true; + this.form.schoolId = this.schoolId; + if (this.form.id != null) { + updateIot(this.form).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }).finally(() => { + this.buttonLoading = false; + }); + } else { + addIot(this.form).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }).finally(() => { + this.buttonLoading = false; + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const ids = row.id || this.ids; + this.$modal.confirm('鏄惁纭鍒犻櫎IoT璁惧缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(() => { + this.loading = true; + return delIot(ids); + }).then(() => { + this.loading = false; + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).finally(() => { + this.loading = false; + }); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download('oa/iot/export', { + ...this.queryParams + }, `iot_${new Date().getTime()}.xlsx`) + }, + // 鑾峰彇澶栬鏁伴噺 + getNum() { + numberList(Object.assign({}, this.queryParams, {schoolId: this.schoolId})).then(res => { + this.sum = res.data; + }) + } + } +}; +</script> -- Gitblit v1.9.1