fix:页面修改为VUE3模式。
This commit is contained in:
@@ -64,78 +64,76 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script setup>
|
||||
import { listHeartJourney, delHeartJourney } from '@/api/invest/heartJourney'
|
||||
import { getDicts } from '@/api/system/dict/data.js'
|
||||
import {onLoad,onShow} from "@dcloudio/uni-app";
|
||||
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
|
||||
import {reactive ,toRefs,ref,computed }from "vue";
|
||||
const pageNum = ref(1)
|
||||
const listData = ref([])
|
||||
const isShow = ref(false)
|
||||
const status = ref('loadmore')
|
||||
const journeyTypeList = ref([])
|
||||
const settingPickShow = ref(false)
|
||||
const settingColumns = ref([])
|
||||
const data = reactive({
|
||||
filterPanel: false,
|
||||
queryParams: {
|
||||
name: '',
|
||||
type: '',
|
||||
}
|
||||
})
|
||||
const { filterPanel, queryParams} = toRefs(data)
|
||||
const windowHeight = computed(() => {
|
||||
uni.getSystemInfoSync().windowHeight - 50
|
||||
})
|
||||
onLoad(() => {
|
||||
getDict()
|
||||
getList()
|
||||
});
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
filterPanel: false,
|
||||
listData: [],
|
||||
pageNum: 1,
|
||||
queryParams: {
|
||||
name: '',
|
||||
type: '',
|
||||
},
|
||||
status: 'loadmore',
|
||||
journeyTypeList: [],
|
||||
settingPickShow: false,
|
||||
settingColumns: [],
|
||||
columns: [],
|
||||
isShow: false
|
||||
onShow(() => {
|
||||
if (isShow.value) {
|
||||
getList()
|
||||
isShow.value = false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
windowHeight() {
|
||||
return uni.getSystemInfoSync().windowHeight - 50
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getDict()
|
||||
this.getList()
|
||||
},
|
||||
onShow() {
|
||||
if (this.isShow) {
|
||||
this.getList()
|
||||
this.isShow = false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadmore() {
|
||||
this.pageNum += 1
|
||||
if (this.status == 'loadmore') {
|
||||
this.getList()
|
||||
});
|
||||
|
||||
function loadmore() {
|
||||
pageNum.value += 1
|
||||
if (status.value == 'loadmore') {
|
||||
getList()
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
this.status = 'loading'
|
||||
listHeartJourney({ pageSize: 10, pageNum: this.pageNum, ...this.queryParams }).then(res => {
|
||||
this.listData = this.listData.concat(res.rows)
|
||||
if (this.listData.length < res.total) {
|
||||
this.status = 'loadmore'
|
||||
}
|
||||
function getList() {
|
||||
status.value = 'loading'
|
||||
listHeartJourney({ pageSize: 10, pageNum: pageNum.value, ...queryParams.value }).then(res => {
|
||||
listData.value = listData.value.concat(res.rows)
|
||||
if (listData.length < res.total) {
|
||||
status.value = 'loadmore'
|
||||
} else {
|
||||
this.status = 'nomore'
|
||||
status.value = 'nomore'
|
||||
}
|
||||
}).catch(() => {
|
||||
this.status = 'nomore'
|
||||
status.value = 'nomore'
|
||||
})
|
||||
},
|
||||
getDict() {
|
||||
}
|
||||
function getDict() {
|
||||
// 工单状态
|
||||
getDicts('journey_type').then(res => {
|
||||
this.journeyTypeList = res.data
|
||||
journeyTypeList.value = res.data
|
||||
})
|
||||
},
|
||||
settingConfirm(e) {
|
||||
this.queryParams.settingId = e.value[0].settingId
|
||||
this.queryParams.settingName = e.value[0].settingName
|
||||
this.settingPickShow = false
|
||||
},
|
||||
settingCancel() {
|
||||
this.settingPickShow = false
|
||||
},
|
||||
dictStr(val, arr) {
|
||||
}
|
||||
function settingConfirm(e) {
|
||||
queryParams.value.settingId = e.value[0].settingId
|
||||
queryParams.value.settingName = e.value[0].settingName
|
||||
settingPickShow.value = false
|
||||
}
|
||||
function settingCancel() {
|
||||
settingPickShow.value = false
|
||||
}
|
||||
function dictStr(val, arr) {
|
||||
let str = ''
|
||||
arr.map(item => {
|
||||
if (item.dictValue === val) {
|
||||
@@ -143,48 +141,48 @@ export default {
|
||||
}
|
||||
})
|
||||
return str
|
||||
},
|
||||
selectStatus(item) {
|
||||
this.queryParams.type = item.dictValue
|
||||
this.journeyTypeList.map(ele => {
|
||||
}
|
||||
function selectStatus(item) {
|
||||
queryParams.value.type = item.dictValue
|
||||
journeyTypeList.value.map(ele => {
|
||||
if (ele.dictValue == item.dictValue) {
|
||||
ele.selected = true
|
||||
this.$set(ele, 'selected', true)
|
||||
Reflect.set(ele, 'selected', true)
|
||||
} else {
|
||||
this.$set(ele, 'selected', false)
|
||||
Reflect.set(ele, 'selected', false)
|
||||
}
|
||||
})
|
||||
},
|
||||
searchSubmit() {
|
||||
this.pageNum = 1
|
||||
this.listData = []
|
||||
this.getList()
|
||||
this.filterPanel = false
|
||||
},
|
||||
searchBlur() {
|
||||
this.pageNum = 1
|
||||
this.listData = []
|
||||
this.getList()
|
||||
},
|
||||
resetQuery() {
|
||||
this.queryParams.name = '',
|
||||
this.queryParams.type = ''
|
||||
this.journeyTypeList.map(ele => {
|
||||
this.$set(ele, 'selected', false)
|
||||
}
|
||||
function searchSubmit() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
filterPanel.value = false
|
||||
}
|
||||
function searchBlur() {
|
||||
pageNum.value = 1
|
||||
listData.value = []
|
||||
getList()
|
||||
}
|
||||
function resetQuery() {
|
||||
queryParams.value.name = '',
|
||||
queryParams.value.type = ''
|
||||
journeyTypeList.value.map(ele => {
|
||||
Reflect.set(ele, 'selected', false)
|
||||
})
|
||||
},
|
||||
enterDetails(item) {
|
||||
}
|
||||
function enterDetails(item) {
|
||||
uni.navigateTo({ url: `/pages/work/heartJourney/details?id=${item.id}` })
|
||||
},
|
||||
handleEdit(item) {
|
||||
}
|
||||
function handleEdit(item) {
|
||||
uni.navigateTo({ url: `/pages/work/heartJourney/addEdit?id=${item.id}` })
|
||||
this.isShow = true
|
||||
},
|
||||
handleAdd() {
|
||||
isShow.value = true
|
||||
}
|
||||
function handleAdd() {
|
||||
uni.navigateTo({ url: `/pages/work/heartJourney/addEdit` })
|
||||
this.isShow = true
|
||||
},
|
||||
handleDelete(item) {
|
||||
isShow.value = true
|
||||
}
|
||||
function handleDelete(item) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '你确定要删除吗',
|
||||
@@ -197,10 +195,8 @@ export default {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user