优化后,再次提交

This commit is contained in:
王利强
2026-05-03 09:08:56 +08:00
parent 721ef0ad54
commit 805747d1d9
1243 changed files with 46213 additions and 221 deletions

View File

@@ -0,0 +1,385 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_three_one_api_license = require("../../request/three_one_api/license.js");
const request_request = require("../../request/request.js");
if (!Array) {
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
const _easycom_u_datetime_picker2 = common_vendor.resolveComponent("u-datetime-picker");
const _easycom_u_modal2 = common_vendor.resolveComponent("u-modal");
(_easycom_u_popup2 + _easycom_u_datetime_picker2 + _easycom_u_modal2)();
}
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
const _easycom_u_datetime_picker = () => "../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker.js";
const _easycom_u_modal = () => "../../uni_modules/uview-plus/components/u-modal/u-modal.js";
if (!Math) {
(_easycom_u_popup + _easycom_u_datetime_picker + _easycom_u_modal)();
}
const _sfc_main = {
__name: "Idphotomanagement",
setup(__props) {
const licenseList = common_vendor.ref([]);
const deptList = common_vendor.ref([]);
const selectedDept = common_vendor.ref(null);
const showAddPopup = common_vendor.ref(false);
const showDatePicker = common_vendor.ref(false);
const showDeptPopup = common_vendor.ref(false);
const showDeleteModal = common_vendor.ref(false);
const isEdit = common_vendor.ref(false);
const currentEditId = common_vendor.ref(null);
const currentDeleteItem = common_vendor.ref(null);
const submitting = common_vendor.ref(false);
const datePickerType = common_vendor.ref("start");
const datePickerValue = common_vendor.ref(Date.now());
const formData = common_vendor.reactive({
enterpriseId: "",
enterpriseName: "",
type: "",
code: "",
startDate: "",
endDate: "",
legalPerson: "",
photo: "",
photoPreview: ""
});
common_vendor.onMounted(() => {
loadLicenseList();
loadDeptList();
});
const getImageUrl = (path) => {
if (!path)
return "";
return request_request.toImageUrl(path);
};
const previewImage = (path) => {
common_vendor.index.previewImage({
urls: [getImageUrl(path)]
});
};
const loadLicenseList = async () => {
try {
const res = await request_three_one_api_license.getLicenseList();
if (res.code === 0) {
licenseList.value = res.data.records || [];
}
} catch (err) {
common_vendor.index.__f__("error", "at pages/Idphotomanagement/Idphotomanagement.vue:249", "获取证照列表失败:", err);
}
};
const loadDeptList = async () => {
try {
const res = await request_three_one_api_license.getLicenseEnterpriseSelect();
if (res.code === 0) {
deptList.value = res.data || [];
}
} catch (err) {
common_vendor.index.__f__("error", "at pages/Idphotomanagement/Idphotomanagement.vue:261", "获取部门列表失败:", err);
}
};
const openAddPopup = () => {
resetForm();
isEdit.value = false;
currentEditId.value = null;
showAddPopup.value = true;
};
const handleEdit = async (item) => {
try {
const res = await request_three_one_api_license.getLicenseDetail({ id: item.id });
if (res.code === 0) {
const detail = res.data;
isEdit.value = true;
currentEditId.value = item.id;
formData.enterpriseId = detail.enterpriseId || "";
formData.type = detail.type || "";
formData.code = detail.code || "";
formData.startDate = detail.startDate || "";
formData.endDate = detail.endDate || "";
formData.legalPerson = detail.legalPerson || "";
formData.photo = detail.photo || "";
formData.photoPreview = detail.photo ? getImageUrl(detail.photo) : "";
const dept = deptList.value.find((d) => d.id === detail.enterpriseId);
formData.enterpriseName = dept ? dept.name : "";
selectedDept.value = dept || null;
showAddPopup.value = true;
}
} catch (err) {
common_vendor.index.__f__("error", "at pages/Idphotomanagement/Idphotomanagement.vue:301", "获取证照详情失败:", err);
common_vendor.index.showToast({ title: "获取详情失败", icon: "none" });
}
};
const handleDelete = (item) => {
currentDeleteItem.value = item;
showDeleteModal.value = true;
};
const confirmDelete = async () => {
if (!currentDeleteItem.value)
return;
try {
const res = await request_three_one_api_license.deleteLicense({ id: currentDeleteItem.value.id });
if (res.code === 0) {
common_vendor.index.showToast({ title: "删除成功", icon: "success" });
loadLicenseList();
}
} catch (err) {
common_vendor.index.__f__("error", "at pages/Idphotomanagement/Idphotomanagement.vue:323", "删除失败:", err);
common_vendor.index.showToast({ title: "删除失败", icon: "none" });
} finally {
showDeleteModal.value = false;
currentDeleteItem.value = null;
}
};
const closePopup = () => {
showAddPopup.value = false;
resetForm();
};
const resetForm = () => {
formData.enterpriseId = "";
formData.enterpriseName = "";
formData.type = "";
formData.code = "";
formData.startDate = "";
formData.endDate = "";
formData.legalPerson = "";
formData.photo = "";
formData.photoPreview = "";
selectedDept.value = null;
isEdit.value = false;
currentEditId.value = null;
};
const confirmDept = () => {
if (selectedDept.value) {
formData.enterpriseId = selectedDept.value.id;
formData.enterpriseName = selectedDept.value.name;
}
showDeptPopup.value = false;
};
const openDatePicker = (type) => {
datePickerType.value = type;
let currentDate = "";
if (type === "start" && formData.startDate) {
currentDate = formData.startDate;
} else if (type === "end" && formData.endDate) {
currentDate = formData.endDate;
}
if (currentDate) {
datePickerValue.value = new Date(currentDate).getTime();
} else {
datePickerValue.value = Date.now();
}
showDatePicker.value = true;
};
const onDateCancel = () => {
showDatePicker.value = false;
};
const onDateConfirm = (e) => {
const timestamp = datePickerValue.value;
if (!timestamp || isNaN(timestamp)) {
common_vendor.index.__f__("error", "at pages/Idphotomanagement/Idphotomanagement.vue:396", "无效的日期值:", timestamp);
showDatePicker.value = false;
return;
}
const date = new Date(timestamp);
if (isNaN(date.getTime())) {
common_vendor.index.__f__("error", "at pages/Idphotomanagement/Idphotomanagement.vue:405", "无效的日期:", date);
showDatePicker.value = false;
return;
}
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const dateStr = `${year}-${month}-${day}`;
if (datePickerType.value === "start") {
formData.startDate = dateStr;
} else {
formData.endDate = dateStr;
}
showDatePicker.value = false;
};
const chooseImage = () => {
common_vendor.index.chooseImage({
count: 1,
sizeType: ["compressed"],
sourceType: ["album", "camera"],
success: (res) => {
const tempFilePath = res.tempFilePaths[0];
formData.photoPreview = tempFilePath;
uploadImage(tempFilePath);
}
});
};
const uploadImage = (filePath) => {
common_vendor.index.showLoading({ title: "上传中..." });
common_vendor.index.uploadFile({
url: baseUrl + "/frontend/attachment/upload",
filePath,
name: "file",
header: {
"Authorization": request_request.getToken()
},
success: (uploadRes) => {
common_vendor.index.hideLoading();
try {
const data = JSON.parse(uploadRes.data);
if (data.code === 0 && data.data) {
formData.photo = data.data.url || data.data;
common_vendor.index.showToast({ title: "上传成功", icon: "success" });
} else {
common_vendor.index.showToast({ title: data.msg || "上传失败", icon: "none" });
formData.photoPreview = "";
}
} catch (e) {
common_vendor.index.__f__("error", "at pages/Idphotomanagement/Idphotomanagement.vue:461", "解析上传结果失败:", e);
common_vendor.index.showToast({ title: "上传失败", icon: "none" });
formData.photoPreview = "";
}
},
fail: (err) => {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/Idphotomanagement/Idphotomanagement.vue:468", "上传失败:", err);
common_vendor.index.showToast({ title: "上传失败", icon: "none" });
formData.photoPreview = "";
}
});
};
const removeImage = () => {
formData.photo = "";
formData.photoPreview = "";
};
const handleSubmit = async () => {
if (!formData.enterpriseId) {
common_vendor.index.showToast({ title: "请选择部门", icon: "none" });
return;
}
submitting.value = true;
try {
const submitData = {
enterpriseId: formData.enterpriseId,
type: formData.type,
code: formData.code,
startDate: formData.startDate,
endDate: formData.endDate,
legalPerson: formData.legalPerson,
photo: formData.photo
};
let res;
if (isEdit.value) {
submitData.id = currentEditId.value;
res = await request_three_one_api_license.updateLicense(submitData);
} else {
res = await request_three_one_api_license.addLicense(submitData);
}
if (res.code === 0) {
common_vendor.index.showToast({
title: isEdit.value ? "修改成功" : "新增成功",
icon: "success"
});
closePopup();
loadLicenseList();
}
} catch (err) {
common_vendor.index.__f__("error", "at pages/Idphotomanagement/Idphotomanagement.vue:521", "提交失败:", err);
common_vendor.index.showToast({ title: "操作失败", icon: "none" });
} finally {
submitting.value = false;
}
};
return (_ctx, _cache) => {
return common_vendor.e({
a: licenseList.value.length > 0
}, licenseList.value.length > 0 ? {
b: common_vendor.f(licenseList.value, (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.type || "未知类型"),
b: common_vendor.o(($event) => handleEdit(item), item.id),
c: common_vendor.o(($event) => handleDelete(item), item.id),
d: common_vendor.t(item.code || "-"),
e: common_vendor.t(item.startDate || "-"),
f: common_vendor.t(item.endDate || "-"),
g: common_vendor.t(item.legalPerson || "-"),
h: item.photo
}, item.photo ? {
i: getImageUrl(item.photo),
j: common_vendor.o(($event) => previewImage(item.photo), item.id)
} : {}, {
k: item.id
});
})
} : {}, {
c: common_vendor.o(openAddPopup),
d: common_vendor.t(isEdit.value ? "编辑证照" : "新增证照"),
e: common_vendor.o(closePopup),
f: common_vendor.t(formData.enterpriseName || "请选择部门"),
g: common_vendor.n(formData.enterpriseName ? "" : "text-gray"),
h: common_vendor.o(($event) => showDeptPopup.value = true),
i: formData.type,
j: common_vendor.o(($event) => formData.type = $event.detail.value),
k: formData.code,
l: common_vendor.o(($event) => formData.code = $event.detail.value),
m: common_vendor.t(formData.startDate || "请选择开始日期"),
n: common_vendor.n(formData.startDate ? "" : "text-gray"),
o: common_vendor.o(($event) => openDatePicker("start")),
p: common_vendor.t(formData.endDate || "请选择结束日期"),
q: common_vendor.n(formData.endDate ? "" : "text-gray"),
r: common_vendor.o(($event) => openDatePicker("end")),
s: formData.legalPerson,
t: common_vendor.o(($event) => formData.legalPerson = $event.detail.value),
v: !formData.photoPreview
}, !formData.photoPreview ? {} : {
w: formData.photoPreview,
x: common_vendor.o(removeImage)
}, {
y: common_vendor.o(chooseImage),
z: common_vendor.o(closePopup),
A: common_vendor.o(handleSubmit),
B: submitting.value,
C: common_vendor.o(closePopup),
D: common_vendor.p({
show: showAddPopup.value,
mode: "center",
round: "20"
}),
E: common_vendor.o(onDateConfirm),
F: common_vendor.o(onDateCancel),
G: common_vendor.o(onDateCancel),
H: common_vendor.o(($event) => datePickerValue.value = $event),
I: common_vendor.p({
show: showDatePicker.value,
mode: "date",
modelValue: datePickerValue.value
}),
J: common_vendor.o(($event) => showDeptPopup.value = false),
K: deptList.value.length > 0
}, deptList.value.length > 0 ? {
L: common_vendor.f(deptList.value, (item, k0, i0) => {
return common_vendor.e({
a: selectedDept.value && selectedDept.value.id === item.id
}, selectedDept.value && selectedDept.value.id === item.id ? {} : {}, {
b: selectedDept.value && selectedDept.value.id === item.id ? 1 : "",
c: common_vendor.t(item.name),
d: item.id,
e: common_vendor.o(($event) => selectedDept.value = item, item.id)
});
})
} : {}, {
M: common_vendor.o(confirmDept),
N: common_vendor.o(($event) => showDeptPopup.value = false),
O: common_vendor.p({
show: showDeptPopup.value,
mode: "center",
round: "20"
}),
P: common_vendor.o(confirmDelete),
Q: common_vendor.o(($event) => showDeleteModal.value = false),
R: common_vendor.p({
show: showDeleteModal.value,
title: "确认删除",
content: "确定要删除这条证照记录吗?",
showCancelButton: true
}),
S: common_vendor.gei(_ctx, "")
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1ad9c724"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/Idphotomanagement/Idphotomanagement.js.map

View File

@@ -0,0 +1,8 @@
{
"navigationBarTitleText": "证件照管理",
"usingComponents": {
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup",
"u-datetime-picker": "../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker",
"u-modal": "../../uni_modules/uview-plus/components/u-modal/u-modal"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,269 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page.data-v-1ad9c724 {
min-height: 100vh;
background: #EBF2FC;
padding-bottom: 120rpx;
}
.license-list.data-v-1ad9c724 {
padding-bottom: 20rpx;
}
.license-item.data-v-1ad9c724 {
background: #fff;
border-radius: 16rpx;
padding: 24rpx;
margin-bottom: 20rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
}
.license-header.data-v-1ad9c724 {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
padding-bottom: 16rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.license-type.data-v-1ad9c724 {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.license-actions.data-v-1ad9c724 {
display: flex;
gap: 20rpx;
}
.action-btn.data-v-1ad9c724 {
font-size: 28rpx;
padding: 8rpx 16rpx;
}
.license-detail.data-v-1ad9c724 {
margin-bottom: 16rpx;
}
.detail-row.data-v-1ad9c724 {
display: flex;
margin-bottom: 12rpx;
font-size: 28rpx;
}
.detail-row .label.data-v-1ad9c724 {
color: #999;
width: 160rpx;
flex-shrink: 0;
}
.detail-row .value.data-v-1ad9c724 {
color: #333;
flex: 1;
}
.license-photo.data-v-1ad9c724 {
width: 200rpx;
height: 150rpx;
border-radius: 8rpx;
overflow: hidden;
}
.license-photo image.data-v-1ad9c724 {
width: 100%;
height: 100%;
}
.empty-state.data-v-1ad9c724 {
padding: 200rpx 0;
text-align: center;
}
.add-btn.data-v-1ad9c724 {
position: fixed;
bottom: 40rpx;
left: 30rpx;
right: 30rpx;
height: 88rpx;
line-height: 88rpx;
border-radius: 44rpx;
font-size: 32rpx;
}
.popup-content.data-v-1ad9c724 {
width: 600rpx;
background: #fff;
border-radius: 20rpx;
padding: 30rpx;
}
.popup-header.data-v-1ad9c724 {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
}
.popup-title.data-v-1ad9c724 {
font-size: 34rpx;
color: #333;
}
.popup-close.data-v-1ad9c724 {
font-size: 48rpx;
color: #999;
line-height: 1;
}
.popup-body.data-v-1ad9c724 {
max-height: 700rpx;
overflow-y: auto;
}
.form-item.data-v-1ad9c724 {
margin-bottom: 24rpx;
}
.form-label.data-v-1ad9c724 {
font-size: 28rpx;
color: #333;
margin-bottom: 12rpx;
}
.form-input.data-v-1ad9c724 {
width: 100%;
height: 80rpx;
border: 2rpx solid #E5E5E5;
border-radius: 12rpx;
padding: 0 24rpx;
font-size: 28rpx;
box-sizing: border-box;
}
.form-select.data-v-1ad9c724 {
display: flex;
align-items: center;
line-height: 80rpx;
}
.upload-box.data-v-1ad9c724 {
width: 200rpx;
height: 200rpx;
border: 2rpx dashed #ccc;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.upload-add.data-v-1ad9c724 {
display: flex;
flex-direction: column;
align-items: center;
}
.upload-icon.data-v-1ad9c724 {
font-size: 60rpx;
color: #999;
}
.upload-text.data-v-1ad9c724 {
font-size: 24rpx;
color: #999;
margin-top: 8rpx;
}
.upload-preview.data-v-1ad9c724 {
width: 100%;
height: 100%;
position: relative;
}
.upload-img.data-v-1ad9c724 {
width: 100%;
height: 100%;
border-radius: 12rpx;
}
.upload-delete.data-v-1ad9c724 {
position: absolute;
top: -16rpx;
right: -16rpx;
width: 40rpx;
height: 40rpx;
background: #ff4d4f;
color: #fff;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
}
.popup-footer.data-v-1ad9c724 {
display: flex;
justify-content: center;
gap: 30rpx;
margin-top: 40rpx;
}
.btn-cancel.data-v-1ad9c724 {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border: 2rpx solid #E5E5E5;
border-radius: 40rpx;
background: #fff;
color: #333;
font-size: 30rpx;
}
.btn-confirm.data-v-1ad9c724 {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
color: #fff;
font-size: 30rpx;
}
.dept-popup.data-v-1ad9c724 {
width: 600rpx;
background: #fff;
border-radius: 20rpx;
padding: 30rpx;
}
.dept-list.data-v-1ad9c724 {
max-height: 400rpx;
overflow-y: auto;
margin-bottom: 30rpx;
}
.dept-item.data-v-1ad9c724 {
display: flex;
align-items: center;
padding: 24rpx;
border: 2rpx solid #E5E5E5;
border-radius: 12rpx;
margin-bottom: 16rpx;
}
.dept-checkbox.data-v-1ad9c724 {
width: 36rpx;
height: 36rpx;
border: 2rpx solid #ccc;
border-radius: 6rpx;
margin-right: 20rpx;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.dept-checkbox-active.data-v-1ad9c724 {
background: #2667E9;
border-color: #2667E9;
color: #fff;
}
.dept-name.data-v-1ad9c724 {
font-size: 28rpx;
color: #333;
}
.btn-dept-confirm.data-v-1ad9c724 {
width: 100%;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
color: #fff;
font-size: 30rpx;
}