Browse Source

fix: 注释不必要代码

feature-no-sdk
panyuyi 3 weeks ago
parent
commit
e44e7b66f0
  1. 8
      src/components.d.ts
  2. 147
      src/views/Main/Dike/components/fileManagement.vue
  3. 303
      src/views/Main/Dike/components/floodControlMaterials.vue
  4. 112
      src/views/Main/Sluice/components/fileManagement.vue

8
src/components.d.ts

@ -19,6 +19,8 @@ declare module 'vue' {
ElIcon: typeof import('element-plus/es')['ElIcon']
ElInput: typeof import('element-plus/es')['ElInput']
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElSelect: typeof import('element-plus/es')['ElSelect']
@ -26,6 +28,9 @@ declare module 'vue' {
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
Form: typeof import('./components/Form/index.vue')['default']
InputNumber: typeof import('./components/Input/input-number.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
@ -33,7 +38,4 @@ declare module 'vue' {
TableColumn: typeof import('./components/TableColumn/index.vue')['default']
Tree: typeof import('./components/Tree/index.vue')['default']
}
export interface ComponentCustomProperties {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
}

147
src/views/Main/Dike/components/fileManagement.vue

@ -5,82 +5,90 @@
<div class="search-item">
<span class="option-label">档案类型</span>
<el-select
v-model="selectedFileType"
placeholder="请选择档案类型"
clearable
style="width: 200px;"
v-model="selectedFileType"
placeholder="请选择档案类型"
clearable
style="width: 200px"
>
<el-option
v-for="item in scaleOptions"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
v-for="item in scaleOptions"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
/>
</el-select>
</div>
</div>
<div class="right-options">
<el-button type="primary" class="search-btn !ml-12" @click="handleSearch">查询</el-button>
<el-button @click="handleReset">重置</el-button>
<el-button
type="primary"
class="search-btn !ml-12"
@click="handleSearch"
>查询</el-button
>
<el-button @click="handleReset">重置</el-button>
</div>
</div>
<div class="table-container">
<el-table :data="tableData" border style="width: 100%;color: black">
<el-table :data="tableData" border style="width: 100%; color: black">
<el-table-column type="index" label="序号" width="120" align="center" />
<el-table-column prop="regulationsAttachment" label="档案类型" width="650" align="center" >
<el-table-column
prop="regulationsAttachment"
label="档案类型"
width="650"
align="center"
>
<template #default="{ row }">
{{projTypeFormat(row.regulationsAttachment)}}
{{ projTypeFormat(row.regulationsAttachment) }}
</template>
</el-table-column>
<el-table-column prop="planAttachment" label="档案附件" align="center">
<template #default="{ row }">
<div
style="cursor: pointer"
v-for="(item, index) in parseAttachments(row.planAttachment)"
:key="index"
@click="downloadFile(item, index)"
style="cursor: pointer"
v-for="(item, index) in parseAttachments(row.planAttachment)"
:key="index"
@click="downloadFile(item, index)"
>
<i class="el-icon-document"></i>
{{ item.name }}
<i
class="el-icon-download"
style="cursor: pointer"
></i>
<i class="el-icon-download" style="cursor: pointer"></i>
</div>
</template>
</el-table-column>
</el-table>
</div>
<el-dialog
v-model="dialogVisible"
title="档案详情"
width="50%"
>
<el-dialog v-model="dialogVisible" title="档案详情" width="50%">
<div class="detail-container">
<div class="detail-item">
<span class="detail-label">档案类型</span>
<span class="detail-value">{{ projTypeFormat(currentRow.regulationsAttachment) || '--' }}</span>
<span class="detail-value">{{
projTypeFormat(currentRow.regulationsAttachment) || "--"
}}</span>
</div>
<div class="detail-item">
<span class="detail-label">档案附件</span>
<div class="detail-value attachment-list">
<div
v-for="(item, index) in parseAttachments(currentRow.planAttachment)"
:key="index"
class="attachment-item"
v-for="(item, index) in parseAttachments(
currentRow.planAttachment
)"
:key="index"
class="attachment-item"
>
<i class="el-icon-document"></i>
{{ item.name }}
<i
class="el-icon-download"
style="cursor: pointer; margin-left: 8px;"
class="el-icon-download"
style="cursor: pointer; margin-left: 8px"
></i>
</div>
<div v-if="!parseAttachments(currentRow.planAttachment).length" class="no-attachments">
<div
v-if="!parseAttachments(currentRow.planAttachment).length"
class="no-attachments"
>
无附件
</div>
</div>
@ -97,25 +105,24 @@
</template>
<script setup lang="ts">
import {ref, onMounted, watch, reactive} from 'vue';
import type { PropType } from 'vue';
import {listAqjdxx, listDagl, listFzwz,getFileStream} from "~/api/dike";
import {getDicts} from "~/api/common";
import {getDictLabel} from "~/utils/dictUtils";
import { ref, onMounted, watch, reactive } from "vue";
import type { PropType } from "vue";
import { listAqjdxx, listDagl, listFzwz, getFileStream } from "~/api/dike";
import { getDicts } from "~/api/common";
import { getDictLabel } from "~/utils/dictUtils";
const props = defineProps({
resCode: {
type: String as PropType<string>
type: String as PropType<string>,
},
});
const scaleOptions=ref([])
const scaleOptions = ref([]);
function getType() {
getDicts("file_data_type").then((res) => {
scaleOptions.value = res || [];
});
}
// Data for the table
const tableData = ref([]);
@ -123,7 +130,7 @@ const tableData = ref([]);
const searchDate = ref([]);
function projTypeFormat(key: string) {
if (!key) return '--';
if (!key) return "--";
return getDictLabel(scaleOptions.value, key) || key;
}
@ -131,21 +138,21 @@ const dialogVisible = ref(false);
// Current row being viewed
const currentRow = reactive({
regulationsAttachment: '',
planAttachment: ''
regulationsAttachment: "",
planAttachment: "",
});
// View function
const handleView = (row: any) => {
console.log('View row:', row);
console.log("View row:", row);
// Copy row data to currentRow
currentRow.regulationsAttachment = row.regulationsAttachment || '';
currentRow.planAttachment = row.planAttachment || '';
currentRow.regulationsAttachment = row.regulationsAttachment || "";
currentRow.planAttachment = row.planAttachment || "";
// Show dialog
dialogVisible.value = true;
};
const selectedFileType = ref('');
const selectedFileType = ref("");
// View function
// const handleView = (row: any) => {
// console.log('View row:', row);
@ -157,21 +164,21 @@ const handleSearch = () => {
//
const handleReset = () => {
selectedFileType.value = '';
selectedFileType.value = "";
initDagl();
};
function downloadFile(item: string, index: number): void {
console.log(item,1111)
console.log(item, 1111);
const file = item;
console.log(file)
console.log(file);
handlePreview(item);
}
function parseAttachments(attachment: string): [] {
return JSON.parse(attachment);
}
function handlePreview(file:object): void {
function handlePreview(file: object): void {
getFileStream({ fileName: file.fileName }).then((res) => {
const blob = new Blob([res], {
type: "application/xlsx",
@ -186,24 +193,21 @@ function handlePreview(file:object): void {
});
}
// Fetch data based on resCode changes
watch(
() => props.resCode,
(newVal) => {
if (newVal) {
fetchSafetyData();
}
},
{ immediate: true }
);
// Fetch safety appraisal data
const fetchSafetyData = async () => {
};
// const fetchSafetyData = async () => {};
// // Fetch data based on resCode changes
// watch(
// () => props.resCode,
// (newVal) => {
// if (newVal) {
// fetchSafetyData();
// }
// },
// { immediate: true }
// );
function initDagl() {
const requestData: any = {
dikeCode: props.resCode,
};
@ -216,11 +220,10 @@ function initDagl() {
listDagl({
page: 1,
pageSize: 10,
data:requestData
data: requestData,
}).then((res) => {
if (res) {
tableData.value=res.records || [];
tableData.value = res.records || [];
}
});
}

303
src/views/Main/Dike/components/floodControlMaterials.vue

@ -5,45 +5,67 @@
<div class="search-item">
<span class="option-label">采购时间</span>
<el-date-picker
v-model="procurementTime"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="选择日期"
style="width: 240px"
v-model="procurementTime"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="选择日期"
style="width: 240px"
/>
</div>
<div class="search-item" style="margin-left: 10px">
<span class="option-label">物资名称</span>
<el-input
v-model="materialName"
placeholder="请输入物资名称"
style="width: 200px"
v-model="materialName"
placeholder="请输入物资名称"
style="width: 200px"
/>
</div>
</div>
<div class="right-options">
<el-button type="primary" class="search-btn !ml-12" @click="handleSearch">查询</el-button>
<el-button @click="handleReset">重置</el-button>
<el-button
type="primary"
class="search-btn !ml-12"
@click="handleSearch"
>查询</el-button
>
<el-button @click="handleReset">重置</el-button>
</div>
</div>
<div class="table-container">
<el-table :data="tableData" border style="width: 100%;color: black">
<el-table :data="tableData" border style="width: 100%; color: black">
<el-table-column type="index" label="序号" width="120" align="center" />
<el-table-column prop="materialName" label="物资名称" width="180" align="center" />
<el-table-column prop="materialNumber" label="物资数量" align="center" />
<el-table-column prop="materialType" label="物资类型" align="center" >
<el-table-column
prop="materialName"
label="物资名称"
width="180"
align="center"
/>
<el-table-column
prop="materialNumber"
label="物资数量"
align="center"
/>
<el-table-column prop="materialType" label="物资类型" align="center">
<template #default="scope">
{{projTypeFormat(scope.row.materialType)}}
{{ projTypeFormat(scope.row.materialType) }}
</template>
</el-table-column>
<el-table-column prop="procurementTime" label="采购时间" align="center" />
<el-table-column
prop="procurementTime"
label="采购时间"
align="center"
/>
<el-table-column prop="personName" label="负责人" align="center" />
<el-table-column label="操作" align="center" width="120">
<template #default="scope">
<el-button type="text" class="view-button" @click="handleView(scope.row)">查看</el-button>
<el-button
type="text"
class="view-button"
@click="handleView(scope.row)"
>查看</el-button
>
</template>
</el-table-column>
</el-table>
@ -51,7 +73,11 @@
<Teleport to="body">
<Transition name="dialog-fade">
<div v-if="dialogVisible" class="modern-dialog-overlay" @click="handleOverlayClick">
<div
v-if="dialogVisible"
class="modern-dialog-overlay"
@click="handleOverlayClick"
>
<div class="modern-dialog-container" @click.stop>
<div class="modern-dialog-header">
<div class="modern-dialog-title">
@ -60,9 +86,15 @@
</div>
<h3>防汛物资详情</h3>
</div>
<button class="modern-dialog-close" @click="dialogVisible = false">
<button
class="modern-dialog-close"
@click="dialogVisible = false"
>
<svg viewBox="0 0 24 24" width="24" height="24">
<path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
<path
fill="currentColor"
d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
/>
</svg>
</button>
</div>
@ -70,171 +102,179 @@
<div class="modern-dialog-content">
<div class="detail-card">
<div class="detail-item">
<div class="detail-content">
<span class="detail-label">物资名称</span>
<span class="detail-value">{{ currentRow.materialName || '--' }}</span>
<span class="detail-value">{{
currentRow.materialName || "--"
}}</span>
</div>
</div>
<div class="detail-item">
<div class="detail-content">
<span class="detail-label">负责人</span>
<span class="detail-value">{{ currentRow.personName || '--' }}</span>
<span class="detail-value">{{
currentRow.personName || "--"
}}</span>
</div>
</div>
<div class="detail-item">
<div class="detail-content">
<span class="detail-label">负责人电话</span>
<span class="detail-value">{{ currentRow.personPhone || '--' }}</span>
<span class="detail-value">{{
currentRow.personPhone || "--"
}}</span>
</div>
</div>
<div class="detail-item conclusion-item">
<div class="detail-content">
<span class="detail-label">负责人职务</span>
<div class="detail-value">{{ currentRow.personLevel || '--' }}</div>
<div class="detail-value">
{{ currentRow.personLevel || "--" }}
</div>
</div>
</div>
<div class="detail-item conclusion-item">
<div class="detail-content">
<span class="detail-label">物资数量</span>
<div class="detail-value">{{ currentRow.materialNumber || '--' }}</div>
<div class="detail-value">
{{ currentRow.materialNumber || "--" }}
</div>
</div>
</div>
<div class="detail-item conclusion-item">
<div class="detail-content">
<span class="detail-label">采购时间</span>
<div class="detail-value">{{ currentRow.procurementTime || '--' }}</div>
<div class="detail-value">
{{ currentRow.procurementTime || "--" }}
</div>
</div>
</div>
<div class="detail-item conclusion-item">
<div class="detail-content">
<span class="detail-label">物资种类</span>
<div class="detail-value">{{ projTypeFormat(currentRow.materialType) || '--' }}</div>
<div class="detail-value">
{{ projTypeFormat(currentRow.materialType) || "--" }}
</div>
</div>
</div>
<div class="detail-item conclusion-item">
<div class="detail-content">
<span class="detail-label">保质期</span>
<div class="detail-value">{{ currentRow.shelfLife || '--' }}</div>
<div class="detail-value">
{{ currentRow.shelfLife || "--" }}
</div>
</div>
</div>
</div>
</div>
<div class="modern-dialog-footer">
<el-button class="close-button" @click="dialogVisible = false">关闭</el-button>
<el-button class="close-button" @click="dialogVisible = false"
>关闭</el-button
>
</div>
</div>
</div>
</Transition>
</Teleport>
<!-- <el-dialog-->
<!-- v-model="dialogVisible"-->
<!-- title="物资详情"-->
<!-- width="50%"-->
<!-- :before-close="handleDialogClose"-->
<!-- >-->
<!-- <div class="detail-container">-->
<!-- <div class="detail-item">-->
<!-- <span class="detail-label">物资名称</span>-->
<!-- <span class="detail-value">{{ currentRow.materialName || '&#45;&#45;' }}</span>-->
<!-- </div>-->
<!-- <div class="detail-item">-->
<!-- <span class="detail-label">物资数量</span>-->
<!-- <span class="detail-value">{{ currentRow.materialNumber || '&#45;&#45;' }}</span>-->
<!-- </div>-->
<!-- <div class="detail-item">-->
<!-- <span class="detail-label">物资类型</span>-->
<!-- <span class="detail-value">{{ projTypeFormat(currentRow.materialType) || '&#45;&#45;' }}</span>-->
<!-- </div>-->
<!-- <div class="detail-item">-->
<!-- <span class="detail-label">采购时间</span>-->
<!-- <span class="detail-value">{{ currentRow.procurementTime || '&#45;&#45;' }}</span>-->
<!-- </div>-->
<!-- <div class="detail-item">-->
<!-- <span class="detail-label">负责人</span>-->
<!-- <span class="detail-value">{{ currentRow.personName || '&#45;&#45;' }}</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <template #footer>-->
<!-- <div class="dialog-footer">-->
<!-- <el-button @click="dialogVisible = false">关闭</el-button>-->
<!-- </div>-->
<!-- </template>-->
<!-- </el-dialog>-->
<!-- <el-dialog-->
<!-- v-model="dialogVisible"-->
<!-- title="物资详情"-->
<!-- width="50%"-->
<!-- :before-close="handleDialogClose"-->
<!-- >-->
<!-- <div class="detail-container">-->
<!-- <div class="detail-item">-->
<!-- <span class="detail-label">物资名称</span>-->
<!-- <span class="detail-value">{{ currentRow.materialName || '&#45;&#45;' }}</span>-->
<!-- </div>-->
<!-- <div class="detail-item">-->
<!-- <span class="detail-label">物资数量</span>-->
<!-- <span class="detail-value">{{ currentRow.materialNumber || '&#45;&#45;' }}</span>-->
<!-- </div>-->
<!-- <div class="detail-item">-->
<!-- <span class="detail-label">物资类型</span>-->
<!-- <span class="detail-value">{{ projTypeFormat(currentRow.materialType) || '&#45;&#45;' }}</span>-->
<!-- </div>-->
<!-- <div class="detail-item">-->
<!-- <span class="detail-label">采购时间</span>-->
<!-- <span class="detail-value">{{ currentRow.procurementTime || '&#45;&#45;' }}</span>-->
<!-- </div>-->
<!-- <div class="detail-item">-->
<!-- <span class="detail-label">负责人</span>-->
<!-- <span class="detail-value">{{ currentRow.personName || '&#45;&#45;' }}</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <template #footer>-->
<!-- <div class="dialog-footer">-->
<!-- <el-button @click="dialogVisible = false">关闭</el-button>-->
<!-- </div>-->
<!-- </template>-->
<!-- </el-dialog>-->
</div>
</template>
<script setup lang="ts">
import {ref, onMounted, watch, reactive} from 'vue';
import type { PropType } from 'vue';
import {listAqjdxx, listFzwz} from "~/api/dike";
import {getDictLabel} from "~/utils/dictUtils";
import {getDicts} from "~/api/common";
import { ref, onMounted, watch, reactive } from "vue";
import type { PropType } from "vue";
import { listAqjdxx, listFzwz } from "~/api/dike";
import { getDictLabel } from "~/utils/dictUtils";
import { getDicts } from "~/api/common";
const handleOverlayClick = (e: MouseEvent) => {
dialogVisible.value = false;
};
const props = defineProps({
resCode: {
type: String as PropType<string>
type: String as PropType<string>,
},
});
const dateRange = ref([]);
const materialName = ref('');
const responsiblePerson = ref('');
const procurementTime=ref(null)
const materialName = ref("");
const responsiblePerson = ref("");
const procurementTime = ref(null);
// Dialog visibility
const dialogVisible = ref(false);
// Current row being viewed
const currentRow = reactive({
materialName: '',
materialNumber: '',
personLevel:'',
personPhone:'',
shelfLife:'',
materialType: '',
procurementTime: '',
personName: ''
materialName: "",
materialNumber: "",
personLevel: "",
personPhone: "",
shelfLife: "",
materialType: "",
procurementTime: "",
personName: "",
});
const handleReset = () => {
procurementTime.value = null;
materialName.value = '';
responsiblePerson.value = '';
materialName.value = "";
responsiblePerson.value = "";
initFxwz();
};
// View function
const handleView = (row: any) => {
console.log('View row:', row);
console.log("View row:", row);
// Copy row data to currentRow
currentRow.materialName = row.materialName || '';
currentRow.materialNumber = row.materialNumber || '';
currentRow.materialType = row.materialType || '';
currentRow.procurementTime = row.procurementTime || '';
currentRow.personName = row.personName || '';
currentRow.personPhone=row.personPhone||'',
currentRow.personLevel=row.personLevel||'',
currentRow.shelfLife=row.shelfLife||''
currentRow.materialName = row.materialName || "";
currentRow.materialNumber = row.materialNumber || "";
currentRow.materialType = row.materialType || "";
currentRow.procurementTime = row.procurementTime || "";
currentRow.personName = row.personName || "";
(currentRow.personPhone = row.personPhone || ""),
(currentRow.personLevel = row.personLevel || ""),
(currentRow.shelfLife = row.shelfLife || "");
// Show dialog
dialogVisible.value = true;
};
const typesMaterials=ref([])
const typesMaterials = ref([]);
// Handle dialog close
const handleDialogClose = () => {
dialogVisible.value = false;
@ -242,11 +282,11 @@ const handleDialogClose = () => {
function getType() {
getDicts("types_materials").then((res) => {
typesMaterials.value = res || [];
console.log(typesMaterials.value,'11111')
console.log(typesMaterials.value, "11111");
});
}
function projTypeFormat(key: string) {
if (!key) return '--';
if (!key) return "--";
return getDictLabel(typesMaterials.value, key) || key;
}
@ -262,31 +302,27 @@ const searchDate = ref([]);
// View function
// Fetch data based on resCode changes
watch(
() => props.resCode,
(newVal) => {
if (newVal) {
fetchSafetyData();
}
},
{ immediate: true }
);
// Fetch safety appraisal data
const fetchSafetyData = async () => {
};
// const fetchSafetyData = async () => {};
// // Fetch data based on resCode changes
// watch(
// () => props.resCode,
// (newVal) => {
// if (newVal) {
// fetchSafetyData();
// }
// },
// { immediate: true }
// );
function initFxwz() {
const requestData: any = {
dikeCode: props.resCode,
};
if (procurementTime.value){
requestData.procurementTime=procurementTime.value;
if (procurementTime.value) {
requestData.procurementTime = procurementTime.value;
}
// Add search parameters if they exist
if (materialName.value) {
@ -302,11 +338,10 @@ function initFxwz() {
listFzwz({
page: 1,
pageSize: 10,
data:requestData
data: requestData,
}).then((res) => {
if (res) {
tableData.value=res.records || [];
tableData.value = res.records || [];
}
});
}
@ -397,7 +432,9 @@ onMounted(() => {
.dialog-fade-enter-active,
.dialog-fade-leave-active {
transition: opacity 0.3s ease, transform 0.3s ease;
transition:
opacity 0.3s ease,
transform 0.3s ease;
}
.dialog-fade-enter-from,
@ -509,7 +546,9 @@ onMounted(() => {
margin-bottom: 5px;
padding-bottom: 5px;
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
transition: transform 0.2s, box-shadow 0.2s;
transition:
transform 0.2s,
box-shadow 0.2s;
&:last-child {
margin-bottom: 0;
@ -575,14 +614,16 @@ onMounted(() => {
border-top: 1px solid #e9ecef;
.close-button {
background: linear-gradient(135deg, #2C7EF8 0%, #2C5EF8 100%);
background: linear-gradient(135deg, #2c7ef8 0%, #2c5ef8 100%);
border: none;
color: white;
padding: 10px 24px;
border-radius: 6px;
font-weight: 500;
cursor: pointer;
transition: transform 0.15s, box-shadow 0.15s;
transition:
transform 0.15s,
box-shadow 0.15s;
&:hover {
transform: translateY(-2px);

112
src/views/Main/Sluice/components/fileManagement.vue

@ -5,61 +5,67 @@
<div class="search-item">
<span class="option-label">档案类型</span>
<el-select
v-model="selectedFileType"
placeholder="请选择档案类型"
clearable
style="width: 200px;"
v-model="selectedFileType"
placeholder="请选择档案类型"
clearable
style="width: 200px"
>
<el-option
v-for="item in scaleOptions"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
v-for="item in scaleOptions"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
/>
</el-select>
</div>
</div>
<div class="right-options">
<el-button type="primary" class="search-btn !ml-12" @click="handleSearch">查询</el-button>
<el-button @click="handleReset">重置</el-button>
<el-button
type="primary"
class="search-btn !ml-12"
@click="handleSearch"
>查询</el-button
>
<el-button @click="handleReset">重置</el-button>
</div>
</div>
<div class="table-container">
<el-table :data="tableData" border style="width: 100%;color: black">
<el-table :data="tableData" border style="width: 100%; color: black">
<el-table-column type="index" label="序号" width="120" align="center" />
<el-table-column prop="regulationsAttachment" label="档案类型" width="650" align="center" >
<el-table-column
prop="regulationsAttachment"
label="档案类型"
width="650"
align="center"
>
<template #default="{ row }">
{{projTypeFormat(row.regulationsAttachment)}}
{{ projTypeFormat(row.regulationsAttachment) }}
</template>
</el-table-column>
<el-table-column prop="planAttachment" label="档案附件" align="center">
<template #default="{ row }">
<div
v-for="(item, index) in parseAttachments(row.planAttachment)"
:key="index"
v-for="(item, index) in parseAttachments(row.planAttachment)"
:key="index"
>
<i class="el-icon-document"></i>
{{ item.name }}
<i
class="el-icon-download"
style="cursor: pointer"
></i>
<i class="el-icon-download" style="cursor: pointer"></i>
</div>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue';
import type { PropType } from 'vue';
import {listDaglsz} from "~/api/sluice";
import {getDicts} from "~/api/common";
import {getDictLabel} from "~/utils/dictUtils";
import { ref, onMounted, watch } from "vue";
import type { PropType } from "vue";
import { listDaglsz } from "~/api/sluice";
import { getDicts } from "~/api/common";
import { getDictLabel } from "~/utils/dictUtils";
// import {getFileStream} from "~/api/common"; //
interface FileItem {
@ -70,12 +76,12 @@ interface FileItem {
const props = defineProps({
resCode: {
type: String as PropType<string>
type: String as PropType<string>,
},
});
//
const selectedFileType = ref('');
const selectedFileType = ref("");
const scaleOptions = ref([]);
function getType() {
@ -100,17 +106,17 @@ const handleSearch = () => {
initDagl();
};
const handleView = (row: any) => {
console.log('View row:', row);
console.log("View row:", row);
// Copy row data to currentRow
currentRow.regulationsAttachment = row.regulationsAttachment || '';
currentRow.planAttachment = row.planAttachment || '';
currentRow.regulationsAttachment = row.regulationsAttachment || "";
currentRow.planAttachment = row.planAttachment || "";
// Show dialog
dialogVisible.value = true;
};
//
const handleReset = () => {
selectedFileType.value = '';
selectedFileType.value = "";
initDagl();
};
@ -129,7 +135,7 @@ function parseAttachments(attachment: string): FileItem[] {
try {
return JSON.parse(attachment);
} catch (error) {
console.error('Error parsing attachments:', error);
console.error("Error parsing attachments:", error);
return [];
}
}
@ -150,20 +156,20 @@ function handlePreview(file: { fileName: string; name: string }): void {
}
// Fetch data based on resCode changes
watch(
() => props.resCode,
(newVal) => {
if (newVal) {
fetchSafetyData();
}
},
{ immediate: true }
);
// watch(
// () => props.resCode,
// (newVal) => {
// if (newVal) {
// fetchSafetyData();
// }
// },
// { immediate: true }
// );
// // Fetch safety appraisal data
// const fetchSafetyData = async () => {
// Fetch safety appraisal data
const fetchSafetyData = async () => {
};
// };
function initDagl() {
//
@ -180,13 +186,15 @@ function initDagl() {
page: 1,
pageSize: 10,
data: requestData,
}).then((res) => {
if (res) {
tableData.value = res.records || [];
}
}).catch(error => {
console.error("API error:", error);
});
})
.then((res) => {
if (res) {
tableData.value = res.records || [];
}
})
.catch((error) => {
console.error("API error:", error);
});
}
onMounted(() => {

Loading…
Cancel
Save