代码提交_对接球机接口
This commit is contained in:
parent
b191114bcc
commit
4b8021094b
|
|
@ -0,0 +1,41 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询球机申请列表
|
||||
export function listCameraApplication(query) {
|
||||
return request({
|
||||
url: '/manage/project/cameraApplication/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 可分配球机列表
|
||||
export function listAvailableCamera(query) {
|
||||
return request({
|
||||
url: '/manage/camera/alloc/availableList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
//确认分配
|
||||
export function confirmAllocation(data) {
|
||||
return request({
|
||||
url: '/manage/camera/alloc/confirm',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
//查看分配详情
|
||||
export function getAllocationDetail(projectId) {
|
||||
return request({
|
||||
url: '/manage/camera/alloc/listByProject/' + projectId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
//根据cameraId查询球机详情
|
||||
export function getCameraDetail(cameraId) {
|
||||
return request({
|
||||
url: '/manage/camera/ledger/' + cameraId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 入库审核列表
|
||||
export function listInventoryAudit(query) {
|
||||
return request({
|
||||
url: '/manage/camera/inbound/auditList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
//确认入库审核通过
|
||||
export function approveInventoryAudit(data) {
|
||||
return request({
|
||||
url: '/manage/camera/inbound/approve',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
//确认入库审核驳回
|
||||
export function rejectInventoryAudit(data) {
|
||||
return request({
|
||||
url: '/manage/camera/inbound/reject',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询球机回收记录列表
|
||||
export function listReturnToInventory(query) {
|
||||
return request({
|
||||
url: '/manage/camera/return/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
//现场回收确认
|
||||
export function submitReturnToInventory(data) {
|
||||
return request({
|
||||
url: '/manage/camera/return/submit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<el-upload
|
||||
multiple
|
||||
:disabled="disabled"
|
||||
:action="uploadImgUrl"
|
||||
:http-request="handleCustomUpload"
|
||||
list-type="picture-card"
|
||||
:on-success="handleUploadSuccess"
|
||||
:before-upload="handleBeforeUpload"
|
||||
|
|
@ -50,6 +50,7 @@
|
|||
<script setup>
|
||||
import { getToken } from "@/utils/auth"
|
||||
import Sortable from 'sortablejs'
|
||||
import { uploadFile } from '@/api/upload'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: [String, Object, Array],
|
||||
|
|
@ -125,6 +126,24 @@ watch(() => props.modelValue, val => {
|
|||
}
|
||||
},{ deep: true, immediate: true })
|
||||
|
||||
// 自定义上传方法
|
||||
async function handleCustomUpload(options) {
|
||||
const { file } = options
|
||||
try {
|
||||
const response = await uploadFile(file)
|
||||
if (response.code === 200) {
|
||||
// 调用成功回调
|
||||
handleUploadSuccess(response, file)
|
||||
} else {
|
||||
// 调用失败回调
|
||||
handleUploadError(new Error(response.msg || '上传失败'), file)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('上传文件失败:', error)
|
||||
handleUploadError(error, file)
|
||||
}
|
||||
}
|
||||
|
||||
// 上传前loading加载
|
||||
function handleBeforeUpload(file) {
|
||||
let isImg = false
|
||||
|
|
@ -201,9 +220,18 @@ function uploadedSuccessfully() {
|
|||
}
|
||||
|
||||
// 上传失败
|
||||
function handleUploadError() {
|
||||
proxy.$modal.msgError("上传图片失败")
|
||||
function handleUploadError(err, file) {
|
||||
number.value--
|
||||
proxy.$modal.msgError(err?.message || "上传图片失败")
|
||||
proxy.$modal.closeLoading()
|
||||
// 从文件列表中移除失败的文件
|
||||
if (file && proxy.$refs.imageUpload) {
|
||||
try {
|
||||
proxy.$refs.imageUpload.handleRemove(file)
|
||||
} catch (e) {
|
||||
console.error('移除失败文件时出错:', e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 预览
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup name="Index">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref, onMounted, onActivated } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { listRiskCardTemplate, publishRiskCardTemplate, obsoleteRiskCardTemplate, exportRiskCardTemplateList } from "@/api/Logistics/riskManagement.js";
|
||||
import { ElMessage, ElMessageBox, ElLoading } from "element-plus";
|
||||
|
|
@ -135,6 +135,11 @@ onMounted(() => {
|
|||
getList();
|
||||
});
|
||||
|
||||
// 页面激活时刷新数据(从详情页返回时)
|
||||
onActivated(() => {
|
||||
getList();
|
||||
});
|
||||
|
||||
// 查询
|
||||
const handleQuery = () => {
|
||||
pageNum.value = 1;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<el-input v-model="queryForm.workLocation" placeholder="请输入作业地点"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="分配状态">
|
||||
<el-select v-model="queryForm.allocationStatus" placeholder="请选择分配状态">
|
||||
<el-select v-model="queryForm.allocStatus" placeholder="请选择分配状态">
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option v-for="item in allocationStatusList" :key="item.value" :label="item.label"
|
||||
:value="item.value"></el-option>
|
||||
|
|
@ -20,31 +20,34 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button size="default">重置</el-button>
|
||||
<el-button type="primary" size="default">查询</el-button>
|
||||
<el-button size="default" @click="handleReset">重置</el-button>
|
||||
<el-button type="primary" size="default" @click="handleQuery">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div class="card-box">
|
||||
<el-table :data="tableData">
|
||||
<el-table :data="tableData" v-loading="loading">
|
||||
<el-table-column prop="projectName" label="项目名称"></el-table-column>
|
||||
<el-table-column prop="constructionUnit" label="施工单位"></el-table-column>
|
||||
<el-table-column prop="workLocation" label="作业地点"></el-table-column>
|
||||
<el-table-column prop="workCycle" label="作业周期"></el-table-column>
|
||||
<el-table-column prop="workStart" label="作业周期" width="320">
|
||||
<template #default="scope">
|
||||
{{ scope.row.workStart }}至{{ scope.row.workEnd }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="riskType" label="风险类型"></el-table-column>
|
||||
<el-table-column prop="needBallheadNum" label="需分配球机数量"></el-table-column>
|
||||
<el-table-column prop="repositoryName" label="所属仓库"></el-table-column>
|
||||
<el-table-column prop="needCameraCnt" label="需分配球机数量"></el-table-column>
|
||||
<el-table-column prop="" label="分配状态">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.allocationStatus === '待分配' ? 'success' : 'danger'">
|
||||
{{ scope.row.allocationStatus }}
|
||||
<el-tag :type="scope.row.allocStatus === '0' ? 'success' : 'danger'">
|
||||
{{ scope.row.allocStatus === '0' ? '待分配' : scope.row.allocStatus === '1' ? '已分配' : '' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180">
|
||||
<template #default="scope">
|
||||
<el-button size="small" type="text" @click="handleAssignBallhead(scope.row)">分配球机</el-button>
|
||||
<el-button size="small" type="primary" link>查看详情</el-button>
|
||||
<el-button size="small" type="primary" link @click="handleViewDetail(scope.row)">查看详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -54,86 +57,123 @@
|
|||
total }}
|
||||
条</span>
|
||||
<el-pagination v-model:current-page="pageNum" v-model:page-size="pageSize" :page-sizes="[5, 10, 20]"
|
||||
:total="total" layout="prev, pager, next"></el-pagination>
|
||||
:total="total" layout="prev, pager, next" @size-change="getList" @current-change="getList"></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 分配球机弹窗 -->
|
||||
<DialogBox v-if="dialogShow" ref="dialogRef" :show="dialogShow" :CloseDialog="handleCancel" />
|
||||
<DialogBox v-show="dialogShow" ref="dialogRef" :show="dialogShow" :CloseDialog="handleCancel" :projectInfo="currentProjectInfo" :readonly="isReadonly" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup name="Index">
|
||||
import { ref } from "vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import DialogBox from "./components/DialogA.vue"
|
||||
import { listCameraApplication } from "@/api/tenement/highRiskProject";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
|
||||
const dialogShow = ref(false) // 分配球机弹窗是否显示
|
||||
const currentProjectInfo = ref(null) // 当前选中的项目信息
|
||||
const isReadonly = ref(false) // 是否为只读模式(查看详情)
|
||||
// 查询表单数据
|
||||
const queryForm = ref({
|
||||
projectName: "",
|
||||
constructionUnit: "",
|
||||
workLocation: "",
|
||||
allocationStatus: ""
|
||||
allocStatus: ""
|
||||
});
|
||||
|
||||
// 分配状态列表
|
||||
const allocationStatusList = ref([
|
||||
{
|
||||
label: "待分配",
|
||||
value: "1"
|
||||
value: "0"
|
||||
},
|
||||
{
|
||||
label: "已分配",
|
||||
value: "2"
|
||||
value: "1"
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格数据
|
||||
const tableData = ref([
|
||||
{
|
||||
id: 1,
|
||||
projectName: "项目1",
|
||||
constructionUnit: "施工单位1",
|
||||
workLocation: "作业地点1",
|
||||
workCycle: "作业周期1",
|
||||
riskType: "高空作业",
|
||||
needBallheadNum: "10",
|
||||
allocationStatus: "待分配",
|
||||
repositoryName: "一号仓库",
|
||||
remark: "备注1"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
projectName: "项目2",
|
||||
constructionUnit: "施工单位2",
|
||||
workLocation: "作业地点2",
|
||||
workCycle: "作业周期2",
|
||||
riskType: "高空作业",
|
||||
needBallheadNum: "10",
|
||||
allocationStatus: "待分配",
|
||||
repositoryName: "二号仓库",
|
||||
remark: "备注2"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
projectName: "项目3",
|
||||
constructionUnit: "施工单位3",
|
||||
workLocation: "作业地点3",
|
||||
workCycle: "作业周期3",
|
||||
riskType: "高空作业",
|
||||
needBallheadNum: "10",
|
||||
allocationStatus: "待分配",
|
||||
repositoryName: "三号仓库",
|
||||
remark: "备注3"
|
||||
},
|
||||
|
||||
]);
|
||||
const tableData = ref([]);
|
||||
const pageNum = ref(1); // 当前页码
|
||||
const pageSize = ref(5); // 每页显示条数
|
||||
const total = ref(20); // 总记录数
|
||||
const pageSize = ref(10); // 每页显示条数
|
||||
const total = ref(0); // 总记录数
|
||||
const loading = ref(false); // 加载状态
|
||||
|
||||
// 获取列表数据
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const params = {
|
||||
pageNum: pageNum.value,
|
||||
pageSize: pageSize.value
|
||||
};
|
||||
|
||||
// 添加查询条件
|
||||
if (queryForm.value.projectName) {
|
||||
params.projectName = queryForm.value.projectName;
|
||||
}
|
||||
if (queryForm.value.constructionUnit) {
|
||||
params.constructionUnit = queryForm.value.constructionUnit;
|
||||
}
|
||||
if (queryForm.value.workLocation) {
|
||||
params.workLocation = queryForm.value.workLocation;
|
||||
}
|
||||
if (queryForm.value.allocStatus) {
|
||||
params.allocStatus = queryForm.value.allocStatus;
|
||||
}
|
||||
|
||||
const response = await listCameraApplication(params);
|
||||
if (response.code === 200) {
|
||||
tableData.value = response.rows || response.data || [];
|
||||
total.value = response.total || 0;
|
||||
} else {
|
||||
ElMessage.error(response.msg || "获取数据失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取列表数据失败:", error);
|
||||
ElMessage.error("获取数据失败,请稍后重试");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 查询
|
||||
const handleQuery = () => {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
queryForm.value = {
|
||||
projectName: "",
|
||||
constructionUnit: "",
|
||||
workLocation: "",
|
||||
allocStatus: ""
|
||||
};
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
// 组件挂载时获取数据
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
|
||||
|
||||
// 分配球机弹窗-打开
|
||||
const handleAssignBallhead = (row) => {
|
||||
currentProjectInfo.value = row
|
||||
isReadonly.value = false
|
||||
dialogShow.value = true
|
||||
}
|
||||
|
||||
// 查看详情-打开
|
||||
const handleViewDetail = (row) => {
|
||||
currentProjectInfo.value = row
|
||||
isReadonly.value = true
|
||||
dialogShow.value = true
|
||||
}
|
||||
|
||||
|
|
@ -141,6 +181,7 @@ const handleAssignBallhead = (row) => {
|
|||
const handleCancel = () => {
|
||||
console.log('关闭弹窗')
|
||||
dialogShow.value = false
|
||||
isReadonly.value = false
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,29 +18,33 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button size="default">重置</el-button>
|
||||
<el-button type="primary" size="default">查询</el-button>
|
||||
<el-button size="default" @click="handleReset">重置</el-button>
|
||||
<el-button type="primary" size="default" @click="handleQuery">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div class="card-box">
|
||||
<el-table :data="tableData" class="mt-2">
|
||||
<el-table-column prop="needBallheadNum" label="球机编号"></el-table-column>
|
||||
<el-table :data="tableData" v-loading="loading" class="mt-2">
|
||||
<el-table-column prop="cameraNo" label="球机编号"></el-table-column>
|
||||
<el-table-column prop="projectName" label="所属项目"></el-table-column>
|
||||
<el-table-column prop="returnStatus" label="回收核验结果"></el-table-column>
|
||||
<el-table-column prop="returnUserName" label="回收人"></el-table-column>
|
||||
<el-table-column prop="submitEndTime" label="提交入库时间" format="yyyy-MM-dd HH:mm:ss"></el-table-column>
|
||||
<el-table-column prop="returnStatus" label="回收状态">
|
||||
<el-table-column prop="remark" label="回收核验结果"></el-table-column>
|
||||
<el-table-column prop="returnBy" label="回收人"></el-table-column>
|
||||
<el-table-column prop="returnTime" label="提交入库时间" format="yyyy-MM-dd HH:mm:ss">
|
||||
<template #default="scope">
|
||||
{{ formatDate(scope.row.returnTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="returnStatus" label="回收状态">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.returnStatus === '待回收' ? 'warning' : 'success'">
|
||||
{{ scope.row.returnStatus }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="操作" width="180">
|
||||
<template #default="scope">
|
||||
<el-button size="small" type="primary" link @click="handleAudit(scope.row)">入库审核</el-button>
|
||||
<el-button size="small" type="Info" link>驳回</el-button>
|
||||
<el-button size="small" type="Info" link @click="handleReject(scope.row)">驳回</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -50,17 +54,19 @@
|
|||
total }}
|
||||
条</span>
|
||||
<el-pagination v-model:current-page="pageNum" v-model:page-size="pageSize" :page-sizes="[5, 10, 20]"
|
||||
:total="total" layout="prev, pager, next"></el-pagination>
|
||||
:total="total" layout="prev, pager, next" @size-change="getList" @current-change="getList"></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 入库审核弹窗 -->
|
||||
<DialogBox v-if="dialogShow" ref="dialogRef" :show="dialogShow" :CloseDialog="handleCancel" />
|
||||
<DialogBox v-show="dialogShow" ref="dialogRef" :show="dialogShow" :CloseDialog="handleCancel" :rowData="currentRowData" @refresh="handleRefresh" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup name="Index">
|
||||
import { ref } from "vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import DialogBox from "./components/DialogC.vue";
|
||||
|
||||
import { listInventoryAudit, rejectInventoryAudit } from "@/api/tenement/inventoryAudit";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { formatDate } from "@/utils";
|
||||
|
||||
// 查询表单数据
|
||||
const queryForm = ref({
|
||||
|
|
@ -86,47 +92,123 @@ const StatusList = ref([
|
|||
]);
|
||||
|
||||
// 表格数据
|
||||
const tableData = ref([
|
||||
{
|
||||
id: 1,
|
||||
needBallheadNum: "1001",
|
||||
projectName: "项目1",
|
||||
returnStatus: "待审核",
|
||||
returnUserName: "用户1",
|
||||
submitEndTime: "2023-08-01 10:00:00"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
projectName: "项目2",
|
||||
constructionUnit: "施工单位2",
|
||||
needBallheadNum: "1002",
|
||||
submitEndTime: "2023-08-02 10:00:00",
|
||||
returnStatus: "待回收"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
projectName: "项目3",
|
||||
constructionUnit: "施工单位3",
|
||||
needBallheadNum: "1003",
|
||||
submitEndTime: "2023-08-03 10:00:00",
|
||||
returnStatus: "已回收待入库"
|
||||
},
|
||||
|
||||
]);
|
||||
const tableData = ref([]);
|
||||
const dialogShow = ref(false); // 入库审核弹窗-显示状态
|
||||
const currentRowData = ref(null); // 当前选中的行数据
|
||||
const pageNum = ref(1); // 当前页码
|
||||
const pageSize = ref(5); // 每页显示条数
|
||||
const total = ref(20); // 总记录数
|
||||
const total = ref(0); // 总记录数
|
||||
const loading = ref(false); // 加载状态
|
||||
|
||||
|
||||
// 获取列表数据
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const params = {
|
||||
pageNum: pageNum.value,
|
||||
pageSize: pageSize.value
|
||||
};
|
||||
|
||||
// 添加查询条件
|
||||
if (queryForm.value.dateRange && queryForm.value.dateRange.length === 2) {
|
||||
params.startTime = queryForm.value.dateRange[0];
|
||||
params.endTime = queryForm.value.dateRange[1];
|
||||
}
|
||||
if (queryForm.value.projectName) {
|
||||
params.projectName = queryForm.value.projectName;
|
||||
}
|
||||
if (queryForm.value.returnStatus !== "") {
|
||||
params.returnStatus = queryForm.value.returnStatus;
|
||||
}
|
||||
|
||||
const response = await listInventoryAudit(params);
|
||||
if (response.code === 200) {
|
||||
tableData.value = response.rows || response.data || [];
|
||||
total.value = response.total || 0;
|
||||
} else {
|
||||
ElMessage.error(response.msg || "获取数据失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取列表数据失败:", error);
|
||||
ElMessage.error("获取数据失败,请稍后重试");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 查询
|
||||
const handleQuery = () => {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
queryForm.value = {
|
||||
dateRange: [],
|
||||
projectName: "",
|
||||
returnStatus: ""
|
||||
};
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
// 组件挂载时获取数据
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
|
||||
// 入库审核弹窗-打开
|
||||
const handleAudit = (row) => {
|
||||
currentRowData.value = row; // 保存当前行数据
|
||||
dialogShow.value = true
|
||||
}
|
||||
// 关闭弹窗
|
||||
const handleCancel = () => {
|
||||
console.log('关闭弹窗')
|
||||
dialogShow.value = false
|
||||
currentRowData.value = null; // 清空行数据
|
||||
}
|
||||
|
||||
// 刷新列表(入库成功后调用)
|
||||
const handleRefresh = () => {
|
||||
getList()
|
||||
}
|
||||
|
||||
// 驳回入库审核
|
||||
const handleReject = async (row) => {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要驳回球机编号为"${row.cameraNo}"的入库审核吗?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
|
||||
const params = {
|
||||
id: row.id || row.returnId,
|
||||
cameraId: row.cameraId || row.id,
|
||||
cameraNo: row.cameraNo,
|
||||
returnIds: row.returnId ? [row.returnId] : []
|
||||
}
|
||||
|
||||
const response = await rejectInventoryAudit(params)
|
||||
if (response.code === 200) {
|
||||
ElMessage.success('驳回成功')
|
||||
getList() // 刷新列表
|
||||
} else {
|
||||
ElMessage.error(response.msg || '驳回失败')
|
||||
}
|
||||
} catch (error) {
|
||||
if (error !== 'cancel') {
|
||||
console.error('驳回失败:', error)
|
||||
ElMessage.error('驳回失败,请稍后重试')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -9,19 +9,19 @@
|
|||
<el-input v-model="queryForm.constructionUnit" placeholder="请输入单位名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="球机编号">
|
||||
<el-input v-model="queryForm.needBallheadNum" placeholder="请输入球机编号"></el-input>
|
||||
<el-input v-model="queryForm.cameraNo" placeholder="请输入球机编号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="回收状态">
|
||||
<el-select v-model="queryForm.returnStatus" placeholder="请选择回收状态">
|
||||
<el-select v-model="queryForm.auditStatus" placeholder="请选择回收状态">
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option v-for="item in returnStatusList" :key="item.value" :label="item.label"
|
||||
<el-option v-for="item in auditStatusList" :key="item.value" :label="item.label"
|
||||
:value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button size="default">重置</el-button>
|
||||
<el-button type="primary" size="default">查询</el-button>
|
||||
<el-button size="default" @click="handleReset">重置</el-button>
|
||||
<el-button type="primary" size="default" @click="handleQuery">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
|
@ -34,15 +34,19 @@
|
|||
<el-button type="primary" plain size="default">打印</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table :data="tableData" class="mt-2">
|
||||
<el-table :data="tableData" v-loading="loading" class="mt-2">
|
||||
<el-table-column prop="projectName" label="项目名称"></el-table-column>
|
||||
<el-table-column prop="constructionUnit" label="施工单位"></el-table-column>
|
||||
<el-table-column prop="needBallheadNum" label="分配球机编号"></el-table-column>
|
||||
<el-table-column prop="submitEndTime" label="提交结束时间"></el-table-column>
|
||||
<el-table-column prop="returnStatus" label="回收状态">
|
||||
<el-table-column prop="cameraNo" label="分配球机编号"></el-table-column>
|
||||
<el-table-column prop="createTime" label="提交结束时间">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.returnStatus === '待回收' ? 'warning' : 'success'">
|
||||
{{ scope.row.returnStatus }}
|
||||
{{ formatDate(scope.row.createTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="auditStatus" label="回收状态">
|
||||
<template #default="scope">
|
||||
<el-tag :type="getStatusType(scope.row.auditStatus)">
|
||||
{{ getStatusLabel(scope.row.auditStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -58,85 +62,154 @@
|
|||
total }}
|
||||
条</span>
|
||||
<el-pagination v-model:current-page="pageNum" v-model:page-size="pageSize" :page-sizes="[5, 10, 20]"
|
||||
:total="total" layout="prev, pager, next"></el-pagination>
|
||||
:total="total" layout="prev, pager, next" @size-change="getList" @current-change="getList"></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 球机回收入库弹窗 -->
|
||||
<DialogBox v-if="dialogShow" ref="dialogRef" :show="dialogShow" :CloseDialog="handleCancel" />
|
||||
<DialogBox v-show="dialogShow" ref="dialogRef" :show="dialogShow" :CloseDialog="handleCancel" :rowData="currentRowData" @refresh="getList" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import DialogBox from "./components/DialogB.vue"
|
||||
import { listReturnToInventory } from "@/api/tenement/returnToInventory";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { formatDate } from "@/utils";
|
||||
|
||||
|
||||
// 查询表单数据
|
||||
const queryForm = ref({
|
||||
projectName: "",
|
||||
constructionUnit: "",
|
||||
needBallheadNum: "",
|
||||
returnStatus: ""
|
||||
cameraNo: "",
|
||||
auditStatus: ""
|
||||
});
|
||||
|
||||
// 回收状态列表
|
||||
const returnStatusList = ref([
|
||||
const auditStatusList = ref([
|
||||
{
|
||||
label: "待回收",
|
||||
value: "-1"
|
||||
},
|
||||
{
|
||||
label: "待审核",
|
||||
value: "0"
|
||||
},
|
||||
{
|
||||
label: "已通过",
|
||||
value: "1"
|
||||
},
|
||||
{
|
||||
label: "已回收待入库",
|
||||
label: "已驳回",
|
||||
value: "2"
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格数据
|
||||
const tableData = ref([
|
||||
{
|
||||
id: 1,
|
||||
projectName: "项目1",
|
||||
constructionUnit: "施工单位1",
|
||||
needBallheadNum: "1001",
|
||||
submitEndTime: "2023-08-01 10:00:00",
|
||||
returnStatus: "待回收"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
projectName: "项目2",
|
||||
constructionUnit: "施工单位2",
|
||||
needBallheadNum: "1002",
|
||||
submitEndTime: "2023-08-02 10:00:00",
|
||||
returnStatus: "待回收"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
projectName: "项目3",
|
||||
constructionUnit: "施工单位3",
|
||||
needBallheadNum: "1003",
|
||||
submitEndTime: "2023-08-03 10:00:00",
|
||||
returnStatus: "已回收待入库"
|
||||
},
|
||||
// 状态映射
|
||||
const statusMap = {
|
||||
"-1": { label: "待回收", type: "warning" },
|
||||
"0": { label: "待审核", type: "info" },
|
||||
"1": { label: "已通过", type: "success" },
|
||||
"2": { label: "已驳回", type: "danger" }
|
||||
};
|
||||
|
||||
]);
|
||||
// 获取状态标签
|
||||
const getStatusLabel = (status) => {
|
||||
const statusStr = String(status);
|
||||
return statusMap[statusStr]?.label || "未知状态";
|
||||
};
|
||||
|
||||
// 获取状态标签类型
|
||||
const getStatusType = (status) => {
|
||||
const statusStr = String(status);
|
||||
return statusMap[statusStr]?.type || "";
|
||||
};
|
||||
|
||||
// 表格数据
|
||||
const tableData = ref([]);
|
||||
const pageNum = ref(1); // 当前页码
|
||||
const pageSize = ref(10); // 每页显示条数
|
||||
const total = ref(0); // 总记录数
|
||||
const loading = ref(false); // 加载状态
|
||||
|
||||
// 弹窗显示状态
|
||||
const dialogShow = ref(false);
|
||||
// 当前选中的行数据
|
||||
const currentRowData = ref(null);
|
||||
|
||||
const pageNum = ref(1); // 当前页码
|
||||
const pageSize = ref(5); // 每页显示条数
|
||||
const total = ref(20); // 总记录数
|
||||
// 获取列表数据
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const params = {
|
||||
pageNum: pageNum.value,
|
||||
pageSize: pageSize.value
|
||||
};
|
||||
|
||||
// 添加查询条件
|
||||
if (queryForm.value.projectName) {
|
||||
params.projectName = queryForm.value.projectName;
|
||||
}
|
||||
if (queryForm.value.constructionUnit) {
|
||||
params.constructionUnit = queryForm.value.constructionUnit;
|
||||
}
|
||||
if (queryForm.value.cameraNo) {
|
||||
params.cameraNo = queryForm.value.cameraNo;
|
||||
}
|
||||
if (queryForm.value.auditStatus !== "") {
|
||||
params.auditStatus = queryForm.value.auditStatus;
|
||||
}
|
||||
|
||||
const response = await listReturnToInventory(params);
|
||||
if (response.code === 200) {
|
||||
tableData.value = response.rows || response.data || [];
|
||||
total.value = response.total || 0;
|
||||
} else {
|
||||
ElMessage.error(response.msg || "获取数据失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取列表数据失败:", error);
|
||||
ElMessage.error("获取数据失败,请稍后重试");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 查询
|
||||
const handleQuery = () => {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
queryForm.value = {
|
||||
projectName: "",
|
||||
constructionUnit: "",
|
||||
cameraNo: "",
|
||||
auditStatus: ""
|
||||
};
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
// 组件挂载时获取数据
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
|
||||
// 球机回收入库弹窗-打开
|
||||
const handleReturnToInventory = (row) => {
|
||||
currentRowData.value = row
|
||||
dialogShow.value = true
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const handleCancel = () => {
|
||||
console.log('关闭弹窗')
|
||||
dialogShow.value = false
|
||||
currentRowData.value = null
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<!-- 分配球机-弹窗详情 -->
|
||||
<template>
|
||||
<el-dialog title="分配球机" v-model="props.show" @close="handleClose" width="900px">
|
||||
<el-dialog :title="props.readonly ? '查看详情' : '分配球机'" v-model="props.show" @close="handleClose" width="900px">
|
||||
<div class="Cneter-box">
|
||||
<!-- 项目信息 -->
|
||||
<div class="project-info">
|
||||
|
|
@ -9,13 +9,25 @@
|
|||
<el-col :span="12">
|
||||
<div class="info-item">
|
||||
<label>项目名称:</label>
|
||||
<span>地铁10号线扩建工程</span>
|
||||
<span>{{ projectInfo?.projectName || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="info-item">
|
||||
<label>施工单位:</label>
|
||||
<span>{{ projectInfo?.constructionUnit || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="info-item">
|
||||
<label>作业地点:</label>
|
||||
<span>{{ projectInfo?.workLocation || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="info-item">
|
||||
<label>需分配球机数量:</label>
|
||||
<span>3</span>
|
||||
<span>{{ projectInfo?.needCameraCnt || '-' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -24,20 +36,22 @@
|
|||
<!-- 球机选择 -->
|
||||
<div class="camera-selection">
|
||||
<h3>球机选择</h3>
|
||||
<el-input placeholder="按球机编号或型号搜索" class="mb-4" style="margin-bottom: 10px;" />
|
||||
<el-input v-model="searchKeyword" placeholder="按球机编号或型号搜索" class="mb-4" style="margin-bottom: 10px;"
|
||||
@input="handleSearch" :disabled="props.readonly" />
|
||||
|
||||
<el-table :data="cameraList" border height="300px">
|
||||
<el-table-column type="selection" />
|
||||
<el-table-column prop="number" label="球机编号" />
|
||||
<el-table ref="cameraTableRef" :data="cameraList" border height="300px" v-loading="cameraLoading"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" :selectable="() => !props.readonly" />
|
||||
<el-table-column prop="cameraNo" label="球机编号" />
|
||||
<el-table-column prop="model" label="型号" />
|
||||
<el-table-column prop="status" label="状态">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.status === '闲置' ? 'success' : 'warning'">
|
||||
{{ scope.row.status }}
|
||||
<el-tag :type="getStatusType(scope.row.status)">
|
||||
{{ getStatusText(scope.row.status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="unit" label="所属单位" />
|
||||
<el-table-column prop="ownerUnit" label="所属单位" />
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
|
|
@ -48,19 +62,20 @@
|
|||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="分配人:">
|
||||
<el-input v-model="form.assigner" placeholder="请输入分配人" />
|
||||
<el-input v-model="form.assigner" placeholder="请输入分配人" :disabled="props.readonly" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="分配时间:">
|
||||
<el-date-picker v-model="form.assignTime" type="datetime" placeholder="选择分配时间"
|
||||
style="width: 100%;" />
|
||||
style="width: 100%;" :disabled="props.readonly" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="配送地址:">
|
||||
<el-input v-model="form.deliveryAddress" type="textarea" placeholder="请输入配送地址" :rows="3" />
|
||||
<el-input v-model="form.deliveryAddress" type="textarea" placeholder="请输入配送地址" :rows="3"
|
||||
:disabled="props.readonly" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
|
@ -68,14 +83,16 @@
|
|||
|
||||
<!-- 底部按钮 -->
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确认分配</el-button>
|
||||
<el-button @click="handleClose">{{ props.readonly ? '关闭' : '取消' }}</el-button>
|
||||
<el-button v-if="!props.readonly" type="primary" @click="handleSubmit">确认分配</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, watch, defineProps } from 'vue'
|
||||
import { listAvailableCamera, confirmAllocation, getAllocationDetail, getCameraDetail } from '@/api/tenement/highRiskProject'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
|
|
@ -85,6 +102,14 @@ const props = defineProps({
|
|||
CloseDialog: {
|
||||
type: Function,
|
||||
default: () => { }
|
||||
},
|
||||
projectInfo: {
|
||||
type: Object,
|
||||
default: () => null
|
||||
},
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -92,28 +117,268 @@ const emit = defineEmits(['update:show'])
|
|||
|
||||
// 表单数据
|
||||
const form = ref({
|
||||
assigner: '张伟',
|
||||
assignTime: '2024-04-05 14:30',
|
||||
deliveryAddress: '北京市朝阳区建国路88号'
|
||||
assigner: '',
|
||||
assignTime: '',
|
||||
deliveryAddress: ''
|
||||
})
|
||||
|
||||
// 搜索关键词
|
||||
const searchKeyword = ref('')
|
||||
|
||||
// 球机列表数据
|
||||
const cameraList = ref([
|
||||
{ number: 'BG-2024-001', model: 'Hikvision DS-2DE4A425IW-DE', status: '闲置', unit: '北京设备租赁公司' },
|
||||
{ number: 'BG-2024-002', model: 'Dahua SD1A404XB-GNR', status: '闲置', unit: '北京设备租赁公司' },
|
||||
{ number: 'BG-2024-003', model: 'Hikvision DS-2DE4A425IW-DE', status: '闲置', unit: '北京设备租赁公司' },
|
||||
{ number: 'BG-2024-004', model: 'Dahua SD6C425X-GNR', status: '维修中', unit: '北京设备租赁公司' },
|
||||
{ number: 'BG-2024-005', model: 'Hikvision DS-2DE4A425IW-DE', status: '闲置', unit: '北京设备租赁公司' }
|
||||
])
|
||||
const cameraList = ref([])
|
||||
const cameraLoading = ref(false)
|
||||
const allCameraList = ref([]) // 存储所有球机数据,用于搜索过滤
|
||||
const cameraTableRef = ref(null) // 表格引用,用于获取选中的行
|
||||
const selectedCameras = ref([]) // 选中的球机列表
|
||||
|
||||
// 获取可分配球机列表
|
||||
const getCameraList = async () => {
|
||||
cameraLoading.value = true
|
||||
try {
|
||||
const response = await listAvailableCamera({})
|
||||
if (response.code === 200) {
|
||||
allCameraList.value = response.rows || response.data || []
|
||||
cameraList.value = allCameraList.value
|
||||
} else {
|
||||
ElMessage.error(response.msg || '获取球机列表失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取球机列表失败:', error)
|
||||
ElMessage.error('获取球机列表失败,请稍后重试')
|
||||
} finally {
|
||||
cameraLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索过滤
|
||||
const handleSearch = () => {
|
||||
if (!searchKeyword.value) {
|
||||
cameraList.value = allCameraList.value
|
||||
return
|
||||
}
|
||||
const keyword = searchKeyword.value.toLowerCase()
|
||||
cameraList.value = allCameraList.value.filter(item => {
|
||||
return (item.cameraNo && item.cameraNo.toLowerCase().includes(keyword)) ||
|
||||
(item.model && item.model.toLowerCase().includes(keyword))
|
||||
})
|
||||
}
|
||||
|
||||
// 多选框选中数据变化
|
||||
const handleSelectionChange = (selection) => {
|
||||
selectedCameras.value = selection
|
||||
// 实时提示选择数量
|
||||
const needCount = props.projectInfo?.needCameraCnt
|
||||
if (needCount !== undefined && needCount !== null && !props.readonly) {
|
||||
const selectedCount = selection.length
|
||||
if (selectedCount > needCount) {
|
||||
ElMessage.warning(`已选择${selectedCount}个球机,需分配数量为${needCount}个,请取消多余的选择`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取状态文本
|
||||
const getStatusText = (status) => {
|
||||
const statusMap = {
|
||||
'0': '闲置',
|
||||
'1': '已分配',
|
||||
'2': '待回收',
|
||||
'3': '已入库'
|
||||
}
|
||||
return statusMap[status] || status
|
||||
}
|
||||
|
||||
// 获取状态类型
|
||||
const getStatusType = (status) => {
|
||||
const typeMap = {
|
||||
'0': 'success',
|
||||
'1': 'warning',
|
||||
'2': 'info',
|
||||
'3': ''
|
||||
}
|
||||
return typeMap[status] || ''
|
||||
}
|
||||
|
||||
// 获取分配详情
|
||||
const getDetail = async () => {
|
||||
if (!props.projectInfo) {
|
||||
return
|
||||
}
|
||||
const projectId = props.projectInfo.id || props.projectInfo.projectId
|
||||
if (!projectId) {
|
||||
ElMessage.error('项目ID不存在')
|
||||
return
|
||||
}
|
||||
|
||||
cameraLoading.value = true
|
||||
try {
|
||||
const response = await getAllocationDetail(projectId)
|
||||
if (response.code === 200) {
|
||||
const data = response.data || response.rows || []
|
||||
|
||||
// 如果是数组,取第一条数据(通常一个项目只有一条分配记录)
|
||||
const detailData = Array.isArray(data) ? (data[0] || {}) : data
|
||||
|
||||
// 填充表单数据
|
||||
form.value = {
|
||||
assigner: detailData.allocBy || detailData.assigner || '',
|
||||
assignTime: detailData.allocTime || detailData.assignTime || '',
|
||||
deliveryAddress: detailData.allocNote || detailData.deliveryAddress || detailData.deliveryAddr || ''
|
||||
}
|
||||
|
||||
// 提取已分配的球机ID列表
|
||||
let allocatedCameraIds = []
|
||||
if (detailData.cameraIds && Array.isArray(detailData.cameraIds)) {
|
||||
allocatedCameraIds = detailData.cameraIds
|
||||
} else if (detailData.cameras && Array.isArray(detailData.cameras)) {
|
||||
// 如果cameras是对象数组,提取ID
|
||||
allocatedCameraIds = detailData.cameras.map(cam => cam.id || cam.cameraId || cam.cameraNo).filter(Boolean)
|
||||
} else if (detailData.cameraId) {
|
||||
// 单个球机ID
|
||||
allocatedCameraIds = [detailData.cameraId]
|
||||
}
|
||||
|
||||
// 如果有球机ID,调用getCameraDetail接口获取球机详情并渲染到表格
|
||||
if (allocatedCameraIds.length > 0) {
|
||||
const cameraDetailList = []
|
||||
// 遍历所有cameraId,获取每个球机的详情
|
||||
for (const cameraId of allocatedCameraIds) {
|
||||
try {
|
||||
const cameraResponse = await getCameraDetail(cameraId)
|
||||
if (cameraResponse.code === 200) {
|
||||
const cameraData = cameraResponse.data || cameraResponse
|
||||
cameraDetailList.push({
|
||||
id: cameraData.cameraId || cameraData.id || cameraId,
|
||||
cameraId: cameraData.cameraId || cameraData.id || cameraId,
|
||||
cameraNo: cameraData.cameraNo || '',
|
||||
model: cameraData.model || '',
|
||||
status: cameraData.status || '',
|
||||
ownerUnit: cameraData.ownerUnit || ''
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`获取球机${cameraId}详情失败:`, error)
|
||||
}
|
||||
}
|
||||
|
||||
// 将获取到的球机详情数据渲染到表格
|
||||
cameraList.value = cameraDetailList
|
||||
allCameraList.value = cameraDetailList
|
||||
} else {
|
||||
// 如果没有球机ID,清空表格
|
||||
cameraList.value = []
|
||||
allCameraList.value = []
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(response.msg || '获取详情失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取详情失败:', error)
|
||||
ElMessage.error('获取详情失败,请稍后重试')
|
||||
} finally {
|
||||
cameraLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 监听弹窗显示状态,打开时获取球机列表
|
||||
watch(() => props.show, (newVal) => {
|
||||
if (newVal) {
|
||||
if (props.readonly) {
|
||||
// 查看详情模式:调用详情接口
|
||||
getDetail()
|
||||
} else {
|
||||
// 分配模式:调用球机选择列表接口
|
||||
getCameraList()
|
||||
// 重置搜索关键词
|
||||
searchKeyword.value = ''
|
||||
// 重置表单
|
||||
form.value = {
|
||||
assigner: '',
|
||||
assignTime: '',
|
||||
deliveryAddress: ''
|
||||
}
|
||||
// 清空表格选中状态
|
||||
selectedCameras.value = []
|
||||
if (cameraTableRef.value) {
|
||||
cameraTableRef.value.clearSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const handleClose = () => {
|
||||
props.CloseDialog()
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
// 提交逻辑
|
||||
console.log('提交分配信息', form.value)
|
||||
props.CloseDialog()
|
||||
const handleSubmit = async () => {
|
||||
// 验证是否选择了球机
|
||||
if (selectedCameras.value.length === 0) {
|
||||
ElMessage.warning('请至少选择一个球机')
|
||||
return
|
||||
}
|
||||
|
||||
// 验证选中的球机数量是否与需分配数量一致
|
||||
const needCount = props.projectInfo?.needCameraCnt
|
||||
if (needCount !== undefined && needCount !== null) {
|
||||
const selectedCount = selectedCameras.value.length
|
||||
if (selectedCount !== needCount) {
|
||||
ElMessage.warning(`选中的球机数量为${selectedCount}个,需分配球机数量为${needCount}个,数量不一致,请重新选择`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 验证表单信息
|
||||
if (!form.value.assigner) {
|
||||
ElMessage.warning('请输入分配人')
|
||||
return
|
||||
}
|
||||
|
||||
if (!form.value.assignTime) {
|
||||
ElMessage.warning('请选择分配时间')
|
||||
return
|
||||
}
|
||||
|
||||
if (!form.value.deliveryAddress) {
|
||||
ElMessage.warning('请输入配送地址')
|
||||
return
|
||||
}
|
||||
|
||||
// 格式化分配时间
|
||||
let assignTimeStr = ''
|
||||
if (form.value.assignTime instanceof Date) {
|
||||
const year = form.value.assignTime.getFullYear()
|
||||
const month = String(form.value.assignTime.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(form.value.assignTime.getDate()).padStart(2, '0')
|
||||
const hours = String(form.value.assignTime.getHours()).padStart(2, '0')
|
||||
const minutes = String(form.value.assignTime.getMinutes()).padStart(2, '0')
|
||||
const seconds = String(form.value.assignTime.getSeconds()).padStart(2, '0')
|
||||
assignTimeStr = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||
} else {
|
||||
assignTimeStr = form.value.assignTime
|
||||
}
|
||||
|
||||
// 准备提交数据
|
||||
const submitData = {
|
||||
projectId: props.projectInfo?.id || props.projectInfo?.projectId, // 项目ID
|
||||
cameraIds: selectedCameras.value.map(camera => camera.id || camera.cameraId), // 选中的球机ID数组
|
||||
allocBy: form.value.assigner, // 分配人
|
||||
allocTime: form.value.assignTime, // 分配时间
|
||||
allocNote: form.value.deliveryAddress // 配送地址
|
||||
}
|
||||
|
||||
try {
|
||||
// 调用确认分配接口
|
||||
const response = await confirmAllocation(submitData)
|
||||
if (response.code === 200) {
|
||||
ElMessage.success('分配成功')
|
||||
props.CloseDialog()
|
||||
} else {
|
||||
ElMessage.error(response.msg || '分配失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('分配失败:', error)
|
||||
ElMessage.error('分配失败,请稍后重试')
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -11,31 +11,31 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="球机编号/数量">
|
||||
<el-input v-model="form.cameraIds" disabled />
|
||||
<el-form-item label="球机编号">
|
||||
<el-input v-model="form.cameraNo" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="分配时间">
|
||||
<el-input v-model="form.allocationTime" disabled />
|
||||
<el-input v-model="form.createTime" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 球机外观完整性 -->
|
||||
<el-form-item label="球机外观完整性">
|
||||
<el-radio-group v-model="form.appearanceStatus">
|
||||
<el-radio label="完好">完好</el-radio>
|
||||
<el-radio label="破损">破损</el-radio>
|
||||
<el-radio label="丢失">丢失</el-radio>
|
||||
<el-radio-group v-model="form.appearanceIntegrity">
|
||||
<el-radio :label="0">完好</el-radio>
|
||||
<el-radio :label="1">破损</el-radio>
|
||||
<el-radio :label="2">丢失</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 功能测试结果 -->
|
||||
<el-form-item label="功能测试结果">
|
||||
<el-radio-group v-model="form.functionStatus">
|
||||
<el-radio label="正常">正常</el-radio>
|
||||
<el-radio label="异常">异常</el-radio>
|
||||
<el-radio-group v-model="form.functionalTestResult">
|
||||
<el-radio :label="0">正常</el-radio>
|
||||
<el-radio :label="1">异常</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
|
|
@ -43,32 +43,24 @@
|
|||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="回收人">
|
||||
<el-input v-model="form.recycler" />
|
||||
<el-input v-model="form.returnBy" placeholder="请输入回收人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="回收时间">
|
||||
<el-date-picker v-model="form.recycleTime" type="datetime" style="width: 100%;" />
|
||||
<el-date-picker v-model="form.returnTime" type="datetime" placeholder="选择回收时间" style="width: 100%;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 回收照片 -->
|
||||
<el-form-item label="回收照片">
|
||||
<div class="upload-area">
|
||||
<p>点击上传或拖拽图片到此处</p>
|
||||
<p>支持JPG/PNG格式,至少上传1张</p>
|
||||
</div>
|
||||
<div class="photo-grid">
|
||||
<div class="photo-item" v-for="(photo, index) in form.photos" :key="index">
|
||||
<img :src="photo" alt="回收照片" />
|
||||
</div>
|
||||
</div>
|
||||
<ImageUpload v-model="form.returnPhotos" :limit="5" :fileSize="5" />
|
||||
</el-form-item>
|
||||
|
||||
<!-- 备注 -->
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="如选择'破损'或'丢失',请在此说明原因" />
|
||||
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注信息" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
|
@ -76,14 +68,17 @@
|
|||
<!-- 底部按钮 -->
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">返回</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确认回收</el-button>
|
||||
<el-button type="primary" @click="handleSubmit" :loading="submitting">确认回收</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
import { ref, watch } from 'vue'
|
||||
import ImageUpload from '@/components/ImageUpload/index.vue'
|
||||
import { submitReturnToInventory } from '@/api/tenement/returnToInventory'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { formatDate } from '@/utils'
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
|
|
@ -93,35 +88,145 @@ const props = defineProps({
|
|||
CloseDialog: {
|
||||
type: Function,
|
||||
default: () => { }
|
||||
},
|
||||
rowData: {
|
||||
type: Object,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:show'])
|
||||
const emit = defineEmits(['update:show', 'refresh'])
|
||||
|
||||
// 提交中状态
|
||||
const submitting = ref(false)
|
||||
|
||||
// 表单数据
|
||||
const form = ref({
|
||||
assigner: '张伟',
|
||||
assignTime: '2024-04-05 14:30',
|
||||
deliveryAddress: '北京市朝阳区建国路88号'
|
||||
projectName: '', // 项目名称(从表格获取)
|
||||
cameraNo: '', // 球机编号(从表格获取)
|
||||
allocationTime: '', // 分配时间(从表格获取)
|
||||
appearanceIntegrity: '', // 球机外观完整性
|
||||
functionalTestResult: '', // 功能测试结果
|
||||
returnBy: '', // 回收人
|
||||
returnTime: '', // 回收时间
|
||||
returnPhotos: '', // 回收照片
|
||||
remark: '' // 备注
|
||||
})
|
||||
|
||||
// 球机列表数据
|
||||
const cameraList = ref([
|
||||
{ number: 'BG-2024-001', model: 'Hikvision DS-2DE4A425IW-DE', status: '闲置', unit: '北京设备租赁公司' },
|
||||
{ number: 'BG-2024-002', model: 'Dahua SD1A404XB-GNR', status: '闲置', unit: '北京设备租赁公司' },
|
||||
{ number: 'BG-2024-003', model: 'Hikvision DS-2DE4A425IW-DE', status: '闲置', unit: '北京设备租赁公司' },
|
||||
{ number: 'BG-2024-004', model: 'Dahua SD6C425X-GNR', status: '维修中', unit: '北京设备租赁公司' },
|
||||
{ number: 'BG-2024-005', model: 'Hikvision DS-2DE4A425IW-DE', status: '闲置', unit: '北京设备租赁公司' }
|
||||
])
|
||||
// 监听弹窗显示状态,打开时初始化表单数据
|
||||
watch(() => props.show, (newVal) => {
|
||||
if (newVal && props.rowData) {
|
||||
// 从表格行数据中获取信息
|
||||
form.value = {
|
||||
projectName: props.rowData.projectName || '',
|
||||
cameraNo: props.rowData.cameraNo || '',
|
||||
allocationTime: formatDate(props.rowData.allocationTime || props.rowData.assignTime || ''),
|
||||
appearanceIntegrity: props.rowData.appearanceIntegrity !== undefined && props.rowData.appearanceIntegrity !== null ? Number(props.rowData.appearanceIntegrity) : '',
|
||||
functionalTestResult: props.rowData.functionalTestResult !== undefined && props.rowData.functionalTestResult !== null ? Number(props.rowData.functionalTestResult) : '',
|
||||
returnBy: props.rowData.returnBy || '',
|
||||
returnTime: '',
|
||||
returnPhotos: props.rowData.returnPhotos || props.rowData.photoUrls || '',
|
||||
remark: props.rowData.remark || ''
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const handleClose = () => {
|
||||
// 重置表单
|
||||
form.value = {
|
||||
projectName: '',
|
||||
cameraNo: '',
|
||||
allocationTime: '',
|
||||
appearanceIntegrity: '',
|
||||
functionalTestResult: '',
|
||||
returnBy: '',
|
||||
returnTime: '',
|
||||
returnPhotos: '',
|
||||
remark: ''
|
||||
}
|
||||
props.CloseDialog()
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
// 提交逻辑
|
||||
console.log('提交分配信息', form.value)
|
||||
props.CloseDialog()
|
||||
const handleSubmit = async () => {
|
||||
// 表单验证
|
||||
if (form.value.appearanceIntegrity === '' || form.value.appearanceIntegrity === null || form.value.appearanceIntegrity === undefined) {
|
||||
ElMessage.warning('请选择球机外观完整性')
|
||||
return
|
||||
}
|
||||
|
||||
if (form.value.functionalTestResult === '' || form.value.functionalTestResult === null || form.value.functionalTestResult === undefined) {
|
||||
ElMessage.warning('请选择功能测试结果')
|
||||
return
|
||||
}
|
||||
|
||||
if (!form.value.returnBy) {
|
||||
ElMessage.warning('请输入回收人')
|
||||
return
|
||||
}
|
||||
|
||||
if (!form.value.returnTime) {
|
||||
ElMessage.warning('请选择回收时间')
|
||||
return
|
||||
}
|
||||
|
||||
// 格式化回收时间
|
||||
let returnTimeStr = ''
|
||||
if (form.value.returnTime instanceof Date) {
|
||||
const year = form.value.returnTime.getFullYear()
|
||||
const month = String(form.value.returnTime.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(form.value.returnTime.getDate()).padStart(2, '0')
|
||||
const hours = String(form.value.returnTime.getHours()).padStart(2, '0')
|
||||
const minutes = String(form.value.returnTime.getMinutes()).padStart(2, '0')
|
||||
const seconds = String(form.value.returnTime.getSeconds()).padStart(2, '0')
|
||||
returnTimeStr = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||
} else {
|
||||
returnTimeStr = form.value.returnTime
|
||||
}
|
||||
|
||||
// 处理回收照片:将逗号分隔的字符串转换为数组
|
||||
let photoUrls = []
|
||||
if (form.value.returnPhotos) {
|
||||
// 如果 returnPhotos 是字符串(逗号分隔),转换为数组
|
||||
if (typeof form.value.returnPhotos === 'string') {
|
||||
photoUrls = form.value.returnPhotos.split(',').filter(url => url.trim())
|
||||
} else if (Array.isArray(form.value.returnPhotos)) {
|
||||
photoUrls = form.value.returnPhotos
|
||||
}
|
||||
}
|
||||
|
||||
// 从表格数据中获取 cameraId
|
||||
const cameraId = props.rowData?.cameraIds || props.rowData?.id || 0
|
||||
|
||||
// 准备提交数据
|
||||
const submitData = {
|
||||
projectId: props.rowData?.projectId, // 项目ID
|
||||
id: props.rowData?.id || props.rowData?.returnId, // 回收记录ID
|
||||
cameraIds: cameraId.split(',').map(item => item.trim()), // 球机ID数组(从表格数据中获取)
|
||||
cameraNo: form.value.cameraNo, // 球机编号
|
||||
appearanceIntegrity: form.value.appearanceIntegrity, // 球机外观完整性
|
||||
functionalTestResult: form.value.functionalTestResult, // 功能测试结果
|
||||
returnBy: form.value.returnBy, // 回收人
|
||||
returnTime: form.value.returnTime, // 回收时间
|
||||
photoUrls: photoUrls, // 回收照片数组
|
||||
remark: form.value.remark || '' // 备注
|
||||
}
|
||||
|
||||
submitting.value = true
|
||||
try {
|
||||
const response = await submitReturnToInventory(submitData)
|
||||
if (response.code === 200) {
|
||||
ElMessage.success('回收确认成功')
|
||||
emit('refresh') // 触发父组件刷新列表
|
||||
handleClose()
|
||||
} else {
|
||||
ElMessage.error(response.msg || '回收确认失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('回收确认失败:', error)
|
||||
ElMessage.error('回收确认失败,请稍后重试')
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,14 +7,15 @@
|
|||
<el-row :gutter="20">
|
||||
<el-col :span="10">
|
||||
<div class="camera-photo">
|
||||
<img src="https://via.placeholder.com/300x200?text=Camera" alt="球机照片" />
|
||||
<img v-if="form.photoUrl" :src="form.photoUrl" alt="球机照片" />
|
||||
<div v-else class="no-photo">暂无照片</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="14">
|
||||
<div class="info-list">
|
||||
<div class="info-item">
|
||||
<label>球机编号:</label>
|
||||
<span>{{ form.cameraId }}</span>
|
||||
<span>{{ form.cameraNo }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<label>所属项目:</label>
|
||||
|
|
@ -22,15 +23,15 @@
|
|||
</div>
|
||||
<div class="info-item">
|
||||
<label>回收人:</label>
|
||||
<span>{{ form.recycler }}</span>
|
||||
<span>{{ form.returnBy }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<label>回收时间:</label>
|
||||
<span>{{ form.recycleTime }}</span>
|
||||
<span>{{ form.returnTime }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<label>核验结果:</label>
|
||||
<span>{{ form.inspectionResult }}</span>
|
||||
<span>{{ form.remark }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
|
|
@ -50,14 +51,14 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="入库时间">
|
||||
<el-date-picker v-model="form.storageTime" type="datetime" style="width: 100%;" />
|
||||
<el-date-picker v-model="form.inboundTime" type="datetime" style="width: 100%;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form :model="form" label-width="100px">
|
||||
<el-form-item label="入库管理员">
|
||||
<el-input v-model="form.manager" placeholder="请输入入库管理员" />
|
||||
<el-input v-model="form.keeper" placeholder="请输入入库管理员" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
|
|
@ -68,13 +69,17 @@
|
|||
<!-- 底部按钮 -->
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确认入库</el-button>
|
||||
<el-button type="primary" @click="handleSubmit" :loading="submitting">确认入库</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, watch } from 'vue'
|
||||
import { formatDate } from '@/utils'
|
||||
import { approveInventoryAudit } from '@/api/tenement/inventoryAudit'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
|
|
@ -83,33 +88,147 @@ const props = defineProps({
|
|||
CloseDialog: {
|
||||
type: Function,
|
||||
default: () => { }
|
||||
},
|
||||
rowData: {
|
||||
type: Object,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const form = ref({
|
||||
cameraId: 'QJ20230401001',
|
||||
projectName: '阳光花园小区改造项目',
|
||||
recycler: '李建国',
|
||||
recycleTime: '2023-04-15 14:30:22',
|
||||
inspectionResult: '外观完好,功能正常',
|
||||
warehouse: '1',
|
||||
storageTime: '2023-04-18 10:30:00',
|
||||
manager: '张伟'
|
||||
cameraNo: '',
|
||||
projectName: '',
|
||||
returnBy: '',
|
||||
returnTime: '',
|
||||
remark: '',
|
||||
photoUrl: '', // 球机照片
|
||||
warehouse: '',
|
||||
inboundTime: '',
|
||||
keeper: ''
|
||||
})
|
||||
const Frules = ref({
|
||||
warehouse: [{ required: true, message: '请选择入库仓库', trigger: 'blur' }],
|
||||
})
|
||||
|
||||
const formRef = ref(null)
|
||||
const submitting = ref(false)
|
||||
|
||||
// 监听弹窗显示状态,打开时从表格行数据中获取信息
|
||||
watch(() => props.show, (newVal) => {
|
||||
if (newVal && props.rowData) {
|
||||
// 处理照片URL:如果有多个照片,取第一张
|
||||
let photoUrl = ''
|
||||
if (props.rowData.returnPhotos) {
|
||||
if (typeof props.rowData.returnPhotos === 'string') {
|
||||
const photos = props.rowData.returnPhotos.split(',').filter(url => url.trim())
|
||||
photoUrl = photos[0] || ''
|
||||
} else if (Array.isArray(props.rowData.returnPhotos) && props.rowData.returnPhotos.length > 0) {
|
||||
photoUrl = props.rowData.returnPhotos[0]
|
||||
}
|
||||
} else if (props.rowData.photoUrls) {
|
||||
if (typeof props.rowData.photoUrls === 'string') {
|
||||
const photos = props.rowData.photoUrls.split(',').filter(url => url.trim())
|
||||
photoUrl = photos[0] || ''
|
||||
} else if (Array.isArray(props.rowData.photoUrls) && props.rowData.photoUrls.length > 0) {
|
||||
photoUrl = props.rowData.photoUrls[0]
|
||||
}
|
||||
}
|
||||
|
||||
// 从表格行数据中获取信息
|
||||
form.value = {
|
||||
cameraNo: props.rowData.cameraNo || '',
|
||||
projectName: props.rowData.projectName || '',
|
||||
returnBy: props.rowData.returnBy || '',
|
||||
returnTime: props.rowData.returnTime ? formatDate(props.rowData.returnTime) : '',
|
||||
remark: props.rowData.remark || '',
|
||||
photoUrl: photoUrl,
|
||||
warehouse: '',
|
||||
inboundTime: '',
|
||||
keeper: ''
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
const handleClose = () => {
|
||||
// 重置表单
|
||||
form.value = {
|
||||
cameraNo: '',
|
||||
projectName: '',
|
||||
returnBy: '',
|
||||
returnTime: '',
|
||||
remark: '',
|
||||
photoUrl: '',
|
||||
warehouse: '',
|
||||
inboundTime: '',
|
||||
keeper: ''
|
||||
}
|
||||
props.CloseDialog()
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
// 提交逻辑
|
||||
console.log('提交分配信息', form.value)
|
||||
props.CloseDialog()
|
||||
const handleSubmit = async () => {
|
||||
// 表单验证
|
||||
if (!formRef.value) return
|
||||
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
} catch (error) {
|
||||
ElMessage.warning('请完善表单信息')
|
||||
return
|
||||
}
|
||||
|
||||
// 验证必填项
|
||||
if (!form.value.warehouse) {
|
||||
ElMessage.warning('请选择入库仓库')
|
||||
return
|
||||
}
|
||||
|
||||
// 格式化入库时间
|
||||
let inboundTimeStr = ''
|
||||
if (form.value.inboundTime) {
|
||||
if (form.value.inboundTime instanceof Date) {
|
||||
const year = form.value.inboundTime.getFullYear()
|
||||
const month = String(form.value.inboundTime.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(form.value.inboundTime.getDate()).padStart(2, '0')
|
||||
const hours = String(form.value.inboundTime.getHours()).padStart(2, '0')
|
||||
const minutes = String(form.value.inboundTime.getMinutes()).padStart(2, '0')
|
||||
const seconds = String(form.value.inboundTime.getSeconds()).padStart(2, '0')
|
||||
inboundTimeStr = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||
} else {
|
||||
inboundTimeStr = form.value.inboundTime
|
||||
}
|
||||
}
|
||||
|
||||
// 构建提交数据
|
||||
const submitData = {
|
||||
id: props.rowData?.id || props.rowData?.returnId, // 记录ID
|
||||
cameraId: props.rowData?.cameraId || props.rowData?.id, // 球机ID
|
||||
cameraNo: form.value.cameraNo, // 球机编号
|
||||
warehouse: form.value.warehouse, // 入库仓库
|
||||
inboundTime: form.value.inboundTime, // 入库时间,如果没有选择则使用当前时间
|
||||
keeper: form.value.keeper || '', // 入库管理员
|
||||
returnIds: props.rowData?.returnId ? [props.rowData.returnId] : [] // 从表格中的returnId获取
|
||||
}
|
||||
|
||||
submitting.value = true
|
||||
try {
|
||||
const response = await approveInventoryAudit(submitData)
|
||||
if (response.code === 200) {
|
||||
ElMessage.success('确认入库成功')
|
||||
emit('refresh') // 触发父组件刷新列表
|
||||
handleClose()
|
||||
} else {
|
||||
ElMessage.error(response.msg || '确认入库失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('确认入库失败:', error)
|
||||
ElMessage.error('确认入库失败,请稍后重试')
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
@ -140,6 +259,16 @@ const handleSubmit = () => {
|
|||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.no-photo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 200px;
|
||||
color: #909399;
|
||||
background-color: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.info-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
|
|||
Loading…
Reference in New Issue