{"remainingRequest":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\bzzgj-fvue\\src\\views\\Mobile\\Manage\\MobileTroubleshooting\\index.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\src\\views\\Mobile\\Manage\\MobileTroubleshooting\\index.vue","mtime":1690541169611},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\bzzgj-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\r\nimport nineLittlePlaceApi from '@/views/Manage/saftyDanger/api/nineLittlePlaceApi'\r\nimport QuerySearchPopup from './components/QuerySearchPopup/index.vue'\r\nimport dictUtils from '@/components/dict/DictSelectUtils'\r\n\r\nconst {loadCmgtSaftyDangerUnit} = nineLittlePlaceApi\r\n\r\nexport default {\r\n name: 'MobileDevice', // 排查单位查询\r\n components: {QuerySearchPopup},\r\n data() {\r\n return {\r\n listData: [], //产品列表\r\n loading: false, // 列表加载loading状态\r\n finished: false, // 是否数据加载完毕\r\n refreshing: false, // 下拉刷新\r\n querySearchPopup: false, // 搜索弹层\r\n querys: [\r\n {\r\n group: 'main',\r\n operation: 'LIKE',\r\n parentGroup: '',\r\n property: 'unit_name_',\r\n relation: 'AND',\r\n value: ''\r\n },\r\n {\r\n group: 'main',\r\n operation: 'LIKE',\r\n parentGroup: '',\r\n property: 'type_',\r\n relation: 'AND',\r\n value: ''\r\n },\r\n {\r\n group: 'main',\r\n operation: 'LIKE',\r\n parentGroup: '',\r\n property: 'small_place_area_',\r\n relation: 'AND',\r\n value: ''\r\n },\r\n {\r\n group: 'main',\r\n operation: 'LIKE',\r\n parentGroup: '',\r\n property: 'emphasis_level_',\r\n relation: 'AND',\r\n value: ''\r\n }\r\n ],\r\n // 自定义请求参数配置对象\r\n customQueryPrams: {\r\n pageSize: 10,\r\n page: 1,\r\n unit_name_: '',\r\n type_: '',\r\n small_place_area_: '',\r\n emphasis_level_: ''\r\n },\r\n // 类型\r\n typeOptions: [\r\n {name: '全部', value: ''},\r\n {name: '九小场所', value: '1'},\r\n {name: '重点单位', value: '2'}\r\n ],\r\n //九小场所片区\r\n nineSmallPlacesOptions: [\r\n {name: '全部片区', value: ''},\r\n ...dictUtils.getDictItemsFromCache('jxcspq')\r\n ],\r\n //重点单位级别\r\n keyUnitLevelOptions: [\r\n {name: '全部', value: ''},\r\n ...dictUtils.getDictItemsFromCache('zddwjb')\r\n ]\r\n }\r\n },\r\n computed: {\r\n // 加工为后端需要的请求格式\r\n queryParams() {\r\n const {pageSize, page, ...item} = this.customQueryPrams\r\n return {\r\n pageBean: {pageSize, page},\r\n querys: this.querys.map(i => {\r\n return {...i, value: item[i.property]}\r\n }),\r\n sorter: [{direction: 'DESC', property: 'createTime'}]\r\n }\r\n }\r\n },\r\n created() {\r\n this.getListData() // 获取列表数据\r\n },\r\n methods: {\r\n // 字典转义(转义、翻译)\r\n dictionaryEscape(dictionary, val, option = {}) {\r\n if (!(Array.isArray(dictionary) && dictionary.length)) return ''\r\n option = {\r\n valueKey: 'value',\r\n labelKey: 'name',\r\n dictionaryType: true,// true 为转义 false 为翻译\r\n ...option\r\n }\r\n const {valueKey, labelKey, dictionaryType} = option\r\n let item = dictionary.find(i => i[dictionaryType ? valueKey : labelKey] === val) || {}\r\n return item[dictionaryType ? labelKey : valueKey] || ''\r\n },\r\n\r\n // 跳转设备详情\r\n handleDetail(query) {\r\n /*\r\n * 翻译字段并携带参数跳转\r\n * */\r\n const {typeOptions, nineSmallPlacesOptions, keyUnitLevelOptions, dictionaryEscape} = this\r\n const {type, smallPlaceArea, emphasisLevel} = query\r\n this.$router.push({\r\n name: 'MobileTroubleshootingDetail',\r\n query: {\r\n ...query,\r\n type: dictionaryEscape(typeOptions, type),\r\n smallPlaceArea: dictionaryEscape(nineSmallPlacesOptions, smallPlaceArea),\r\n emphasisLevel: dictionaryEscape(keyUnitLevelOptions, emphasisLevel)\r\n }\r\n })\r\n },\r\n\r\n // 列表触底时触发\r\n onLoad() {\r\n this.customQueryPrams.page++\r\n this.getListData(_ => this.loading = false)\r\n },\r\n\r\n // 列表下拉刷新时触发\r\n onRefresh() {\r\n this.customQueryPrams.page = 1\r\n this.listData = []\r\n this.getListData(_ => this.refreshing = false)\r\n },\r\n\r\n // 获取列表数据\r\n async getListData(callback) {\r\n /*\r\n * 定义 escapeOpt 字段对应字典名 对象,后续进行字段的翻译逻辑\r\n * queryParams 为重新加工结构赋值的新请求配置参数\r\n * */\r\n const escapeOpt = {\r\n type_: 'typeOptions',\r\n small_place_area_: 'nineSmallPlacesOptions',\r\n emphasis_level_: 'keyUnitLevelOptions'\r\n }\r\n const queryParams = {\r\n ...this.queryParams,\r\n querys: this.queryParams.querys.map(i => {\r\n let escape = this[escapeOpt[i.property]]\r\n if (!escape) return i\r\n return {\r\n ...i,\r\n value: this.dictionaryEscape(escape, i.value, {\r\n dictionaryType: false\r\n })\r\n }\r\n })\r\n }\r\n\r\n /*\r\n * 进行数据合并,并判断是否数据加载完成\r\n * */\r\n const {data: {rows, total}} = await loadCmgtSaftyDangerUnit(queryParams)\r\n const {pageSize, page} = this.customQueryPrams\r\n this.listData = this.listData.concat(rows)\r\n if (pageSize * page >= total) this.finished = true\r\n\r\n callback && callback() // 回调函数,方便调用后个性化逻辑书写\r\n },\r\n\r\n // 打开弹层\r\n showPopup(popupName) {\r\n this[popupName] = true\r\n },\r\n\r\n // 查询/重置按钮点击\r\n searchData() {\r\n this.finished = false\r\n this.customQueryPrams.page = 1\r\n this.listData = []\r\n this.getListData()\r\n }\r\n }\r\n}\r\n",null]}