| | |
| | | <template> |
| | | <basic-container> |
| | | <el-form ref="queryParamsRef" :model="searchParams"> |
| | | <el-row :gutter="16"> |
| | | <el-col :span="4"> |
| | | <el-form-item label="名称" prop="deviceName"> |
| | | <el-input v-model="searchParams.deviceName" placeholder="请输入" clearable @clear="handleSearch" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="类型" prop="deviceType"> |
| | | <el-select v-model="searchParams.deviceType" placeholder="请选择" clearable @change="handleSearch"> |
| | | <el-option |
| | | v-for="item in dictObj.deviceType" |
| | | :key="item.dictKey" |
| | | :label="item.dictValue" |
| | | :value="item.dictKey" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="部门" prop="belongDept"> |
| | | <el-tree-select |
| | | v-model="searchParams.belongDept" |
| | | :data="deptTree" |
| | | :props="treeProps" |
| | | node-key="id" |
| | | check-strictly |
| | | clearable |
| | | @change="handleSearch" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="时间"> |
| | | <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-item> |
| | | </el-col> |
| | | </el-row> |
| | | </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"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column type="index" width="60" label="序号" /> |
| | | <el-table-column prop="deviceName" label="设备名称" /> |
| | | <el-table-column prop="deviceType" label="类型"> |
| | | <template v-slot="{ row }"> |
| | | {{ getDictLabel(row.deviceType, dictObj.deviceType) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="deviceModel" label="型号" /> |
| | | <el-table-column prop="deviceSpecification" label="规格" /> |
| | | <el-table-column prop="manufacturer" label="生产厂商" /> |
| | | <el-table-column prop="createTime" label="入库时间" /> |
| | | <el-table-column prop="source" label="来源" /> |
| | | <el-table-column prop="purpose" label="用途" /> |
| | | <el-table-column prop="belongDeptName" label="所属部门" /> |
| | | <el-table-column prop="charger" label="负责人" /> |
| | | <el-table-column prop="yxzt" label="运行状态"> |
| | | <template v-slot="{ row }"> |
| | | {{ DEVICE_STATUS[row.status] || '-' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作"> |
| | | <template v-slot="{ row }"> |
| | | <el-link @click="handleView(row)" type="primary">查看</el-link> |
| | | <el-link @click="handleEdit(row)" type="warning">编辑</el-link> |
| | | <el-link @click="outbound(row)" type="warning">出库</el-link> |
| | | <el-link @click="scrap(row)" type="warning" v-if="row.status !== 3">报废</el-link> |
| | | <!-- <el-link @click="handleDelete(row)" type="danger">删除</el-link>--> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div> |
| | | <el-pagination |
| | | v-model:current-page="searchParams.current" |
| | | v-model:page-size="searchParams.size" |
| | | :total="total" |
| | | @change="getList" |
| | | /> |
| | | <div class="chart"> |
| | | <DeviceChart1 :key="updateKey"/> |
| | | <DeviceChart2 :key="updateKey"/> |
| | | <DeviceChart3 :key="updateKey"/> |
| | | </div> |
| | | |
| | | <FormDiaLog ref="dialogRef" @success="getList" /> |
| | | <DeviceTrackDiaLog ref="outboundDialogRef" @success="getList" /> |
| | | <DeviceScrapDiaLog ref="scrapDialogRef" @success="getList" /> |
| | | <el-form ref="queryParamsRef" :model="searchParams" class="command-page-history-search"> |
| | | <el-form-item label="设备名称" prop="deviceName"> |
| | | <el-input |
| | | class="command-input" |
| | | v-model="searchParams.deviceName" |
| | | placeholder="请输入" |
| | | clearable |
| | | @clear="handleSearch" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="设备类型" prop="deviceType"> |
| | | <el-select |
| | | class="command-select" |
| | | popper-class="command-select-popper" |
| | | v-model="searchParams.deviceType" |
| | | placeholder="请选择" |
| | | clearable |
| | | @change="handleSearch" |
| | | > |
| | | <el-option |
| | | v-for="item in dictObj.deviceType" |
| | | :key="item.dictKey" |
| | | :label="item.dictValue" |
| | | :value="item.dictKey" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="所属部门" prop="belongDept"> |
| | | <el-tree-select |
| | | class="command-select" |
| | | popper-class="command-tree-select-popper" |
| | | v-model="searchParams.belongDept" |
| | | :data="deptTree" |
| | | :props="treeProps" |
| | | node-key="id" |
| | | check-strictly |
| | | clearable |
| | | @change="handleSearch" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item class="history-search-actions"> |
| | | <el-button :icon="RefreshRight" @click="resetForm"></el-button> |
| | | <el-button class="search-btn" :icon="Search" @click="handleSearch"></el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <div class="command-table-toolbar"> |
| | | <el-button :icon="Plus" color="#284FE3" type="primary" @click="handleAdd">设备建档</el-button> |
| | | <!-- <el-button type="danger" :disabled="!selectedIds.length" @click="handleDelete()">删除</el-button>--> |
| | | </div> |
| | | |
| | | <div class="command-table-container" v-loading="loading" element-loading-background="rgba(5, 5, 15, 0.6)"> |
| | | <div class="command-table-content command-table-content-bg"> |
| | | <el-table class="command-table" :data="list" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="index" show-overflow-tooltip width="64" label="序号" /> |
| | | <el-table-column prop="deviceName" show-overflow-tooltip width="130" label="设备名称" /> |
| | | <el-table-column prop="deviceType" show-overflow-tooltip width="130" label="设备类型"> |
| | | <template v-slot="{ row }"> |
| | | {{ getDictLabel(row.deviceType, dictObj.deviceType) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="deviceModel" show-overflow-tooltip width="98" label="型号" /> |
| | | <el-table-column prop="deviceSpecification" show-overflow-tooltip width="112" label="规格" /> |
| | | <el-table-column prop="manufacturer" show-overflow-tooltip width="130" label="生产厂商" /> |
| | | <el-table-column prop="createTime" show-overflow-tooltip width="96" label="入库时间"> |
| | | <template v-slot="{ row }"> |
| | | {{ dayjs(row.createTime).format('YYYY-MM-DD') }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="source" show-overflow-tooltip width="120" label="来源" /> |
| | | <el-table-column prop="purpose" show-overflow-tooltip width="130" label="用途" /> |
| | | <el-table-column prop="belongDeptName" show-overflow-tooltip width="160" label="所属部门" /> |
| | | <el-table-column prop="charger" show-overflow-tooltip width="100" label="负责人" /> |
| | | <el-table-column prop="yxzt" show-overflow-tooltip width="96" label="运行状态"> |
| | | <template v-slot="{ row }"> |
| | | {{ getDictLabel(row.status, dictObj.deviceStatus) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="yxzt" show-overflow-tooltip width="96" label="出库状态"> |
| | | <template v-slot="{ row }"> |
| | | {{ getDictLabel(row.trackStatus, trackStatusOptions) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" class-name="operation-btns"> |
| | | <template v-slot="{ row }"> |
| | | <el-link @click="handleView(row)">查看</el-link> |
| | | <el-link @click="handleEdit(row)">编辑</el-link> |
| | | <el-link v-if="row.trackStatus === 0" @click="outbound(row)">出库</el-link> |
| | | <el-link v-else @click="returnDevice(row)">归还</el-link> |
| | | <el-link @click="scrap(row)" v-if="row.status !== 3">报废</el-link> |
| | | <!-- <el-link @click="handleDelete(row)" type="danger">删除</el-link>--> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <div class="command-table-pagination"> |
| | | <el-pagination |
| | | popper-class="command-select-popper" |
| | | v-model:current-page="searchParams.current" |
| | | v-model:page-size="searchParams.size" |
| | | layout="total, prev, pager, next, sizes" |
| | | :total="total" |
| | | @change="getList" |
| | | /> |
| | | </div> |
| | | </div> |
| | | |
| | | <FormDiaLog ref="dialogRef" @success="successFun" /> |
| | | <DeviceTrackDiaLog ref="outboundDialogRef" @success="successFun" /> |
| | | <DeviceScrapDiaLog ref="scrapDialogRef" @success="successFun" /> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { Search, RefreshRight, Plus, Download } from '@element-plus/icons-vue' |
| | | import { onMounted, ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { exportFwDeviceApi, fwDevicePageApi, fwDeviceRemoveApi } from '@/views/basicManage/deviceStock/fwDevice' |
| | | import { fwDeviceUpdateTrackStatusApi } from '@/views/basicManage/deviceStock/fwDeviceTrackApi' |
| | | import FormDiaLog from './FormDiaLog.vue' |
| | | import { getDictionaryByCode } from '@/api/system/dictbiz' |
| | | import { getDeptTree } from '@/api/system/dept' |
| | | import { blobDownload, dateRangeFormat, getDictLabel } from '@ztzf/utils' |
| | | import { DEVICE_STATUS } from '@ztzf/constants' |
| | | import { blobDownload, dateRangeFormat, getDictLabel, formatDateToSlash } from '@ztzf/utils' |
| | | import DeviceTrackDiaLog from '@/views/basicManage/deviceStock/DeviceTrackDiaLog.vue' |
| | | import DeviceScrapDiaLog from '@/views/basicManage/deviceStock/DeviceScrapDiaLog.vue' |
| | | import DeviceChart1 from '@/views/basicManage/deviceStock/DeviceChart1.vue' |
| | | import DeviceChart2 from '@/views/basicManage/deviceStock/DeviceChart2.vue' |
| | | import DeviceChart3 from '@/views/basicManage/deviceStock/DeviceChart3.vue' |
| | | import dayjs from 'dayjs' |
| | | |
| | | const initSearchParams = () => ({ |
| | | deviceName: '', // 设备名称 |
| | |
| | | size: 10, // 每页大小 |
| | | }) |
| | | const searchParams = ref(initSearchParams()) // 查询参数 |
| | | const loading = ref(false) // 列表加载中 |
| | | const loading = ref(true) // 列表加载中 |
| | | const list = ref([]) // 列表数据 |
| | | const total = ref(0) // 总数 |
| | | const selectedIds = ref([]) // 勾选的设备ID列表 |
| | |
| | | const exportLoading = ref(false) |
| | | provide('dictObj', dictObj) |
| | | provide('deptTree', deptTree) |
| | | |
| | | // 出库状态 |
| | | const trackStatusOptions = ref([ |
| | | { dictKey: 0, dictValue: '未出库' }, |
| | | { dictKey: 1, dictValue: '已出库' } |
| | | ]) |
| | | |
| | | const updateKey = ref(0) |
| | | function successFun() { |
| | | updateKey.value = updateKey.value + 1 |
| | | getList() |
| | | } |
| | | |
| | | // 获取列表 |
| | | async function getList() { |
| | |
| | | outboundDialogRef.value?.open({ mode: 'edit', row: { ...row } }) |
| | | } |
| | | |
| | | // 归还 |
| | | async function returnDevice(row) { |
| | | await ElMessageBox.confirm(`确认归还吗?`, '提示', { |
| | | type: 'warning', |
| | | customClass: 'command-page-view-message-box', |
| | | confirmButtonClass: 'command-message-box-confirm', |
| | | cancelButtonClass: 'command-message-box-cancel', |
| | | }) |
| | | const payload = { |
| | | deviceId: row.id |
| | | } |
| | | await fwDeviceUpdateTrackStatusApi(payload) |
| | | ElMessage.success('归还成功') |
| | | getList() |
| | | } |
| | | |
| | | function scrap(row) { |
| | | scrapDialogRef.value?.open({ mode: 'edit', row: { ...row } }) |
| | | } |
| | |
| | | // 删除 |
| | | async function handleDelete(row) { |
| | | const tips = row ? '该条' : '选中的项' |
| | | await ElMessageBox.confirm(`确认删除${tips}吗?`, '提示', { type: 'warning' }) |
| | | await ElMessageBox.confirm(`确认删除${tips}吗?`, '提示', { |
| | | type: 'warning', |
| | | customClass: 'command-page-view-message-box', |
| | | confirmButtonClass: 'command-message-box-confirm', |
| | | cancelButtonClass: 'command-message-box-cancel', |
| | | }) |
| | | const ids = row ? row.id : selectedIds.value.join(',') |
| | | await fwDeviceRemoveApi({ ids }) |
| | | ElMessage.success('删除成功') |
| | |
| | | |
| | | // 获取字典 |
| | | function getDictList() { |
| | | getDictionaryByCode('deviceType,deviceAtt').then(res => { |
| | | getDictionaryByCode('deviceType,deviceAtt,deviceStatus').then(res => { |
| | | dictObj.value = res.data.data |
| | | }) |
| | | } |
| | |
| | | getDeptTreeFun() |
| | | }) |
| | | </script> |
| | | <style scoped lang="scss"></style> |
| | | <style scoped lang="scss"> |
| | | .chart { |
| | | margin-bottom: 30px; |
| | | width: 100%; |
| | | height: 234px; |
| | | display: flex; |
| | | :deep() { |
| | | * { |
| | | box-sizing: border-box; |
| | | } |
| | | .deviceChart { |
| | | margin-left: 20px; |
| | | height: 100%; |
| | | background: rgba(26, 26, 42, 0.3); |
| | | border-radius: 10px 10px 10px 10px; |
| | | position: relative; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 10px; |
| | | |
| | | &:first-child { |
| | | margin-left: 0; |
| | | } |
| | | |
| | | .titleBg { |
| | | font-weight: 400; |
| | | font-size: 18px; |
| | | color: #ffffff; |
| | | font-family: PangMen, serif; |
| | | padding-left: 22px; |
| | | } |
| | | .chartBox { |
| | | width: 100%; |
| | | height: 0; |
| | | flex-grow: 1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |