{"remainingRequest":"D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\sfz-lh-fvue\\src\\views\\Normal\\DeviceManagement\\eleDevice.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\sfz-lh-fvue\\src\\views\\Normal\\DeviceManagement\\eleDevice.vue","mtime":1706123309640},{"path":"D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\sfz-lh-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\nimport {dragController} from '@/assets/js/dragController'\r\nimport {TableMixin} from '@/mixins/tableMixin'\r\nimport routerManagement from '@/api/BasicDataManagement/tollStationManagement.js'\r\nimport device from '@/api/DeviceManagement/device.js'\r\nimport utils from '@/utils.js'\r\nexport default {\r\n name: 'eleDevice',\r\n mixins: [TableMixin],\r\n data() {\r\n return {\r\n treeLevel: '1',\r\n treeLoading: false,\r\n treeTollStationId: '',\r\n treeTollStationName: '',\r\n tollStation: null, // 当前收费站信息\r\n sreachTree: '',\r\n currentTreeId: '',\r\n dialog: {\r\n title: '',\r\n isRoot: false,\r\n visible: false,\r\n },\r\n dialogForm: {},\r\n rules: {\r\n positionName: {\r\n required: true,\r\n message: '请输入位置名称',\r\n trigger: 'blur',\r\n },\r\n positionCode: {\r\n required: true,\r\n message: '请输入位置编码',\r\n trigger: 'blur',\r\n },\r\n },\r\n treeData: [\r\n // {\r\n // label: '一级 1',\r\n // id: 1,\r\n // children: [],\r\n // },\r\n ],\r\n defaultProps: {\r\n children: 'children',\r\n label: 'positionName',\r\n },\r\n searchForm: {},\r\n roadOptions: [], // 路段数据\r\n tollStationOptions: [], // 收费站数据\r\n loading: false,\r\n tableLoading: false,\r\n tableData: [],\r\n defaultQuerys: [\r\n {\r\n group: 'main',\r\n operation: 'IN',\r\n property: 'position_id_',\r\n relation: 'AND',\r\n value: '',\r\n },\r\n {\r\n group: 'main',\r\n operation: 'NOT_EQUAL',\r\n parentGroup: '',\r\n property: 'type',\r\n relation: 'AND',\r\n value: '1',\r\n },\r\n ],\r\n params: {\r\n pageBean: {\r\n page: 1,\r\n pageSize: 50,\r\n total: 0,\r\n },\r\n querys: [],\r\n sorter: [\r\n {\r\n direction: 'ASC',\r\n property: 'sn_',\r\n },\r\n {\r\n direction: 'ASC',\r\n property: 'name',\r\n },\r\n ],\r\n },\r\n activeTreeData: null,\r\n sortData: {}, // 变动的sort数据集\r\n }\r\n },\r\n watch: {\r\n sreachTree(val) {\r\n this.$refs.tree.filter(val)\r\n },\r\n },\r\n computed: {\r\n SearchPanel() {\r\n return {\r\n '--searchPanel': this.searchPanel + 'px',\r\n }\r\n },\r\n },\r\n mounted() {\r\n dragController()\r\n this.loadTollStation()\r\n this.loadRoad()\r\n },\r\n methods: {\r\n handleSaveSort() {\r\n this.$confirm(\r\n this.$t('确定保存设备排序号?'),\r\n this.$t('common.tips'),\r\n {\r\n confirmButtonText: this.$t('common.confirm'),\r\n cancelButtonText: this.$t('common.cancel'),\r\n type: 'warning',\r\n }\r\n ).then(() => {\r\n device\r\n .saveSort(this.sortData)\r\n .then((res) => {\r\n console.log(res)\r\n if (res.data.state) {\r\n this.$message({\r\n message: '保存排序号成功',\r\n type: 'success',\r\n })\r\n }\r\n })\r\n .finally(() => {\r\n this.loadData(1)\r\n })\r\n })\r\n },\r\n handleChangeSort(item) {\r\n let levelKey\r\n if (this.activeTreeData.level == 1) {\r\n if (this.activeTreeData.positionName == '收费站') {\r\n levelKey = '10'\r\n } else if (this.activeTreeData.positionName == '服务区') {\r\n levelKey = '20'\r\n } else if (this.activeTreeData.positionName == '路段监控') {\r\n levelKey = '30'\r\n }\r\n this.sortData[item.id] = levelKey + item.sn\r\n }\r\n },\r\n handleModal(row) {\r\n this.$router.push({\r\n path: '/platLayout/devicePosition',\r\n query: {id: row.id},\r\n })\r\n },\r\n loadTree() {\r\n this.treeLoading = true\r\n this.treeData = []\r\n let data = this.qs.stringify({\r\n stationId: this.treeTollStationId,\r\n })\r\n device.queryPositionTree(data).then((res) => {\r\n this.treeLoading = false\r\n this.treeData = res.value || []\r\n if (this.treeData.length) {\r\n this.activeTreeData = this.treeData[0]\r\n this.treeLevel = this.treeData[0].level\r\n this.currentTreeId = this.treeData[0].id\r\n this.defaultQuerys[0].value = this.currentTreeId\r\n this.$nextTick(() => {\r\n if (this.$refs.tree)\r\n this.$refs.tree.setCurrentKey(this.currentTreeId)\r\n })\r\n }\r\n this.loadData()\r\n })\r\n },\r\n //获取数据\r\n loadData(page) {\r\n if (page) this.params.pageBean.page = page\r\n this.tableLoading = true\r\n this.params.querys.push(...this.defaultQuerys)\r\n this.sortData = {}\r\n device.queryDeviceList(this.params).then((res) => {\r\n this.tableLoading = false\r\n let data = res.value\r\n if (data.rows && data.rows.length) {\r\n data.rows.forEach((item) => {\r\n if (item.sn && item.sn.length >= 3) {\r\n item.sn = item.sn.slice(2)\r\n }\r\n })\r\n }\r\n this.tableData = data.rows || []\r\n\r\n if (data.page) {\r\n this.params.pageBean = {\r\n page: data.page,\r\n pageSize: data.pageSize,\r\n total: data.total,\r\n }\r\n }\r\n this.params.querys = []\r\n })\r\n },\r\n handleSearch() {\r\n let querys = []\r\n for (let key in this.searchForm) {\r\n querys.push({\r\n group: 'main',\r\n operation:\r\n key == 'name' || key == 'code' ? 'LIKE' : 'EQUAL',\r\n parentGroup: '',\r\n property: key,\r\n relation: 'AND',\r\n value: this.searchForm[key],\r\n })\r\n }\r\n this.params.querys.push(...querys)\r\n this.loadData(1)\r\n },\r\n // 路段数据\r\n loadRoad() {\r\n let params = {\r\n pageBean: {\r\n page: 1,\r\n pageSize: -1,\r\n },\r\n }\r\n routerManagement.queryRoad(params).then((res) => {\r\n this.roadOptions = res.rows || []\r\n })\r\n },\r\n // 收费站\r\n loadTollStation() {\r\n let params = {\r\n pageBean: {\r\n page: 1,\r\n pageSize: -1,\r\n },\r\n }\r\n routerManagement.queryTollStation(params).then((res) => {\r\n let data = res.data\r\n this.tollStationOptions = data.rows || []\r\n this.treeTollStationId = this.tollStationOptions[0].id\r\n this.treeTollStationName = this.tollStationOptions[0].name\r\n if (this.treeTollStationId) {\r\n this.loadTree()\r\n this.tollStation = this.tollStationOptions[0]\r\n }\r\n })\r\n },\r\n changeTollStation(val) {\r\n let options = utils.deepClone(this.tollStationOptions)\r\n let target = options.filter((item) => (item.id = val))[0]\r\n\r\n this.treeTollStationId = val\r\n this.treeTollStationName = target.name\r\n if (this.treeTollStationId) {\r\n this.loadTree()\r\n this.tollStation = target\r\n }\r\n },\r\n filterNode(value, data) {\r\n if (!value) return true\r\n return data.positionName.indexOf(value) !== -1\r\n },\r\n handleAddType() {\r\n this.dialog.title = '新增位置分类'\r\n this.dialog.isRoot = true\r\n this.dialog.visible = true\r\n },\r\n handleCascaderChange(val) {},\r\n handleNodeClick(obj, node, tree) {\r\n this.activeTreeData = obj\r\n this.treeLevel = obj.level\r\n this.currentTreeId = obj.id\r\n this.defaultQuerys[0].value = this.currentTreeId\r\n this.loadData(1)\r\n },\r\n handleDialogClose() {\r\n this.dialogForm = {}\r\n this.dialog.title = ''\r\n this.dialog.isRoot = false\r\n this.dialog.visible = false\r\n },\r\n handleAddNode(node, data) {\r\n this.dialogForm.parentId = data.id\r\n this.dialog.title = '新增位置分类'\r\n this.dialog.isRoot = false\r\n this.dialog.visible = true\r\n },\r\n handleEditNode(node, data) {\r\n this.dialogForm = data\r\n this.dialog.title = '编辑位置分类'\r\n this.dialog.isRoot = !this.dialogForm.parentId ? true : false\r\n this.dialog.visible = true\r\n },\r\n handleDelNode(node, data) {\r\n this.$confirm(\r\n `确定删除选中${data.positionName}吗?`,\r\n this.$t('common.tips'),\r\n {\r\n confirmButtonText: this.$t('common.confirm'),\r\n cancelButtonText: this.$t('common.cancel'),\r\n type: 'warning',\r\n }\r\n ).then(() => {\r\n device.delPosition(data.id).then((res) => {\r\n this.loadTree()\r\n if (res.state) {\r\n this.$message({\r\n message: '删除成功',\r\n type: 'success',\r\n })\r\n }\r\n })\r\n })\r\n },\r\n handleSaveType() {\r\n this.$refs.form.validate((valid) => {\r\n if (valid) {\r\n this.dialogForm.tollStationId = this.treeTollStationId\r\n this.dialogForm.tollStationName = this.treeTollStationName\r\n let API = device.addPosition\r\n if (this.dialogForm.id) API = device.updatePosition\r\n API(this.dialogForm).then((res) => {\r\n if (res.state) {\r\n this.loadTree()\r\n this.handleDialogClose()\r\n } else {\r\n this.$message(res.massage)\r\n }\r\n })\r\n }\r\n })\r\n },\r\n //添加\r\n handleAdd() {\r\n this.$router.push({\r\n path: '/platLayout/editDevice',\r\n query: {\r\n treeTollStationId: this.treeTollStationId,\r\n positionId: this.currentTreeId,\r\n },\r\n })\r\n },\r\n // 编辑\r\n handleEdit(rows) {\r\n this.$router.push({\r\n path: '/platLayout/editDevice',\r\n query: {id: rows.id},\r\n })\r\n },\r\n handleDelete() {\r\n this.$confirm(\r\n this.$t('common.sureDelete'),\r\n this.$t('common.tips'),\r\n {\r\n confirmButtonText: this.$t('common.confirm'),\r\n cancelButtonText: this.$t('common.cancel'),\r\n type: 'warning',\r\n }\r\n ).then(() => {\r\n device.batchDelete(this.deleteIds).then((res) => {\r\n this.loadData(1)\r\n if (res.data.state) {\r\n this.$message({\r\n message: '删除成功',\r\n type: 'success',\r\n })\r\n }\r\n })\r\n })\r\n },\r\n },\r\n}\r\n",null]}