123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <template>
- <!-- 今日做糖列表 -->
- <div class="sugarPage flex-col">
- <s-header :name="$t('device.todaysSugarList')" :noback="false"></s-header>
- <div class="box1 flex-col">
- <div class="block2 flex-row justify-between">
- <div class="block3 flex-col"></div>
- <span class="info2">{{ $t('device.equipmentName') }}:{{ deviceDetal ? deviceDetal.name : '' }}</span>
- </div>
- <van-list class="o-pt-20" v-model:loading="loading" :finished="finished" :finished-text="$t('public.noMore')"
- @load="selectSugarListFun">
- <van-cell v-for="(item, index) in list" :key="index" :title="item" />
- </van-list>
- </div>
- </div>
- </template>
- <script>
- import {
- onMounted,
- ref
- } from "vue";
- import sHeader from "@/components/SimpleHeader";
- import {
- getDeviceDetal,
- selectSugarList
- } from "@/service/device";
- import {
- showFailToast
- } from "vant";
- import {
- getLoginUser,
- styleUrl
- } from "@/common/js/utils";
- import {
- useRoute
- } from 'vue-router';
- export default {
- setup() {
- const route = useRoute();
- const deviceId = route.query.deviceId;
- const deviceDetal = ref(null);
- const loading = ref(false);
- const finished = ref(false);
- const user = getLoginUser();
- const list = ref([]);
- // 初始化页面获取列表
- onMounted(async () => {
- // 加载样式
- styleUrl('doSugar');
- getDeviceDetalFun();
- selectSugarListFun();
- // console.log(deviceDetal);
- });
- // 获取设备数据
- const getDeviceDetalFun = async () => {
- const {
- data
- } = await getDeviceDetal({
- id: deviceId
- });
- if (data.code === '00000') {
- deviceDetal.value = data.data;
- } else {
- showFailToast(data.message);
- }
- }
- // 获取做糖列表数据
- const selectSugarListFun = async () => {
- // console.log(user);
- const {
- data
- } = await selectSugarList({
- adminId: user.id
- });
- if (data.code) {
- list.value = data.data.map((item) => {
- return item.productName;
- });
- finished.value = true;
- } else {
- showFailToast(data.message);
- }
- };
- return {
- list,
- deviceDetal,
- loading,
- finished,
- selectSugarListFun,
- };
- },
- components: {
- sHeader
- },
- };
- </script>
- <style lang="less" scoped>
- @import "../../common/style/common";
- </style>
|