优化后,再次提交
This commit is contained in:
186
unpackage/dist/dev/mp-weixin/pages/Inspectionwarning/Inspectionwarning.js
vendored
Normal file
186
unpackage/dist/dev/mp-weixin/pages/Inspectionwarning/Inspectionwarning.js
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_assets = require("../../common/assets.js");
|
||||
const request_api = require("../../request/api.js");
|
||||
if (!Array) {
|
||||
const _easycom_up_datetime_picker2 = common_vendor.resolveComponent("up-datetime-picker");
|
||||
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
|
||||
(_easycom_up_datetime_picker2 + _easycom_up_input2)();
|
||||
}
|
||||
const _easycom_up_datetime_picker = () => "../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker.js";
|
||||
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_datetime_picker + _easycom_up_input)();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "Inspectionwarning",
|
||||
setup(__props) {
|
||||
const searchForm = common_vendor.reactive({
|
||||
startDate: "",
|
||||
endDate: "",
|
||||
deptName: ""
|
||||
});
|
||||
const showStartDatePicker = common_vendor.ref(false);
|
||||
const showEndDatePicker = common_vendor.ref(false);
|
||||
const startDateValue = common_vendor.ref(Number(/* @__PURE__ */ new Date()));
|
||||
const endDateValue = common_vendor.ref(Number(/* @__PURE__ */ new Date()));
|
||||
const statistics = common_vendor.reactive({
|
||||
total: 0,
|
||||
overdue: 0,
|
||||
completed: 0,
|
||||
pending: 0
|
||||
});
|
||||
const dataList = common_vendor.ref([]);
|
||||
const pageNum = common_vendor.ref(1);
|
||||
const pageSize = common_vendor.ref(20);
|
||||
const formatDate = (timestamp) => {
|
||||
const date = new Date(timestamp);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
const onStartDateConfirm = (e) => {
|
||||
const dateStr = formatDate(e.value);
|
||||
searchForm.startDate = `${dateStr} 00:00:00`;
|
||||
showStartDatePicker.value = false;
|
||||
};
|
||||
const onEndDateConfirm = (e) => {
|
||||
const dateStr = formatDate(e.value);
|
||||
searchForm.endDate = `${dateStr} 23:59:59`;
|
||||
showEndDatePicker.value = false;
|
||||
};
|
||||
const getStatusClass = (overdueDays) => {
|
||||
if (!overdueDays || overdueDays === "按期") {
|
||||
return "status-normal";
|
||||
}
|
||||
const days = parseInt(overdueDays);
|
||||
if (days >= 7) {
|
||||
return "status-serious";
|
||||
} else if (days >= 1) {
|
||||
return "status-overdue";
|
||||
}
|
||||
return "status-normal";
|
||||
};
|
||||
const getStatusText = (overdueDays, statusName) => {
|
||||
if (!overdueDays || overdueDays === "按期") {
|
||||
return statusName === "已完成" ? "按期已完成" : "期限内待检";
|
||||
}
|
||||
const days = parseInt(overdueDays);
|
||||
if (days >= 7) {
|
||||
return "严重逾期";
|
||||
} else if (days >= 1) {
|
||||
return statusName === "已完成" ? "逾期已完成" : "逾期未检";
|
||||
}
|
||||
return "期限内待检";
|
||||
};
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const params = {
|
||||
pageNum: pageNum.value,
|
||||
pageSize: pageSize.value
|
||||
};
|
||||
if (searchForm.startDate) {
|
||||
params.startDate = searchForm.startDate;
|
||||
}
|
||||
if (searchForm.endDate) {
|
||||
params.endDate = searchForm.endDate;
|
||||
}
|
||||
if (searchForm.deptName && searchForm.deptName.trim()) {
|
||||
params.deptName = searchForm.deptName.trim();
|
||||
}
|
||||
const res = await request_api.getInspectionWarningList(params);
|
||||
if (res.code === 0) {
|
||||
if (res.data.statistics) {
|
||||
statistics.total = res.data.statistics.total || 0;
|
||||
statistics.overdue = res.data.statistics.overdue || 0;
|
||||
statistics.completed = res.data.statistics.completed || 0;
|
||||
statistics.pending = res.data.statistics.pending || 0;
|
||||
}
|
||||
if (res.data.page && res.data.page.records) {
|
||||
dataList.value = res.data.page.records;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/Inspectionwarning/Inspectionwarning.vue:255", "获取预警列表失败:", error);
|
||||
}
|
||||
};
|
||||
const handleSearch = () => {
|
||||
pageNum.value = 1;
|
||||
fetchData();
|
||||
};
|
||||
common_vendor.onShow(() => {
|
||||
fetchData();
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.f(_ctx.warningList, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.name),
|
||||
b: _ctx.activeIndex === index ? 1 : "",
|
||||
c: index,
|
||||
d: common_vendor.o(($event) => _ctx.switchTab(index), index)
|
||||
};
|
||||
}),
|
||||
b: common_assets._imports_0$1,
|
||||
c: common_vendor.t(searchForm.startDate || "请选择"),
|
||||
d: common_vendor.n(searchForm.startDate ? "date-value" : "date-placeholder"),
|
||||
e: common_vendor.o(($event) => showStartDatePicker.value = true),
|
||||
f: common_vendor.o(onStartDateConfirm),
|
||||
g: common_vendor.o(($event) => showStartDatePicker.value = false),
|
||||
h: common_vendor.o(($event) => showStartDatePicker.value = false),
|
||||
i: common_vendor.o(($event) => startDateValue.value = $event),
|
||||
j: common_vendor.p({
|
||||
show: showStartDatePicker.value,
|
||||
mode: "date",
|
||||
modelValue: startDateValue.value
|
||||
}),
|
||||
k: common_vendor.t(searchForm.endDate || "请选择"),
|
||||
l: common_vendor.n(searchForm.endDate ? "date-value" : "date-placeholder"),
|
||||
m: common_vendor.o(($event) => showEndDatePicker.value = true),
|
||||
n: common_vendor.o(onEndDateConfirm),
|
||||
o: common_vendor.o(($event) => showEndDatePicker.value = false),
|
||||
p: common_vendor.o(($event) => showEndDatePicker.value = false),
|
||||
q: common_vendor.o(($event) => endDateValue.value = $event),
|
||||
r: common_vendor.p({
|
||||
show: showEndDatePicker.value,
|
||||
mode: "date",
|
||||
modelValue: endDateValue.value
|
||||
}),
|
||||
s: common_vendor.o(($event) => searchForm.deptName = $event),
|
||||
t: common_vendor.p({
|
||||
placeholder: "请输入公司名称",
|
||||
border: "surround",
|
||||
modelValue: searchForm.deptName
|
||||
}),
|
||||
v: common_vendor.o(handleSearch),
|
||||
w: common_assets._imports_1,
|
||||
x: common_vendor.t(statistics.total),
|
||||
y: common_vendor.t(statistics.overdue),
|
||||
z: common_vendor.t(statistics.completed),
|
||||
A: common_vendor.t(statistics.pending),
|
||||
B: common_vendor.f(dataList.value, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(getStatusText(item.overdueDays, item.statusName)),
|
||||
b: common_vendor.n(getStatusClass(item.overdueDays)),
|
||||
c: common_vendor.t(index + 1),
|
||||
d: common_vendor.t(item.deptName || "-"),
|
||||
e: common_vendor.t(item.planName || "-"),
|
||||
f: common_vendor.t(item.cycleName || "-"),
|
||||
g: common_vendor.t(item.taskDate || "-"),
|
||||
h: common_vendor.t(item.finishTime || "未完成"),
|
||||
i: common_vendor.t(item.executorName || "-"),
|
||||
j: common_vendor.t(item.overdueDays || "-"),
|
||||
k: item.id
|
||||
};
|
||||
}),
|
||||
C: dataList.value.length === 0
|
||||
}, dataList.value.length === 0 ? {} : {}, {
|
||||
D: common_vendor.gei(_ctx, "")
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-00b99536"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/Inspectionwarning/Inspectionwarning.js.map
|
||||
7
unpackage/dist/dev/mp-weixin/pages/Inspectionwarning/Inspectionwarning.json
vendored
Normal file
7
unpackage/dist/dev/mp-weixin/pages/Inspectionwarning/Inspectionwarning.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "日常安全检查预警",
|
||||
"usingComponents": {
|
||||
"up-datetime-picker": "../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker",
|
||||
"up-input": "../../uni_modules/uview-plus/components/u-input/u-input"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/pages/Inspectionwarning/Inspectionwarning.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/pages/Inspectionwarning/Inspectionwarning.wxml
vendored
Normal file
File diff suppressed because one or more lines are too long
184
unpackage/dist/dev/mp-weixin/pages/Inspectionwarning/Inspectionwarning.wxss
vendored
Normal file
184
unpackage/dist/dev/mp-weixin/pages/Inspectionwarning/Inspectionwarning.wxss
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* uni.scss */
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.page.data-v-00b99536 {
|
||||
min-height: 100vh;
|
||||
background: #EBF2FC;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
.section-header.data-v-00b99536 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.section-header .section-icon.data-v-00b99536 {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
.search-card .date-row.data-v-00b99536 {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
}
|
||||
.search-card .date-row .date-item.data-v-00b99536 {
|
||||
flex: 1;
|
||||
}
|
||||
.search-card .date-label.data-v-00b99536 {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.search-card .date-picker.data-v-00b99536 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 72rpx;
|
||||
padding: 0 20rpx;
|
||||
background: #f8f8f8;
|
||||
border-radius: 8rpx;
|
||||
border: 1rpx solid #eee;
|
||||
}
|
||||
.search-card .date-picker .date-value.data-v-00b99536 {
|
||||
color: #333;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.search-card .date-picker .date-placeholder.data-v-00b99536 {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.search-card .search-btn.data-v-00b99536 {
|
||||
margin-top: 30rpx;
|
||||
background: linear-gradient(135deg, #667eea 0%, #2667E9 100%);
|
||||
color: #fff;
|
||||
border-radius: 40rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.stat-grid.data-v-00b99536 {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.stat-grid .stat-item.data-v-00b99536 {
|
||||
flex: 1;
|
||||
height: 124rpx;
|
||||
border-radius: 12rpx;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.stat-grid .stat-item .stat-num.data-v-00b99536 {
|
||||
font-size: 40rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.stat-grid .stat-item .stat-label.data-v-00b99536 {
|
||||
font-size: 24rpx;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
.stat-grid .stat-total.data-v-00b99536 {
|
||||
background: linear-gradient(135deg, #628EFB 0%, #4A7CF7 100%);
|
||||
}
|
||||
.stat-grid .stat-overdue.data-v-00b99536 {
|
||||
background: linear-gradient(135deg, #32DCC7 0%, #20C5B0 100%);
|
||||
}
|
||||
.stat-grid .stat-completed.data-v-00b99536 {
|
||||
background: linear-gradient(135deg, #32D1E9 0%, #20B8D0 100%);
|
||||
}
|
||||
.stat-grid .stat-pending.data-v-00b99536 {
|
||||
background: linear-gradient(135deg, #A190F5 0%, #8B78E8 100%);
|
||||
}
|
||||
.list-title-bar.data-v-00b99536 {
|
||||
width: 8rpx;
|
||||
height: 32rpx;
|
||||
background: #2667E9;
|
||||
border-radius: 4rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
.list-card.data-v-00b99536 {
|
||||
position: relative;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 2rpx 10rpx rgba(0, 0, 0, 0.08);
|
||||
border-left: 8rpx solid #2667E9;
|
||||
border-radius: 16rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.list-card .card-header.data-v-00b99536 {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.list-card .card-row.data-v-00b99536 {
|
||||
display: flex;
|
||||
margin-top: 16rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.list-card .card-row .row-label.data-v-00b99536 {
|
||||
color: #999;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.list-card .card-row .row-value.data-v-00b99536 {
|
||||
color: #333;
|
||||
word-break: break-all;
|
||||
}
|
||||
.status-tag.data-v-00b99536 {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 160rpx;
|
||||
height: 50rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transform: rotate(0deg);
|
||||
border-radius: 0 16rpx 0 16rpx;
|
||||
}
|
||||
.status-tag .status-text.data-v-00b99536 {
|
||||
font-size: 22rpx;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
}
|
||||
.status-serious.data-v-00b99536 {
|
||||
background: linear-gradient(135deg, #FF6B6B 0%, #EE5A5A 100%);
|
||||
}
|
||||
.status-overdue.data-v-00b99536 {
|
||||
background: linear-gradient(135deg, #FFA726 0%, #FF9800 100%);
|
||||
}
|
||||
.status-normal.data-v-00b99536 {
|
||||
background: linear-gradient(135deg, #66BB6A 0%, #4CAF50 100%);
|
||||
}
|
||||
.status-completed.data-v-00b99536 {
|
||||
background: linear-gradient(135deg, #42A5F5 0%, #2196F3 100%);
|
||||
}
|
||||
.empty-tip.data-v-00b99536 {
|
||||
text-align: center;
|
||||
padding: 100rpx 0;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user