| | |
| | | class="!w-220px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="创建时间" prop="createTime"> |
| | | <el-date-picker |
| | | v-model="queryParams.createTime" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | type="daterange" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" |
| | | class="!w-220px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="设备编号" prop="devId"> |
| | | <el-input |
| | | v-model="queryParams.devId" |
| | |
| | | class="!w-240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="状态" prop="state"> |
| | | <el-select |
| | | v-model="queryParams.state" |
| | | placeholder="请选择状态" |
| | | clearable |
| | | class="!w-240px" |
| | | > |
| | | <el-option |
| | | v-for="dict in stateOptions" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <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 getStrDictOptions(DICT_TYPE.ECG_DEV_CATEGORY)" |
| | | v-for="dict in categoryOptions" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | |
| | | placeholder="请选择品牌" |
| | | clearable |
| | | class="!w-240px" |
| | | @change="brandChanged" |
| | | > |
| | | <el-option label="请选择字典生成" value="" /> |
| | | <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"> |
| | |
| | | clearable |
| | | class="!w-240px" |
| | | > |
| | | <el-option label="请选择字典生成" value="" /> |
| | | <el-option |
| | | v-for="dict in modelOptions" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | |
| | | <!-- 列表 --> |
| | | <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="lost" > |
| | | <template #default="scope"> |
| | | {{scope.row.lost == 1 ? "遗失" : ""}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="采购日期" align="center" prop="purchaseDate" :formatter="dateFormatter2" width="120px"/> |
| | | <!-- <el-table-column label="id" align="center" prop="id" />--> |
| | | <el-table-column label="设备编号" align="center" prop="devId" width="100px" /> |
| | | <el-table-column label="分类名" align="center" prop="category"> |
| | | <template #default="scope"> |
| | |
| | | </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" |
| | |
| | | v-hasPermi="['ecg:device:update']" |
| | | > |
| | | 编辑 |
| | | </el-button> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | @click="openForm('devState', scope.row.id)" |
| | | v-hasPermi="['ecg:device:update']" |
| | | > |
| | | 设备状态 |
| | | </el-button> |
| | | <el-button |
| | | link |
| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { getStrDictOptions, DICT_TYPE } from '@/utils/dict' |
| | | import {dateFormatter, dateFormatter2} from '@/utils/formatTime' |
| | | import {getStrDictOptions, DICT_TYPE, DictDataType} from '@/utils/dict' |
| | | import {dateFormatter2} from '@/utils/formatTime' |
| | | import download from '@/utils/download' |
| | | import { DeviceApi, DeviceVO } from '@/api/ecg/devmanage' |
| | | import {DeviceApi, DeviceVO, DevModelApi, OptionsVO} from '@/api/ecg/devmanage' |
| | | import DeviceForm from './DeviceForm.vue' |
| | | |
| | | /** 设备 列表 */ |
| | |
| | | purchaseDate: [], |
| | | createTime: [], |
| | | devId: undefined, |
| | | state: 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 () => { |
| | |
| | | } |
| | | } |
| | | |
| | | const stateOptions = [ |
| | | {label: "空闲", value: 0}, |
| | | {label: "已领用", value: 5}, |
| | | {label: "已装机", value: 10}, |
| | | {label: "已遗失", value: 20}, |
| | | {label: "待维修", value: 30}, |
| | | {label: "维修中", value: 40}, |
| | | {label: "已报废", value: 50} |
| | | ] |
| | | |
| | | const tranlateDevState = (state) => { |
| | | const stateOption = stateOptions.find(obj => obj.value === state) |
| | | console.info( stateOption ) |
| | | return undefined !== stateOption ? stateOption.label : '' |
| | | } |
| | | |
| | | const categoryChanged = async () => { |
| | | const data = await DevModelApi.getBrandOption(queryParams.category!) |
| | | brandOptions.value = data |
| | | |
| | | queryParams.brand = '' |
| | | queryParams.model = '' |
| | | |
| | | //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(() => { |
| | | onMounted( async () => { |
| | | const data = await getStrDictOptions(DICT_TYPE.ECG_DEV_CATEGORY) |
| | | categoryOptions.value = data |
| | | |
| | | getList() |
| | | }) |
| | | </script> |