| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="时间" prop="belongDept"> |
| | | <el-date-picker |
| | | popper-class="ztzf-date-picker-popper" |
| | | class="ztzf-date-picker" |
| | | v-model="dateRange" |
| | | type="daterange" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | @change="handleSearch" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item> |
| | | <el-button @click="resetForm">重置</el-button> |
| | | <el-button type="primary" @click="handleSearch">查询</el-button> |
| | |
| | | </el-form> |
| | | <div> |
| | | <el-button type="primary" @click="handleAdd">新增</el-button> |
| | | <el-button type="primary" @click="exportFile" :loading="exportLoading">导出</el-button> |
| | | <el-button type="danger" :disabled="!selectedIds.length" @click="handleDelete()">删除</el-button> |
| | | </div> |
| | | <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange"> |
| | |
| | | <script setup> |
| | | import { onMounted, ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { fwDevicePageApi, fwDeviceRemoveApi } from '@/views/basicManage/deviceStock/fwDevice' |
| | | import { exportFwDeviceApi, fwDevicePageApi, fwDeviceRemoveApi } from '@/views/basicManage/deviceStock/fwDevice' |
| | | import FormDiaLog from './FormDiaLog.vue' |
| | | import { getDictionaryByCode } from '@/api/system/dictbiz' |
| | | import { getDeptTree } from '@/api/system/dept' |
| | | import { getDictLabel } from '@ztzf/utils' |
| | | import { blobDownload, dateRangeFormat, getDictLabel } from '@ztzf/utils' |
| | | |
| | | const initSearchParams = () => ({ |
| | | deviceName: '', // 设备名称 |
| | |
| | | deviceType: [], //设备类型 |
| | | deviceAtt: [], //设备属性 |
| | | }) |
| | | const dateRange = ref([]) |
| | | const deptTree = ref([]) |
| | | const treeProps = { |
| | | label: 'name', |
| | | children: 'children', |
| | | } |
| | | const exportLoading = ref(false) |
| | | provide('dictObj', dictObj) |
| | | provide('deptTree', deptTree) |
| | | |
| | | // 获取列表 |
| | | async function getList() { |
| | | const range = dateRangeFormat(dateRange.value) |
| | | loading.value = true |
| | | try { |
| | | const res = await fwDevicePageApi(searchParams.value) |
| | | const res = await fwDevicePageApi({ ...searchParams.value, start_time: range[0], end_time: range[1] }) |
| | | list.value = res?.data?.data?.records ?? [] |
| | | total.value = res?.data?.data?.total ?? 0 |
| | | } finally { |
| | |
| | | |
| | | // 重置查询 |
| | | function resetForm() { |
| | | dateRange.value = [] |
| | | queryParamsRef.value?.resetFields() |
| | | searchParams.value.current = 1 |
| | | getList() |
| | |
| | | selectedIds.value = rows.map(item => item.id) |
| | | } |
| | | |
| | | function exportFile() { |
| | | exportLoading.value = true |
| | | exportFwDeviceApi() |
| | | .then(res => { |
| | | blobDownload(res) |
| | | }) |
| | | .finally(() => { |
| | | exportLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | // 获取字典 |
| | | function getDictList() { |
| | | getDictionaryByCode('deviceType,deviceAtt').then(res => { |