|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="safety-platform-container">
|
|
<div class="safety-platform-container">
|
|
|
<header class="safety-platform-container__header">
|
|
<header class="safety-platform-container__header">
|
|
|
- <div class="breadcrumb-title"> 物品库存管理 </div>
|
|
|
|
|
|
|
+ <div class="breadcrumb-title"> 安全体系建设工作计划管理(管理员) </div>
|
|
|
</header>
|
|
</header>
|
|
|
<main class="safety-platform-container__main">
|
|
<main class="safety-platform-container__main">
|
|
|
<div class="search-table-container">
|
|
<div class="search-table-container">
|
|
@@ -10,21 +10,15 @@
|
|
|
<el-button type="primary" class="search-table-container--button" @click="handleCreate">
|
|
<el-button type="primary" class="search-table-container--button" @click="handleCreate">
|
|
|
添加
|
|
添加
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- <el-button plain class="search-table-container--button" @click="handleImport">
|
|
|
|
|
- 导入
|
|
|
|
|
- </el-button>
|
|
|
|
|
- <el-button plain class="search-table-container--button" @click="handleDownload">
|
|
|
|
|
- 导出
|
|
|
|
|
- </el-button>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="act-search">
|
|
<div class="act-search">
|
|
|
<section class="select-box">
|
|
<section class="select-box">
|
|
|
<div class="select-box--item">
|
|
<div class="select-box--item">
|
|
|
- <span>物品名称:</span>
|
|
|
|
|
|
|
+ <span>工作内容/计划名称:</span>
|
|
|
<el-input
|
|
<el-input
|
|
|
- v-model="tableQuery.queryParam.stuffName"
|
|
|
|
|
- placeholder="搜索物品名称"
|
|
|
|
|
|
|
+ v-model="tableQuery.queryParam.keyword"
|
|
|
|
|
+ placeholder="搜索工作内容或计划名称"
|
|
|
class="act-search-input"
|
|
class="act-search-input"
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
@@ -35,10 +29,42 @@
|
|
|
placeholder="请选择状态"
|
|
placeholder="请选择状态"
|
|
|
clearable
|
|
clearable
|
|
|
>
|
|
>
|
|
|
- <el-option label="启用" :value="true" />
|
|
|
|
|
- <el-option label="禁用" :value="false" />
|
|
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in WORK_PLAN_STATUS_OPTIONS"
|
|
|
|
|
+ :key="item.value"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :value="item.value"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="select-box--item">
|
|
|
|
|
+ <span>分类名称:</span>
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="tableQuery.queryParam.classifyName"
|
|
|
|
|
+ placeholder="请选择分类名称"
|
|
|
|
|
+ filterable
|
|
|
|
|
+ clearable
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in classifyNameOptions"
|
|
|
|
|
+ :key="item.value"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :value="item.value"
|
|
|
|
|
+ />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <span>计划日期范围:</span>
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="dateRange"
|
|
|
|
|
+ type="daterange"
|
|
|
|
|
+ range-separator="至"
|
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
|
|
+ format="YYYY-MM-DD"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
</section>
|
|
</section>
|
|
|
<section class="search-btn">
|
|
<section class="search-btn">
|
|
|
<el-button type="primary" @click="handleSearch">查询</el-button>
|
|
<el-button type="primary" @click="handleSearch">查询</el-button>
|
|
@@ -57,36 +83,59 @@
|
|
|
>
|
|
>
|
|
|
<template #status="scope">
|
|
<template #status="scope">
|
|
|
<span>
|
|
<span>
|
|
|
- {{ scope.row.statusName || (scope.row.status === true || scope.row.status === 'true' ? '启用' : scope.row.status === false || scope.row.status === 'false' ? '禁用' : '-') }}
|
|
|
|
|
|
|
+ {{ WORK_PLAN_STATUS_LABEL[String(scope.row.status)] || '-' }}
|
|
|
</span>
|
|
</span>
|
|
|
</template>
|
|
</template>
|
|
|
<template #action="scope">
|
|
<template #action="scope">
|
|
|
<div class="action-container--div" style="justify-content: left">
|
|
<div class="action-container--div" style="justify-content: left">
|
|
|
- <ActionButton text="编辑" @click="handleEdit(scope.row.id)" />
|
|
|
|
|
- <ActionButton
|
|
|
|
|
- text="删除"
|
|
|
|
|
- :popconfirm="{
|
|
|
|
|
- title: '确定要删除?',
|
|
|
|
|
- }"
|
|
|
|
|
- @confirm="handleDelete(scope.row.id)"
|
|
|
|
|
- />
|
|
|
|
|
- <ActionButton text="查看" @click="handleView(scope.row.id)" />
|
|
|
|
|
|
|
+ <!-- 未下发(0):编辑、删除、查看发送对象、下发 -->
|
|
|
|
|
+ <template v-if="Number(scope.row.status) === 0">
|
|
|
|
|
+ <ActionButton text="编辑" @click="handleEdit(scope.row.id)" />
|
|
|
|
|
+ <ActionButton
|
|
|
|
|
+ text="删除"
|
|
|
|
|
+ :popconfirm="{
|
|
|
|
|
+ title: '确定要删除?',
|
|
|
|
|
+ }"
|
|
|
|
|
+ @confirm="handleDelete(scope.row.id)"
|
|
|
|
|
+ />
|
|
|
|
|
+ <ActionButton text="查看发送对象" @click="handleViewRecipients(scope.row.id)" />
|
|
|
|
|
+ <ActionButton text="下发" @click="handleIssue(scope.row.id)" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 进行中(1)/待反馈:查看 -->
|
|
|
|
|
+ <template v-else-if="Number(scope.row.status) === 1">
|
|
|
|
|
+ <ActionButton text="查看" @click="handleView(scope.row.id)" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 已完成(2):删除、查看 -->
|
|
|
|
|
+ <template v-else-if="Number(scope.row.status) === 2">
|
|
|
|
|
+ <ActionButton
|
|
|
|
|
+ text="删除"
|
|
|
|
|
+ :popconfirm="{
|
|
|
|
|
+ title: '确定要删除?',
|
|
|
|
|
+ }"
|
|
|
|
|
+ @confirm="handleDelete(scope.row.id)"
|
|
|
|
|
+ />
|
|
|
|
|
+ <ActionButton text="查看" @click="handleView(scope.row.id)" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 已作废(3):删除、查看 -->
|
|
|
|
|
+ <template v-else-if="Number(scope.row.status) === 3">
|
|
|
|
|
+ <ActionButton
|
|
|
|
|
+ text="删除"
|
|
|
|
|
+ :popconfirm="{
|
|
|
|
|
+ title: '确定要删除?',
|
|
|
|
|
+ }"
|
|
|
|
|
+ @confirm="handleDelete(scope.row.id)"
|
|
|
|
|
+ />
|
|
|
|
|
+ <ActionButton text="查看" @click="handleView(scope.row.id)" />
|
|
|
|
|
+ </template>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</BasicTable>
|
|
</BasicTable>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</main>
|
|
</main>
|
|
|
- <BatchImport
|
|
|
|
|
- v-if="batchImportVisible"
|
|
|
|
|
- :visible="batchImportVisible"
|
|
|
|
|
- :import-api-url="importApiUrl"
|
|
|
|
|
- :template-url="templateUrl"
|
|
|
|
|
- template-name="下载模板"
|
|
|
|
|
- :show-template="false"
|
|
|
|
|
- @close="batchImportVisible = false"
|
|
|
|
|
- @update="handleUpdate"
|
|
|
|
|
- />
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -96,31 +145,39 @@
|
|
|
import BasicTable from '@/components/BasicTable.vue';
|
|
import BasicTable from '@/components/BasicTable.vue';
|
|
|
import useTableConfig from '@/hooks/useTableConfigHook';
|
|
import useTableConfig from '@/hooks/useTableConfigHook';
|
|
|
import ActionButton from '@/components/ActionButton.vue';
|
|
import ActionButton from '@/components/ActionButton.vue';
|
|
|
- import { TABLE_OPTIONS, INVENTORY_TABLE_COLUMNS } from './configs/tables';
|
|
|
|
|
|
|
+ import { TABLE_OPTIONS, WORK_PLAN_TABLE_COLUMNS, WORK_PLAN_STATUS_OPTIONS, WORK_PLAN_STATUS_LABEL } from './configs/tables';
|
|
|
import { useRouter } from 'vue-router';
|
|
import { useRouter } from 'vue-router';
|
|
|
import type { QueryPageRequest } from '@/types/basic-query';
|
|
import type { QueryPageRequest } from '@/types/basic-query';
|
|
|
- import { queryInventoryManage, deleteInventory, exportInventory } from '@/api/inventory';
|
|
|
|
|
- import { downloadByData } from '@/utils/file/download';
|
|
|
|
|
- import BatchImport from '@/components/batch-import/BatchImport.vue';
|
|
|
|
|
- import { useGlobSetting } from '@/hooks/setting';
|
|
|
|
|
- import urlJoin from 'url-join';
|
|
|
|
|
|
|
+ // TODO: 替换为实际的工作计划管理API
|
|
|
|
|
+ // import { queryWorkPlanPage, deleteWorkPlan, issueWorkPlan } from '@/api/workPlan';
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
// 表格
|
|
// 表格
|
|
|
const basicTableRef = ref<InstanceType<typeof BasicTable>>();
|
|
const basicTableRef = ref<InstanceType<typeof BasicTable>>();
|
|
|
|
|
|
|
|
- const { tableConfig, pagination } = useTableConfig(INVENTORY_TABLE_COLUMNS, TABLE_OPTIONS);
|
|
|
|
|
|
|
+ const { tableConfig, pagination } = useTableConfig(WORK_PLAN_TABLE_COLUMNS, TABLE_OPTIONS);
|
|
|
|
|
|
|
|
const tableData = ref<any[]>([]);
|
|
const tableData = ref<any[]>([]);
|
|
|
|
|
|
|
|
|
|
+ // 日期范围
|
|
|
|
|
+ const dateRange = ref<[string, string] | null>(null);
|
|
|
|
|
+
|
|
|
|
|
+ // 分类名称选项(TODO: 从接口获取或使用字典)
|
|
|
|
|
+ const classifyNameOptions = ref<Array<{ label: string; value: string }>>([
|
|
|
|
|
+ // { label: '分类1', value: '分类1' },
|
|
|
|
|
+ // { label: '分类2', value: '分类2' },
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
const tableQuery = reactive<QueryPageRequest<any>>({
|
|
const tableQuery = reactive<QueryPageRequest<any>>({
|
|
|
pageNumber: pagination.pageNumber,
|
|
pageNumber: pagination.pageNumber,
|
|
|
pageSize: pagination.pageSize,
|
|
pageSize: pagination.pageSize,
|
|
|
queryParam: {
|
|
queryParam: {
|
|
|
- stuffName: '', // 物品名称
|
|
|
|
|
- status: true, // 状态,默认启用
|
|
|
|
|
- ids: [], // 选择数据的ID
|
|
|
|
|
|
|
+ keyword: '', // 工作内容/计划名称
|
|
|
|
|
+ status: undefined, // 状态
|
|
|
|
|
+ classifyName: '', // 分类名称
|
|
|
|
|
+ planStartTime: '', // 计划开始时间
|
|
|
|
|
+ planEndTime: '', // 计划结束时间
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -136,27 +193,31 @@
|
|
|
getTableData();
|
|
getTableData();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-
|
|
|
|
|
async function getTableData() {
|
|
async function getTableData() {
|
|
|
tableConfig.loading = true;
|
|
tableConfig.loading = true;
|
|
|
try {
|
|
try {
|
|
|
- const res = await queryInventoryManage(tableQuery);
|
|
|
|
|
- if (res) {
|
|
|
|
|
- // 映射返回数据字段到表格字段
|
|
|
|
|
- tableData.value = res.records.map((item) => ({
|
|
|
|
|
- id: item.id,
|
|
|
|
|
- itemName: item.stuffName, // 物品名称
|
|
|
|
|
- warehouseDate: item.inStoreTime, // 入库日期
|
|
|
|
|
- itemQuantity: item.stuffQty, // 物品数量
|
|
|
|
|
- handler: item.createdUserName, // 经办人
|
|
|
|
|
- remarks: item.remark, // 备注
|
|
|
|
|
- status: item.status, // 状态:true-启用,false-禁用
|
|
|
|
|
- statusName: item.statusName, // 状态名称
|
|
|
|
|
- }));
|
|
|
|
|
- pagination.total = res.totalRow;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // TODO: 替换为实际的工作计划管理API调用
|
|
|
|
|
+ // const res = await queryWorkPlanPage(tableQuery);
|
|
|
|
|
+ // if (res) {
|
|
|
|
|
+ // tableData.value = res.records.map((item) => ({
|
|
|
|
|
+ // id: item.id,
|
|
|
|
|
+ // workContent: item.workContent || item.planName, // 工作内容
|
|
|
|
|
+ // status: item.status, // 状态
|
|
|
|
|
+ // classifyName: item.classifyName, // 分类名称
|
|
|
|
|
+ // trainingPlanName: item.trainingPlanName, // 培训计划名称
|
|
|
|
|
+ // responsibleDept: item.responsibleDept, // 责任部门
|
|
|
|
|
+ // cooperateDept: item.cooperateDept, // 配合部门
|
|
|
|
|
+ // planCompleteTime: item.planCompleteTime, // 计划完成时间
|
|
|
|
|
+ // }));
|
|
|
|
|
+ // pagination.total = res.totalRow;
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ // 临时数据,用于测试
|
|
|
|
|
+ tableData.value = [];
|
|
|
|
|
+ pagination.total = 0;
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
- console.error('获取物品库存列表失败:', e);
|
|
|
|
|
|
|
+ console.error('获取工作计划列表失败:', e);
|
|
|
|
|
+ ElMessage.error('获取工作计划列表失败');
|
|
|
tableData.value = [];
|
|
tableData.value = [];
|
|
|
pagination.total = 0;
|
|
pagination.total = 0;
|
|
|
} finally {
|
|
} finally {
|
|
@@ -165,52 +226,29 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const handleSearch = () => {
|
|
const handleSearch = () => {
|
|
|
|
|
+ // 处理日期范围
|
|
|
|
|
+ if (dateRange.value && dateRange.value.length === 2) {
|
|
|
|
|
+ tableQuery.queryParam.planStartTime = dateRange.value[0];
|
|
|
|
|
+ tableQuery.queryParam.planEndTime = dateRange.value[1];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ tableQuery.queryParam.planStartTime = '';
|
|
|
|
|
+ tableQuery.queryParam.planEndTime = '';
|
|
|
|
|
+ }
|
|
|
pagination.pageNumber = 1;
|
|
pagination.pageNumber = 1;
|
|
|
tableQuery.pageNumber = 1;
|
|
tableQuery.pageNumber = 1;
|
|
|
getTableData();
|
|
getTableData();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const handleReset = () => {
|
|
const handleReset = () => {
|
|
|
- tableQuery.queryParam.stuffName = '';
|
|
|
|
|
- tableQuery.queryParam.status = true; // 重置为默认启用状态
|
|
|
|
|
- tableQuery.queryParam.ids = [];
|
|
|
|
|
|
|
+ tableQuery.queryParam.keyword = '';
|
|
|
|
|
+ tableQuery.queryParam.status = undefined;
|
|
|
|
|
+ tableQuery.queryParam.classifyName = '';
|
|
|
|
|
+ tableQuery.queryParam.planStartTime = '';
|
|
|
|
|
+ tableQuery.queryParam.planEndTime = '';
|
|
|
|
|
+ dateRange.value = null;
|
|
|
handleSearch();
|
|
handleSearch();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // 批量导入
|
|
|
|
|
- const batchImportVisible = ref(false);
|
|
|
|
|
- const { urlPrefix } = useGlobSetting();
|
|
|
|
|
- const importApiUrl = ref(urlJoin(urlPrefix, '/inventory/importInventory'));
|
|
|
|
|
- const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/import-inventory-template.xlsx');
|
|
|
|
|
-
|
|
|
|
|
- const handleImport = () => {
|
|
|
|
|
- batchImportVisible.value = true;
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- const handleUpdate = () => {
|
|
|
|
|
- batchImportVisible.value = false;
|
|
|
|
|
- getTableData();
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- const handleDownload = async () => {
|
|
|
|
|
- try {
|
|
|
|
|
- const exportParams = {
|
|
|
|
|
- stuffName: tableQuery.queryParam.stuffName || undefined,
|
|
|
|
|
- status: tableQuery.queryParam.status,
|
|
|
|
|
- ids: tableQuery.queryParam.ids.length > 0 ? tableQuery.queryParam.ids : undefined,
|
|
|
|
|
- };
|
|
|
|
|
- const response = await exportInventory(exportParams);
|
|
|
|
|
- if (response) {
|
|
|
|
|
- const fileName = `物品库存管理_${new Date().toISOString().split('T')[0]}.xlsx`;
|
|
|
|
|
- downloadByData(response, fileName);
|
|
|
|
|
- ElMessage.success('导出成功');
|
|
|
|
|
- }
|
|
|
|
|
- } catch (e) {
|
|
|
|
|
- console.error('导出物品库存失败:', e);
|
|
|
|
|
- ElMessage.error('导出失败,请重试');
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
const handleCreate = () => {
|
|
const handleCreate = () => {
|
|
|
router.push({
|
|
router.push({
|
|
|
name: 'SafetySystemConstructionWorkPlanManagementItem',
|
|
name: 'SafetySystemConstructionWorkPlanManagementItem',
|
|
@@ -232,7 +270,8 @@
|
|
|
|
|
|
|
|
const handleDelete = async (id: number) => {
|
|
const handleDelete = async (id: number) => {
|
|
|
try {
|
|
try {
|
|
|
- await deleteInventory(id);
|
|
|
|
|
|
|
+ // TODO: 替换为实际的工作计划删除API
|
|
|
|
|
+ // await deleteWorkPlan(id);
|
|
|
ElMessage.success('删除成功');
|
|
ElMessage.success('删除成功');
|
|
|
getTableData();
|
|
getTableData();
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
@@ -251,6 +290,23 @@
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ const handleViewRecipients = (id: number) => {
|
|
|
|
|
+ // TODO: 实现查看发送对象功能
|
|
|
|
|
+ ElMessage.info('查看发送对象功能待实现');
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const handleIssue = async (id: number) => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // TODO: 替换为实际的工作计划下发API
|
|
|
|
|
+ // await issueWorkPlan(id);
|
|
|
|
|
+ ElMessage.success('下发成功');
|
|
|
|
|
+ getTableData();
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.error('下发工作计划失败:', e);
|
|
|
|
|
+ ElMessage.error('下发失败,请重试');
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getTableData();
|
|
getTableData();
|
|
|
});
|
|
});
|
|
@@ -261,4 +317,4 @@
|
|
|
@use '@/styles/page-main-layout.scss' as *;
|
|
@use '@/styles/page-main-layout.scss' as *;
|
|
|
@use '@/styles/basic-table-action.scss' as *;
|
|
@use '@/styles/basic-table-action.scss' as *;
|
|
|
@use '@/views/traffic/violation/style/act-search-table.scss' as *;
|
|
@use '@/views/traffic/violation/style/act-search-table.scss' as *;
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|