123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <template>
- <van-nav-bar
- title="业务字典"
- left-text=""
- left-arrow
- @click-left="onClickLeft"
- @click-right="onClickRight"
- >
- <template #right> 添加 </template>
- </van-nav-bar>
- <van-search
- v-model="req.keyword"
- placeholder="请输入关键词"
- @search="onRefresh"
- />
- <van-pull-refresh v-model="loading" @refresh="onRefresh">
- <div class="list">
- <van-list
- v-model:loading="loading"
- :finished="finished"
- finished-text="没有更多了"
- @load="onLoad"
- style="margin-bottom: 60px"
- >
- <commonList
- :data="listData"
- @onClick="toDtl"
- :config="listConfig"
- ></commonList>
- </van-list>
- </div>
- </van-pull-refresh>
- </template>
- <script setup>
- import { ref, getCurrentInstance, onMounted } from 'vue'
- import commonList from '@/components/common-list.vue'
- import { useRoute } from 'vue-router'
- import { getUserInfo } from '@/utils/auth'
- const loading = ref(false)
- const router = useRoute()
- const req = ref({
- pageNum: 1,
- keyword: null,
- tenantId: getUserInfo().tenantId,
- code: null,
- })
- const finished = ref(false)
- const proxy = getCurrentInstance().proxy
- const listData = ref([])
- const listConfig = ref([
- {
- label: '键',
- prop: 'dictKey',
- },
- {
- label: '值',
- prop: 'dictValue',
- },
- {
- label: '排序',
- prop: 'sort',
- },
- ])
- const onRefresh = () => {
- req.value.pageNum = 1
- finished.value = false
- getList('refresh')
- }
- const onLoad = () => {
- getList()
- }
- const onClickLeft = () => proxy.$router.push('/main/working')
- const onClickRight = () => {
- proxy.$router.push({
- path: 'tenantAdd',
- query: {
- dictCode:router.query.code
- },
- })
- }
- proxy.uploadDdRightBtn(onClickRight,'添加')
- const toDtl = (row) => {
- console.log(row)
- proxy.$router.push({
- path: 'tenantAdd',
- query: row,
- })
- }
- const warehouseType = ref([])
- const getList = (type) => {
- loading.value = true
- proxy
- .post('dictTenantData/page', req.value)
- .then((res) => {
- listData.value =
- type === 'refresh'
- ? res.data.rows
- : listData.value.concat(res.data.rows)
- if (req.value.pageNum * 10 >= res.data.total) {
- finished.value = true
- }
- req.value.pageNum++
- loading.value = false
- })
- .catch((err) => {
- loading.value = false
- })
- }
- onMounted(() => {
- req.value.dictCode = router.query.code
- getList()
- })
- </script>
- <style lang="scss" scoped>
- .list {
- min-height: 70vh;
- }
- </style>
|