From 6570b36a352edd87532dcf13a124181d4d815a39 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期二, 30 六月 2026 13:23:26 +0800
Subject: [PATCH] 销项发票页面新增录入发票功能
---
src/views/safeProduction/safetyTrainingAssessment/index.vue | 131 ++++++++++++++++++++++++++++++++-----------
1 files changed, 96 insertions(+), 35 deletions(-)
diff --git a/src/views/safeProduction/safetyTrainingAssessment/index.vue b/src/views/safeProduction/safetyTrainingAssessment/index.vue
index 1ab310f..38c2172 100644
--- a/src/views/safeProduction/safetyTrainingAssessment/index.vue
+++ b/src/views/safeProduction/safetyTrainingAssessment/index.vue
@@ -56,7 +56,8 @@
<el-form ref="formRef"
:model="form"
:rules="rules"
- label-width="120px">
+ label-position="top"
+ label-width="150px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="鍩硅鏃ユ湡"
@@ -75,7 +76,21 @@
prop="courseCode">
<el-input v-model="form.courseCode"
disabled
- placeholder="鑷姩鐢熸垚" />
+ placeholder="淇濆瓨鍚庤嚜鍔ㄧ敓鎴�" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="鍒涘缓鏃堕棿"
+ prop="createTime">
+ <el-date-picker style="width: 100%"
+ v-model="formCreateTimeDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
</el-form-item>
</el-col>
</el-row>
@@ -85,6 +100,7 @@
prop="openingTime">
<el-time-picker v-model="form.openingTime"
placeholder="璇烽�夋嫨"
+ style="width: 100%"
value-format="HH:mm:ss"
format="HH:mm:ss"
clearable />
@@ -95,6 +111,7 @@
prop="endTime">
<el-time-picker v-model="form.endTime"
placeholder="璇烽�夋嫨"
+ style="width: 100%"
value-format="HH:mm:ss"
format="HH:mm:ss"
clearable />
@@ -178,9 +195,9 @@
</el-form>
<template #footer>
<span class="dialog-footer">
- <el-button @click="dialogVisible = false">鍙栨秷</el-button>
<el-button type="primary"
@click="submitForm">纭畾</el-button>
+ <el-button @click="dialogVisible = false">鍙栨秷</el-button>
</span>
</template>
</el-dialog>
@@ -190,8 +207,9 @@
width="900px"
:close-on-click-modal="false">
<div class="knowledge-detail">
+ <div class="classtitle">璇剧▼璇︽儏</div>
<el-descriptions size="mini"
- style="margin-left: 60px;"
+ border
:column="3">
<el-descriptions-item label="璇剧▼缂栧彿:">{{ currentKnowledge.courseCode }}</el-descriptions-item>
<el-descriptions-item label="鍩硅鍐呭:">{{ currentKnowledge.trainingContent }}</el-descriptions-item>
@@ -235,14 +253,17 @@
<el-descriptions-item label="闄勪欢鍒楄〃:">
<el-button type="primary"
size="small"
- @click="downLoadFile(endform)">闄勪欢鍒楄〃</el-button>
+ @click="openFileDialog(endform)">闄勪欢鍒楄〃</el-button>
</el-descriptions-item>
</el-descriptions>
- <el-divider style="margin: 20px 0;" />
+ <!-- <el-divider style="margin: 20px 0;" /> -->
+ <div class="classtitle"
+ style="margin-top: 40px;margin-bottom: 30px;">璇剧▼璇勪环</div>
<el-form ref="formRef"
:model="form"
:rules="rules"
- label-width="130px">
+ label-position="top"
+ label-width="150px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="璇勪环浜�:"
@@ -317,10 +338,13 @@
</el-col>
</el-row> -->
</el-form>
+ <div class="classtitle"
+ style="margin-top: 40px;">鑰冩牳鍒楄〃</div>
<el-table style="margin-top: 20px;"
:data="endform.safeTrainingDetailsDtoList"
border
fit
+ stripe
highlight-current-row>
<el-table-column prop="nickName"
label="濮撳悕" />
@@ -348,20 +372,13 @@
</span>
</template>
</el-dialog>
- <!-- 闄勪欢鍒楄〃寮圭獥 -->
- <FileListDialog ref="fileListRef"
- v-model="fileListDialogVisible"
- :show-upload-button="true"
- :show-delete-button="true"
- :upload-method="handleUpload"
- :delete-method="handleFileDelete"
- title="闄勪欢鍒楄〃" />
+ <!-- todo 闄勪欢棰勮鐩稿叧 -->
+ <FileList v-if="fileDialogVisible" v-model:visible="fileDialogVisible" record-type="safe_training" :record-id="recordId" />
</div>
</template>
<script setup>
import { Search } from "@element-plus/icons-vue";
- import FileListDialog from "@/components/Dialog/FileListDialog.vue";
import {
onMounted,
ref,
@@ -390,6 +407,7 @@
import useUserStore from "@/store/modules/user";
import dayjs from "dayjs";
const userStore = useUserStore();
+ const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
// 琛ㄥ崟楠岃瘉瑙勫垯
const rules = {
@@ -441,12 +459,19 @@
trainingMode: "", // 鍩硅鏂瑰紡
placeTraining: "", // 鍩硅鍦扮偣
classHour: "", // 璇炬椂
+ createTime: "", // 鍒涘缓鏃堕棿
},
dialogVisible: false,
dialogTitle: "",
dialogType: "add",
viewDialogVisible: false,
currentKnowledge: {},
+ });
+ const formCreateTimeDate = computed({
+ get: () => (form.value.createTime ? String(form.value.createTime).split(" ")[0] : ""),
+ set: (value) => {
+ form.value.createTime = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
+ },
});
const {
@@ -608,7 +633,7 @@
name: "闄勪欢",
type: "text",
clickFun: row => {
- downLoadFile(row);
+ openFileDialog(row);
},
color: "#007AFF",
},
@@ -616,7 +641,7 @@
{
name: "缁撴灉鏄庣粏",
type: "text",
- // disabled: row => row.state !== 2,
+ disabled: row => row.state == 0,
clickFun: row => {
viewResultDetail(row);
},
@@ -770,22 +795,17 @@
form.value.principalMobile = selectedUser.phonenumber;
}
};
- /**
- * 涓嬭浇鏂囦欢
- *
- * @param row 涓嬭浇鏂囦欢鐨勭浉鍏充俊鎭璞�
- */
- const fileListRef = ref(null);
- const fileListDialogVisible = ref(false);
- const currentFileRow = ref(null);
- const downLoadFile = row => {
- currentFileRow.value = row;
- safeTrainingFileListPage({ safeTrainingId: row.id }).then(res => {
- if (fileListRef.value) {
- fileListRef.value.open(res.data.records);
- }
- });
- };
+
+ // 鎵撳紑闄勪欢寮圭獥
+ const recordId =ref(0)
+ const fileDialogVisible = ref(false)
+
+ // 鎵撳紑闄勪欢寮规
+ const openFileDialog = async (row) => {
+ recordId.value = row.id
+ fileDialogVisible.value = true
+ }
+
// 涓婁紶闄勪欢
const handleUpload = async () => {
if (!currentFileRow.value) {
@@ -834,6 +854,8 @@
// 閲嶆柊鍔犺浇鏂囦欢鍒楄〃
const listRes = await safeTrainingFileListPage({
safeTrainingId: currentFileRow.value.id,
+ current: filePagination.value.current,
+ size: filePagination.value.size,
});
if (listRes.code === 200 && fileListRef.value) {
const fileList = (listRes.data?.records || []).map(item => ({
@@ -843,6 +865,7 @@
...item,
}));
fileListRef.value.setList(fileList);
+ filePagination.value.total = listRes.data?.total || 0;
}
// 杩斿洖鏂版枃浠朵俊鎭�
resolve({
@@ -870,6 +893,31 @@
input.click();
});
};
+ const filePagination = ref({
+ current: 1,
+ size: 10,
+ total: 0,
+ });
+ const paginationSearch = async (page, size) => {
+ filePagination.value.current = page;
+ filePagination.value.size = size;
+ const listRes = await safeTrainingFileListPage({
+ safeTrainingId: currentFileRow.value.id,
+ current: filePagination.value.current,
+ size: filePagination.value.size,
+ });
+ if (listRes.code === 200) {
+ const fileList = (listRes.data?.records || []).map(item => ({
+ name: item.name,
+ url: item.url,
+ id: item.id,
+ ...item,
+ }));
+
+ fileListRef.value.setList(fileList);
+ filePagination.value.total = listRes.data?.total || 0;
+ }
+ };
// 鍒犻櫎闄勪欢
const handleFileDelete = async row => {
try {
@@ -880,6 +928,8 @@
if (currentFileRow.value && fileListRef.value) {
const listRes = await safeTrainingFileListPage({
safeTrainingId: currentFileRow.value.id,
+ current: filePagination.value.current,
+ size: filePagination.value.size,
});
if (listRes.code === 200) {
const fileList = (listRes.data?.records || []).map(item => ({
@@ -889,6 +939,7 @@
...item,
}));
fileListRef.value.setList(fileList);
+ filePagination.value.total = listRes.data?.total || 0;
}
}
return true; // 杩斿洖 true 琛ㄧず鍒犻櫎鎴愬姛锛岀粍浠朵細鏇存柊鍒楄〃
@@ -961,7 +1012,7 @@
const pagination = obj => {
page.value.current = obj.page;
page.value.size = obj.limit;
- handleQuery();
+ getList();
};
// 閫夋嫨鍙樺寲澶勭悊
@@ -995,6 +1046,7 @@
trainingMode: "", // 鍩硅鏂瑰紡
placeTraining: "", // 鍩硅鍦扮偣
classHour: "", // 璇炬椂
+ createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 鍒涘缓鏃堕棿
});
} else if (type === "edit" && row) {
dialogTitle.value = "缂栬緫鍩硅";
@@ -1012,6 +1064,7 @@
trainingMode: row.trainingMode, // 鍩硅鏂瑰紡
placeTraining: row.placeTraining, // 鍩硅鍦扮偣
classHour: row.classHour, // 璇炬椂
+ createTime: row.createTime || "", // 鍒涘缓鏃堕棿
});
}
dialogVisible.value = true;
@@ -1235,4 +1288,12 @@
:deep(.danger-row td) {
color: #e95a66 !important;
}
+ .classtitle {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ border-left: 4px solid #409eff;
+ padding-left: 12px;
+ margin-bottom: 12px;
+ }
</style>
--
Gitblit v1.9.3