From 600f3c72842b59fc368c2512f1ded25687d104ae Mon Sep 17 00:00:00 2001 From: mark <mark18340872469@163.com> Date: 星期二, 27 九月 2022 16:48:05 +0800 Subject: [PATCH] 点位信息维护 --- src/views/dataPush/components/point.vue | 611 +++++++++++++++++++------------------------------------ 1 files changed, 210 insertions(+), 401 deletions(-) diff --git a/src/views/dataPush/components/point.vue b/src/views/dataPush/components/point.vue index ef048c4..60f2f71 100644 --- a/src/views/dataPush/components/point.vue +++ b/src/views/dataPush/components/point.vue @@ -15,15 +15,15 @@ :fit="true" :default-sort="{ prop: 'createTime', order: 'descending' }" > - <el-table-column prop="a" label="鐐逛綅鍚嶇О" show-overflow-tooltip></el-table-column> - <el-table-column prop="b" label="鎶ヨ閫氶亾缂栫爜" show-overflow-tooltip></el-table-column> - <el-table-column prop="c" label="浼佷笟缂栫爜" show-overflow-tooltip></el-table-column> - <el-table-column prop="d" label="鎺ㄩ�佸満鏅�" show-overflow-tooltip></el-table-column> - <el-table-column prop="e" label="鎺ㄥ姩鏃堕棿" show-overflow-tooltip></el-table-column> + <el-table-column prop="cameraName" label="鐐逛綅鍚嶇О" show-overflow-tooltip></el-table-column> + <el-table-column prop="channelCode" label="鎶ヨ閫氶亾缂栫爜" show-overflow-tooltip></el-table-column> + <el-table-column prop="companyCode" label="浼佷笟缂栫爜" show-overflow-tooltip></el-table-column> + <el-table-column prop="scenes" label="鎺ㄩ�佸満鏅�" show-overflow-tooltip></el-table-column> + <el-table-column prop="updatedAt" label="鎺ㄥ姩鏃堕棿" show-overflow-tooltip></el-table-column> <el-table-column label="鎿嶄綔" align="center" width="100px"> <template slot-scope="scope"> - <span class="iconfont option" style="color:red" @click="delUser(scope.row)">鍒犻櫎</span> + <span class="iconfont option" style="color:red" @click="delCameras(scope.row)">鍒犻櫎</span> </template> </el-table-column> </el-table> @@ -42,10 +42,6 @@ </div> </div> <div class="sub-account" v-else-if="isShowAdd"> - <!-- <div class="add-title" @click="isShowAdd = false"> - <span class="iconfont"></span> - <span>瀛愯处鎴风鐞�</span> - </div> --> <div class="head-name" style="margin-bottom:20px">缂栬緫鐐逛綅</div> <el-form :model="ruleForm" @@ -55,20 +51,55 @@ label-width="100px" class="add-ruleForm" > - <el-form-item label="鐐逛綅鍚嶇О" prop="a"> - <el-input v-model="ruleForm.a" placeholder="璇疯緭鍏ョ偣浣嶅悕绉�" style="width: 350px"></el-input> + <el-form-item label="鐐逛綅鍚嶇О" prop="CameraName"> + <!-- <el-input v-model="ruleForm.CameraName" placeholder="璇疯緭鍏ョ偣浣嶅悕绉�" style="width: 350px"></el-input> --> + <el-select style="width: 350px" v-model="ruleForm.CameraName" placeholder="璇烽�夋嫨"> + <el-option v-for="item in cameraOptions" :key="item.id" :label="item.name" :value="item.name"> </el-option> + </el-select> </el-form-item> - <el-form-item label="鎶ヨ閫氶亾缂栫爜" prop="b"> - <el-input v-model="ruleForm.b" placeholder="璇疯緭鍏ユ姤璀﹂�氶亾缂栫爜" style="width: 350px"></el-input> + <el-form-item label="鎶ヨ閫氶亾缂栫爜" prop="ChannelCode"> + <el-input v-model="ruleForm.ChannelCode" placeholder="璇疯緭鍏ユ姤璀﹂�氶亾缂栫爜" style="width: 350px"></el-input> </el-form-item> - <el-form-item label="浼佷笟缂栫爜" prop="c"> - <el-input v-model="ruleForm.c" placeholder="璇疯緭鍏ヤ紒涓氱紪鐮�" style="width: 350px"></el-input> + <el-form-item label="浼佷笟缂栫爜" prop="CompanyCode"> + <el-input v-model="ruleForm.CompanyCode" placeholder="璇疯緭鍏ヤ紒涓氱紪鐮�" style="width: 350px"></el-input> </el-form-item> - <el-form-item label="鎺ㄩ�佸満鏅�" prop="d"> - <el-input v-model="ruleForm.d" placeholder="璇疯緭鍏ユ帹閫佸満鏅�" style="width: 350px"></el-input> + <el-form-item label="鎺ㄩ�佸満鏅�" prop="Sceneslist"> + <el-select multiple style="width: 350px" v-model="ruleForm.Sceneslist" filterable placeholder="璇烽�夋嫨"> + <el-option v-for="item in scene_nameOptions" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> </el-form-item> - <el-form-item label="鎺ㄥ姩鏃堕棿" prop="e"> - <el-input v-model="ruleForm.e" placeholder="璇疯緭鍏ユ帹鍔ㄦ椂闂�" style="width: 350px"></el-input> + <el-form-item label="鎺ㄥ姩鏃堕棿"> + <el-col :span="12" style="width: 175px"> + <el-form-item prop="StartTime"> + <el-time-select + style="width: 175px" + placeholder="璧峰鏃堕棿" + v-model="ruleForm.StartTime" + :picker-options="{ + start: '00:00', + step: '00:30', + end: '23:30' + }" + > + </el-time-select> + </el-form-item> + </el-col> + <el-col :span="12" style="width: 175px"> + <el-form-item prop="EndTime"> + <el-time-select + style="width: 175px" + placeholder="缁撴潫鏃堕棿" + v-model="ruleForm.EndTime" + :picker-options="{ + start: '00:00', + step: '00:30', + end: '23:30' + }" + > + </el-time-select> + </el-form-item> + </el-col> </el-form-item> </el-form> <div class="right"> @@ -80,424 +111,202 @@ </template> <script> -import { findUserList, saveSubUser, getMenu, getDataTree, deleteUser } from "@/api/user" -import { findTaskById, updateTask } from "@/api/report" -import { getAreas, getDic } from "@/api/login" +import { getLocalCameraTree } from "@/api/area" +import { getClusterDevList } from "@/api/clusterManage" +import { camerasList, camerasCreate, camerasDelete } from "@/api/report" export default { - computed: { - taskOptions() { - return this.VideoPhotoData.tasks.filter((item) => !item.isDelete) - } - }, data() { - const validateTree = (rule, value, callback) => { - if ( - this.ruleForm.menuIds && - this.ruleForm.dataIds && - this.ruleForm.menuIds.length > 0 && - this.ruleForm.dataIds.length > 0 - ) { - callback() - } else { - callback(new Error("璇烽�夎彍鍗曟潈闄愬拰鏁版嵁鏉冮檺")) - } - } return { - searchTime: [this.$moment().format("YYYY-MM-DD 00:00:00"), this.$moment().format("YYYY-MM-DD HH:mm:ss")], //鎼滅储鏃堕棿 + cameraOptions: [], + scene_nameOptions: [ + { + value: "鏄庣伀", + label: "鏄庣伀" + }, + { + value: "鐑熼浘", + label: "鐑熼浘" + }, + { + value: "缈昏秺鍥存爮", + label: "缈昏秺鍥存爮" + }, + { + value: "鍖哄煙鍏ヤ镜", + label: "鍖哄煙鍏ヤ镜" + }, + { + value: "浜哄憳鎾ょ", + label: "浜哄憳鎾ょ" + }, + { + value: "浜哄憳绂诲矖", + label: "浜哄憳绂诲矖" + }, + { + value: "浜哄憳鑱氶泦", + label: "浜哄憳鑱氶泦" + }, + { + value: "鎵撶數璇�", + label: "鎵撶數璇�" + }, + { + value: "鎶界儫", + label: "鎶界儫" + }, + { + value: "鏈僵鎴村畨鍏ㄥ附", + label: "鏈僵鎴村畨鍏ㄥ附" + }, + { + value: "鏈┛鐫�宸ヤ綔鏈�", + label: "鏈┛鐫�宸ヤ綔鏈�" + }, + { + value: "鐫″矖", + label: "鐫″矖" + } + ], + isShowAdd: false, //鏄惁灞曠ず鏂板寮圭獥 + ruleForm: { + CameraName: "", // 鎽勫儚鏈哄悕绉� + ChannelCode: "", // 鎶ヨ閫氶亾缂栧彿 + CompanyCode: "", // 鎵�灞炰紒涓氱紪鍙� + Scenes: "", // 鎺ㄩ�佸満鏅� + Sceneslist: [], // 鎺ㄩ�佸満鏅� + StartTime: "", // 寮�濮嬫椂闂� + EndTime: "", // 缁撴潫鏃堕棿 + + CameraId: "", // 鎽勫儚鏈篿d + Level: "", + Enable: true + }, + + dataList: [], + + tip: 1, + rules: { + CameraName: [{ required: true, message: "璇烽�夋嫨璁惧鍚嶇О", trigger: "change" }], + ChannelCode: [{ required: true, message: "璇疯緭鍏ユ姤璀﹂�氶亾缂栫爜", trigger: "blur" }], + CompanyCode: [{ required: true, message: "璇疯緭鍏ヤ紒涓氱紪鐮�", trigger: "blur" }], + Sceneslist: [{ type: "array", required: true, message: "璇烽�夋嫨鎺ㄩ�佸満鏅�", trigger: "change" }] + // StartTime: [{ required: true, message: "璇烽�夋嫨寮�濮嬫椂闂�", trigger: "change" }], + // EndTime: [{ required: true, message: "璇烽�夋嫨缁撴潫鏃堕棿", trigger: "change" }] + }, page: 1, size: 10, //鍒嗛〉鐩稿叧 - total: 0, //鎬绘暟, - inputText: "", //杈撳叆妗嗗唴瀹� - activeStep: 0, - activeIndex: 0, - industrys: [], - treeHeight: 750, - treeData: [], - treeSettings: { - check: { - enable: true - } - }, - options: { - lazy: true, - lazyLoad(node, resolve) { - // 鎳掑姞杞借妭鐐圭渷甯傛暟鎹� - const { level } = node - let nodes - getAreas({ parentId: level == 0 ? 0 : node.value }) - .then((json) => { - nodes = json.data.list - nodes = nodes.map((item) => ({ - value: item.id, - label: item.name, - level: item.level, - leaf: level >= 1 - })) - resolve(nodes) - }) - .catch((err) => { - console.log(err) - }) - } - }, - dataList: [], - isShowAdd: false, //鏄惁灞曠ず鏂板寮圭獥 - isShowUnbind: false, //鏄惁灞曠ず瑙g粦寮圭獥 - isShowRelate: false, - isEditing: false, - unbindId: "", - durationArr: [ - { - value: 1, - label: "1骞�" - }, - { - value: 2, - label: "2骞�" - }, - { - value: 3, - label: "3骞�" - } - ], //鎵�灞為泦缇や笅鎷夋 - timeLength: null, //閫変腑鐨勬巿鏉冩椂闀� - showQuit: false, //灞曠ず閫�鍑洪泦缇ょ殑寮圭獥 - showJoin: false, //灞曠ず鍔犲叆闆嗙兢鐨勫脊绐� - activeEquipment: null, //澶勭悊涓殑璁惧 - checkedData: [], - checkedMenu: [], - ruleForm: { - //y - a: "", - b: "", - c: "", - d: "", - e: "", - id: "", - username: "", - userType: "", - password: "", - trueName: "", - companyName: "", - phoneNum: "", - email: "basic", - isChangePwd: false, - industryId: "", - address: [], - authDuration: 3, - areaId: "", - provinceId: "", - menuIds: [], - dataIds: [] - }, - rules: { - //y - a: [{ required: true, message: "璇疯緭鍏ョ偣浣嶅悕绉�", trigger: "blur" }], - b: [{ required: true, message: "璇疯緭鍏ユ姤璀﹂�氶亾缂栫爜", trigger: "blur" }], - c: [{ required: true, message: "璇疯緭鍏ヤ紒涓氱紪鐮�", trigger: "blur" }], - d: [{ required: true, message: "璇疯緭鍏ユ帹閫佸満鏅�", trigger: "blur" }], - e: [{ required: true, message: "璇疯緭鍏ユ帹鍔ㄦ椂闂�", trigger: "blur" }] - }, - sysMenus: [], - DataTree: [], - smsSceneConfig: [], - smsLevelConfig: [], - smsEnable: false, - userInfo: {}, - curEditId: "", - defaultProp: { - children: "children", - label: "name" - }, - levelOptions: [ - { value: "涓�绾�", label: "涓�绾�" }, - { value: "浜岀骇", label: "浜岀骇" }, - { value: "涓夌骇", label: "涓夌骇" }, - { value: "鍥涚骇", label: "鍥涚骇" }, - { value: "浜旂骇", label: "浜旂骇" } - ] + total: 0 //鎬绘暟, } }, - // created() { - // this.userInfo = JSON.parse(sessionStorage.getItem("userInfo")) - // this.findUserList() - // this.getIndustrys() - // this.fetchSysMenus() - // this.fetchDataTree() - // }, - // mounted() { - // this.TreeDataPool.reset() - // this.TreeDataPool.multiple = true - // this.VideoPhotoData.queryTaskList() - // }, + created() { + this.checkCamerasList() + this.aaaaa() + }, + + // const rsp: any = await getLocalCameraTree(params) + // console.log(rsp, "rsp") methods: { - fetchDataTree() { - getDataTree({ userId: this.userInfo.id }).then((res) => { - this.DataTree = res.data.dataTree - }) - }, - fetchSysMenus() { - getMenu().then((rsp) => { - if (rsp && rsp.success) { - this.sysMenus = rsp.data.menus - // this.userMenus = []; + async aaaaa() { + let clusterId = "" + let clusterReq = await getClusterDevList() + if (clusterReq && clusterReq.success) { + if (clusterReq.data.clusterList.length > 0) { + clusterId = clusterReq.data.clusterList[0].cluster_id } - }) - }, - selectDevice(node, checked, hasChildren) { - if (checked) { - sessionStorage.setItem("clusterId", node.id) - this.TreeDataPool.fetchTreeData() - this.treeData = this.TreeDataPool.treeData - } else { - this.treeData = [] - this.TreeDataPool.reset() } + console.log(clusterId) + let camereReq = await getLocalCameraTree({ clusterId: clusterId }) + console.log(camereReq.data.treeMenu, "camereReqcamereReqcamereReq") + let array = camereReq.data.treeMenu + for (let i = 0; i < array.length; i++) { + console.log(array[i].children, "11111111") + for (let j = 0; j < array[i].children.length; j++) { + this.cameraOptions.push(array[i].children[j]) + } + } + console.log(this.cameraOptions, "arrrrrrrrrrrrrrrr") }, addPoint() { this.isShowAdd = true + this.tip = 1 this.resetUser() - }, - async editUser(row) { - this.isShowAdd = true - this.isEditing = true - this.ruleForm.id = row.id - this.ruleForm.username = row.username - this.ruleForm.userType = row.userType - this.ruleForm.password = row.password - this.ruleForm.trueName = row.trueName - this.ruleForm.companyName = row.companyName - this.ruleForm.phoneNum = row.phoneNum - this.ruleForm.email = row.email - this.ruleForm.isChangePwd = false - this.ruleForm.industryId = row.industryId - this.ruleForm.areaId = row.areaId - this.ruleForm.address = [row.provinceId, row.areaId] - this.ruleForm.provinceId = row.provinceId - this.ruleForm.authDuration = row.authDuration - this.checkedMenu = row.menuIds - this.checkedData = row.dataIds - - this.smsSceneConfig = [] - this.smsLevelConfig = [] - this.smsEnable = false - findTaskById({ id: row.id }).then((rsp) => { - if (rsp && rsp.success && rsp.data != "") { - if (rsp.data.taskName != "") { - this.smsSceneConfig = rsp.data.taskName.split(",") + }, //y + saveUser() { + this.$refs["ruleForm"].validate((valid) => { + if (valid) { + let obj = this.cameraOptions.find((item) => item.name === this.ruleForm.CameraName) + console.log(obj, "dddddddd") + let params = { + CameraName: this.ruleForm.CameraName, + ChannelCode: this.ruleForm.ChannelCode, + CompanyCode: this.ruleForm.CompanyCode, + Scenes: this.ruleForm.Sceneslist.toString(), + StartTime: this.ruleForm.StartTime, + EndTime: this.ruleForm.EndTime, + CameraId: obj.id, // + Level: this.ruleForm.Level, + Enable: this.ruleForm.Enable } - if (rsp.data.level != "") { - this.smsLevelConfig = rsp.data.level.split(",") - } - this.smsEnable = rsp.data.enable + console.log(params, "paramsv") + camerasCreate(params).then((res) => { + console.log(res, "res") + if (res && res.success) { + this.$message({ + type: "success", + message: res.msg + }) + this.goback() + } + }) + } else { + return false } }) - - // 鏌ヨ褰撳墠鐢ㄦ埛鏉冮檺涓嬫墍鏈夊彲绠$悊鐨勬憚鍍忔満 - if (row.dataIds) { - sessionStorage.setItem("clusterId", row.dataIds[0]) - await this.TreeDataPool.fetchTreeData() - } - - // 鐢╡mail瀛楁鏆傛椂浠f浛鎽勫儚鏈洪泦鍚堝瓧娈� - let checkedCameras = row.email - - // basic 涓哄瓙璐︽埛榛樿鐨勭┖瀛楁,琛ㄧず鍙鐞嗙殑鎽勫儚鏈虹洰褰曚负绌� - if (checkedCameras == "basic") { - return - } - - // 鍙嶉�夋憚鍍忔満 - if (checkedCameras.length) { - let cameraIds = checkedCameras.split(",") - this.$refs.ztreeMenus.updateNodes(cameraIds) - } }, - delUser(row) { - this.$confirm("纭瑕佸垹闄よ鐢ㄦ埛鍚�, 鏄惁缁х画?", "鎻愮ず", { + handleSizeChange(size) { + this.size = size + this.checkCamerasList() + }, + //鍒嗛〉鍔熻兘 + refrash(page) { + this.page = page + this.checkCamerasList() + }, + delCameras(row) { + this.$confirm("纭瑕佸垹闄よ鐐逛綅鍚�, 鏄惁缁х画?", "鎻愮ず", { confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", type: "warning" }).then(async () => { - let rsp = await deleteUser({ id: row.id }) + let rsp = await camerasDelete({ id: row.id }) if (rsp && rsp.success) { this.$message({ type: "success", message: "鍒犻櫎鎴愬姛!" }) } - - this.findUserList() + this.checkCamerasList() }) + }, + async checkCamerasList() { + let res = await camerasList({ pageIndex: this.page, pageSize: this.size }) + this.dataList = res.data + this.total = res.total }, resetUser() { this.ruleForm = { - id: "", - username: "", - userType: "", - password: "", - trueName: "", - companyName: "", - phoneNum: "", - email: "", - isChangePwd: false, - address: [], - industryId: "", - areaId: "", - provinceId: "", - authDuration: 1 + CameraName: "", + ChannelCode: "", + CompanyCode: "", + Sceneslist: [], + StartTime: "", + EndTime: "" } - this.smsSceneConfig = [] - this.smsLevelConfig = [] - this.smsEnable = false - this.$nextTick(() => { - this.$refs.treeMenus.setCheckedKeys([]) - this.$refs.treeData.setCheckedKeys([]) - }) - }, - async getIndustrys() { - let res = await getDic() - if (res.success) { - this.industrys = res.data.dics - } else { - console.log("鏌ヨ琛屼笟鍒楄〃澶辫触锛�") - } - }, - saveUser() { - let _this = this - this.ruleForm.menuIds = this.$refs.treeMenus.getCheckedKeys() - this.ruleForm.dataIds = this.$refs.treeData.getCheckedKeys() - this.$refs["ruleForm"].validate((valid) => { - if (valid) { - let json = { - id: this.isEditing ? this.ruleForm.id : "", - username: this.ruleForm.username, - password: this.ruleForm.password, - isChangePwd: this.ruleForm.isChangePwd, - userType: this.ruleForm.userType, - trueName: this.ruleForm.trueName, - companyName: this.ruleForm.companyName, - phoneNum: this.ruleForm.phoneNum, - industryId: this.ruleForm.industryId, - areaId: this.ruleForm.address.length == 2 ? this.ruleForm.address[1] : "", - authDuration: this.ruleForm.authDuration, - menuIds: this.ruleForm.menuIds, - dataIds: this.ruleForm.dataIds - } - - // 鑾峰彇瀛愯处鎴烽�変腑鐨勬憚鍍忔満鍒楄〃 - let cameraIds = this.TreeDataPool.selectedNodes - if (cameraIds.length == 0) { - json.email = "basic" - } else { - json.email = cameraIds.join(",") - } - - // 缂栬緫涓嶆彁浜ゅ瘑鐮� - if (this.isEditing) { - delete json.password - json.isChangePwd = false - } - - if (typeof json.areaId === "string") { - delete json.areaId - } - - if (typeof json.authDuration === "string") { - delete json.authDuration - } - - // return - saveSubUser(json) - .then((res) => { - if (res.success) { - // 淇濆瓨娑堟伅鎺ㄩ�� - if (_this.isEditing) { - let smsTaskInfo = { - id: _this.ruleForm.id, - taskName: _this.smsSceneConfig.join(","), - level: _this.smsLevelConfig.join(","), - cameras: json.email, - person: json.trueName, - tel: json.phoneNum, - enable: _this.smsEnable, - IsDel: "0" - } - - updateTask(smsTaskInfo).then((rsp) => { - // console.log(rsp) - }) - } - - _this.$notify.success(res.data) - _this.isShowAdd = false - _this.isEditing = false - _this.findUserList() - } else { - _this.$notify.error(res.msg) - } - }) - .catch((err) => { - _this.$notify.error(err.data.msg) - }) - } else { - return false - } - }) - }, - findUserList() { - findUserList({ - inputText: this.inputText, - page: this.page, - size: this.size, - authDuration: this.timeLength - }) - .then((res) => { - if (res.success) { - this.dataList = res.data.dataList - this.total = res.data.total - } else { - this.$notify.error("鍔犺浇瀛愯处鎴峰垪琛ㄥけ璐�") - } - }) - .catch((e) => { - this.$notify.error(e.msg) - }) }, goback() { this.isShowAdd = false - this.isEditing = false - this.isShowRelate = false - this.activeIndex = 0 - }, - goto(i) { - this.activeIndex = i - }, - reset() { - this.inputText = "" - this.timeLength = null - }, - - //鍒嗛〉鍔熻兘 - handleSizeChange(size) { - this.size = size - this.findUserList() - }, - //鍒嗛〉鍔熻兘 - refrash(page) { - this.page = page - this.findUserList() - }, - - // 鐢熸垚uuid - getUuid() { - let originStr = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - let originChar = "0123456789abcdef" - let len = originChar.length - return originStr.replace(/x/g, function(match) { - return originChar.charAt(Math.floor(Math.random() * len)) - }) } } } -- Gitblit v1.8.0