This commit is contained in:
2025-09-09 10:48:54 +08:00
12 changed files with 421 additions and 132 deletions

View File

@ -5,7 +5,7 @@ VITE_APP_TITLE = 煤科建管平台
VITE_APP_ENV = 'development'
# 开发环境
VITE_APP_BASE_API = 'http://192.168.110.180:8899'
VITE_APP_BASE_API = 'http://192.168.110.149:8899'
# 李陈杰 209
# VITE_APP_BASE_API = 'http://192.168.110.209:8899'
# 曾涛

BIN
public/xx.xlsx Normal file

Binary file not shown.

View File

@ -98,3 +98,18 @@ export const cashTotal = () => {
method: 'get'
});
};
//安全天数
export const getSafetyDay = (projectId) => {
return request({
url: '/money/big/screen/safetyDay/' + projectId,
method: 'get'
});
};
//安全天数
export const getWeather = (projectId) => {
return request({
url: '/money/big/screen/weather/' + projectId,
method: 'get'
});
};

View File

@ -61,3 +61,22 @@ export const delSupplierInput = (id: string | number | Array<string | number>) =
method: 'delete'
});
};
//导入供商入库
export const leadingIn = (formData: FormData, projectId) => {
return request({
url: '/supplierInput/supplierInput/import?projectId=' + projectId,
method: 'post',
data: formData,
headers: {
'Content-Type': 'multipart/form-data'
}
});
};
//导入供商出库
export const leadingOut = () => {
return request({
url: '/supplierInput/supplierInput/export',
method: 'post'
});
};

View File

@ -19,8 +19,12 @@
<!-- 左侧天气图标 + 日期文字 -->
<div class="left-section">
<div class="weather-list" @mouseenter="requestPause" @mouseleave="resumeScroll">
<div v-for="(item, i) in weatherList" :key="i" class="weather-item"
:style="{ transform: `translateY(-${offsetY}px)`, transition: transition }">
<div
v-for="(item, i) in weatherList"
:key="i"
class="weather-item"
:style="{ transform: `translateY(-${offsetY}px)`, transition: transition }"
>
<img :src="`../../../src/assets/images/${item.icon}.png`" alt="" />
<div>{{ item.weather }}{{ item.tempMin }}°/{{ item.tempMax }}°</div>
<div>{{ item.week }}({{ item.date }})</div>
@ -78,15 +82,15 @@ const props = defineProps({
type: Boolean,
default: false
}
})
});
const emit = defineEmits(['changePage'])
const emit = defineEmits(['changePage']);
const safetyDay = ref<number>(0);
const weatherList = ref<Weather[]>([])
const timer = ref<number | null>(0)
const offsetY = ref<number>(0)
const curIndex = ref(0)
const weatherList = ref<Weather[]>([]);
const timer = ref<number | null>(0);
const offsetY = ref<number>(0);
const curIndex = ref(0);
const transition = ref('transform 0.5s ease');
const pendingPause = ref(false);
@ -106,18 +110,16 @@ function judgeDayOrNight(sunRise: string, sunSet: string) {
const now = new Date();
const currentMinutes = now.getHours() * 60 + now.getMinutes();
// true 白天 false 夜晚
return currentMinutes >= sunRiseMinutes && currentMinutes <= sunSetMinutes
? true
: false;
return currentMinutes >= sunRiseMinutes && currentMinutes <= sunSetMinutes ? true : false;
}
/**
* 设置天气周期滑动
*/
const setWeatherScroll = () => {
curIndex.value += 1
curIndex.value += 1;
transition.value = 'transform 0.3s ease';
offsetY.value = curIndex.value * 60
offsetY.value = curIndex.value * 60;
if (curIndex.value === weatherList.value.length - 1) {
setTimeout(() => {
@ -126,7 +128,7 @@ const setWeatherScroll = () => {
offsetY.value = 0;
}, 350);
}
}
};
function startScroll() {
if (timer.value) clearInterval(timer.value);
@ -135,57 +137,56 @@ function startScroll() {
function requestPause() {
if (timer.value) {
clearInterval(timer.value)
timer.value = null
clearInterval(timer.value);
timer.value = null;
}
pendingPause.value = true;
}
function resumeScroll() {
console.log('resumeScroll')
console.log('resumeScroll');
pendingPause.value = false;
startScroll();
}
onMounted(() => {
/**
* 获取安全生产天数
*/
getScreenSafetyDay(props.projectId).then(res => {
const { data, code } = res
getScreenSafetyDay(props.projectId).then((res) => {
const { data, code } = res;
if (code === 200) {
safetyDay.value = data.safetyDay;
}
})
});
/**
* 获取近三天天气
*/
getScreenWeather(props.projectId).then(res => {
const { data, code } = res
getScreenWeather(props.projectId).then((res) => {
const { data, code } = res;
if (code === 200) {
data.forEach(item => {
data.forEach((item) => {
if (judgeDayOrNight(item.sunRise, item.sunSet)) {
item.weather = item.dayStatus
item.icon = item.dayIcon
item.weather = item.dayStatus;
item.icon = item.dayIcon;
} else {
item.weather = item.nightStatus
item.icon = item.nightIcon
item.weather = item.nightStatus;
item.icon = item.nightIcon;
}
})
weatherList.value = data
});
weatherList.value = data;
// 多添加第一项 实现无缝衔接
weatherList.value = [...weatherList.value, weatherList.value[0]]
startScroll()
weatherList.value = [...weatherList.value, weatherList.value[0]];
startScroll();
}
})
});
});
onUnmounted(() => {
if (timer.value) {
clearInterval(timer.value)
clearInterval(timer.value);
}
})
});
</script>
<style scoped lang="scss">

