| applications/drone-command/src/views/basicManage/deviceStock/DeviceScrapDiaLog.vue | ●●●●● patch | view | raw | blame | history | |
| applications/drone-command/src/views/basicManage/deviceStock/DeviceTrackDiaLog.vue | ●●●●● patch | view | raw | blame | history | |
| applications/drone-command/src/views/basicManage/deviceStock/deviceStock.vue | ●●●●● patch | view | raw | blame | history | |
| applications/drone-command/src/views/basicManage/deviceStock/fwDeviceScrapApi.js | ●●●●● patch | view | raw | blame | history | |
| applications/drone-command/src/views/basicManage/maintainRecord/MaintenanceDiaLog.vue | ●●●●● patch | view | raw | blame | history |
applications/drone-command/src/views/basicManage/deviceStock/DeviceScrapDiaLog.vue
New file @@ -0,0 +1,114 @@ <template> <el-dialog v-model="visible" :title="dialogTitle" @closed="handleClosed" destroy-on-close> <el-form ref="formRef" :model="formData" :rules="rules" label-width="100px"> <el-row> <el-col :span="24"> <el-form-item label="报废原因" prop="scrapReason"> <el-input v-model="formData.scrapReason" maxlength="50" placeholder="请输入" clearable /> </el-form-item> </el-col> <el-col :span="24"> <el-form-item label="处置方式" prop="disposeWay"> <el-input v-model="formData.disposeWay" maxlength="50" placeholder="请输入" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="报废时间" prop="scrapTime"> <el-date-picker v-model="formData.scrapTime" type="date" placeholder="选择日期" value-format="YYYY-MM-DD HH:mm:ss" clearable /> </el-form-item> </el-col> </el-row> </el-form> <template #footer> <el-button @click="handleCancel">{{ dialogReadonly ? '关闭' : '取消' }}</el-button> <el-button v-if="!dialogReadonly" type="primary" :loading="submitting" :disabled="submitting" @click="handleSubmit" > 确定 </el-button> </template> </el-dialog> </template> <script setup> import { computed, ref } from 'vue' import { ElMessage } from 'element-plus' import { fieldRules } from '@ztzf/utils' import { fwDeviceScrapSaveApi } from '@/views/basicManage/deviceStock/fwDeviceScrapApi' const initForm = () => ({ deviceId: '', // 设备ID disposeWay: '', //处置方式 scrapReason: '', // 报废原因 scrapTime: '', // 报废时间 }) const emit = defineEmits(['success']) const formRef = ref(null) // 表单实例 const formData = ref(initForm()) // 表单数据 const visible = ref(false) // 弹框显隐 const dialogMode = ref('add') // 弹框模式 const submitting = ref(false) const dialogReadonly = computed(() => dialogMode.value === 'view') const dialogTitle = computed(() => { if (dialogMode.value === 'edit') { return '报废' } else if (dialogMode.value === 'view') { return '查看' } else { return '新增' } }) const rules = { scrapReason: fieldRules(true, 50), disposeWay: fieldRules(true, 50), scrapTime: fieldRules(true, 0), } // 关闭弹框 function handleCancel() { visible.value = false } // 提交新增/编辑 async function handleSubmit() { const isValid = await formRef.value?.validate().catch(() => false) if (!isValid) return submitting.value = true try { await fwDeviceScrapSaveApi(formData.value) ElMessage.success(dialogMode.value === 'add' ? '出库成功' : '更新成功') visible.value = false emit('success') } finally { submitting.value = false } } // 关闭后重置 function handleClosed() { formData.value = initForm() } // 打开弹框 async function open({ mode, row } = {}) { dialogMode.value = mode || 'add' visible.value = true formData.value.deviceId = row.id } onMounted(() => { }) defineExpose({ open }) </script> applications/drone-command/src/views/basicManage/deviceStock/DeviceTrackDiaLog.vue
@@ -55,7 +55,6 @@ <script setup> import { computed, ref } from 'vue' import { ElMessage } from 'element-plus' import { fwDeviceDetailApi, fwDeviceSubmitApi } from '@/views/basicManage/deviceStock/fwDevice' import { getUserListApi } from '@/api/system/user' import { fieldRules } from '@ztzf/utils' import { fwDeviceTrackSubmitApi } from '@/views/basicManage/deviceStock/fwDeviceTrackApi' @@ -76,7 +75,7 @@ const dialogReadonly = computed(() => dialogMode.value === 'view') const dialogTitle = computed(() => { if (dialogMode.value === 'edit') { return '编辑' return '出库' } else if (dialogMode.value === 'view') { return '查看' } else { @@ -119,7 +118,6 @@ submitting.value = false } } // 关闭后重置 function handleClosed() { applications/drone-command/src/views/basicManage/deviceStock/deviceStock.vue
@@ -58,7 +58,7 @@ <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> <!-- <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" /> @@ -87,7 +87,8 @@ <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="handleDelete(row)" type="danger">删除</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> @@ -102,6 +103,7 @@ <FormDiaLog ref="dialogRef" @success="getList" /> <DeviceTrackDiaLog ref="outboundDialogRef" @success="getList" /> <DeviceScrapDiaLog ref="scrapDialogRef" @success="getList" /> </basic-container> </template> @@ -115,6 +117,7 @@ import { blobDownload, dateRangeFormat, getDictLabel } from '@ztzf/utils' import { DEVICE_STATUS } from '@ztzf/constants' import DeviceTrackDiaLog from '@/views/basicManage/deviceStock/DeviceTrackDiaLog.vue' import DeviceScrapDiaLog from '@/views/basicManage/deviceStock/DeviceScrapDiaLog.vue' const initSearchParams = () => ({ deviceName: '', // 设备名称 @@ -131,6 +134,7 @@ const queryParamsRef = ref(null) // 查询表单实例 const dialogRef = ref(null) // 弹框实例 const outboundDialogRef = ref(null) // 弹框实例 const scrapDialogRef = ref(null) // 弹框实例 const dictObj = ref({ deviceType: [], //设备类型 deviceAtt: [], //设备属性 @@ -184,7 +188,11 @@ } function outbound(row) { outboundDialogRef.value?.open({ mode: 'add', row: { ...row } }) outboundDialogRef.value?.open({ mode: 'edit', row: { ...row } }) } function scrap(row) { scrapDialogRef.value?.open({ mode: 'edit', row: { ...row } }) } // 删除 applications/drone-command/src/views/basicManage/deviceStock/fwDeviceScrapApi.js
New file @@ -0,0 +1,28 @@ import request from '@/axios' // 新增报废记录 export const fwDeviceScrapSaveApi = data => { return request({ url: `/drone-fw/device/fwDeviceScrap/save`, method: 'post', data, }) } // 分页 export const fwDeviceScrapPageApi = params => { return request({ url: `/drone-fw/device/fwDeviceScrap/page`, method: 'get', params, }) } // 详情 export const fwDeviceScrapDetailApi = params => { return request({ url: `/drone-fw/device/fwDeviceScrap/detail`, method: 'get', params, }) } applications/drone-command/src/views/basicManage/maintainRecord/MaintenanceDiaLog.vue
@@ -126,7 +126,6 @@ planId: res?.data?.data?.id, deviceId: res?.data?.data.deviceId, } console.log(formData.value, 66) } // 关闭后重置