wangrong
2026-09-24 bf9400d4198094194439214b5e90036b2f040052
src/modules/push/views/weight.vue
@@ -8,6 +8,9 @@
         <!-- 删除按钮 -->
         <cl-multi-delete-btn />
         <cl-flex1 />
         <cl-filter label="上传时间">
            <cl-date-picker type="daterange" />
         </cl-filter>
         <!-- 条件搜索 -->
         <cl-search ref="Search" />
      </cl-row>
@@ -33,12 +36,15 @@
   name: "push-weight",
});
import { ref } from "vue";
import { useCrud, useTable, useUpsert, useSearch } from "@cool-vue/crud";
import { useCool } from "/@/cool";
import { useI18n } from "vue-i18n";
const { service } = useCool();
const { t } = useI18n();
const garbageTypeOptions = ref<{ label: string; value: string }[]>([]);
// cl-upsert
const Upsert = useUpsert({
@@ -98,6 +104,7 @@
         component: { name: "cl-date-text" },
      },
      { label: t("垃圾类型"), prop: "garbageType", minWidth: 120 },
      { label: t("垃圾分类"), prop: "garbageName", minWidth: 140 },
      {
         label: t("垃圾重量"),
         prop: "weight",
@@ -129,7 +136,34 @@
});
// cl-search
const Search = useSearch();
const Search = useSearch({
   items: [
      {
         prop: "deviceNo",
         component: {
            name: "el-input",
            props: {
               placeholder: t("搜索设备号"),
               clearable: true,
            },
            style: { width: "150px" },
         },
      },
      {
         prop: "garbageType",
         component: {
            name: "el-select",
            props: {
               placeholder: t("垃圾类型"),
               filterable: true,
               clearable: true,
            },
            options: garbageTypeOptions,
            style: { width: "180px" },
         },
      },
   ],
});
// cl-crud
const Crud = useCrud(
@@ -137,6 +171,14 @@
      service: service.push.weight,
   },
   (app) => {
      service.basicdata.wastetype.list({ status: 1 }).then((res) => {
         garbageTypeOptions.value = (res || [])
            .filter((item: any) => item.status === 1)
            .map((item: any) => ({
               label: item.name,
               value: item.code,
            }));
      });
      app.refresh();
   },
);