View File

@ -140,9 +140,9 @@ const createEarth = () => {
// 加载底图
loadBaseMap(earthInstance.viewer);
// 可以取消注释以下代码来设置初始视角
// // 可以取消注释以下代码来设置初始视角
// YJ.Global.flyTo(earthInstance, view);
// YJ.Global.setDefaultView(earthInstance.viewer, view)
// YJ.Global.setDefaultView(earthInstance.viewer, view);
// 地球创建完成后获取并渲染轨迹数据
getTrajectoryData();

View File

@ -6,7 +6,7 @@
</div>
<div style="font-size: 12px; padding-left: 10px">安全生产天数</div>
<div class="header_left_text">
1,235
{{ safetyDay }}
<span style="font-size: 12px"></span>
</div>
</div>
@ -16,14 +16,20 @@
</div>
<div class="right">
<div class="top-bar">
<!-- 左侧天气图标 + 日期文字 -->
<!-- 左侧天气轮播区域 -->
<div class="left-section">
<img src="@/assets/large/weather.png" alt="天气图标" />
<span>
<span>多云 9°/18°</span>
<span style="padding-left: 20px"> {{ week[date.week] }} ({{ date.ymd }})</span>
</span>
<div class="weather-list" @mouseenter="requestPause" @mouseleave="resumeScroll">
<div
v-for="(item, i) in weatherList"
:key="i"
class="weather-item"
:style="{ transform: `translateY(-${offsetY}px)`, transition: transition }"
>
<img :src="`../../../src/assets/images/${item.icon}.png`" alt="" />
<div>{{ item.weather }}{{ item.tempMin }}°/{{ item.tempMax }}°</div>
<div>{{ item.week }}({{ item.date }})</div>
</div>
</div>
</div>
<!-- 分割线 -->
<div class="divider">
@ -41,38 +47,164 @@
</template>
<script setup lang="ts">
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { useUserStoreHook } from '@/store/modules/user';
import { getSafetyDay, getWeather } from '@/api/largeScreen/index';
interface WeatherData {
date: string;
week: string;
tempMax: string;
tempMin: string;
sunRise: string;
sunSet: string;
dayStatus: string;
dayIcon: string;
nightStatus: string;
nightIcon: string;
}
// 星期映射
const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
// 日期数据
const date = ref({
ymd: '',
hms: '',
week: 0
});
// 安全生产天数
const safetyDay = ref('');
// 用户存储
const userStore = useUserStoreHook();
const currentProject = computed(() => userStore.selectedProject);
// 天气轮播相关变量
const weatherList = ref<WeatherData[]>([]);
const offsetY = ref<number>(0);
const curIndex = ref(0);
const transition = ref('transform 0.5s ease');
const timer = ref<number | null>(0);
const pendingPause = ref(false);
// 判断当前时间是白天/夜晚
function judgeDayOrNight(sunRise: string, sunSet: string) {
const timeToMinutes = (timeStr: string) => {
const [hours, minutes] = timeStr.split(':').map(Number);
return isNaN(hours) || isNaN(minutes) ? 0 : hours * 60 + minutes;
};
const sunRiseMinutes = timeToMinutes(sunRise);
const sunSetMinutes = timeToMinutes(sunSet);
const now = new Date();
const currentMinutes = now.getHours() * 60 + now.getMinutes();
return currentMinutes >= sunRiseMinutes && currentMinutes <= sunSetMinutes;
}
// 天气轮播逻辑每5秒切换一次
const setWeatherScroll = () => {
curIndex.value += 1;
transition.value = 'transform 0.3s ease';
offsetY.value = curIndex.value * 60; // 每个天气项高度60px需和样式一致
// 轮播到最后一项时,无缝衔接回第一项
if (curIndex.value === weatherList.value.length - 1) {
setTimeout(() => {
transition.value = 'none';
curIndex.value = 0;
offsetY.value = 0;
}, 350);
}
};
// 启动轮播定时器
function startScroll() {
if (timer.value) clearInterval(timer.value);
timer.value = window.setInterval(setWeatherScroll, 5000) as unknown as number;
}
// 鼠标悬浮暂停轮播
function requestPause() {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
pendingPause.value = true;
}
// 鼠标离开恢复轮播
function resumeScroll() {
pendingPause.value = false;
startScroll();
}
// 设置实时时间
const setTime = () => {
let date1 = new Date();
let year: any = date1.getFullYear();
let month: any = date1.getMonth() + 1;
let day: any = date1.getDate();
let hours: any = date1.getHours();
if (hours < 10) {
hours = '0' + hours;
}
let minutes: any = date1.getMinutes();
if (minutes < 10) {
minutes = '0' + minutes;
}
let seconds: any = date1.getSeconds();
if (seconds < 10) {
seconds = '0' + seconds;
}
date.value.ymd = year + '-' + month + '-' + day;
date.value.hms = hours + ':' + minutes + ':' + seconds;
const date1 = new Date();
const year = date1.getFullYear();
const month = date1.getMonth() + 1;
const day = date1.getDate();
const hours = date1.getHours().toString().padStart(2, '0');
const minutes = date1.getMinutes().toString().padStart(2, '0');
const seconds = date1.getSeconds().toString().padStart(2, '0');
date.value.ymd = `${year}-${month}-${day}`;
date.value.hms = `${hours}:${minutes}:${seconds}`;
date.value.week = date1.getDay();
};
// 添加定时器,每秒更新一次时间
const timer = setInterval(setTime, 1000);
// 获取天气数据
const getWeatherData = async () => {
try {
if (currentProject.value?.id) {
const res = await getWeather(currentProject.value.id);
if (res.code === 200 && res.data && res.data.length > 0) {
weatherList.value = res.data;
// 处理每一天的天气(白天/夜晚切换图标和状态)
weatherList.value.forEach((item) => {
const isDay = judgeDayOrNight(item.sunRise, item.sunSet);
item.status = isDay ? item.dayStatus : item.nightStatus;
item.icon = isDay ? item.dayIcon : item.nightIcon;
item.tempRange = `${item.tempMin}°/${item.tempMax}°`;
});
// 复制第一项实现无缝轮播
weatherList.value = [...weatherList.value, weatherList.value[0]];
startScroll(); // 数据加载后启动轮播
}
}
} catch (error) {
console.error('获取天气数据失败:', error);
}
};
// 获取安全生产天数
const getSafetyDays = async () => {
try {
if (currentProject.value?.id) {
const res = await getSafetyDay(currentProject.value.id);
if (res.code === 200 && res.data) {
safetyDay.value = res.data.safetyDay.toString();
}
}
} catch (error) {
console.error('获取安全生产天数失败:', error);
}
};
// 组件挂载时初始化
onMounted(() => {
setTime(); // 初始化时间
getSafetyDays();
getWeatherData();
// 时间定时器(每秒更新)
window.setInterval(setTime, 1000);
});
// 组件卸载时清除定时器
onUnmounted(() => {
clearInterval(timer);
if (timer.value) {
clearInterval(timer.value);
}
});
</script>
@ -86,41 +218,47 @@ onUnmounted(() => {
grid-template-columns: 1fr 1fr 1fr;
color: #fff;
}
.header_left {
display: flex;
align-items: center;
.header_left_img {
width: 48px;
height: 48px;
box-sizing: border-box;
// padding-right: 10px;
}
.header_left_text {
font-weight: 500;
text-shadow: 0px 1.24px 6.21px rgba(25, 179, 250, 1);
}
}
.header_right {
width: 100%;
height: 100%;
display: flex;
}
.title {
color: #fff;
font-family: 'AlimamaShuHeiTi', sans-serif;
text-align: center;
}
.title > div:first-child {
/* 第一个子元素的样式 */
font-size: 38px;
// font-weight: 300;
letter-spacing: 0.1em;
}
.title > div:last-child {
/* 最后一个子元素的样式 */
font-size: 14px;
letter-spacing: 0.3em; /* 调整这个值来控制间距大小 */
}
.right {
width: 100%;
height: 100%;
display: flex;
}
/* 顶部栏容器Flex 水平布局 + 垂直居中 */
.top-bar {
width: 100%;
@ -128,27 +266,44 @@ onUnmounted(() => {
display: flex;
align-items: center;
justify-content: flex-end;
// background-color: #1e2128;
color: #fff;
padding: 8px 16px;
font-size: 14px;
}
/* 左侧区域(天气 + 日期):自身也用 Flex 水平排列,确保元素在一行 */
.left-section {
height: 100%;
display: flex;
align-items: center;
// margin-right: auto; /* 让右侧元素(管理系统)居右 */
.weather-list {
height: 60px;
overflow: hidden;
.weather-item {
height: 60px;
line-height: 60px;
display: flex;
align-items: center;
& > div:last-child {
margin-left: 10px;
}
.left-section img {
width: 32px;
height: 32px;
margin-right: 8px; /* 图标与文字间距 */
img {
width: 50px;
height: 50px;
}
}
}
}
/* 分割线(视觉分隔,可根据需求调整样式) */
.divider {
display: grid;
grid-template-rows: 1fr 1fr;
height: 100%; /* 根据需要调整高度 */
gap: 2px;
padding: 14px 10px;
}
@ -165,16 +320,27 @@ onUnmounted(() => {
background: #19b5fb;
align-self: end;
}
/* 右侧区域(管理系统):图标 + 文字水平排列 */
.right-section {
display: flex;
align-items: center;
font-family: 'AlimamaShuHeiTi', sans-serif;
font-size: 20px;
cursor: pointer;
}
.right-section img {
width: 20px;
height: 20px;
margin-right: 6px; /* 图标与文字间距 */
margin-right: 6px;
/* 图标与文字间距 */
}
.change {
display: grid;
place-items: center;
margin-right: 10px;
cursor: pointer;
}
</style>

View File

@ -38,7 +38,6 @@
</template>
</el-card>
<!-- 本地数据懒加载表格 -->
<el-table
:data="state.tableData"
v-loading="state.loading.list"
@ -52,15 +51,16 @@
:load="loadLocalChildNodes"
@expand-change="handleExpandChange"
>
<!-- 1. 普通列添加 align="center" 实现表头+单元格居中 -->
<el-table-column align="center" prop="num" label="编号" />
<el-table-column prop="name" label="工程或费用名称" width="180" />
<el-table-column prop="unit" label="单位" />
<el-table-column prop="specification" label="规格型号" width="80" />
<el-table-column prop="quantity" label="数量" width="100" />
<el-table-column prop="batchNumber" label="批次号" width="200" />
<el-table-column align="center" prop="name" label="工程或费用名称" width="180" />
<el-table-column align="center" prop="unit" label="单位" />
<el-table-column align="center" prop="specification" label="规格型号" width="80" />
<el-table-column align="center" prop="quantity" label="数量" width="100" />
<el-table-column align="center" prop="batchNumber" label="批次号" width="200" />
<!-- 优化的输入框列 -->
<el-table-column prop="brand" label="品牌">
<!-- 2. 带输入框的列添加 align="center" + 输入框内联样式 text-align: center -->
<el-table-column align="center" prop="brand" label="品牌">
<template #default="{ row }">
<el-input
v-model.lazy="row.brand"
@ -70,11 +70,12 @@
clearable
:key="`brand-${row.id}`"
@change="handleInputChange(row, 'brand')"
style="text-align: center"
/>
</template>
</el-table-column>
<el-table-column prop="texture" label="材质">
<el-table-column align="center" prop="texture" label="材质">
<template #default="{ row }">
<el-input
v-model.lazy="row.texture"
@ -84,6 +85,7 @@
clearable
:key="`texture-${row.id}`"
@change="handleInputChange(row, 'texture')"
style="text-align: center"
/>
</template>
</el-table-column>

View File

@ -73,12 +73,12 @@
</el-row>
</el-form> -->
<el-table :data="tableData" v-loading="loading" row-key="id" border>
<el-table-column prop="num" label="编号" />
<el-table-column prop="name" label="名称" />
<el-table-column prop="specification" label="规格" />
<el-table-column prop="unit" label="单位" />
<el-table-column prop="quantity" label="数量" />
<el-table-column prop="remark" label="备注" />
<el-table-column align="center" prop="num" label="编号" />
<el-table-column align="center" prop="name" label="名称" />
<el-table-column align="center" prop="specification" label="规格" />
<el-table-column align="center" prop="unit" label="单位" />
<el-table-column align="center" prop="quantity" label="数量" />
<el-table-column align="center" prop="remark" label="备注" />
</el-table>
</div>
</el-card>
@ -214,7 +214,7 @@ const getInfo = () => {
console.log('res.data', masterDataRes);
Object.assign(form.value, masterDataRes?.data[0]);
// console.log('form', form.value);
tableData.value = res.rows.reverse();//翻转
tableData.value = res.rows; //正序显示
loading.value = false;
buttonLoading.value = false;
});
@ -319,9 +319,7 @@ onMounted(() => {
.el-input__inner,
.el-select .el-input__inner {
border-radius: 4px;
transition:
border-color 0.2s,
box-shadow 0.2s;
transition: border-color 0.2s, box-shadow 0.2s;
&:focus {
border-color: var(--primary-light);
@ -331,9 +329,7 @@ onMounted(() => {
.el-textarea__inner {
border-radius: 4px;
transition:
border-color 0.2s,
box-shadow 0.2s;
transition: border-color 0.2s, box-shadow 0.2s;
&:focus {
border-color: var(--primary-light);

View File

@ -74,10 +74,10 @@
<el-table-column label="设计面积(亩)" align="center" prop="designArea" width="180" />
<el-table-column label="责任人" align="center" prop="responsiblePerson" />
<el-table-column label="预计完成时间" align="center" prop="expectedFinishDate" width="180"> </el-table-column>
<el-table-column label="流转状态" align="center" prop="transferStatusName" />
<el-table-column label="流转状态" align="center" prop="type" />
<el-table-column label="已流转面积(亩)" align="center" prop="transferArea" width="180" />
<el-table-column label="不流转数据" align="center" prop="noTrans" width="180" />
<el-table-column label="未流转数据" align="center" prop="noTransferAea" width="180" />
<el-table-column label="不流转面积(亩)" align="center" prop="noTrans" width="180" />
<el-table-column label="未流转面积(亩)" align="center" prop="noTransferAea" width="180" />
<el-table-column label="流转比例(%)" align="center" width="180">
<template #default="scope">
{{ scope.row.transferArea && scope.row.designArea ? ((scope.row.transferArea / scope.row.designArea) * 100).toFixed(2) : '0.00' }}
@ -120,7 +120,7 @@
</div>
<div class="summary-item transfer-area">
<div class="summary-content">
<span class="summary-label">已流转面积</span>
<span class="summary-label">已流转面积()</span>
<span class="summary-value">{{ sonSummaryInfo.totalTransferArea }} </span>
</div>
<el-icon class="summary-icon" :size="50" color="#3176ff">
@ -129,7 +129,7 @@
</div>
<div class="summary-item non-transfer-area">
<div class="summary-content">
<span class="summary-label">不流转面积</span>
<span class="summary-label">不流转面积()</span>
<span class="summary-value">{{ sonSummaryInfo.totalNonTransferArea }} </span>
</div>
<el-icon class="summary-icon" :size="50" color="#3176ff">
@ -138,7 +138,7 @@
</div>
<div class="summary-item remaining-area">
<div class="summary-content">
<span class="summary-label">未流转面积</span>
<span class="summary-label">未流转面积()</span>
<span class="summary-value">{{ sonSummaryInfo.remainingArea }} </span>
</div>
<el-icon class="summary-icon" :size="50" color="#3176ff">
@ -292,7 +292,7 @@
<el-form-item label="已流转面积(亩)" prop="areaValue">
<el-input v-model="sonForm.areaValue" type="number" placeholder="请输入已流转面积" @input="calcSonTransferRatio" />
<div style="color: #ff4d4f; font-size: 12px; margin-top: 4px">
{{ sonForm.areaValue && sonForm.transferStatus == '1' ? `提示:已流转面积不能超过设计面积 ${sonForm.designArea}` : '' }}
{{ sonForm.areaValue && sonForm.transferStatus == '1' ? `提示:当前剩余${sonSummaryInfo.remainingArea}` : '' }}
</div>
</el-form-item>
</el-col>
@ -325,7 +325,7 @@
<el-form-item label="不流转面积(亩)" prop="areaValue">
<el-input v-model="sonForm.areaValue" type="number" placeholder="请输入不流转面积" />
<div style="color: #ff4d4f; font-size: 12px; margin-top: 4px">
{{ sonForm.areaValue && sonForm.transferStatus == '2' ? `提示:不流转面积不能超过设计面积 ${sonForm.designArea}` : '' }}
{{ sonForm.areaValue && sonForm.transferStatus == '2' ? `提示:当前剩余 ${sonSummaryInfo.remainingArea}` : '' }}
</div>
</el-form-item>
</el-col>
@ -751,6 +751,16 @@ const sonRules = {
projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }],
parentId: [{ required: true, message: '父级ID不能为空', trigger: 'blur' }],
landType: [{ required: true, message: '土地类型不能为空', trigger: 'change' }],
landRent: [{ required: true, message: '土地租金不能为空', trigger: 'blur' }],
seedlingCompensation: [{ required: true, message: '青苗赔偿不能为空', trigger: 'blur' }],
totalAmount: [{ required: true, message: '总金额不能为空', trigger: 'blur' }],
statusDescription: [{ required: true, message: '状态说明不能为空', trigger: 'blur' }],
issueSummary: [{ required: true, message: '问题总结不能为空', trigger: 'blur' }],
nextStrategy: [{ required: true, message: '下一步策略不能为空', trigger: 'blur' }],
noContractArea: [{ required: true, message: '不签约面积不能为空', trigger: 'blur' }],
noSurveyArea: [{ required: true, message: '不测量面积不能为空', trigger: 'blur' }],
noContractReason: [{ required: true, message: '不签约原因不能为空', trigger: 'blur' }],
nonTransferReason: [{ required: true, message: '不流转原因不能为空', trigger: 'blur' }],
transferRatio: [
{
required: true,

View File

@ -46,16 +46,16 @@
:load="loadChildren"
:has-children="hasChildren"
>
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
<el-table-column prop="icon" label="图标" align="center" width="100">
<el-table-column align="center" prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
<el-table-column align="center" prop="icon" label="图标" width="100">
<template #default="scope">
<svg-icon :icon-class="scope.row.icon" />
</template>
</el-table-column>
<el-table-column prop="orderNum" label="排序" width="60"></el-table-column>
<el-table-column prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="status" label="状态" width="80">
<el-table-column align="center" prop="orderNum" label="排序" width="60"></el-table-column>
<el-table-column align="center" prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
<el-table-column align="center" prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
<el-table-column align="center" prop="status" label="状态" width="80">
<template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.status" />
</template>
@ -65,7 +65,7 @@
<span>{{ scope.row.createTime }}</span>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="180">
<el-table-column align="center" fixed="right" label="操作" width="180">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button v-hasPermi="['system:menu:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)" />

View File

@ -31,9 +31,14 @@
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['supplierInput:supplierInput:add']">新增</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['supplierInput:supplierInput:export']"></el-button>
</el-col> -->
<el-col :span="1.5">
<el-button type="warning" plain icon="Upload" @click="handleImport" v-hasPermi="['supplierInput:supplierInput:import']"></el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['supplierInput:supplierInput:export']"
>导出模板</el-button
>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
@ -223,8 +228,8 @@
<!-- 第十行安全生产许可证有效期仅劳务类型显示 -->
<el-row :gutter="20" class="mb-4" v-if="form.supplierType === '劳务'">
<el-col :span="12">
<el-form-item label="安全生产许可证发证日期" prop="safeCertificateValidity">
<el-date-picker v-model="form.safeCertificateValidity" type="date" placeholder="请选择发证日期" />
<el-form-item label="安全生产许可证有效期" prop="safeCertificateValidity">
<el-date-picker v-model="form.safeCertificateValidity" type="date" placeholder="请选择有效期" />
</el-form-item>
</el-col>
<el-col :span="12">
@ -243,7 +248,7 @@
<el-form-item label="注册造价工程师" prop="registeredEngineerNumber">
<el-input v-model="form.registeredEngineerNumber" placeholder="请输入注册造价工程师数量" clearable />
</el-form-item>
<el-form-item label="其他(分别写)" prop="otherBuildingNumber">
<el-form-item label="其他人员数量" prop="otherBuildingNumber">
<el-input v-model="form.otherBuildingNumber" placeholder="请输入其他人员数量" clearable />
</el-form-item>
</el-col>
@ -309,7 +314,14 @@
<script setup name="SupplierInput" lang="ts">
import { ComponentInternalInstance, getCurrentInstance, onMounted, ref, reactive, toRefs, computed } from 'vue';
import { ElFormInstance } from 'element-plus';
import { listSupplierInput, getSupplierInput, delSupplierInput, updateSupplierInput } from '@/api/supplierInput/supplierInput/index';
import {
listSupplierInput,
getSupplierInput,
delSupplierInput,
updateSupplierInput,
leadingIn,
leadingOut
} from '@/api/supplierInput/supplierInput/index';
import { SupplierInputVO, SupplierInputQuery, SupplierInputForm, PageData, DialogOption } from '@/api/supplierInput/supplierInput/types';
import Pagination from '@/components/Pagination/index.vue';
import RightToolbar from '@/components/RightToolbar/index.vue';
@ -688,9 +700,77 @@ const handleDelete = async (row?: SupplierInputVO) => {
}
};
/** 导出操作 */
/** 导出操作(下载静态模板文件) */
const handleExport = () => {
proxy?.download('supplierInput/supplierInput/export', { ...queryParams.value }, `supplierInput_${new Date().getTime()}.xlsx`);
try {
// 创建a标签并直接下载public目录下的静态文件
const link = document.createElement('a');
link.href = '/xx.xlsx'; // 使用public目录下现有的Excel文件作为模板
link.download = '供应商导入模板.xlsx';
document.body.appendChild(link);
link.click();
// 清理DOM元素
setTimeout(() => {
document.body.removeChild(link);
}, 100);
} catch (error) {
proxy?.$modal.msgError('模板下载失败,请重试');
}
};
/** 导入操作 */
const handleImport = () => {
// 创建一个隐藏的input[type=file]元素
const input = document.createElement('input');
input.type = 'file';
input.accept = '.xlsx,.xls'; // 限定只能导入excel文件
input.style.display = 'none';
// 监听文件选择事件
input.onchange = async (e: Event) => {
const target = e.target as HTMLInputElement;
const file = target.files?.[0];
if (file) {
// 检查文件类型是否为Excel
const isValidType = file.name.endsWith('.xlsx') || file.name.endsWith('.xls');
if (!isValidType) {
proxy?.$modal.msgError('请选择Excel文件(.xlsx或.xls)');
return;
}
// 创建FormData并添加文件
const formData = new FormData();
formData.append('file', file);
try {
// 显示加载状态
loading.value = true;
// 调用导入接口
const res = await leadingIn(formData, queryParams.value.projectId);
console.log('111111111111', queryParams.value.projectId);
if (res.code === 200) {
proxy?.$modal.msgSuccess('导入成功');
// 刷新列表
getList();
} else {
proxy?.$modal.msgError(res.msg || '导入失败');
}
} catch (error) {
proxy?.$modal.msgError('导入失败,请重试');
} finally {
loading.value = false;
}
}
// 清除input元素
input.remove();
};
// 触发文件选择对话框
document.body.appendChild(input);
input.click();
};
//调用projectId并获取列表
onMounted(() => {