123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <template>
- <div style="padding-bottom: 60px">
- <van-nav-bar :title="'设备管理'" left-text="" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
- <template #right> {{$t('common.add')}} </template>
- </van-nav-bar>
- <van-search v-model="req.keyword" :placeholder="$t('common.pleaseEnterKeywords')" @search="onRefresh" />
- <van-pull-refresh v-model="loading" @refresh="onRefresh">
- <div class="list">
- <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" @load="onLoad" style="margin-bottom: 60px">
- <commonList :data="listData" :config="listConfig" @onClick="toDtl" :showMore="false"></commonList>
- </van-list>
- </div>
- </van-pull-refresh>
- </div>
- </template>
- <script setup>
- import { ref, getCurrentInstance, onMounted } from "vue";
- import commonList from "@/components/common-list.vue";
- import { useRoute } from "vue-router";
- const loading = ref(false);
- const router = useRoute();
- const req = ref({
- total: 3,
- pageNum: 1,
- pageSize: 10,
- });
- const finished = ref(false);
- const proxy = getCurrentInstance().proxy;
- const listData = ref([]);
- const listConfig = ref([
- {
- label: "业务公司",
- prop: "companyName",
- },
- {
- label: "设备编码",
- prop: "deviceCode",
- },
- {
- label: "设备名称",
- prop: "deviceName",
- },
- {
- label: "规格型号",
- prop: "deviceSpec",
- },
- {
- label: "制造商",
- prop: "makerName",
- },
- {
- label: "制造商电话",
- prop: "makerPhone",
- },
- {
- label: "出厂日期",
- prop: "deviceDeliveryTime",
- },
- {
- label: "备注",
- prop: "remark",
- },
- ]);
- 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: "/main/equipmentAdd",
- query: {
- type: "add",
- },
- });
- };
- proxy.uploadDdRightBtn(onClickRight, proxy.t("common.add"));
- const toDtl = (row) => {
- proxy.$router.push({
- path: "/main/equipmentAdd",
- query: {
- id: row.id,
- type: "edit",
- },
- });
- };
- const getList = (type) => {
- loading.value = true;
- proxy
- .post("/tdaDevice/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;
- });
- };
- getList();
- </script>
- <style lang="scss" scoped>
- .list {
- min-height: 70vh;
- }
- </style>
|