|
@@ -87,7 +87,7 @@ import { NavBar, Search, List, Cell, Icon, Popup, Button, Empty } from 'vant'
|
|
|
Vue.use(NavBar).use(Search).use(List).use(Cell).use(Icon).use(Popup).use(Button).use(Empty)
|
|
|
import { mapGetters } from 'vuex'
|
|
|
|
|
|
-import { querySmsLocation } from '@/api/equipmentList'
|
|
|
+import { queryMoreAsset, queryAssetClass } from '@/api/equipmentList'
|
|
|
import { queryPic } from '@/api/public'
|
|
|
import ImagePreview from '@/components/ImagePreview'
|
|
|
import { sleep } from '@/utils/util'
|
|
@@ -235,7 +235,10 @@ export default {
|
|
|
computed: {
|
|
|
...mapGetters(['plazaId', 'smsxt', 'categoryId']),
|
|
|
},
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.system_code = this.smsxt
|
|
|
+ this.onLoad()
|
|
|
+ },
|
|
|
beforeMount() {},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
@@ -252,12 +255,71 @@ export default {
|
|
|
this.loadMore = false
|
|
|
this.sbssList = [{ text: '全部', code: '', active: 'active' }]
|
|
|
// 查询筛选条件的 设备设施
|
|
|
- // this.getSbss()
|
|
|
+ this.getSbss()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 获取设备列表
|
|
|
+ */
|
|
|
+ async getList() {
|
|
|
+ let data = {
|
|
|
+ page: this.page,
|
|
|
+ size: this.size,
|
|
|
+ plazaId: this.plazaId,
|
|
|
+ onlyMainAsset: true,
|
|
|
+ }
|
|
|
+ let postParams = {
|
|
|
+ system_code: this.system_code,
|
|
|
+ }
|
|
|
+ // 筛选后,专业系统选择全部, 删除上传system_code的字段
|
|
|
+ if (!this.system_code || this.system_code === '全部') {
|
|
|
+ delete postParams.system_code
|
|
|
+ }
|
|
|
+ // TODO: 筛选后, 使用classstructureid字段
|
|
|
+ if (this.sbss_code) {
|
|
|
+ data.classstructureid = this.sbss_code
|
|
|
+ }
|
|
|
+ // TODO: keyword
|
|
|
+ if (this.keyword) {
|
|
|
+ data.keyword = `${this.keyword}:sbjc,assetnum;`
|
|
|
+ }
|
|
|
+ let resData = await queryMoreAsset({ data, postParams })
|
|
|
+ if (!resData && !resData?.data) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ console.log(resData)
|
|
|
+ },
|
|
|
+ async onLoad() {
|
|
|
+ console.log('onload')
|
|
|
+ if (this.page > 1) {
|
|
|
+ await sleep(1000)
|
|
|
+ }
|
|
|
+ await this.getList()
|
|
|
+ this.page++
|
|
|
+ this.loading = false
|
|
|
+ if (this.list.length >= this.count) {
|
|
|
+ this.finished = true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 跳转设备详情页
|
|
|
+ */
|
|
|
+ goToDetail(item) {
|
|
|
+ const { assetid } = item
|
|
|
+ assetid && this.$router.push({ name: 'AssetDetail', query: { assetid } })
|
|
|
},
|
|
|
onSearch() {
|
|
|
// 初始化数据,查询列表
|
|
|
},
|
|
|
/**
|
|
|
+ * 初始化数据,查询列表
|
|
|
+ */
|
|
|
+ initData() {
|
|
|
+ this.finished = false
|
|
|
+ this.page = 1
|
|
|
+ this.count = 0
|
|
|
+ this.list = []
|
|
|
+ },
|
|
|
+ /**
|
|
|
* popup 更改系统
|
|
|
*/
|
|
|
changeSystem(data) {
|
|
@@ -271,34 +333,85 @@ export default {
|
|
|
})
|
|
|
// 弹窗选中的系统
|
|
|
this.$set(this.modalDataBak, 'system', data.smsxt)
|
|
|
- // this.getSbss(data.smsxt)
|
|
|
+ this.getSbss(data.smsxt)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * popup 更改设备设施
|
|
|
+ */
|
|
|
+ changeSbss(data) {
|
|
|
+ let sbssList = this.sbssList
|
|
|
+ sbssList.map((item) => {
|
|
|
+ item.active = ''
|
|
|
+ if (item.text === data.text && item.code === data.code) {
|
|
|
+ item.active = 'active'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 弹窗选中的系统
|
|
|
+ // TODO: 111
|
|
|
+ console.log(data)
|
|
|
+ this.$set(this.modalDataBak, 'sbss', data.code)
|
|
|
},
|
|
|
/**
|
|
|
+ * 获取设备设施筛选条件
|
|
|
+ * @param smsxt 右弹窗 更改专业系统传递参数
|
|
|
+ */
|
|
|
+ async getSbss(smsxt) {
|
|
|
+ console.log(this.smsxt, this.system_code)
|
|
|
+ let getParams = {
|
|
|
+ system_code: smsxt || this.smsxt,
|
|
|
+ }
|
|
|
+ if (smsxt === '全部') {
|
|
|
+ delete getParams.system_code
|
|
|
+ }
|
|
|
+ let resData = await queryAssetClass({ getParams })
|
|
|
+ console.log(resData)
|
|
|
+ if (!resData && !resData?.data) {
|
|
|
+ this.sbssList = [{ text: '全部', code: '全部', active: 'active' }]
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let res_data = resData.data || []
|
|
|
+ let sbssList = []
|
|
|
+ res_data.map((item) => {
|
|
|
+ sbssList.push({
|
|
|
+ text: item.classqc,
|
|
|
+ active: '',
|
|
|
+ // code: detail.systemqm,
|
|
|
+ code: item.classstructureid,
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.sbssList = [{ text: '全部', code: '全部', active: 'active' }, ...sbssList]
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
* 重置
|
|
|
*/
|
|
|
reset() {
|
|
|
- // this.modalDataBak = {
|
|
|
- // system: '',
|
|
|
- // }
|
|
|
- // this.modalData = {
|
|
|
- // system: '',
|
|
|
- // }
|
|
|
- // this.system_code = this.smsxt
|
|
|
+ this.modalDataBak = {
|
|
|
+ system: '',
|
|
|
+ sbss: '全部',
|
|
|
+ }
|
|
|
+ this.modalData = {
|
|
|
+ system: '',
|
|
|
+ sbss: '全部',
|
|
|
+ }
|
|
|
+ this.system_code = this.smsxt
|
|
|
+ this.sbss_code = ''
|
|
|
this.showPopup = false
|
|
|
// 初始化数据,查询列表
|
|
|
- // this.initData()
|
|
|
- // this.onLoad()
|
|
|
+ this.initData()
|
|
|
+ this.onLoad()
|
|
|
},
|
|
|
/**
|
|
|
* 弹窗确认
|
|
|
*/
|
|
|
confirm() {
|
|
|
- // this.modalData = cloneDeep(this.modalDataBak)
|
|
|
+ this.modalData = cloneDeep(this.modalDataBak)
|
|
|
this.showPopup = false
|
|
|
- // this.system_code = this.modalData.system
|
|
|
+ this.system_code = this.modalData.system
|
|
|
+ this.sbss_code = this.modalData.sbss
|
|
|
// 初始化数据,查询列表
|
|
|
- // this.initData()
|
|
|
- // this.onLoad()
|
|
|
+ this.initData()
|
|
|
+ this.onLoad()
|
|
|
},
|
|
|
},
|
|
|
}
|