From 89380e6260a75d1d3b94de687ebcc2f50d50659d Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 03 Feb 2026 15:44:33 +0800
Subject: [PATCH] feat:环境变量配置调整

---
 applications/drone-command/src/views/basicManage/deviceStock/index.vue |  230 ++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 169 insertions(+), 61 deletions(-)

diff --git a/applications/drone-command/src/views/basicManage/deviceStock/index.vue b/applications/drone-command/src/views/basicManage/deviceStock/index.vue
index b504d5c..38cb3d6 100644
--- a/applications/drone-command/src/views/basicManage/deviceStock/index.vue
+++ b/applications/drone-command/src/views/basicManage/deviceStock/index.vue
@@ -1,51 +1,70 @@
 <template>
 	<basic-container>
-		<el-form ref="queryParamsRef" :model="searchParams" class="ztzf-page-history-search">
-			<el-form-item label="名称" prop="deviceName">
-				<el-input class="ztzf-data-cockpit-search-input" v-model="searchParams.deviceName" placeholder="请输入"
-					clearable @clear="handleSearch" />
+		<div class="chart">
+			<DeviceChart1 :key="updateKey"/>
+			<DeviceChart2 :key="updateKey"/>
+			<DeviceChart3 :key="updateKey"/>
+		</div>
+
+		<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="ztzf-data-cockpit-select" popper-class="ztzf-data-cockpit-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-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="ztzf-data-cockpit-select" popper-class="ztzf-data-cockpit-tree-select-popper"
-					v-model="searchParams.belongDept" :data="deptTree" :props="treeProps" node-key="id" check-strictly
-					clearable @change="handleSearch" />
+			<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 label="时间">
-				<el-date-picker popper-class="ztzf-data-cockpit-date-picker-popper"
-					class="ztzf-data-cockpit-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-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="ztzf-table-toolbar">
-			<el-button :icon="Plus" color="#284FE3" type="primary" @click="handleAdd">新增</el-button>
-			<el-button :icon="Download" type="primary" @click="exportFile" :loading="exportLoading">导出</el-button>
+		<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="ztzf-table-container" v-loading="loading" element-loading-background="rgba(5, 5, 15, 0.6)">
-			<div class="ztzf-table-content ztzf-table-content-bg">
-				<el-table class="ztzf-data-cockpit-table" :data="list" @selection-change="handleSelectionChange">
-					<el-table-column type="selection" width="46" />
+		<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="类型">
+					<el-table-column prop="deviceType" show-overflow-tooltip width="130" label="设备类型">
 						<template v-slot="{ row }">
 							{{ getDictLabel(row.deviceType, dictObj.deviceType) }}
 						</template>
@@ -55,23 +74,29 @@
 					<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 }">
-							{{ formatDateToSlash(row.createTime) }}
+							{{ dayjs(row.createTime).format('YYYY-MM-DD') }}
 						</template>
 					</el-table-column>
-					<el-table-column prop="source" show-overflow-tooltip width="112" label="来源" />
-					<el-table-column prop="purpose" show-overflow-tooltip width="206" label="用途" />
-					<el-table-column prop="belongDeptName" show-overflow-tooltip width="124" label="所属部门" />
+					<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="116" label="运行状态">
+					<el-table-column prop="yxzt" show-overflow-tooltip width="96" label="运行状态">
 						<template v-slot="{ row }">
-							{{ DEVICE_STATUS[row.status] || '-' }}
+							{{ 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 @click="outbound(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>
@@ -79,16 +104,21 @@
 				</el-table>
 			</div>
 
-			<div class="ztzf-table-pagination">
-				<el-pagination popper-class="ztzf-data-cockpit-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 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="getList" />
-		<DeviceTrackDiaLog ref="outboundDialogRef" @success="getList" />
-		<DeviceScrapDiaLog ref="scrapDialogRef" @success="getList" />
+		<FormDiaLog ref="dialogRef" @success="successFun" />
+		<DeviceTrackDiaLog ref="outboundDialogRef" @success="successFun" />
+		<DeviceScrapDiaLog ref="scrapDialogRef" @success="successFun" />
 	</basic-container>
 </template>
 
@@ -97,13 +127,17 @@
 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, formatDateToSlash } 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'
+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: '', // 设备名称
@@ -113,7 +147,7 @@
 	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列表
@@ -135,8 +169,20 @@
 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 () {
+async function getList() {
 	const range = dateRangeFormat(dateRange.value)
 	loading.value = true
 	try {
@@ -150,13 +196,13 @@
 }
 
 // 查询
-function handleSearch () {
+function handleSearch() {
 	searchParams.value.current = 1
 	getList()
 }
 
 // 重置查询
-function resetForm () {
+function resetForm() {
 	dateRange.value = []
 	queryParamsRef.value?.resetFields()
 	searchParams.value.current = 1
@@ -164,27 +210,48 @@
 }
 
 // 查看
-function handleView (row) {
+function handleView(row) {
 	dialogRef.value?.open({ mode: 'view', row: { ...row } })
 }
 
 // 编辑
-function handleEdit (row) {
+function handleEdit(row) {
 	dialogRef.value?.open({ mode: 'edit', row: { ...row } })
 }
 
-function outbound (row) {
+function outbound(row) {
 	outboundDialogRef.value?.open({ mode: 'edit', row: { ...row } })
 }
 
-function scrap (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) {
+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('删除成功')
@@ -193,11 +260,11 @@
 }
 
 // 勾选值设置
-function handleSelectionChange (rows) {
+function handleSelectionChange(rows) {
 	selectedIds.value = rows.map(item => item.id)
 }
 
-function exportFile () {
+function exportFile() {
 	exportLoading.value = true
 	exportFwDeviceApi()
 		.then(res => {
@@ -209,21 +276,21 @@
 }
 
 // 获取字典
-function getDictList () {
-	getDictionaryByCode('deviceType,deviceAtt').then(res => {
+function getDictList() {
+	getDictionaryByCode('deviceType,deviceAtt,deviceStatus').then(res => {
 		dictObj.value = res.data.data
 	})
 }
 
 // 获取部门树
-function getDeptTreeFun () {
+function getDeptTreeFun() {
 	getDeptTree().then(res => {
 		deptTree.value = res.data.data
 	})
 }
 
 // 新增
-function handleAdd () {
+function handleAdd() {
 	dialogRef.value?.open({ mode: 'add' })
 }
 
@@ -233,4 +300,45 @@
 	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>

--
Gitblit v1.9.3