This commit is contained in:
yanran200730
2023-04-18 10:05:10 +08:00
3 changed files with 29 additions and 73 deletions

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="AppEquipmentManage"> <div class="AppEquipmentManage">
<keep-alive :include="['List']"> <keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component> <component :is="currentPage" v-bind="$props"/>
</keep-alive> </keep-alive>
</div> </div>
</template> </template>
@@ -17,38 +17,13 @@ export default {
instance: Function, instance: Function,
dict: Object, dict: Object,
}, },
computed: {
data() { currentPage: v => v.$route.hash == "#taskList" ? taskList : List
return {
component: 'List',
params: {},
include: [],
}
}, },
components: { components: {
List, List,
taskList, taskList,
},
methods: {
onChange(data) {
if (data.type === 'taskList') {
this.component = 'taskList'
this.params = data.params
} }
if (data.type == 'list') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
},
},
} }
</script> </script>

View File

@@ -49,9 +49,7 @@ export default {
props: { props: {
dict: Object, dict: Object,
instance: Function, instance: Function,
params: Object,
}, },
data() { data() {
return { return {
isAdd: false, isAdd: false,
@@ -113,17 +111,13 @@ export default {
locate: false locate: false
} }
}, },
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
}, },
created() { created() {
this.dict.load('dlbDevStatus', 'yesOrNo').then(() => {
this.getList() this.getList()
}) this.dict.load('dlbDevStatus', 'yesOrNo')
}, },
methods: { methods: {
bind(item) { bind(item) {
this.areaId = '' this.areaId = ''
@@ -186,13 +180,7 @@ export default {
}, },
toTaskList(id) { toTaskList(id) {
this.$emit('change', { this.$router.push({hash: "#taskList", query: {id}})
type: 'taskList',
params: {
id: id || '',
// areaId: this.areaId,
},
})
}, },
update() { update() {
this.btnLoading = true this.btnLoading = true

View File

@@ -1,7 +1,7 @@
<template> <template>
<section class="taskList"> <section class="taskList">
<ai-list> <ai-list>
<ai-title slot="title" title="任务列表" isShowBack isShowBottomBorder @onBackClick="cancel(true)"/> <ai-title slot="title" title="任务列表" isShowBack isShowBottomBorder @onBackClick="cancel"/>
<template #content> <template #content>
<ai-search-bar bottomBorder> <ai-search-bar bottomBorder>
<template slot="right"> <template slot="right">
@@ -25,13 +25,13 @@
</template> </template>
<script> <script>
import {mapMutations} from "vuex";
export default { export default {
name: 'taskList', name: 'taskList',
components: {},
props: { props: {
dict: Object, dict: Object,
instance: Function, instance: Function,
params: Object,
}, },
data() { data() {
return { return {
@@ -103,19 +103,16 @@ export default {
} }
}, },
created() { created() {
this.$dict.load('dlbDyclingType','dlbMessageUrgency','dlbBroadcastStatus','dlbResourceType').then(()=>{ this.setPageTitle("设备任务列表")
this.dict.load('dlbDyclingType', 'dlbMessageUrgency', 'dlbBroadcastStatus', 'dlbResourceType')
this.getList() this.getList()
})
}, },
methods: { methods: {
...mapMutations(['setPageTitle']),
getList() { getList() {
this.instance.post(`/app/appzyvideobroadcast/list?deviceId`,null,{ const {id: deviceId} = this.$route.query
params: { this.instance.post(`/app/appzyvideobroadcast/list`, null, {
...this.page, params: {...this.page, ...this.search, deviceId}
...this.search,
deviceId: this.params.deviceId
}
}).then(res => { }).then(res => {
if (res?.data) { if (res?.data) {
this.tableData = res.data.records this.tableData = res.data.records
@@ -123,7 +120,6 @@ export default {
} }
}) })
}, },
reset(id) { reset(id) {
this.$confirm('确定要撤回该任务吗?').then(() => { this.$confirm('确定要撤回该任务吗?').then(() => {
this.instance.post(`/app/appzyvideobroadcast/getBroadcastRecall?broadcastId=${id}`).then((res) => { this.instance.post(`/app/appzyvideobroadcast/getBroadcastRecall?broadcastId=${id}`).then((res) => {
@@ -134,11 +130,8 @@ export default {
}) })
}) })
}, },
cancel(isRefresh) { cancel() {
this.$emit('change', { this.$router.push({})
type: 'list',
isRefresh: !!isRefresh,
})
}, },
}, },
} }