¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <ContentWrap> |
| | | <!-- æç´¢å·¥ä½æ --> |
| | | <el-form |
| | | class="-mb-15px" |
| | | :model="queryParams" |
| | | ref="queryFormRef" |
| | | :inline="true" |
| | | label-width="68px" |
| | | > |
| | | <el-form-item label="åç±»å" prop="category"> |
| | | <el-select |
| | | v-model="queryParams.category" |
| | | placeholder="è¯·éæ©åç±»å" |
| | | clearable |
| | | class="!w-240px" |
| | | @change="categoryChanged" |
| | | > |
| | | <el-option |
| | | v-for="dict in categoryOptions" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åç" prop="brand"> |
| | | <el-select |
| | | v-model="queryParams.brand" |
| | | placeholder="è¯·éæ©åç" |
| | | clearable |
| | | class="!w-240px" |
| | | @change="brandChanged" |
| | | > |
| | | <el-option |
| | | v-for="dict in brandOptions" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åå·" prop="model"> |
| | | <el-select |
| | | v-model="queryParams.model" |
| | | placeholder="è¯·éæ©åå·" |
| | | clearable |
| | | class="!w-240px" |
| | | > |
| | | <el-option |
| | | v-for="dict in modelOptions" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> æç´¢</el-button> |
| | | <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </ContentWrap> |
| | | |
| | | <!-- å表 --> |
| | | <ContentWrap> |
| | | <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> |
| | | <!-- <el-table-column label="id" align="center" prop="id" />--> |
| | | <el-table-column label="åç±»å" align="center" prop="category"> |
| | | <template #default="scope"> |
| | | <dict-tag :type="DICT_TYPE.ECG_DEV_CATEGORY" :value="scope.row.category" /> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- |
| | | <el-table-column label="åç" align="center" prop="brand" width="100px"> |
| | | <template #default="scope"> |
| | | <dict-tag :type="DICT_TYPE.ECG_DEV_BRAND" :value="scope.row.brand" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="åå·" align="center" prop="model" /> |
| | | --> |
| | | <el-table-column label="使ç¨ç¶æ" align="center" prop="lost" > |
| | | <template #default="scope"> |
| | | <span>{{tranlateDevState(scope.row.state)}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column label="éè´æ¥æ" align="center" prop="purchaseDate" :formatter="dateFormatter2" width="120px"/>--> |
| | | <el-table-column label="æ°é" align="center" prop="devCount" /> |
| | | </el-table> |
| | | </ContentWrap> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import {getStrDictOptions, DICT_TYPE, DictDataType} from '@/utils/dict' |
| | | import {dateFormatter, dateFormatter2} from '@/utils/formatTime' |
| | | import download from '@/utils/download' |
| | | import {DeviceApi, DeviceStatisticVO, DeviceVO, DevModelApi, OptionsVO} from '@/api/ecg/devmanage' |
| | | import DeviceForm from './DeviceForm.vue' |
| | | |
| | | /** è®¾å¤ å表 */ |
| | | defineOptions({ name: 'DeviceStatistic' }) |
| | | |
| | | const message = useMessage() // æ¶æ¯å¼¹çª |
| | | const { t } = useI18n() // å½é
å |
| | | |
| | | const loading = ref(true) // å表çå è½½ä¸ |
| | | const list = ref<DeviceStatisticVO[]>([]) // åè¡¨çæ°æ® |
| | | const queryParams = reactive({ |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | purchaseDate: [], |
| | | createTime: [], |
| | | devId: undefined, |
| | | category: undefined, |
| | | brand: undefined, |
| | | model: undefined |
| | | }) |
| | | const queryFormRef = ref() // æç´¢ç表å |
| | | const exportLoading = ref(false) // 导åºçå è½½ä¸ |
| | | |
| | | const categoryOptions = ref<DictDataType[]>([]) |
| | | const brandOptions = ref<OptionsVO[]>([]) |
| | | const modelOptions = ref<OptionsVO[]>([]) |
| | | |
| | | /** æ¥è¯¢å表 */ |
| | | const getList = async () => { |
| | | loading.value = true |
| | | try { |
| | | const data = await DeviceApi.deviceStatistic(queryParams) |
| | | console.info( data ) |
| | | list.value = data |
| | | } finally { |
| | | loading.value = false |
| | | } |
| | | } |
| | | |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | queryParams.pageNo = 1 |
| | | getList() |
| | | } |
| | | |
| | | /** éç½®æé®æä½ */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields() |
| | | handleQuery() |
| | | } |
| | | |
| | | /** æ·»å /ä¿®æ¹æä½ */ |
| | | const formRef = ref() |
| | | const openForm = (type: string, id?: number) => { |
| | | formRef.value.open(type, id) |
| | | } |
| | | |
| | | /** å é¤æé®æä½ */ |
| | | const handleDelete = async (id: number) => { |
| | | try { |
| | | // å é¤çäºæ¬¡ç¡®è®¤ |
| | | await message.delConfirm() |
| | | // åèµ·å é¤ |
| | | await DeviceApi.deleteDevice(id) |
| | | message.success(t('common.delSuccess')) |
| | | // å·æ°å表 |
| | | await getList() |
| | | } catch {} |
| | | } |
| | | |
| | | /** å¯¼åºæé®æä½ */ |
| | | const handleExport = async () => { |
| | | try { |
| | | // 导åºçäºæ¬¡ç¡®è®¤ |
| | | await message.exportConfirm() |
| | | // åèµ·å¯¼åº |
| | | exportLoading.value = true |
| | | const data = await DeviceApi.exportDevice(queryParams) |
| | | download.excel(data, '设å¤.xls') |
| | | } catch { |
| | | } finally { |
| | | exportLoading.value = false |
| | | } |
| | | } |
| | | |
| | | const tranlateDevState = (state) => { |
| | | if (state === 0) return "空é²"; |
| | | else if (state=== 5) return "å·²é¢ç¨"; |
| | | else if (state=== 10) return "å·²è£
æº"; |
| | | else if (state=== 20) return "å·²é失"; |
| | | else if (state=== 30) return "ç»´ä¿®ä¸"; |
| | | else if (state=== 40) return "å·²æ¥åº"; |
| | | } |
| | | |
| | | const categoryChanged = async () => { |
| | | const data = await DevModelApi.getBrandOption(queryParams.category!) |
| | | brandOptions.value = data |
| | | |
| | | queryParams.brand = '' |
| | | |
| | | //queryParams.brand = brandOptions.value.length === 0 ? "" : brandOptions.value[0].value |
| | | //brandChanged() |
| | | } |
| | | |
| | | const brandChanged = async () => { |
| | | const data = await DevModelApi.getModelOption(queryParams.category!, queryParams.brand!) |
| | | modelOptions.value = data |
| | | |
| | | queryParams.model = '' |
| | | |
| | | //queryParams.model = modelOptions.value.length === 0 ? "" : modelOptions.value[0].value |
| | | } |
| | | |
| | | /** åå§å **/ |
| | | onMounted( async () => { |
| | | const data = await getStrDictOptions(DICT_TYPE.ECG_DEV_CATEGORY) |
| | | categoryOptions.value = data |
| | | |
| | | getList() |
| | | }) |
| | | </script> |