From b2635a9c524aa0d7f76c65c65724a58f0993e0b8 Mon Sep 17 00:00:00 2001 From: 唐耀东 <18861537@qq.com> Date: 星期四, 12 五月 2022 22:30:41 +0800 Subject: [PATCH] 提交代码 --- src/views/construction/constructionList/index.vue | 8 src/api/oa/ai.js | 44 ++++ src/views/construction/ai/index.vue | 459 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 509 insertions(+), 2 deletions(-) diff --git a/src/api/oa/ai.js b/src/api/oa/ai.js new file mode 100644 index 0000000..b9334ba --- /dev/null +++ b/src/api/oa/ai.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 鏌ヨAI璁惧鍒楄〃 +export function listAi(query) { + return request({ + url: '/oa/ai/list', + method: 'get', + params: query + }) +} + +// 鏌ヨAI璁惧璇︾粏 +export function getAi(id) { + return request({ + url: '/oa/ai/' + id, + method: 'get' + }) +} + +// 鏂板AI璁惧 +export function addAi(data) { + return request({ + url: '/oa/ai', + method: 'post', + data: data + }) +} + +// 淇敼AI璁惧 +export function updateAi(data) { + return request({ + url: '/oa/ai', + method: 'put', + data: data + }) +} + +// 鍒犻櫎AI璁惧 +export function delAi(id) { + return request({ + url: '/oa/ai/' + id, + method: 'delete' + }) +} diff --git a/src/views/construction/ai/index.vue b/src/views/construction/ai/index.vue new file mode 100644 index 0000000..ec0e800 --- /dev/null +++ b/src/views/construction/ai/index.vue @@ -0,0 +1,459 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <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="model"> + <el-input + v-model="queryParams.model" + placeholder="璇疯緭鍏ュ瀷鍙�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐢熶骇鍘傚晢" prop="manufacturerId"> + <manufacturer v-model="queryParams.manufacturerId"></manufacturer> + </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:ai: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:ai: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:ai:remove']" + >鍒犻櫎 + </el-button> + </el-col> + </el-row> + + <el-table v-loading="loading" :data="aiList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center"/> + <el-table-column label="" align="center" prop="id" v-if="true"/> + <el-table-column label="閮ㄧ讲鍚嶇О" align="center" prop="deploymentName"/> + <el-table-column label="鏀寔閫氶亾" align="center" prop="passageway"> + <template slot-scope="scope"> + <dict-tag :options="dict.type.DICT112" :value="scope.row.passageway"/> + </template> + </el-table-column> + <el-table-column label="LAN1" align="center" prop="lanOne"/> + <el-table-column label="IP" align="center" prop="ipOne"/> + <el-table-column label="LAN2" align="center" prop="lanTwo"/> + <el-table-column label="IP" align="center" prop="ipTwo"/> + <el-table-column label="鐧诲綍璐︽埛" align="center" prop="loginAccount"/> + <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"/> + <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)" + >鏌ョ湅 + </el-button> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['oa:ai:edit']" + >淇敼 + </el-button> + <el-button + size="mini" + type="text" + class="del-btn" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['oa:ai: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" + /> + + <!-- 娣诲姞鎴栦慨鏀笰I璁惧瀵硅瘽妗� --> + <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="passageway"> + <el-select v-model="form.passageway" placeholder="璇烽�夋嫨閫氶亾"> + <el-option + v-for="dict in dict.type.DICT112" + :key="dict.value" + :label="dict.label" + :value="dict.value" + ></el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="LAN1" prop="lanOne"> + <el-input v-model="form.lanOne" placeholder="璇疯緭鍏AN1"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="IP" prop="ipOne"> + <el-input v-model="form.ipOne" placeholder="璇疯緭鍏P"/> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="LAN2" prop="lanTwo"> + <el-input v-model="form.lanTwo" placeholder="璇疯緭鍏AN2"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="IP" prop="ipTwo"> + <el-input v-model="form.ipTwo" placeholder="璇疯緭鍏P"/> + </el-form-item> + </el-col> + </el-row> + <el-form-item label="鐧诲綍璐︽埛" prop="loginAccount"> + <el-input v-model="form.loginAccount" maxlength="64" show-word-limit placeholder="璇疯緭鍏ョ櫥褰曡处鎴�"/> + </el-form-item> + <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-model="form.manufacturerId"></manufacturer> + </el-form-item> + </el-col> + </el-row> + </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 {listAi, getAi, delAi, addAi, updateAi} from "@/api/oa/ai"; +import building from "../../components/building"; +import organization from "../../components/organization"; +import constructionBatch from "../../components/constructionBatch"; +import manufacturer from "../../components/manufacturer"; +import nvr from "../../components/nvr"; + +export default { + name: "Ai", + dicts: ['DICT112'], + props: { + schoolId: { + type: Number, + default: undefined + } + }, + components: { + building, + organization, + constructionBatch, + manufacturer, + nvr + }, + data() { + return { + // 鎸夐挳loading + buttonLoading: false, + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // AI璁惧琛ㄦ牸鏁版嵁 + aiList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + buildingId: undefined, + organizationId: undefined, + constructionBatchId: undefined, + model: undefined, + manufacturerId: undefined, + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + id: [ + {required: true, message: "涓嶈兘涓虹┖", trigger: "blur"} + ], + deploymentName: [ + {required: true, message: "閮ㄧ讲鍚嶇О涓嶈兘涓虹┖", trigger: "blur"} + ], + passageway: [ + {required: true, message: "閫氶亾涓嶈兘涓虹┖", trigger: "change"} + ], + lanOne: [ + {required: true, message: "LAN1涓嶈兘涓虹┖", 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: "璇疯緭鍏ユ纭殑LAN1", + trigger: "blur" + } + ], + ipOne: [ + {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" + } + ], + lanTwo: [ + { + 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: "璇疯緭鍏ユ纭殑LAN2", + trigger: "blur" + } + ], + ipTwo: [ + { + 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 + }; + }, + created() { + this.getList(); + }, + methods: { + /** 鏌ヨAI璁惧鍒楄〃 */ + getList() { + this.loading = true; + listAi(Object.assign({}, this.queryParams, {schoolId: this.schoolId})).then(response => { + this.aiList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: undefined, + deploymentName: undefined, + passageway: undefined, + lanOne: undefined, + ipOne: undefined, + lanTwo: undefined, + ipTwo: undefined, + loginAccount: undefined, + buildingId: undefined, + organizationId: undefined, + constructionBatchId: undefined, + serialNumber: undefined, + model: undefined, + manufacturerId: undefined, + createTime: undefined, + createBy: 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 = "娣诲姞AI璁惧"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.loading = true; + this.disabled = false; + this.reset(); + const id = row.id || this.ids + getAi(id).then(response => { + this.loading = false; + this.form = response.data; + this.open = true; + this.title = "淇敼AI璁惧"; + }); + }, + handleInfo(row) { + this.loading = true; + this.disabled = true; + this.reset(); + getAi(row.id).then(response => { + this.loading = false; + this.form = response.data; + this.open = true; + this.title = "AI璁惧璇︽儏"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate(valid => { + if (valid) { + this.buttonLoading = true; + this.form.schoolId = this.schoolId; + if (this.form.id != null) { + updateAi(this.form).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }).finally(() => { + this.buttonLoading = false; + }); + } else { + addAi(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('鏄惁纭鍒犻櫎AI璁惧缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(() => { + this.loading = true; + return delAi(ids); + }).then(() => { + this.loading = false; + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).finally(() => { + this.loading = false; + }); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download('oa/ai/export', { + ...this.queryParams + }, `ai_${new Date().getTime()}.xlsx`) + } + } +}; +</script> diff --git a/src/views/construction/constructionList/index.vue b/src/views/construction/constructionList/index.vue index c4b0adf..a9374a4 100644 --- a/src/views/construction/constructionList/index.vue +++ b/src/views/construction/constructionList/index.vue @@ -16,7 +16,9 @@ <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="AI璁惧" name="five"> + <ai v-if="activeName === 'five'" :schoolId="schoolId"></ai> + </el-tab-pane> <el-tab-pane label="浜ゆ崲璁惧" name="six">浜ゆ崲璁惧</el-tab-pane> <el-tab-pane label="鏈嶅姟鍣�" name="seven">鏈嶅姟鍣�</el-tab-pane> <el-tab-pane label="杞欢绯荤粺" name="eight">杞欢绯荤粺</el-tab-pane> @@ -44,6 +46,7 @@ import nvr from '../nvr' import ipc from '../ipc' import iot from '../iot' +import ai from '../ai' export default { name: "constructionList", @@ -53,7 +56,8 @@ reserveIp, nvr, ipc, - iot + iot, + ai }, data() { return { -- Gitblit v1.9.1