一单四制优化及加入工作流

This commit is contained in:
王利强
2026-07-27 09:27:22 +08:00
parent 455fd4fc07
commit 7c3285ed5a
725 changed files with 19668 additions and 2921 deletions

View File

@@ -22,10 +22,15 @@ if (!Math) {
"./pages/hiddendanger/add.js";
"./pages/hiddendanger/view.js";
"./pages/hiddendanger/detail2.js";
"./pages/hiddendanger/process-chain.js";
"./pages/hiddendanger/rectification.js";
"./pages/hiddendanger/acceptance.js";
"./pages/hiddendanger/acceptance-approval.js";
"./pages/hiddendanger/assignment.js";
"./pages/closeout/application.js";
"./pages/closeout/apply.js";
"./pages/closeout/approval.js";
"./pages/closeout/leader-approval.js";
"./pages/closeout/editor.js";
"./pages/equipmentregistration/equipmentregistration.js";
"./pages/area/management.js";
@@ -36,6 +41,7 @@ if (!Math) {
"./pages/personalcenter/settings.js";
"./pages/personalcenter/account.js";
"./pages/personalcenter/edit.js";
"./pages/personalcenter/identity.js";
"./pages/login/login.js";
"./pages/login/reg.js";
"./pages/login/enterprise.js";
@@ -114,6 +120,11 @@ common_vendor.index.addInterceptor("uploadFile", {
return validateUploadLocalFileExt(args.filePath) ? args : false;
}
});
uni_modules_uviewPlus_index.setConfig({
config: {
loadFontOnce: true
}
});
function createApp() {
const app = common_vendor.createSSRApp(_sfc_main);
app.use(uni_modules_uviewPlus_index.uviewPlus);

View File

@@ -19,10 +19,15 @@
"pages/hiddendanger/add",
"pages/hiddendanger/view",
"pages/hiddendanger/detail2",
"pages/hiddendanger/process-chain",
"pages/hiddendanger/rectification",
"pages/hiddendanger/acceptance",
"pages/hiddendanger/acceptance-approval",
"pages/hiddendanger/assignment",
"pages/closeout/application",
"pages/closeout/apply",
"pages/closeout/approval",
"pages/closeout/leader-approval",
"pages/closeout/editor",
"pages/equipmentregistration/equipmentregistration",
"pages/area/management",
@@ -33,6 +38,7 @@
"pages/personalcenter/settings",
"pages/personalcenter/account",
"pages/personalcenter/edit",
"pages/personalcenter/identity",
"pages/login/login",
"pages/login/reg",
"pages/login/enterprise",

View File

@@ -7139,9 +7139,9 @@ function isConsoleWritable() {
return isWritable;
}
function initRuntimeSocketService() {
const hosts = "172.22.80.1,192.168.1.144,127.0.0.1";
const hosts = "172.30.48.1,192.168.1.144,127.0.0.1";
const port = "8090";
const id = "mp-weixin_4A0WII";
const id = "mp-weixin_4ene97";
const lazy = typeof swan !== "undefined";
let restoreError = lazy ? () => {
} : initOnError();

View File

@@ -0,0 +1,144 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
const components_flow_flowAssigneeUtils = require("./flowAssigneeUtils.js");
if (!Array) {
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
_easycom_u_popup2();
}
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
if (!Math) {
(FlowAssigneeTree + _easycom_u_popup)();
}
const FlowAssigneeTree = () => "./FlowAssigneeTree.js";
const _sfc_main = {
__name: "FlowAssigneePickerPopup",
props: {
show: {
type: Boolean,
default: false
},
taskId: {
type: String,
default: ""
},
pickerIdentityId: {
type: String,
default: ""
},
pickerName: {
type: String,
default: ""
}
},
emits: ["update:pickerIdentityId", "update:pickerName", "cancel", "confirm"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const loading = common_vendor.ref(false);
const deptTree = common_vendor.ref([]);
const localPickerIdentityId = common_vendor.ref("");
const localPickerName = common_vendor.ref("");
const pickerDisplayName = common_vendor.computed(() => {
const user = components_flow_flowAssigneeUtils.findAssigneeUserInDeptTree(deptTree.value, localPickerIdentityId.value);
return user ? components_flow_flowAssigneeUtils.formatAssigneeDisplayName(user) : localPickerName.value;
});
const syncLocalPicker = () => {
localPickerIdentityId.value = props.pickerIdentityId || "";
localPickerName.value = props.pickerName || "";
};
const fetchAssigneeTree = async () => {
if (!props.taskId) {
deptTree.value = [];
return;
}
loading.value = true;
try {
const res = await request_api.getFlowApproverCandidates(props.taskId);
if (res.code === 0) {
deptTree.value = components_flow_flowAssigneeUtils.normalizeApproverDeptTree(res.data);
} else {
deptTree.value = [];
common_vendor.index.showToast({ title: res.msg || "获取处理人失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at components/flow/FlowAssigneePickerPopup.vue:93", "获取处理人失败:", error);
deptTree.value = [];
common_vendor.index.showToast({ title: "获取处理人失败", icon: "none" });
} finally {
loading.value = false;
}
};
common_vendor.watch(
() => props.show,
async (visible) => {
if (!visible)
return;
syncLocalPicker();
await fetchAssigneeTree();
}
);
const handleUserSelect = (user) => {
const identityId = components_flow_flowAssigneeUtils.resolveAssigneeIdentityId(user);
if (!identityId)
return;
localPickerIdentityId.value = identityId;
localPickerName.value = components_flow_flowAssigneeUtils.formatAssigneeDisplayName(user);
emit("update:pickerIdentityId", identityId);
emit("update:pickerName", localPickerName.value);
};
const handleCancel = () => {
emit("cancel");
};
const handleConfirm = () => {
if (!localPickerIdentityId.value) {
common_vendor.index.showToast({ title: "请选择下一步处理人", icon: "none" });
return;
}
const user = components_flow_flowAssigneeUtils.findAssigneeUserInDeptTree(deptTree.value, localPickerIdentityId.value);
if (!user) {
common_vendor.index.showToast({ title: "所选身份无效,请重新选择", icon: "none" });
return;
}
const name = components_flow_flowAssigneeUtils.formatAssigneeDisplayName(user);
emit("update:pickerIdentityId", localPickerIdentityId.value);
emit("update:pickerName", name);
emit("confirm", {
identityId: localPickerIdentityId.value,
name,
user
});
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.o(handleCancel),
b: __props.pickerIdentityId
}, __props.pickerIdentityId ? {
c: common_vendor.t(pickerDisplayName.value)
} : {}, {
d: loading.value
}, loading.value ? {} : !__props.taskId ? {} : deptTree.value.length === 0 ? {} : {
g: common_vendor.o(handleUserSelect),
h: common_vendor.p({
depts: deptTree.value,
["selected-identity-id"]: __props.pickerIdentityId
})
}, {
e: !__props.taskId,
f: deptTree.value.length === 0,
i: common_vendor.o(handleCancel),
j: common_vendor.o(handleConfirm),
k: common_vendor.o(handleCancel),
l: common_vendor.p({
show: __props.show,
mode: "bottom",
round: "20"
}),
m: common_vendor.gei(_ctx, "")
});
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-2685d664"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/flow/FlowAssigneePickerPopup.js.map

View File

@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup",
"flow-assignee-tree": "./FlowAssigneeTree"
}
}

View File

@@ -0,0 +1 @@
<u-popup wx:if="{{l}}" u-s="{{['d']}}" bindclose="{{k}}" u-i="2685d664-0" bind:__l="__l" u-p="{{l}}" class="{{['data-v-2685d664', virtualHostClass]}}" virtualHostClass="{{['data-v-2685d664', virtualHostClass]}}" style="{{virtualHostStyle}}" virtualHostStyle="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" virtualHostHidden="{{virtualHostHidden || false}}" id="{{m}}" virtualHostId="{{m}}"><view class="user-popup data-v-2685d664"><view class="popup-header data-v-2685d664"><view class="popup-title text-bold data-v-2685d664">选择下一步处理人</view><view class="popup-close data-v-2685d664" bindtap="{{a}}">×</view></view><view wx:if="{{b}}" class="selected-summary data-v-2685d664"><text class="summary-label data-v-2685d664">已选:</text><text class="summary-text data-v-2685d664">{{c}}</text></view><scroll-view class="user-list-scroll data-v-2685d664" scroll-y><view wx:if="{{d}}" class="empty-tip data-v-2685d664">加载中...</view><view wx:elif="{{e}}" class="empty-tip data-v-2685d664">缺少任务ID无法加载处理人</view><view wx:elif="{{f}}" class="empty-tip data-v-2685d664">暂无人员数据</view><flow-assignee-tree wx:else class="data-v-2685d664" virtualHostClass="data-v-2685d664" bindselect="{{g}}" u-i="2685d664-1,2685d664-0" bind:__l="__l" u-p="{{h||''}}"/></scroll-view><view class="popup-footer data-v-2685d664"><button class="btn-cancel data-v-2685d664" bindtap="{{i}}">取消</button><button class="btn-confirm bg-blue data-v-2685d664" bindtap="{{j}}">确定</button></view></view></u-popup>

View File

@@ -0,0 +1,96 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.user-popup.data-v-2685d664 {
background: #fff;
}
.user-popup .popup-header.data-v-2685d664 {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.user-popup .popup-header .popup-title.data-v-2685d664 {
font-size: 32rpx;
color: #333;
}
.user-popup .popup-header .popup-close.data-v-2685d664 {
font-size: 40rpx;
color: #999;
line-height: 1;
}
.user-popup .selected-summary.data-v-2685d664 {
padding: 16rpx 30rpx;
background: #f5f7fa;
border-bottom: 1rpx solid #eee;
font-size: 24rpx;
line-height: 1.5;
}
.user-popup .selected-summary .summary-label.data-v-2685d664 {
color: #909399;
}
.user-popup .selected-summary .summary-text.data-v-2685d664 {
color: #333;
}
.user-popup .user-list-scroll.data-v-2685d664 {
max-height: 600rpx;
box-sizing: border-box;
}
.user-popup .empty-tip.data-v-2685d664 {
padding: 80rpx 20rpx;
text-align: center;
color: #909399;
font-size: 26rpx;
}
.user-popup .popup-footer.data-v-2685d664 {
display: flex;
gap: 24rpx;
padding: 24rpx 30rpx;
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
background: #fff;
}
.user-popup .popup-footer button.data-v-2685d664 {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
font-size: 30rpx;
margin: 0;
padding: 0;
}
.user-popup .popup-footer button.data-v-2685d664::after {
border: none;
}
.user-popup .popup-footer .btn-cancel.data-v-2685d664 {
background: #fff;
color: #2667E9;
border: 2rpx solid #2667E9;
}
.user-popup .popup-footer .btn-confirm.data-v-2685d664 {
color: #fff;
border: none;
}

View File

@@ -0,0 +1,50 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const components_flow_flowAssigneeUtils = require("./flowAssigneeUtils.js");
const _sfc_main = {
__name: "FlowAssigneeTree",
props: {
depts: {
type: Array,
default: () => []
},
selectedIdentityId: {
type: String,
default: ""
}
},
emits: ["select"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const flatRows = common_vendor.computed(() => components_flow_flowAssigneeUtils.flattenApproverDeptTree(props.depts));
const handleSelect = (user) => {
emit("select", user);
};
return (_ctx, _cache) => {
return {
a: common_vendor.f(flatRows.value, (row, k0, i0) => {
return common_vendor.e({
a: row.type === "dept"
}, row.type === "dept" ? {
b: common_vendor.t(row.deptName),
c: `${row.level * 24 + 20}rpx`
} : common_vendor.e({
d: common_vendor.t(common_vendor.unref(components_flow_flowAssigneeUtils.formatAssigneeDisplayName)(row.user)),
e: String(__props.selectedIdentityId) === String(common_vendor.unref(components_flow_flowAssigneeUtils.resolveAssigneeIdentityId)(row.user))
}, String(__props.selectedIdentityId) === String(common_vendor.unref(components_flow_flowAssigneeUtils.resolveAssigneeIdentityId)(row.user)) ? {} : {}, {
f: String(__props.selectedIdentityId) === String(common_vendor.unref(components_flow_flowAssigneeUtils.resolveAssigneeIdentityId)(row.user)) ? 1 : "",
g: `${row.level * 24 + 20}rpx`,
h: common_vendor.o(($event) => handleSelect(row.user), row.key)
}), {
i: row.key
});
}),
b: common_vendor.gei(_ctx, "")
};
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1fe646a4"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/flow/FlowAssigneeTree.js.map

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view class="{{['assignee-tree', 'data-v-1fe646a4', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{b}}"><block wx:for="{{a}}" wx:for-item="row" wx:key="i"><view wx:if="{{row.a}}" class="dept-node data-v-1fe646a4" style="{{'padding-left:' + row.c}}"><text class="dept-name data-v-1fe646a4">{{row.b}}</text></view><view wx:else class="{{['user-item', 'data-v-1fe646a4', row.f && 'active']}}" style="{{'padding-left:' + row.g}}" bindtap="{{row.h}}"><text class="user-item-text data-v-1fe646a4">{{row.d}}</text><text wx:if="{{row.e}}" class="cuIcon-check text-blue data-v-1fe646a4"></text></view></block></view>

View File

@@ -0,0 +1,51 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.dept-node.data-v-1fe646a4 {
padding: 20rpx 20rpx 12rpx;
font-size: 26rpx;
color: #909399;
line-height: 1.4;
}
.dept-name.data-v-1fe646a4 {
font-weight: 600;
}
.user-item.data-v-1fe646a4 {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 20rpx;
border-bottom: 1rpx solid #f5f5f5;
}
.user-item.active .user-item-text.data-v-1fe646a4 {
color: #2667E9;
font-weight: 600;
}
.user-item .user-item-text.data-v-1fe646a4 {
flex: 1;
font-size: 28rpx;
color: #333;
}

View File

@@ -0,0 +1,85 @@
"use strict";
const resolveAssigneeIdentityId = (user) => {
if (!user)
return "";
const id = user.identityId ?? user.userIdentityId ?? user.userId ?? "";
return id === "" || id == null ? "" : String(id);
};
const getAssigneeItemKey = (user) => {
const identityId = resolveAssigneeIdentityId(user);
if (identityId)
return `identity-${identityId}`;
return `user-${user.userId || user.nickName || ""}`;
};
const formatAssigneeDisplayName = (user) => {
if (!user)
return "";
if (user.identityName) {
return `${user.nickName || user.userName || ""}_${user.identityName}`;
}
if (user.postName) {
return `${user.nickName || user.userName || ""}_${user.postName}`;
}
return user.nickName || user.userName || user.name || "未知人员";
};
const normalizeApproverDeptTree = (data) => {
if (!data)
return [];
if (Array.isArray(data))
return data;
if (Array.isArray(data.records))
return data.records;
if (Array.isArray(data.list))
return data.list;
return [];
};
const findAssigneeUserInDeptTree = (depts, identityId) => {
var _a;
if (!identityId || !Array.isArray(depts))
return null;
for (const dept of depts) {
const user = (dept.users || []).find(
(item) => String(resolveAssigneeIdentityId(item)) === String(identityId)
);
if (user)
return user;
if ((_a = dept.children) == null ? void 0 : _a.length) {
const found = findAssigneeUserInDeptTree(dept.children, identityId);
if (found)
return found;
}
}
return null;
};
const flattenApproverDeptTree = (depts, level = 0) => {
var _a;
const rows = [];
if (!Array.isArray(depts))
return rows;
for (const dept of depts) {
rows.push({
type: "dept",
key: `dept-${dept.deptId ?? dept.deptName ?? level}`,
deptName: dept.deptName || "",
level
});
for (const user of dept.users || []) {
rows.push({
type: "user",
key: getAssigneeItemKey(user),
user,
level: level + 1
});
}
if ((_a = dept.children) == null ? void 0 : _a.length) {
rows.push(...flattenApproverDeptTree(dept.children, level + 1));
}
}
return rows;
};
exports.findAssigneeUserInDeptTree = findAssigneeUserInDeptTree;
exports.flattenApproverDeptTree = flattenApproverDeptTree;
exports.formatAssigneeDisplayName = formatAssigneeDisplayName;
exports.normalizeApproverDeptTree = normalizeApproverDeptTree;
exports.resolveAssigneeIdentityId = resolveAssigneeIdentityId;
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/flow/flowAssigneeUtils.js.map

File diff suppressed because one or more lines are too long

View File

@@ -223,9 +223,10 @@ const _sfc_main = {
x: item.type === "rectify",
O: item.type === "verify",
Z: item.type === "writeoff",
ak: "node-" + index,
al: "hazard-node-" + index,
am: index === common_vendor.unref(historyList).length - 1 ? 1 : ""
ak: common_vendor.unref(activeIndex) === index ? 1 : "",
al: "node-" + index,
am: "hazard-node-" + index,
an: index === common_vendor.unref(historyList).length - 1 ? 1 : ""
});
}),
j: common_vendor.unref(contentScrollIntoView),

File diff suppressed because one or more lines are too long

View File

@@ -208,6 +208,16 @@
padding-bottom: 40rpx;
margin-bottom: 0;
}
.detail-card-shell.data-v-f38c3cb4 {
border-radius: 22rpx;
padding: 2rpx;
background: transparent;
transition: background 0.3s ease, box-shadow 0.3s ease;
}
.detail-card-shell--active.data-v-f38c3cb4 {
background: linear-gradient(145deg, rgba(4, 108, 234, 0.48) 0%, rgba(38, 103, 233, 0.3) 50%, rgba(33, 88, 200, 0.16) 100%);
box-shadow: 0 8rpx 24rpx rgba(38, 103, 233, 0.12);
}
.detail-card.data-v-f38c3cb4 {
background: #fff;
border-radius: 16rpx;

View File

@@ -244,9 +244,10 @@ const _sfc_main = {
A: item.type === "rectify",
R: item.type === "verify",
ac: item.type === "writeoff",
an: "node-" + index,
ao: "hazard-node-" + index,
ap: index === common_vendor.unref(historyList).length - 1 ? 1 : ""
an: common_vendor.unref(activeIndex) === index ? 1 : "",
ao: "node-" + index,
ap: "hazard-node-" + index,
aq: index === common_vendor.unref(historyList).length - 1 ? 1 : ""
});
}),
g: common_vendor.s(scrollAreaStyle.value),

File diff suppressed because one or more lines are too long

View File

@@ -121,6 +121,16 @@
padding-bottom: 40rpx;
margin-bottom: 0;
}
.detail-card-shell.data-v-361ef447 {
border-radius: 22rpx;
padding: 2rpx;
background: transparent;
transition: background 0.3s ease, box-shadow 0.3s ease;
}
.detail-card-shell--active.data-v-361ef447 {
background: linear-gradient(145deg, rgba(4, 108, 234, 0.48) 0%, rgba(38, 103, 233, 0.3) 50%, rgba(33, 88, 200, 0.16) 100%);
box-shadow: 0 8rpx 24rpx rgba(38, 103, 233, 0.12);
}
.detail-card.data-v-361ef447 {
background: #fff;
border-radius: 20rpx;

View File

@@ -0,0 +1,350 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_request = require("../../request/request.js");
const components_hazardDetail_processChain = require("./processChain.js");
const components_hazardDetail_processChainLabels = require("./processChainLabels.js");
const components_hazardDetail_useProcessChainScroll = require("./useProcessChainScroll.js");
const _sfc_main = {
__name: "HazardProcessChainPanel",
props: {
chainData: {
type: Object,
default: () => ({})
},
loading: {
type: Boolean,
default: false
},
bodyHeight: {
type: Number,
default: 0
}
},
setup(__props) {
const labels = components_hazardDetail_processChainLabels.CHAIN_LABELS;
const props = __props;
const { chainData, loading } = common_vendor.toRefs(props);
const {
historyList,
activeIndex,
contentScrollIntoView,
stepScrollIntoView,
scrollWithAnimation,
onContentScroll,
onScrollToLower,
scrollToNode,
scheduleMeasureLayout
} = components_hazardDetail_useProcessChainScroll.useProcessChainScroll(chainData, loading);
const scrollAreaStyle = common_vendor.computed(() => {
const height = props.bodyHeight > 0 ? props.bodyHeight : 400;
return { height: `${height}px` };
});
const detailBodyStyle = common_vendor.computed(() => {
const height = props.bodyHeight > 0 ? props.bodyHeight : 400;
return { height: `${height}px` };
});
common_vendor.watch(
() => props.bodyHeight,
(height) => {
if (height > 0) {
scheduleMeasureLayout();
setTimeout(scheduleMeasureLayout, 100);
}
}
);
const LEVEL_CLASS_MAP = {
2: "level-normal",
3: "level-major"
};
const getLevelTagClass = (content) => {
const level = content == null ? void 0 : content.level;
const levelName = content == null ? void 0 : content.levelName;
if (level != null && LEVEL_CLASS_MAP[level]) {
return LEVEL_CLASS_MAP[level];
}
if (levelName && components_hazardDetail_processChainLabels.LEVEL_NAME_CLASS_MAP[levelName]) {
return components_hazardDetail_processChainLabels.LEVEL_NAME_CLASS_MAP[levelName];
}
return "";
};
const resolveFileUrl = (path) => request_request.toImageUrl(path);
const fieldText = (item, value) => components_hazardDetail_processChain.resolveFieldDisplay(value, item.completed);
const isPendingText = (item, value) => fieldText(item, value) === components_hazardDetail_processChain.PENDING_LABEL;
const formatCost = (cost, completed = true) => {
if (cost == null || cost === "")
return components_hazardDetail_processChain.resolveFieldDisplay("", completed);
const num = Number(cost);
if (Number.isNaN(num))
return components_hazardDetail_processChain.resolveFieldDisplay("", completed);
return `${num} ${labels.yuan}`;
};
const previewSingle = (path) => {
const url = resolveFileUrl(path);
if (!url)
return;
common_vendor.index.previewImage({ current: url, urls: [url] });
};
const previewImages = (attachments, index) => {
const urls = (attachments || []).filter((f) => f.fileType === "image" || !f.fileType).map((f) => resolveFileUrl(f.filePath)).filter(Boolean);
if (!urls.length)
return;
common_vendor.index.previewImage({ current: urls[index] || urls[0], urls });
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.unref(loading)
}, common_vendor.unref(loading) ? {
b: common_vendor.t(common_vendor.unref(labels).loading)
} : common_vendor.unref(historyList).length === 0 ? {
d: common_vendor.t(common_vendor.unref(labels).empty)
} : {
e: common_vendor.f(common_vendor.unref(historyList), (item, index, i0) => {
return common_vendor.e({
a: common_vendor.unref(components_hazardDetail_processChain.getProcessStepIconPath)(item, common_vendor.unref(activeIndex) === index),
b: common_vendor.unref(activeIndex) === index ? 1 : "",
c: common_vendor.t(item.nodeName),
d: common_vendor.unref(activeIndex) === index ? 1 : "",
e: index < common_vendor.unref(historyList).length - 1
}, index < common_vendor.unref(historyList).length - 1 ? {} : {}, {
f: "step-" + index,
g: "process-step-" + index,
h: common_vendor.unref(activeIndex) === index ? 1 : "",
i: common_vendor.o(($event) => common_vendor.unref(scrollToNode)(index), "step-" + index)
});
}),
f: common_vendor.s(scrollAreaStyle.value),
g: common_vendor.unref(stepScrollIntoView),
h: common_vendor.f(common_vendor.unref(historyList), (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.titlePrefix),
b: common_vendor.t(fieldText(item, item.operator)),
c: common_vendor.t(fieldText(item, item.time)),
d: item.type === "add" && item.content.levelName
}, item.type === "add" && item.content.levelName ? {
e: common_vendor.t(item.content.levelName),
f: common_vendor.n(getLevelTagClass(item.content))
} : {}, {
g: item.type === "add"
}, item.type === "add" ? common_vendor.e({
h: common_vendor.t(common_vendor.unref(labels).hazardCode),
i: common_vendor.t(fieldText(item, item.content.code)),
j: common_vendor.t(common_vendor.unref(labels).hazardTitle),
k: common_vendor.t(fieldText(item, item.content.title)),
l: common_vendor.t(common_vendor.unref(labels).checkSource),
m: common_vendor.t(fieldText(item, item.content.source)),
n: common_vendor.t(common_vendor.unref(labels).hazardSource),
o: common_vendor.t(fieldText(item, item.content.hazardSourceName)),
p: common_vendor.t(common_vendor.unref(labels).hazardArea),
q: common_vendor.t(fieldText(item, item.content.areaName)),
r: common_vendor.t(common_vendor.unref(labels).address),
s: common_vendor.t(fieldText(item, item.content.address)),
t: common_vendor.t(common_vendor.unref(labels).hazardLevel),
v: common_vendor.t(fieldText(item, item.content.levelName)),
w: common_vendor.n(getLevelTagClass(item.content)),
x: common_vendor.t(common_vendor.unref(labels).hazardTag),
y: common_vendor.t(fieldText(item, item.content.tagName)),
z: common_vendor.t(common_vendor.unref(labels).description),
A: common_vendor.t(fieldText(item, item.content.description)),
B: item.content.attachments && item.content.attachments.length || !item.completed
}, item.content.attachments && item.content.attachments.length || !item.completed ? common_vendor.e({
C: common_vendor.t(common_vendor.unref(labels).hazardAttachments),
D: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
E: common_vendor.f(item.content.attachments, (file, idx, i1) => {
return {
a: idx,
b: resolveFileUrl(file.filePath),
c: common_vendor.o(($event) => previewImages(item.content.attachments, idx), idx),
d: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), idx)
};
})
} : {
F: common_vendor.t(fieldText(item, ""))
}) : {}, {
G: common_vendor.t(common_vendor.unref(labels).legalBasis),
H: common_vendor.t(fieldText(item, item.content.legalBasis))
}) : item.type === "assign" ? {
J: common_vendor.t(common_vendor.unref(labels).assigneeName),
K: common_vendor.t(fieldText(item, item.content.assigneeName)),
L: common_vendor.t(common_vendor.unref(labels).assignDeadline),
M: common_vendor.t(fieldText(item, item.content.deadline)),
N: common_vendor.t(common_vendor.unref(labels).assignStatus),
O: common_vendor.t(fieldText(item, item.content.assignStatusName))
} : item.type === "rectify" ? common_vendor.e({
Q: common_vendor.t(common_vendor.unref(labels).rectifyStatus),
R: common_vendor.t(fieldText(item, item.content.rectifyStatusName)),
S: common_vendor.t(common_vendor.unref(labels).rectifyPlan),
T: common_vendor.t(fieldText(item, item.content.rectifyPlan)),
U: common_vendor.t(common_vendor.unref(labels).rectifyResult),
V: common_vendor.t(fieldText(item, item.content.rectifyResult)),
W: common_vendor.t(common_vendor.unref(labels).rectifyMeasures),
X: common_vendor.t(fieldText(item, item.content.rectificationMeasures)),
Y: common_vendor.t(common_vendor.unref(labels).controlMeasures),
Z: common_vendor.t(fieldText(item, item.content.controlMeasures)),
aa: common_vendor.t(common_vendor.unref(labels).rectifierName),
ab: common_vendor.t(fieldText(item, item.content.rectifierName)),
ac: common_vendor.t(common_vendor.unref(labels).managerNames),
ad: common_vendor.t(fieldText(item, item.content.managerNames)),
ae: common_vendor.t(common_vendor.unref(labels).memberNames),
af: common_vendor.t(fieldText(item, item.content.memberNames)),
ag: common_vendor.t(common_vendor.unref(labels).planCost),
ah: common_vendor.t(formatCost(item.content.planCost, item.completed)),
ai: common_vendor.t(common_vendor.unref(labels).actualCost),
aj: common_vendor.t(formatCost(item.content.actualCost, item.completed)),
ak: item.content.attachments && item.content.attachments.length || !item.completed
}, item.content.attachments && item.content.attachments.length || !item.completed ? common_vendor.e({
al: common_vendor.t(common_vendor.unref(labels).rectifyAttachments),
am: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
an: common_vendor.f(item.content.attachments, (file, idx, i1) => {
return common_vendor.e({
a: file.fileType === "image" || !file.fileType
}, file.fileType === "image" || !file.fileType ? {
b: resolveFileUrl(file.filePath),
c: common_vendor.o(($event) => previewImages(item.content.attachments, idx), idx),
d: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), idx)
} : {
e: common_vendor.t(file.fileName || common_vendor.unref(labels).attachmentFallback)
}, {
f: idx
});
})
} : {
ao: common_vendor.t(fieldText(item, ""))
}) : {}, {
ap: item.content.signPath || !item.completed
}, item.content.signPath || !item.completed ? common_vendor.e({
aq: common_vendor.t(common_vendor.unref(labels).rectifySign),
ar: item.content.signPath
}, item.content.signPath ? {
as: resolveFileUrl(item.content.signPath),
at: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
av: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {
aw: common_vendor.t(fieldText(item, ""))
}) : {}) : item.type === "verify" || item.type === "writeoff_approve" ? common_vendor.e({
ay: common_vendor.t(common_vendor.unref(labels).verifyResult),
az: item.completed && item.content.resultName
}, item.completed && item.content.resultName ? {
aA: common_vendor.t(item.content.resultName),
aB: common_vendor.n(item.content.resultName === common_vendor.unref(labels).pass ? "result-tag--pass" : "result-tag--fail")
} : {
aC: common_vendor.t(fieldText(item, item.content.resultName))
}, {
aD: item.content.remark || !item.completed
}, item.content.remark || !item.completed ? {
aE: common_vendor.t(common_vendor.unref(labels).verifyRemark),
aF: common_vendor.t(fieldText(item, item.content.remark))
} : {}, {
aG: item.content.attachments && item.content.attachments.length || !item.completed
}, item.content.attachments && item.content.attachments.length || !item.completed ? common_vendor.e({
aH: common_vendor.t(common_vendor.unref(labels).verifyAttachments),
aI: item.content.attachments && item.content.attachments.length
}, item.content.attachments && item.content.attachments.length ? {
aJ: common_vendor.f(item.content.attachments, (file, idx, i1) => {
return common_vendor.e({
a: file.fileType === "image" || !file.fileType
}, file.fileType === "image" || !file.fileType ? {
b: resolveFileUrl(file.filePath),
c: common_vendor.o(($event) => previewImages(item.content.attachments, idx), idx),
d: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), idx)
} : {
e: common_vendor.t(file.fileName || common_vendor.unref(labels).attachmentFallback)
}, {
f: idx
});
})
} : {
aK: common_vendor.t(fieldText(item, ""))
}) : {}, {
aL: item.content.signPath || !item.completed
}, item.content.signPath || !item.completed ? common_vendor.e({
aM: common_vendor.t(common_vendor.unref(labels).verifySign),
aN: item.content.signPath
}, item.content.signPath ? {
aO: resolveFileUrl(item.content.signPath),
aP: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
aQ: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {
aR: common_vendor.t(fieldText(item, ""))
}) : {}) : item.type === "writeoff_apply" ? common_vendor.e({
aT: common_vendor.t(common_vendor.unref(labels).writeoffDeadline),
aU: common_vendor.t(fieldText(item, item.content.rectifyDeadline)),
aV: common_vendor.t(common_vendor.unref(labels).responsibleDept),
aW: common_vendor.t(fieldText(item, item.content.responsibleDeptName)),
aX: common_vendor.t(common_vendor.unref(labels).responsiblePerson),
aY: common_vendor.t(fieldText(item, item.content.responsiblePerson)),
aZ: common_vendor.t(common_vendor.unref(labels).mainTreatment),
ba: common_vendor.t(fieldText(item, item.content.mainTreatmentContent)),
bb: common_vendor.t(common_vendor.unref(labels).treatmentResult),
bc: common_vendor.t(fieldText(item, item.content.treatmentResult)),
bd: common_vendor.t(common_vendor.unref(labels).selfVerify),
be: common_vendor.t(fieldText(item, item.content.selfVerifyContent)),
bf: item.content.signPath || !item.completed
}, item.content.signPath || !item.completed ? common_vendor.e({
bg: common_vendor.t(common_vendor.unref(labels).applySign),
bh: item.content.signPath
}, item.content.signPath ? {
bi: resolveFileUrl(item.content.signPath),
bj: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
bk: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {
bl: common_vendor.t(fieldText(item, ""))
}) : {}) : item.type === "approval" ? common_vendor.e({
bn: common_vendor.t(common_vendor.unref(labels).approvalOpinion),
bo: item.completed && item.content.approveTypeName
}, item.completed && item.content.approveTypeName ? {
bp: common_vendor.t(item.content.approveTypeName),
bq: common_vendor.n(item.content.pass ? "result-tag--pass" : "result-tag--fail")
} : {
br: common_vendor.t(fieldText(item, item.content.approveTypeName))
}, {
bs: common_vendor.t(common_vendor.unref(labels).approvalComment),
bt: common_vendor.t(fieldText(item, item.content.comment)),
bv: isPendingText(item, item.content.comment) ? 1 : "",
bw: common_vendor.t(common_vendor.unref(labels).smsReminder),
bx: item.content.sendMsgFlag != null
}, item.content.sendMsgFlag != null ? {
by: common_vendor.t(item.content.sendMsgFlag ? common_vendor.unref(labels).yes : common_vendor.unref(labels).no)
} : {
bz: common_vendor.t(fieldText(item, ""))
}, {
bA: item.content.signPath || !item.completed
}, item.content.signPath || !item.completed ? common_vendor.e({
bB: common_vendor.t(common_vendor.unref(labels).approvalSign),
bC: item.content.signPath
}, item.content.signPath ? {
bD: resolveFileUrl(item.content.signPath),
bE: common_vendor.o(($event) => previewSingle(item.content.signPath), "node-" + index),
bF: common_vendor.o((...args) => common_vendor.unref(scheduleMeasureLayout) && common_vendor.unref(scheduleMeasureLayout)(...args), "node-" + index)
} : {
bG: common_vendor.t(fieldText(item, ""))
}) : {}) : {}, {
I: item.type === "assign",
P: item.type === "rectify",
ax: item.type === "verify" || item.type === "writeoff_approve",
aS: item.type === "writeoff_apply",
bm: item.type === "approval",
bH: common_vendor.unref(activeIndex) === index ? 1 : "",
bI: "node-" + index,
bJ: "process-node-" + index,
bK: index === common_vendor.unref(historyList).length - 1 ? 1 : ""
});
}),
i: common_vendor.t(common_vendor.unref(labels).personnelSuffix),
j: common_vendor.s(scrollAreaStyle.value),
k: common_vendor.unref(contentScrollIntoView),
l: common_vendor.unref(scrollWithAnimation),
m: common_vendor.o((...args) => common_vendor.unref(onContentScroll) && common_vendor.unref(onContentScroll)(...args)),
n: common_vendor.o((...args) => common_vendor.unref(onScrollToLower) && common_vendor.unref(onScrollToLower)(...args)),
o: common_vendor.s(detailBodyStyle.value)
}, {
c: common_vendor.unref(historyList).length === 0,
p: common_vendor.gei(_ctx, "")
});
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-020654bc"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/hazardDetail/HazardProcessChainPanel.js.map

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,286 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.hazard-process-chain-panel.data-v-020654bc {
flex: 1;
min-height: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
}
.loading-wrap.data-v-020654bc,
.empty-wrap.data-v-020654bc {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
min-height: 0;
}
.loading-text.data-v-020654bc,
.empty-text.data-v-020654bc {
font-size: 28rpx;
color: #909399;
}
.detail-body.data-v-020654bc {
display: flex;
gap: 20rpx;
align-items: stretch;
overflow: hidden;
box-sizing: border-box;
}
.steps-card.data-v-020654bc {
width: 148rpx;
flex-shrink: 0;
background: #fff;
border-radius: 20rpx;
box-sizing: border-box;
}
.step-item.data-v-020654bc {
padding: 0 8rpx;
}
.step-track.data-v-020654bc {
display: flex;
flex-direction: column;
align-items: center;
padding: 24rpx 0 0;
}
.step-dot.data-v-020654bc {
width: 66rpx;
height: 66rpx;
border-radius: 50%;
background: #f3f3f3;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.2s;
}
.step-dot--active.data-v-020654bc {
background: #2667e9;
}
.step-icon.data-v-020654bc {
width: 36rpx;
height: 36rpx;
}
.step-label.data-v-020654bc {
margin-top: 10rpx;
font-size: 20rpx;
color: #999;
line-height: 1.3;
text-align: center;
word-break: break-all;
}
.step-label--active.data-v-020654bc {
color: #2667e9;
font-weight: 600;
}
.step-line.data-v-020654bc {
width: 0;
height: 36rpx;
margin: 8rpx 0;
border-left: 2rpx dashed #dcdfe6;
}
.content-column.data-v-020654bc {
flex: 1;
width: 0;
min-height: 0;
box-sizing: border-box;
}
.content-scroll.data-v-020654bc {
width: 100%;
box-sizing: border-box;
}
.node-section.data-v-020654bc {
box-sizing: border-box;
padding: 0;
margin-bottom: 24rpx;
}
.node-section--last.data-v-020654bc {
padding-bottom: 40rpx;
margin-bottom: 0;
}
.detail-card-shell.data-v-020654bc {
border-radius: 22rpx;
padding: 2rpx;
background: transparent;
transition: background 0.3s ease, box-shadow 0.3s ease;
}
.detail-card-shell--active.data-v-020654bc {
background: linear-gradient(145deg, rgba(4, 108, 234, 0.48) 0%, rgba(38, 103, 233, 0.3) 50%, rgba(33, 88, 200, 0.16) 100%);
box-shadow: 0 8rpx 24rpx rgba(38, 103, 233, 0.12);
}
.detail-card.data-v-020654bc {
background: #fff;
border-radius: 20rpx;
overflow: hidden;
padding: 28rpx 38rpx;
box-sizing: border-box;
}
.card-header-v2.data-v-020654bc {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16rpx;
padding: 0;
}
.card-header-main.data-v-020654bc {
flex: 1;
min-width: 0;
}
.operator.data-v-020654bc {
font-size: 28rpx;
font-weight: 600;
color: #303133;
line-height: 1.5;
word-break: break-all;
}
.time.data-v-020654bc {
display: block;
margin-top: 8rpx;
font-size: 24rpx;
color: #999;
line-height: 1.4;
}
.level-badge.data-v-020654bc {
flex-shrink: 0;
padding: 6rpx 16rpx;
border-radius: 8rpx;
font-size: 22rpx;
font-weight: 500;
white-space: nowrap;
}
.level-badge.level-normal.data-v-020654bc {
background: #fff7e6;
border: 2rpx solid #ffd591;
color: #fa8c16;
}
.level-badge.level-major.data-v-020654bc {
background: #fff1f0;
border: 2rpx solid #ffa39e;
color: #f5222d;
}
.card-divider.data-v-020654bc {
height: 0;
margin: 20rpx 0;
border-top: 2rpx dashed #eee;
}
.card-body.data-v-020654bc {
padding: 0;
}
.detail-row-v2.data-v-020654bc {
display: flex;
align-items: flex-start;
justify-content: flex-start;
gap: 24rpx;
padding: 18rpx 0;
}
.detail-row-v2--block.data-v-020654bc {
flex-wrap: wrap;
}
.label.data-v-020654bc {
flex-shrink: 0;
font-size: 26rpx;
color: #999;
line-height: 1.5;
}
.value.data-v-020654bc {
flex: 1;
min-width: 0;
font-size: 26rpx;
color: #333;
line-height: 1.6;
text-align: left;
word-break: break-all;
}
.value--pending.data-v-020654bc {
color: #e6a23c;
}
.level-tag.data-v-020654bc {
display: inline-flex;
align-items: center;
padding: 4rpx 16rpx;
border-radius: 8rpx;
font-size: 24rpx;
font-weight: 500;
line-height: 1.4;
white-space: nowrap;
}
.level-normal.data-v-020654bc {
background: #fff7e6;
border: 2rpx solid #ffd591;
color: #fa8c16;
}
.level-major.data-v-020654bc {
background: #fff1f0;
border: 2rpx solid #ffa39e;
color: #f5222d;
}
.attachment-list.data-v-020654bc {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
flex: 1;
min-width: 0;
}
.attachment-img.data-v-020654bc {
width: 160rpx;
height: 160rpx;
border-radius: 12rpx;
background: #f5f7fa;
}
.sign-img.data-v-020654bc {
width: 300rpx;
height: 160rpx;
border: 1rpx solid #e4e7ed;
border-radius: 8rpx;
background: #fafafa;
flex: 1;
min-width: 0;
max-width: 100%;
}
.file-link.data-v-020654bc {
display: inline-block;
padding: 12rpx 20rpx;
background: #f5f7fa;
border: 1rpx solid #e4e7ed;
border-radius: 8rpx;
color: #2667e9;
font-size: 24rpx;
}
.result-tag.data-v-020654bc {
padding: 6rpx 16rpx;
border-radius: 6rpx;
font-size: 24rpx;
}
.result-tag--pass.data-v-020654bc {
background: #f0f9eb;
color: #67c23a;
}
.result-tag--fail.data-v-020654bc {
background: #fef0f0;
color: #f56c6c;
}

View File

@@ -199,6 +199,7 @@ function generateHazardHistory(data) {
}
return list;
}
exports.formatNameList = formatNameList;
exports.generateHazardHistory = generateHazardHistory;
exports.getStatusClass = getStatusClass;
exports.getStepIconPath = getStepIconPath;

View File

@@ -0,0 +1,340 @@
"use strict";
const components_hazardDetail_hazardDetail = require("./hazardDetail.js");
const PENDING_LABEL = "待处理";
const isNodeCompleted = (node) => (node == null ? void 0 : node.completed) !== false;
const resolveFieldDisplay = (value, completed = true) => {
if (value != null && value !== "")
return value;
return completed ? "-" : PENDING_LABEL;
};
const PROCESS_NODE_TYPES = {
ADD: "add",
ASSIGN: "assign",
RECTIFY: "rectify",
RECTIFY_ASSIGN: "rectifyAssign",
VERIFY: "verify",
VERIFY_SUB: "verify_sub",
WRITEOFF_APPLY: "writeoff_apply",
WRITEOFF_APPROVE: "writeoff_approve",
WRITEOFF_SUB: "writeoff_sub",
APPROVAL: "approval"
};
const SUB_TYPE_SUFFIX_MAP = {
verify: "验收",
writeoff: "销号"
};
const TITLE_PREFIX_MAP = {
add: "提交",
assign: "交办",
rectify: "整改",
rectifyAssign: "交办",
verify: "验收",
verify_sub: "审批",
writeoff_apply: "销号申请",
writeoff_approve: "销号审核",
writeoff_sub: "审批"
};
const APPROVAL_TASK_KEY_ICON = {
department_review: "bumenshenpi",
section_chief_review: "fenguanshenpi",
supervising_executive_review: "fenguanshenpi",
supervising_leader_review_1: "zhuguanshenpi",
supervising_leader_review_2: "zhuguanshenpi"
};
const NODE_TYPE_ICON = {
add: "tijiao",
assign: "jiaoban",
rectifyAssign: "jiaoban",
rectify: "zhenggai",
verify: "yanshou",
writeoff_apply: "xiaohao",
writeoff_approve: "xiaohao"
};
const resolveTaskKey = (node) => {
var _a;
return (node == null ? void 0 : node.taskKey) || ((_a = node == null ? void 0 : node.subProcessApprovalInfo) == null ? void 0 : _a.taskKey) || "";
};
const toSafeObject = (value) => value && typeof value === "object" ? value : {};
const toDisplayText = (value) => {
if (value == null || value === "")
return "";
return value;
};
const getProcessStepDisplayName = (node) => {
var _a;
if (!node)
return "";
const nodeType = node.nodeType;
if (nodeType === "verify_sub" || nodeType === "writeoff_sub") {
const subType = (_a = node.subProcessApprovalInfo) == null ? void 0 : _a.subType;
const suffix = SUB_TYPE_SUFFIX_MAP[subType];
return suffix ? `${node.nodeName}${suffix}` : node.nodeName;
}
return node.nodeName || "";
};
const getProcessStepIconPath = (item, active = false) => {
const type = item == null ? void 0 : item.type;
const taskKey = (item == null ? void 0 : item.taskKey) || "";
const state = active ? "selected" : "unselected";
if (type === PROCESS_NODE_TYPES.APPROVAL) {
const iconBase = APPROVAL_TASK_KEY_ICON[taskKey] || "bumenshenpi";
return `/static/yinhuan_detail/${iconBase}_${state}.png`;
}
const base = NODE_TYPE_ICON[item == null ? void 0 : item.rawType] || NODE_TYPE_ICON[type] || "tijiao";
if (base === "zhenggai") {
return active ? "/static/yinhuan_detail/zhenggai_selected.png" : "/static/yinhuan_detail/zhenggai__unselected.png";
}
return `/static/yinhuan_detail/${base}__${state}.png`;
};
const resolveOperator = (node, nodeType) => {
var _a, _b, _c, _d, _e;
const completed = isNodeCompleted(node);
const fallback = completed ? "-" : "";
if (nodeType === PROCESS_NODE_TYPES.ADD) {
return ((_a = node.hazardInfo) == null ? void 0 : _a.reporterName) || fallback;
}
if (nodeType === PROCESS_NODE_TYPES.ASSIGN) {
return ((_b = node.assignInfo) == null ? void 0 : _b.assignerName) || fallback;
}
if (nodeType === PROCESS_NODE_TYPES.RECTIFY) {
return ((_c = node.rectifyInfo) == null ? void 0 : _c.rectifierName) || fallback;
}
if (nodeType === PROCESS_NODE_TYPES.VERIFY || nodeType === PROCESS_NODE_TYPES.WRITEOFF_APPROVE) {
return ((_d = node.verifyInfo) == null ? void 0 : _d.verifierName) || fallback;
}
if (nodeType === PROCESS_NODE_TYPES.WRITEOFF_APPLY) {
return ((_e = node.writeOffApplyInfo) == null ? void 0 : _e.applicantName) || fallback;
}
if (nodeType === PROCESS_NODE_TYPES.APPROVAL) {
const info = node.subProcessApprovalInfo || {};
return info.operatorName || info.assigneeName || fallback;
}
return fallback;
};
const resolveTime = (node, nodeType) => {
var _a, _b, _c, _d, _e, _f;
const completed = isNodeCompleted(node);
const fallback = completed ? "-" : "";
if (nodeType === PROCESS_NODE_TYPES.ADD) {
return ((_a = node.hazardInfo) == null ? void 0 : _a.createdAt) || node.completedAt || node.occurredAt || fallback;
}
if (nodeType === PROCESS_NODE_TYPES.ASSIGN) {
return ((_b = node.assignInfo) == null ? void 0 : _b.assignTime) || node.completedAt || fallback;
}
if (nodeType === PROCESS_NODE_TYPES.RECTIFY) {
return ((_c = node.rectifyInfo) == null ? void 0 : _c.rectifyTime) || node.completedAt || fallback;
}
if (nodeType === PROCESS_NODE_TYPES.VERIFY || nodeType === PROCESS_NODE_TYPES.WRITEOFF_APPROVE) {
return ((_d = node.verifyInfo) == null ? void 0 : _d.verifyTime) || node.completedAt || fallback;
}
if (nodeType === PROCESS_NODE_TYPES.WRITEOFF_APPLY) {
return ((_e = node.writeOffApplyInfo) == null ? void 0 : _e.applyTime) || node.completedAt || fallback;
}
if (nodeType === PROCESS_NODE_TYPES.APPROVAL) {
return ((_f = node.subProcessApprovalInfo) == null ? void 0 : _f.endTime) || node.completedAt || fallback;
}
return node.completedAt || node.occurredAt || fallback;
};
const mapAddContent = (info) => {
const data = toSafeObject(info);
return {
code: toDisplayText(data.code),
title: toDisplayText(data.title),
source: toDisplayText(data.source),
hazardSourceName: toDisplayText(data.hazardSourceName),
areaName: toDisplayText(data.areaName),
address: toDisplayText(data.address),
level: data.level ?? null,
levelName: toDisplayText(data.levelName),
tagName: toDisplayText(data.tagName),
description: toDisplayText(data.description),
attachments: Array.isArray(data.attachments) ? data.attachments : [],
legalBasis: toDisplayText(data.legalBasis)
};
};
const mapAssignContent = (info) => {
const data = toSafeObject(info);
return {
assigneeName: toDisplayText(data.assigneeName),
deadline: toDisplayText(data.deadline),
assignRemark: toDisplayText(data.assignRemark),
assignStatusName: toDisplayText(data.assignStatusName)
};
};
const mapRectifyContent = (info) => {
const data = toSafeObject(info);
return {
rectifyStatusName: toDisplayText(data.rectifyStatusName),
rectifyPlan: toDisplayText(data.rectifyPlan),
rectifyResult: toDisplayText(data.rectifyResult),
rectificationMeasures: toDisplayText(data.rectificationMeasures),
controlMeasures: toDisplayText(data.controlMeasures),
rectifierName: toDisplayText(data.rectifierName),
managerNames: components_hazardDetail_hazardDetail.formatNameList(data.managerNames, ""),
memberNames: components_hazardDetail_hazardDetail.formatNameList(data.memberNames, ""),
planCost: data.planCost ?? null,
actualCost: data.actualCost ?? null,
attachments: Array.isArray(data.attachments) ? data.attachments : [],
signPath: toDisplayText(data.signPath)
};
};
const mapVerifyContent = (info) => {
const data = toSafeObject(info);
return {
resultName: toDisplayText(data.resultName),
remark: toDisplayText(data.remark),
attachments: Array.isArray(data.attachments) ? data.attachments : [],
signPath: toDisplayText(data.signPath)
};
};
const mapApprovalContent = (info) => {
const data = toSafeObject(info);
return {
approveTypeName: toDisplayText(data.approveTypeName),
pass: data.pass ?? null,
comment: toDisplayText(data.comment),
nextStepName: toDisplayText(data.nextStepName),
nextAssigneeName: toDisplayText(data.nextAssigneeName),
sendMsgFlag: data.sendMsgFlag ?? null,
signPath: toDisplayText(data.signPath)
};
};
const mapWriteoffApplyContent = (info) => {
const data = toSafeObject(info);
return {
rectifyDeadline: toDisplayText(data.rectifyDeadline),
responsibleDeptName: toDisplayText(data.responsibleDeptName),
responsiblePerson: toDisplayText(data.responsiblePerson),
mainTreatmentContent: toDisplayText(data.mainTreatmentContent),
treatmentResult: toDisplayText(data.treatmentResult),
selfVerifyContent: toDisplayText(data.selfVerifyContent),
signPath: toDisplayText(data.signPath)
};
};
const resolveNodeType = (node) => {
const nodeType = node == null ? void 0 : node.nodeType;
if (nodeType === "verify_sub" || nodeType === "writeoff_sub") {
return PROCESS_NODE_TYPES.APPROVAL;
}
return nodeType || PROCESS_NODE_TYPES.ADD;
};
const hasRectifyData = (rectifyInfo) => {
if (!rectifyInfo || typeof rectifyInfo !== "object") {
return false;
}
return Boolean(
rectifyInfo.rectifyId || rectifyInfo.rectifyPlan || rectifyInfo.rectifyResult || rectifyInfo.rectifyTime || rectifyInfo.rectifierName
);
};
const hasAssignData = (assignInfo) => {
if (!assignInfo || typeof assignInfo !== "object") {
return false;
}
return Boolean(
assignInfo.assignId || assignInfo.assigneeName || assignInfo.assignerName || assignInfo.assignTime
);
};
const isAssignLikeNodeType = (nodeType) => nodeType === PROCESS_NODE_TYPES.ASSIGN || nodeType === PROCESS_NODE_TYPES.RECTIFY_ASSIGN;
const resolveAssignRectifyDisplayType = (node) => {
if (hasRectifyData(node == null ? void 0 : node.rectifyInfo)) {
return PROCESS_NODE_TYPES.RECTIFY;
}
if (hasAssignData(node == null ? void 0 : node.assignInfo)) {
return PROCESS_NODE_TYPES.ASSIGN;
}
return null;
};
const resolveDisplayType = (node, nodeType) => {
if (isAssignLikeNodeType(nodeType)) {
return resolveAssignRectifyDisplayType(node) || PROCESS_NODE_TYPES.ASSIGN;
}
if (nodeType === PROCESS_NODE_TYPES.RECTIFY) {
return resolveAssignRectifyDisplayType(node) || PROCESS_NODE_TYPES.RECTIFY;
}
return nodeType;
};
const resolveTitlePrefix = (rawType, displayType, node) => {
if (displayType === PROCESS_NODE_TYPES.ASSIGN) {
return TITLE_PREFIX_MAP[rawType] || TITLE_PREFIX_MAP.assign;
}
if (displayType === PROCESS_NODE_TYPES.RECTIFY) {
return TITLE_PREFIX_MAP.rectify;
}
return TITLE_PREFIX_MAP[displayType] || TITLE_PREFIX_MAP[rawType] || node.nodeName || "处理";
};
const mapNodeContent = (node, displayType) => {
switch (displayType) {
case PROCESS_NODE_TYPES.ADD:
return mapAddContent(node.hazardInfo);
case PROCESS_NODE_TYPES.ASSIGN:
return mapAssignContent(node.assignInfo);
case PROCESS_NODE_TYPES.RECTIFY:
return mapRectifyContent(node.rectifyInfo);
case PROCESS_NODE_TYPES.VERIFY:
case PROCESS_NODE_TYPES.WRITEOFF_APPROVE:
return mapVerifyContent(node.verifyInfo);
case PROCESS_NODE_TYPES.WRITEOFF_APPLY:
return mapWriteoffApplyContent(node.writeOffApplyInfo);
case PROCESS_NODE_TYPES.APPROVAL:
return mapApprovalContent(node.subProcessApprovalInfo);
default:
return {};
}
};
const mapProcessNodeToHistoryItem = (node) => {
if (!node || typeof node !== "object") {
return {
type: PROCESS_NODE_TYPES.ADD,
rawType: "",
taskKey: "",
nodeName: "",
titlePrefix: "处理",
operator: "",
time: "",
content: {},
flowTaskId: "",
completed: true
};
}
const nodeType = resolveNodeType(node);
const rawType = node.nodeType || nodeType;
const displayType = resolveDisplayType(node, nodeType);
return {
type: displayType,
rawType,
taskKey: resolveTaskKey(node),
nodeName: getProcessStepDisplayName(node),
titlePrefix: resolveTitlePrefix(rawType, displayType, node),
operator: resolveOperator(node, displayType),
time: resolveTime(node, displayType),
content: mapNodeContent(node, displayType),
flowTaskId: node.flowTaskId || "",
completed: isNodeCompleted(node)
};
};
const mapProcessChainNodes = (nodes = []) => {
if (!Array.isArray(nodes) || nodes.length === 0)
return [];
return nodes.map((node) => mapProcessNodeToHistoryItem(node));
};
const resolveProcessChainSummary = (data) => {
var _a;
if (!data) {
return {
statusName: "-",
createdAt: "-"
};
}
const addNode = (data.nodes || []).find((item) => item.nodeType === "add");
const createdAt = ((_a = addNode == null ? void 0 : addNode.hazardInfo) == null ? void 0 : _a.createdAt) || "-";
return {
statusName: data.statusName || "-",
createdAt
};
};
exports.PENDING_LABEL = PENDING_LABEL;
exports.getProcessStepIconPath = getProcessStepIconPath;
exports.mapProcessChainNodes = mapProcessChainNodes;
exports.resolveFieldDisplay = resolveFieldDisplay;
exports.resolveProcessChainSummary = resolveProcessChainSummary;
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/hazardDetail/processChain.js.map

View File

@@ -0,0 +1,61 @@
"use strict";
const CHAIN_LABELS = {
loading: "加载中...",
empty: "暂无流程记录",
personnelSuffix: "人员:",
hazardCode: "隐患编号",
hazardTitle: "隐患标题",
checkSource: "检查形式",
hazardSource: "隐患来源",
hazardArea: "隐患区域",
address: "位置描述",
hazardLevel: "隐患等级",
hazardTag: "隐患标签",
description: "问题描述",
hazardAttachments: "隐患附件",
legalBasis: "参考法规",
assigneeName: "指定整改责任人",
assignDeadline: "指定整改截至日期",
assignStatus: "交办状态",
rectifyStatus: "整改状态",
rectifyPlan: "整改方案",
rectifyResult: "整改结果",
rectifyMeasures: "整改措施",
controlMeasures: "管控措施",
rectifierName: "整改责任人",
managerNames: "管理人员",
memberNames: "整改成员",
planCost: "预计费用",
actualCost: "实际费用",
rectifyAttachments: "整改附件",
rectifySign: "整改签字",
verifyResult: "验收结果",
pass: "通过",
verifyRemark: "验收备注",
verifyAttachments: "验收附件",
verifySign: "验收签字",
writeoffDeadline: "整改时限",
responsibleDept: "治理责任单位",
responsiblePerson: "主要负责人",
mainTreatment: "主要治理内容",
treatmentResult: "治理完成内容",
selfVerify: "自行验收情况",
applySign: "申请签字",
approvalOpinion: "审批意见",
approvalComment: "意见说明",
smsReminder: "短信提醒",
yes: "是",
no: "否",
approvalSign: "审批签字",
attachmentFallback: "附件",
yuan: "元"
};
const LEVEL_NAME_CLASS_MAP = {
一般: "level-normal",
一般隐患: "level-normal",
重大: "level-major",
重大隐患: "level-major"
};
exports.CHAIN_LABELS = CHAIN_LABELS;
exports.LEVEL_NAME_CLASS_MAP = LEVEL_NAME_CLASS_MAP;
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/hazardDetail/processChainLabels.js.map

View File

@@ -0,0 +1,145 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const components_hazardDetail_processChain = require("./processChain.js");
function useProcessChainScroll(chainSource, loadingSource) {
const instance = common_vendor.getCurrentInstance();
const queryScope = (instance == null ? void 0 : instance.proxy) || instance;
const historyList = common_vendor.ref([]);
const activeIndex = common_vendor.ref(0);
const sectionOffsets = common_vendor.ref([0]);
const contentViewHeight = common_vendor.ref(0);
const contentScrollIntoView = common_vendor.ref("");
const stepScrollIntoView = common_vendor.ref("");
const scrollWithAnimation = common_vendor.ref(true);
const isProgrammaticScroll = common_vendor.ref(false);
let measureLayoutTimer = null;
const measureLayout = () => {
if (!historyList.value.length)
return;
common_vendor.nextTick$1(() => {
const query = common_vendor.index.createSelectorQuery().in(queryScope);
query.select(".content-scroll").boundingClientRect();
query.select(".content-scroll").scrollOffset();
query.selectAll(".node-section").boundingClientRect();
query.exec((res) => {
const containerRect = res == null ? void 0 : res[0];
const scrollOffset = res == null ? void 0 : res[1];
const sections = (res == null ? void 0 : res[2]) || [];
if (!containerRect || !sections.length)
return;
contentViewHeight.value = containerRect.height || 0;
const baseScrollTop = (scrollOffset == null ? void 0 : scrollOffset.scrollTop) || 0;
sectionOffsets.value = sections.map(
(section) => section.top - containerRect.top + baseScrollTop
);
});
});
};
const scheduleMeasureLayout = () => {
clearTimeout(measureLayoutTimer);
measureLayoutTimer = setTimeout(() => {
measureLayout();
}, 80);
};
const rebuildHistory = (data) => {
const nodes = (data == null ? void 0 : data.nodes) || [];
historyList.value = components_hazardDetail_processChain.mapProcessChainNodes(nodes);
activeIndex.value = 0;
contentScrollIntoView.value = "";
scheduleMeasureLayout();
setTimeout(scheduleMeasureLayout, 300);
};
const syncActiveIndex = (scrollTop, scrollHeight = 0) => {
const count = historyList.value.length;
if (!count)
return;
if (scrollHeight > 0 && contentViewHeight.value > 0) {
if (scrollTop + contentViewHeight.value >= scrollHeight - 60) {
if (activeIndex.value !== count - 1) {
activeIndex.value = count - 1;
}
return;
}
}
const offsets = sectionOffsets.value;
if (!offsets.length)
return;
let idx = 0;
for (let i = offsets.length - 1; i >= 0; i--) {
if (scrollTop >= offsets[i] - 80) {
idx = i;
break;
}
}
if (idx !== activeIndex.value) {
activeIndex.value = idx;
}
};
const onContentScroll = (e) => {
if (isProgrammaticScroll.value)
return;
const { scrollTop = 0, scrollHeight = 0 } = e.detail || {};
syncActiveIndex(scrollTop, scrollHeight);
scheduleMeasureLayout();
};
const onScrollToLower = () => {
const count = historyList.value.length;
if (count > 0 && activeIndex.value !== count - 1) {
activeIndex.value = count - 1;
}
};
const scrollToNode = (index) => {
if (index < 0 || index >= historyList.value.length)
return;
isProgrammaticScroll.value = true;
scrollWithAnimation.value = true;
activeIndex.value = index;
contentScrollIntoView.value = "process-node-" + index;
setTimeout(() => {
contentScrollIntoView.value = "";
isProgrammaticScroll.value = false;
scheduleMeasureLayout();
}, 350);
};
common_vendor.watch(
() => typeof loadingSource === "function" ? loadingSource() : loadingSource == null ? void 0 : loadingSource.value,
(loading) => {
if (!loading) {
scheduleMeasureLayout();
setTimeout(scheduleMeasureLayout, 300);
}
}
);
common_vendor.watch(
() => typeof chainSource === "function" ? chainSource() : chainSource == null ? void 0 : chainSource.value,
(val) => rebuildHistory(val),
{ immediate: true, deep: true }
);
common_vendor.watch(activeIndex, (index) => {
stepScrollIntoView.value = "process-step-" + index;
setTimeout(() => {
stepScrollIntoView.value = "";
}, 300);
});
common_vendor.watch(
() => historyList.value.length,
() => scheduleMeasureLayout()
);
common_vendor.onReady(() => {
scheduleMeasureLayout();
setTimeout(scheduleMeasureLayout, 300);
});
return {
historyList,
activeIndex,
contentScrollIntoView,
stepScrollIntoView,
scrollWithAnimation,
onContentScroll,
onScrollToLower,
scrollToNode,
scheduleMeasureLayout
};
}
exports.useProcessChainScroll = useProcessChainScroll;
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/hazardDetail/useProcessChainScroll.js.map

View File

@@ -80,7 +80,7 @@ const _sfc_main = {
return;
}
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/detail2?hazardId=${item.hazardId}&assignId=${item.assignId || ""}`
url: `/pages/hiddendanger/process-chain?hazardId=${item.hazardId}`
});
};
common_vendor.computed(() => {

View File

@@ -1 +1 @@
<view class="{{['padding', 'page', 'data-v-847f15e8', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{h}}"><view wx:if="{{a}}" class="area-list data-v-847f15e8"><view wx:for="{{b}}" wx:for-item="item" wx:key="f" class="padding bg-white radius margin-bottom data-v-847f15e8"><view class="flex justify-between data-v-847f15e8"><view class="data-v-847f15e8"><view class="text-bold text-black data-v-847f15e8">{{item.a}}</view><view class="margin-top flex align-center data-v-847f15e8"><text class="data-v-847f15e8">颜色:</text><view class="color-dot data-v-847f15e8" style="{{'background-color:' + item.b}}"></view><text class="margin-left-xs data-v-847f15e8">{{item.c}}</text></view></view><view class="data-v-847f15e8"><button class="bg-blue cu-btn data-v-847f15e8" bindtap="{{item.d}}">编辑</button><button class="bg-red cu-btn margin-left data-v-847f15e8" bindtap="{{item.e}}">删除</button></view></view></view></view><view wx:else class="empty-state data-v-847f15e8"><text class="text-gray data-v-847f15e8">暂无区域数据</text></view><button class="add-btn bg-blue round data-v-847f15e8" bindtap="{{c}}">新增公司区域</button><area-form-popup wx:if="{{g}}" class="data-v-847f15e8" virtualHostClass="data-v-847f15e8" bindsubmit="{{d}}" bindclose="{{e}}" u-i="847f15e8-0" bind:__l="__l" bindupdateVisible="{{f}}" u-p="{{g}}"/></view>
<view class="{{['padding', 'page', 'data-v-847f15e8', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{h}}"><view wx:if="{{a}}" class="area-list data-v-847f15e8"><view wx:for="{{b}}" wx:for-item="item" wx:key="f" class="padding bg-white radius margin-bottom data-v-847f15e8"><view class="flex justify-between data-v-847f15e8"><view class="data-v-847f15e8"><view class="text-bold text-black data-v-847f15e8">{{item.a}}</view><view class="margin-top flex align-center data-v-847f15e8"><text class="data-v-847f15e8">颜色:</text><view class="color-dot data-v-847f15e8" style="{{'background-color:' + item.b}}"></view><text class="margin-left-xs data-v-847f15e8">{{item.c}}</text></view></view><view class="data-v-847f15e8"><button class="bg-blue cu-btn data-v-847f15e8" bindtap="{{item.d}}">编辑</button><button class="bg-red cu-btn margin-left data-v-847f15e8" bindtap="{{item.e}}">删除</button></view></view></view></view><view wx:else class="empty-state data-v-847f15e8"><text class="text-gray data-v-847f15e8">暂无区域数据</text></view><button class="add-btn bg-blue round data-v-847f15e8" bindtap="{{c}}">新增区域</button><area-form-popup wx:if="{{g}}" class="data-v-847f15e8" virtualHostClass="data-v-847f15e8" bindsubmit="{{d}}" bindclose="{{e}}" u-i="847f15e8-0" bind:__l="__l" bindupdateVisible="{{f}}" u-p="{{g}}"/></view>

View File

@@ -1,196 +1,22 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
if (!Array) {
const _easycom_up_picker2 = common_vendor.resolveComponent("up-picker");
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_radio2 = common_vendor.resolveComponent("up-radio");
const _easycom_up_radio_group2 = common_vendor.resolveComponent("up-radio-group");
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
(_easycom_up_picker2 + _easycom_up_textarea2 + _easycom_up_radio2 + _easycom_up_radio_group2 + _easycom_u_popup2)();
}
const _easycom_up_picker = () => "../../uni_modules/uview-plus/components/u-picker/u-picker.js";
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_radio = () => "../../uni_modules/uview-plus/components/u-radio/u-radio.js";
const _easycom_up_radio_group = () => "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
if (!Math) {
(_easycom_up_picker + _easycom_up_textarea + _easycom_up_radio + _easycom_up_radio_group + _easycom_u_popup)();
}
const _sfc_main = {
__name: "application",
setup(__props) {
const showAddPopup = common_vendor.ref(false);
const showHazardPicker = common_vendor.ref(false);
const selectedHazard = common_vendor.ref("");
const selectedHazardId = common_vendor.ref("");
const hazardColumns = common_vendor.ref([["暂无数据"]]);
const acceptanceHazardList = common_vendor.ref([]);
const hazardList = common_vendor.ref([]);
const selectedDeptName = common_vendor.ref("");
const aiGenerating = common_vendor.ref(false);
const sendMsgFlagRadio = common_vendor.ref("yes");
const sendMsgFlag = common_vendor.computed(() => sendMsgFlagRadio.value === "yes");
const formData = common_vendor.reactive({
rectifyDeadline: "",
// 整改时限
responsibleDeptId: "",
// 隐患治理责任单位ID
responsiblePerson: "",
// 主要负责人
mainTreatmentContent: "",
// 主要治理内容
treatmentResult: "",
// 隐患治理完成内容
selfVerifyContent: ""
// 责任单位自行验收情况
});
const fetchWriteOffList = async () => {
try {
const res = await request_api.getMyWriteOffList();
if (res.code === 0 && res.data) {
hazardList.value = res.data;
common_vendor.index.__f__("log", "at pages/closeout/application.vue:166", "销号申请列表:", res.data);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/application.vue:169", "获取销号申请列表失败:", error);
common_vendor.index.__f__("error", "at pages/closeout/application.vue:47", "获取销号申请列表失败:", error);
}
};
const fetchAcceptanceList = async () => {
try {
const res = await request_api.getAcceptanceList();
if (res.code === 0 && res.data) {
const list = res.data.records || res.data || [];
acceptanceHazardList.value = list;
if (list.length > 0) {
hazardColumns.value = [list.map((item) => item.title || item.hazardTitle || `隐患${item.hazardId}`)];
} else {
hazardColumns.value = [["暂无可申请销号的隐患"]];
}
common_vendor.index.__f__("log", "at pages/closeout/application.vue:186", "可申请销号的隐患列表:", list);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/application.vue:189", "获取可申请销号隐患列表失败:", error);
}
};
const openAddPopup = () => {
resetForm();
fetchAcceptanceList();
showAddPopup.value = true;
};
const fillHazardRelatedFields = (hazard) => {
formData.rectifyDeadline = hazard.deadline || "";
selectedDeptName.value = hazard.deptName || "";
formData.responsiblePerson = hazard.rectifierName || "";
formData.responsibleDeptId = hazard.deptId || "";
};
const onHazardConfirm = (e) => {
common_vendor.index.__f__("log", "at pages/closeout/application.vue:210", "选择的隐患:", e);
if (e.value && e.value.length > 0) {
selectedHazard.value = e.value[0];
const index = e.indexs[0];
const hazard = acceptanceHazardList.value[index];
if (hazard) {
selectedHazardId.value = hazard.hazardId;
fillHazardRelatedFields(hazard);
}
}
showHazardPicker.value = false;
};
const resetForm = () => {
selectedHazard.value = "";
selectedHazardId.value = "";
selectedDeptName.value = "";
formData.rectifyDeadline = "";
formData.responsibleDeptId = "";
formData.responsiblePerson = "";
formData.mainTreatmentContent = "";
formData.treatmentResult = "";
formData.selfVerifyContent = "";
sendMsgFlagRadio.value = "yes";
};
const handleAiGenerate = async () => {
if (!selectedHazardId.value) {
common_vendor.index.showToast({ title: "请先选择隐患", icon: "none" });
return;
}
aiGenerating.value = true;
try {
const hazardRes = await request_api.getHiddenDangerDetail({ hazardId: selectedHazardId.value });
if (hazardRes.code !== 0 || !hazardRes.data) {
common_vendor.index.showToast({ title: "获取隐患详情失败", icon: "none" });
return;
}
const assigns = hazardRes.data.assigns;
if (!assigns || assigns.length === 0 || !assigns[0].rectify) {
common_vendor.index.showToast({ title: "该隐患暂无整改记录", icon: "none" });
return;
}
const rectifyId = assigns[0].rectify.rectifyId;
const rectifyRes = await request_api.getRectifyDetail({ rectifyId });
if (rectifyRes.code !== 0 || !rectifyRes.data) {
common_vendor.index.showToast({ title: "获取整改详情失败", icon: "none" });
return;
}
const rectifyPlan = rectifyRes.data.rectifyPlan;
if (!rectifyPlan) {
common_vendor.index.showToast({ title: "整改方案内容为空", icon: "none" });
return;
}
const aiRes = await request_api.generateWriteoffContent({ rectifyContent: rectifyPlan });
if (aiRes.code === 0 && aiRes.data) {
formData.mainTreatmentContent = aiRes.data.mainContent || "";
formData.treatmentResult = aiRes.data.completionContent || "";
formData.selfVerifyContent = aiRes.data.selfInspection || "";
common_vendor.index.showToast({ title: "AI生成成功", icon: "success" });
} else {
common_vendor.index.showToast({ title: aiRes.msg || "AI生成失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/application.vue:285", "AI生成销号方案失败:", error);
common_vendor.index.showToast({ title: "AI生成失败请重试", icon: "none" });
} finally {
aiGenerating.value = false;
}
};
const handleAdd = async () => {
if (!selectedHazardId.value) {
common_vendor.index.showToast({ title: "请选择隐患", icon: "none" });
return;
}
const params = {
hazardId: Number(selectedHazardId.value),
// 隐患ID必需
rectifyDeadline: formData.rectifyDeadline || "",
// 整改时限
responsibleDeptId: Number(formData.responsibleDeptId) || 0,
// 隐患治理责任单位ID
responsiblePerson: formData.responsiblePerson || "",
// 主要负责人
mainTreatmentContent: formData.mainTreatmentContent || "",
// 主要治理内容
treatmentResult: formData.treatmentResult || "",
// 隐患治理完成内容
selfVerifyContent: formData.selfVerifyContent || "",
// 责任单位自行验收情况
sendMsgFlag: sendMsgFlag.value
// 是否短信提醒
};
common_vendor.index.__f__("log", "at pages/closeout/application.vue:311", "提交数据:", params);
try {
const res = await request_api.applyDelete(params);
if (res.code === 0) {
common_vendor.index.showToast({ title: "申请成功", icon: "success" });
showAddPopup.value = false;
resetForm();
fetchWriteOffList();
} else {
common_vendor.index.showToast({ title: res.msg || "申请失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/application.vue:325", "申请失败:", error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
}
const goAddApply = () => {
common_vendor.index.navigateTo({ url: "/pages/closeout/apply" });
};
const editor = (item) => {
if (!(item == null ? void 0 : item.id)) {
@@ -217,11 +43,11 @@ const _sfc_main = {
return "status-rejected";
return "status-default";
};
common_vendor.onMounted(() => {
common_vendor.onShow(() => {
fetchWriteOffList();
});
return (_ctx, _cache) => {
return common_vendor.e({
return {
a: common_vendor.f(hazardList.value, (item, k0, i0) => {
return {
a: common_vendor.t(item.hazardTitle),
@@ -235,74 +61,9 @@ const _sfc_main = {
i: item.hazardId || item.id
};
}),
b: common_vendor.o(openAddPopup),
c: common_vendor.o(($event) => showAddPopup.value = false),
d: common_vendor.t(selectedHazard.value || "请选择隐患"),
e: common_vendor.n(selectedHazard.value ? "" : "text-gray"),
f: common_vendor.o(($event) => showHazardPicker.value = true)
}, {}, {
k: common_vendor.t(formData.rectifyDeadline || "请先选择隐患"),
l: common_vendor.n(formData.rectifyDeadline ? "" : "text-gray"),
m: common_vendor.t(selectedDeptName.value || "请先选择隐患"),
n: common_vendor.n(selectedDeptName.value ? "" : "text-gray"),
o: common_vendor.t(formData.responsiblePerson || "请先选择隐患"),
p: common_vendor.n(formData.responsiblePerson ? "" : "text-gray"),
q: !aiGenerating.value
}, !aiGenerating.value ? {} : {}, {
r: common_vendor.t(aiGenerating.value ? "AI生成中..." : "AI 生成销号方案"),
s: aiGenerating.value,
t: aiGenerating.value,
v: common_vendor.o(handleAiGenerate),
w: common_vendor.o(($event) => formData.mainTreatmentContent = $event),
x: common_vendor.p({
placeholder: "请输入主要治理内容",
modelValue: formData.mainTreatmentContent
}),
y: common_vendor.o(($event) => formData.treatmentResult = $event),
z: common_vendor.p({
placeholder: "请输入隐患治理完成情况",
modelValue: formData.treatmentResult
}),
A: common_vendor.o(($event) => formData.selfVerifyContent = $event),
B: common_vendor.p({
placeholder: "请输入隐患治理责任单位自行验收的情况",
modelValue: formData.selfVerifyContent
}),
C: common_vendor.p({
label: "是",
name: "yes",
customStyle: {
marginRight: "48rpx"
}
}),
D: common_vendor.p({
label: "否",
name: "no"
}),
E: common_vendor.o(($event) => sendMsgFlagRadio.value = $event),
F: common_vendor.p({
placement: "row",
activeColor: "#2667e9",
modelValue: sendMsgFlagRadio.value
}),
G: common_vendor.o(($event) => showAddPopup.value = false),
H: common_vendor.o(handleAdd),
I: common_vendor.o(($event) => showAddPopup.value = false),
J: common_vendor.p({
show: showAddPopup.value,
mode: "center",
round: "20",
safeAreaInsetBottom: false
}),
K: common_vendor.o(onHazardConfirm),
L: common_vendor.o(($event) => showHazardPicker.value = false),
M: common_vendor.o(($event) => showHazardPicker.value = false),
N: common_vendor.p({
show: showHazardPicker.value,
columns: hazardColumns.value
}),
O: common_vendor.gei(_ctx, "")
});
b: common_vendor.o(goAddApply),
c: common_vendor.gei(_ctx, "")
};
};
}
};

View File

@@ -1,10 +1,4 @@
{
"navigationBarTitleText": "销号申请",
"usingComponents": {
"up-picker": "../../uni_modules/uview-plus/components/u-picker/u-picker",
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
"up-radio": "../../uni_modules/uview-plus/components/u-radio/u-radio",
"up-radio-group": "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group",
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup"
}
"usingComponents": {}
}

File diff suppressed because one or more lines are too long

View File

@@ -58,102 +58,4 @@
.status-default.data-v-4b6250eb {
background: #F5F5F5;
color: #8C8C8C;
}
.popup-content.data-v-4b6250eb {
width: 600rpx;
background: #fff;
border-radius: 20rpx;
overflow: hidden;
}
.popup-header.data-v-4b6250eb {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.popup-header .popup-title.data-v-4b6250eb {
font-size: 32rpx;
color: #333;
}
.popup-header .popup-close.data-v-4b6250eb {
font-size: 40rpx;
color: #999;
line-height: 1;
}
.popup-body.data-v-4b6250eb {
padding: 30rpx;
}
.popup-footer.data-v-4b6250eb {
display: flex;
border-top: 1rpx solid #eee;
}
.popup-footer button.data-v-4b6250eb {
flex: 1;
height: 90rpx;
line-height: 90rpx;
border-radius: 0;
margin: 0 !important;
padding: 0 !important;
font-size: 30rpx;
}
.popup-footer button.data-v-4b6250eb::after {
border: none;
}
.popup-footer .btn-cancel.data-v-4b6250eb {
background: #fff;
color: #666;
}
.popup-footer .btn-confirm.data-v-4b6250eb {
color: #fff;
}
.ai-btn-wrapper.data-v-4b6250eb {
display: flex;
justify-content: flex-end;
}
.ai-analyze-btn.data-v-4b6250eb {
display: flex;
align-items: center;
justify-content: center;
height: 72rpx;
padding: 0 32rpx;
font-size: 28rpx;
color: #fff;
background: linear-gradient(135deg, #4facfe 0%, #2668EA 100%);
border-radius: 36rpx;
border: none;
}
.ai-analyze-btn.data-v-4b6250eb::after {
border: none;
}
.ai-analyze-btn .ai-btn-icon.data-v-4b6250eb {
margin-right: 8rpx;
font-size: 30rpx;
}
.ai-analyze-btn[disabled].data-v-4b6250eb {
opacity: 0.7;
}
.picker-input.data-v-4b6250eb {
background: #fff;
border-radius: 8rpx;
padding: 24rpx 20rpx;
margin-bottom: 20rpx;
border: 1rpx solid #eee;
}
.picker-input text.data-v-4b6250eb {
font-size: 28rpx;
}
.picker-input.readonly.data-v-4b6250eb {
background: #f5f5f5;
color: #666;
}
.static-field.data-v-4b6250eb {
background: #fff;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 24rpx;
margin-bottom: 20rpx;
font-size: 28rpx;
color: #333;
line-height: 1.5;
}

View File

@@ -0,0 +1,549 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
const utils_hazardNav = require("../../utils/hazardNav.js");
if (!Array) {
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_radio2 = common_vendor.resolveComponent("up-radio");
const _easycom_up_radio_group2 = common_vendor.resolveComponent("up-radio-group");
const _easycom_up_picker2 = common_vendor.resolveComponent("up-picker");
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
(_easycom_up_textarea2 + _easycom_up_radio2 + _easycom_up_radio_group2 + _easycom_up_picker2 + _easycom_u_popup2)();
}
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_radio = () => "../../uni_modules/uview-plus/components/u-radio/u-radio.js";
const _easycom_up_radio_group = () => "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
const _easycom_up_picker = () => "../../uni_modules/uview-plus/components/u-picker/u-picker.js";
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
if (!Math) {
(_easycom_up_textarea + _easycom_up_radio + _easycom_up_radio_group + _easycom_up_picker + _easycom_u_popup)();
}
const _sfc_main = {
__name: "apply",
setup(__props) {
const showHazardPicker = common_vendor.ref(false);
const hazardLocked = common_vendor.ref(false);
const selectedHazard = common_vendor.ref("");
const selectedHazardId = common_vendor.ref("");
const assignId = common_vendor.ref("");
const taskId = common_vendor.ref("");
const hazardColumns = common_vendor.ref([["暂无数据"]]);
const selectableHazardList = common_vendor.ref([]);
const selectedDeptName = common_vendor.ref("");
const aiGenerating = common_vendor.ref(false);
const sendMsgFlagRadio = common_vendor.ref("yes");
const sendMsgFlag = common_vendor.computed(() => sendMsgFlagRadio.value === "yes");
const nextStepName = common_vendor.ref("");
const nextStepLoading = common_vendor.ref(false);
const nextStepDisplay = common_vendor.computed(() => {
if (nextStepLoading.value)
return "加载中...";
return nextStepName.value || "暂无下一步流程";
});
const selectedAssigneeIdentityId = common_vendor.ref("");
const selectedAssigneeName = common_vendor.ref("");
const pickerAssigneeIdentityId = common_vendor.ref("");
const pickerAssigneeName = common_vendor.ref("");
const showAssigneePopup = common_vendor.ref(false);
const assigneeList = common_vendor.ref([]);
const assigneeLoading = common_vendor.ref(false);
const formData = common_vendor.reactive({
rectifyDeadline: "",
responsibleDeptId: "",
responsiblePerson: "",
mainTreatmentContent: "",
treatmentResult: "",
selfVerifyContent: ""
});
const fillHazardRelatedFields = (hazard) => {
formData.rectifyDeadline = hazard.deadline || "";
selectedDeptName.value = hazard.deptName || "";
formData.responsiblePerson = hazard.rectifierName || "";
formData.responsibleDeptId = hazard.deptId || "";
};
const resolveTaskIdFromHazard = (hazard) => {
var _a, _b;
if (!hazard)
return "";
const candidates = [
hazard.taskId,
hazard.flowTaskId,
hazard.currentTaskId,
(_a = hazard.flowTask) == null ? void 0 : _a.taskId,
(_b = hazard.currentTask) == null ? void 0 : _b.taskId
];
for (const id of candidates) {
if (id != null && id !== "")
return String(id);
}
return "";
};
const resolveTaskIdFromAssign = (assign) => {
var _a, _b, _c, _d, _e;
if (!assign)
return "";
const candidates = [
assign.taskId,
assign.flowTaskId,
assign.currentTaskId,
(_a = assign.rectify) == null ? void 0 : _a.taskId,
(_b = assign.rectify) == null ? void 0 : _b.flowTaskId,
(_c = assign.rectify) == null ? void 0 : _c.currentTaskId,
(_d = assign.flow) == null ? void 0 : _d.taskId,
(_e = assign.currentTask) == null ? void 0 : _e.taskId
];
for (const id of candidates) {
if (id != null && id !== "")
return String(id);
}
return "";
};
const resolveAssignWithRectify = (assigns, currentAssignId) => {
if (!(assigns == null ? void 0 : assigns.length))
return null;
if (currentAssignId) {
const byAssignId = assigns.find(
(item) => String(item.assignId) === String(currentAssignId) && item.rectify
);
if (byAssignId)
return byAssignId;
}
return assigns.find((item) => item.rectify) || assigns[0] || null;
};
const resolveTaskIdFromDetail = (data) => {
if (!data)
return "";
if (data.taskId)
return String(data.taskId);
if (data.flowTaskId)
return String(data.flowTaskId);
if (data.currentTaskId)
return String(data.currentTaskId);
const assigns = data.assigns || [];
const matchedAssign = resolveAssignWithRectify(assigns, assignId.value);
const fromMatched = resolveTaskIdFromAssign(matchedAssign);
if (fromMatched)
return fromMatched;
for (const assign of assigns) {
const id = resolveTaskIdFromAssign(assign);
if (id)
return id;
}
return "";
};
const resolveNextTaskName = (data) => {
var _a;
if (!data)
return "";
const branches = data.branches || [];
const matchedBranch = branches.find((item) => item.matched) || branches[0];
return ((_a = matchedBranch == null ? void 0 : matchedBranch.nextNode) == null ? void 0 : _a.taskName) || "";
};
const buildPreviewVariables = () => ({
quickApprove: true
});
const getStoredUserInfo = () => {
try {
const stored = common_vendor.index.getStorageSync("userInfo");
if (!stored)
return {};
return typeof stored === "string" ? JSON.parse(stored) : stored;
} catch (error) {
return {};
}
};
const getCurrentDeptId = () => {
const userInfo = getStoredUserInfo();
const identity = userInfo.userIdentity;
if ((identity == null ? void 0 : identity.deptId) != null && identity.deptId !== "") {
return String(identity.deptId);
}
if (userInfo.deptId != null && userInfo.deptId !== "") {
return String(userInfo.deptId);
}
return "";
};
const resolveAssigneeIdentityId = (user) => {
if (!user)
return "";
const id = user.identityId ?? user.userIdentityId ?? user.userId ?? "";
return id === "" || id == null ? "" : String(id);
};
const getAssigneeItemKey = (user) => {
const identityId = resolveAssigneeIdentityId(user);
if (identityId)
return `identity-${identityId}`;
return `user-${user.userId || user.nickName || ""}`;
};
const formatAssigneeDisplayName = (user) => {
if (!user)
return "";
const name = user.nickName || user.userName || user.name || "";
const identityName = user.identityName || "";
if (name && identityName)
return `${name}${identityName}`;
return name || identityName || "未知人员";
};
const resolveAssigneeDeptUserType = () => 2;
const fetchAssigneeList = async () => {
const deptId = getCurrentDeptId();
if (!deptId) {
assigneeList.value = [];
return;
}
assigneeLoading.value = true;
try {
const res = await request_api.getDeptUsers(deptId, { type: resolveAssigneeDeptUserType() });
if (res.code === 0) {
assigneeList.value = res.data || [];
} else {
assigneeList.value = [];
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/apply.vue:320", "获取部门人员失败:", error);
assigneeList.value = [];
} finally {
assigneeLoading.value = false;
}
};
const openAssigneePopup = async () => {
pickerAssigneeIdentityId.value = selectedAssigneeIdentityId.value;
pickerAssigneeName.value = selectedAssigneeName.value;
showAssigneePopup.value = true;
await fetchAssigneeList();
};
const onAssigneeItemClick = (user) => {
const identityId = resolveAssigneeIdentityId(user);
if (!identityId)
return;
pickerAssigneeIdentityId.value = String(identityId);
pickerAssigneeName.value = formatAssigneeDisplayName(user);
};
const confirmAssigneeSelect = () => {
if (!pickerAssigneeIdentityId.value) {
common_vendor.index.showToast({ title: "请选择下一步处理人", icon: "none" });
return;
}
selectedAssigneeIdentityId.value = pickerAssigneeIdentityId.value;
selectedAssigneeName.value = pickerAssigneeName.value;
showAssigneePopup.value = false;
};
const cancelAssigneeSelect = () => {
showAssigneePopup.value = false;
};
const fetchNextStep = async () => {
nextStepLoading.value = true;
try {
const currentTaskId = taskId.value;
if (!currentTaskId) {
nextStepName.value = "";
return;
}
const res = await request_api.getFlowNextNodes({
taskId: currentTaskId,
previewVariables: buildPreviewVariables(),
includeSubProcess: true
});
if (res.code === 0) {
const payload = res.data && typeof res.data === "object" ? res.data : res;
nextStepName.value = resolveNextTaskName(payload);
} else {
nextStepName.value = "";
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/apply.vue:375", "获取下一步流程失败:", error);
nextStepName.value = "";
} finally {
nextStepLoading.value = false;
}
};
const resolveTaskIdForHazard = async (hazard) => {
const presetTaskId = taskId.value;
const fromHazard = resolveTaskIdFromHazard(hazard);
if (fromHazard) {
taskId.value = fromHazard;
}
if (!(hazard == null ? void 0 : hazard.hazardId)) {
return;
}
if (!assignId.value && hazard.assignId) {
assignId.value = String(hazard.assignId);
}
if (taskId.value) {
return;
}
try {
const params = { hazardId: hazard.hazardId };
if (assignId.value) {
params.assignId = assignId.value;
}
const res = await request_api.getHiddenDangerDetail(params);
if (res.code === 0 && res.data) {
taskId.value = resolveTaskIdFromDetail(res.data) || presetTaskId;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/apply.vue:411", "获取隐患任务信息失败:", error);
}
if (!taskId.value && presetTaskId) {
taskId.value = presetTaskId;
}
};
const resetFlowSelection = () => {
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
nextStepName.value = "";
};
const applySelectedHazard = async (hazard) => {
if (!hazard)
return;
selectedHazard.value = hazard.title || hazard.hazardTitle || `隐患${hazard.hazardId}`;
selectedHazardId.value = hazard.hazardId;
assignId.value = hazard.assignId ? String(hazard.assignId) : "";
if (hazard.taskId) {
taskId.value = String(hazard.taskId);
}
fillHazardRelatedFields(hazard);
resetFlowSelection();
await resolveTaskIdForHazard(hazard);
await fetchNextStep();
};
const resolveSelectableRecords = (data) => {
if (!data)
return [];
if (Array.isArray(data))
return data;
if (Array.isArray(data.records))
return data.records;
return [];
};
const canApplyWriteoff = (item) => (item == null ? void 0 : item.statusName) === "待销号" && ((item == null ? void 0 : item.applyFlag) === true || (item == null ? void 0 : item.applyFlag) === 1 || (item == null ? void 0 : item.applyFlag) === "1");
const fetchSelectableHazardList = async () => {
try {
const res = await request_api.getHiddenDangerList({ pageNum: 1, pageSize: 100, status: 4 });
if (res.code === 0 && res.data) {
const list = resolveSelectableRecords(res.data).filter(canApplyWriteoff);
selectableHazardList.value = list;
if (list.length > 0) {
hazardColumns.value = [list.map((item) => item.title || item.hazardTitle || `隐患${item.hazardId}`)];
} else {
hazardColumns.value = [["暂无可申请销号的隐患"]];
}
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/apply.vue:464", "获取可申请销号隐患列表失败:", error);
}
};
const onHazardConfirm = async (e) => {
if (e.value && e.value.length > 0) {
const index = e.indexs[0];
const hazard = selectableHazardList.value[index];
if (hazard) {
await applySelectedHazard(hazard);
}
}
showHazardPicker.value = false;
};
const handleAiGenerate = async () => {
if (!selectedHazardId.value) {
common_vendor.index.showToast({ title: "请先选择隐患", icon: "none" });
return;
}
aiGenerating.value = true;
try {
const hazardRes = await request_api.getHiddenDangerDetail({ hazardId: selectedHazardId.value });
if (hazardRes.code !== 0 || !hazardRes.data) {
common_vendor.index.showToast({ title: "获取隐患详情失败", icon: "none" });
return;
}
const assigns = hazardRes.data.assigns;
if (!assigns || assigns.length === 0 || !assigns[0].rectify) {
common_vendor.index.showToast({ title: "该隐患暂无整改记录", icon: "none" });
return;
}
const rectifyId = assigns[0].rectify.rectifyId;
const rectifyRes = await request_api.getRectifyDetail({ rectifyId });
if (rectifyRes.code !== 0 || !rectifyRes.data) {
common_vendor.index.showToast({ title: "获取整改详情失败", icon: "none" });
return;
}
const rectifyPlan = rectifyRes.data.rectifyPlan;
if (!rectifyPlan) {
common_vendor.index.showToast({ title: "整改方案内容为空", icon: "none" });
return;
}
const aiRes = await request_api.generateWriteoffContent({ rectifyContent: rectifyPlan });
if (aiRes.code === 0 && aiRes.data) {
formData.mainTreatmentContent = aiRes.data.mainContent || "";
formData.treatmentResult = aiRes.data.completionContent || "";
formData.selfVerifyContent = aiRes.data.selfInspection || "";
common_vendor.index.showToast({ title: "AI生成成功", icon: "success" });
} else {
common_vendor.index.showToast({ title: aiRes.msg || "AI生成失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/apply.vue:529", "AI生成销号方案失败:", error);
common_vendor.index.showToast({ title: "AI生成失败请重试", icon: "none" });
} finally {
aiGenerating.value = false;
}
};
const handleCancel = () => {
common_vendor.index.navigateBack();
};
const handleSubmit = async () => {
if (!selectedHazardId.value) {
common_vendor.index.showToast({ title: "请选择隐患", icon: "none" });
return;
}
if (!selectedAssigneeIdentityId.value) {
common_vendor.index.showToast({ title: "请选择下一步处理人", icon: "none" });
return;
}
const params = {
hazardId: Number(selectedHazardId.value),
rectifyDeadline: formData.rectifyDeadline || "",
responsibleDeptId: Number(formData.responsibleDeptId) || 0,
responsiblePerson: formData.responsiblePerson || "",
mainTreatmentContent: formData.mainTreatmentContent || "",
treatmentResult: formData.treatmentResult || "",
selfVerifyContent: formData.selfVerifyContent || "",
assigneeIdentityId: selectedAssigneeIdentityId.value,
sendMsgFlag: sendMsgFlag.value
};
try {
const res = await request_api.applyDelete(params);
if (res.code === 0) {
common_vendor.index.showToast({ title: "申请成功", icon: "success" });
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
} else {
common_vendor.index.showToast({ title: res.msg || "申请失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/apply.vue:573", "申请失败:", error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
}
};
common_vendor.onLoad(async (options) => {
hazardLocked.value = (options == null ? void 0 : options.locked) === "1";
if (options == null ? void 0 : options.assignId) {
assignId.value = String(options.assignId);
}
if (options == null ? void 0 : options.taskId) {
taskId.value = String(options.taskId);
}
const hazardFromOptions = utils_hazardNav.buildWriteoffHazardFromOptions(options);
if (hazardFromOptions == null ? void 0 : hazardFromOptions.hazardId) {
await applySelectedHazard(hazardFromOptions);
return;
}
if (!hazardLocked.value) {
await fetchSelectableHazardList();
}
if (taskId.value) {
await fetchNextStep();
}
});
return (_ctx, _cache) => {
return common_vendor.e({
a: hazardLocked.value
}, hazardLocked.value ? {
b: common_vendor.t(selectedHazard.value || "加载中..."),
c: common_vendor.n(selectedHazard.value ? "" : "text-gray")
} : {
d: common_vendor.t(selectedHazard.value || "请选择隐患"),
e: common_vendor.n(selectedHazard.value ? "" : "text-gray"),
f: common_vendor.o(($event) => showHazardPicker.value = true)
}, {
g: common_vendor.t(formData.rectifyDeadline || "请先选择隐患"),
h: common_vendor.n(formData.rectifyDeadline ? "" : "text-gray"),
i: common_vendor.t(selectedDeptName.value || "请先选择隐患"),
j: common_vendor.n(selectedDeptName.value ? "" : "text-gray"),
k: common_vendor.t(formData.responsiblePerson || "请先选择隐患"),
l: common_vendor.n(formData.responsiblePerson ? "" : "text-gray"),
m: !aiGenerating.value
}, !aiGenerating.value ? {} : {}, {
n: common_vendor.t(aiGenerating.value ? "AI生成中..." : "AI 生成销号方案"),
o: aiGenerating.value,
p: aiGenerating.value,
q: common_vendor.o(handleAiGenerate),
r: common_vendor.o(($event) => formData.mainTreatmentContent = $event),
s: common_vendor.p({
placeholder: "请输入主要治理内容",
modelValue: formData.mainTreatmentContent
}),
t: common_vendor.o(($event) => formData.treatmentResult = $event),
v: common_vendor.p({
placeholder: "请输入隐患治理完成情况",
modelValue: formData.treatmentResult
}),
w: common_vendor.o(($event) => formData.selfVerifyContent = $event),
x: common_vendor.p({
placeholder: "请输入隐患治理责任单位自行验收的情况",
modelValue: formData.selfVerifyContent
}),
y: common_vendor.t(nextStepDisplay.value),
z: common_vendor.t(selectedAssigneeName.value || "请选择下一步处理人"),
A: !selectedAssigneeName.value ? 1 : "",
B: common_vendor.o(openAssigneePopup),
C: common_vendor.p({
label: "是",
name: "yes",
customStyle: {
marginRight: "48rpx"
}
}),
D: common_vendor.p({
label: "否",
name: "no"
}),
E: common_vendor.o(($event) => sendMsgFlagRadio.value = $event),
F: common_vendor.p({
placement: "row",
activeColor: "#2667e9",
modelValue: sendMsgFlagRadio.value
}),
G: common_vendor.o(handleCancel),
H: common_vendor.o(handleSubmit),
I: !hazardLocked.value
}, !hazardLocked.value ? {
J: common_vendor.o(onHazardConfirm),
K: common_vendor.o(($event) => showHazardPicker.value = false),
L: common_vendor.o(($event) => showHazardPicker.value = false),
M: common_vendor.p({
show: showHazardPicker.value,
columns: hazardColumns.value
})
} : {}, {
N: common_vendor.o(cancelAssigneeSelect),
O: assigneeLoading.value
}, assigneeLoading.value ? {} : assigneeList.value.length === 0 ? {} : {
Q: common_vendor.f(assigneeList.value, (user, k0, i0) => {
return common_vendor.e({
a: common_vendor.t(formatAssigneeDisplayName(user)),
b: String(pickerAssigneeIdentityId.value) === String(resolveAssigneeIdentityId(user))
}, String(pickerAssigneeIdentityId.value) === String(resolveAssigneeIdentityId(user)) ? {} : {}, {
c: getAssigneeItemKey(user),
d: String(pickerAssigneeIdentityId.value) === String(resolveAssigneeIdentityId(user)) ? 1 : "",
e: common_vendor.o(($event) => onAssigneeItemClick(user), getAssigneeItemKey(user))
});
})
}, {
P: assigneeList.value.length === 0,
R: common_vendor.o(cancelAssigneeSelect),
S: common_vendor.o(confirmAssigneeSelect),
T: common_vendor.o(cancelAssigneeSelect),
U: common_vendor.p({
show: showAssigneePopup.value,
mode: "bottom",
round: "20"
}),
V: common_vendor.gei(_ctx, "")
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-15674ee6"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/closeout/apply.js.map

View File

@@ -0,0 +1,10 @@
{
"navigationBarTitleText": "新增销号申请",
"usingComponents": {
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
"up-radio": "../../uni_modules/uview-plus/components/u-radio/u-radio",
"up-radio-group": "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group",
"up-picker": "../../uni_modules/uview-plus/components/u-picker/u-picker",
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,172 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page.data-v-15674ee6 {
min-height: 100vh;
background: #EBF2FC;
}
.ai-btn-wrapper.data-v-15674ee6 {
display: flex;
justify-content: flex-end;
}
.ai-analyze-btn.data-v-15674ee6 {
display: flex;
align-items: center;
justify-content: center;
height: 72rpx;
padding: 0 32rpx;
font-size: 28rpx;
color: #fff;
background: linear-gradient(135deg, #4facfe 0%, #2668EA 100%);
border-radius: 36rpx;
border: none;
}
.ai-analyze-btn.data-v-15674ee6::after {
border: none;
}
.ai-analyze-btn .ai-btn-icon.data-v-15674ee6 {
margin-right: 8rpx;
font-size: 30rpx;
}
.ai-analyze-btn[disabled].data-v-15674ee6 {
opacity: 0.7;
}
.picker-input.data-v-15674ee6 {
background: #fff;
border-radius: 8rpx;
padding: 24rpx 20rpx;
margin-bottom: 20rpx;
border: 1rpx solid #eee;
}
.picker-input text.data-v-15674ee6 {
font-size: 28rpx;
}
.picker-input.readonly.data-v-15674ee6 {
background: #f5f5f5;
color: #666;
}
.static-field.data-v-15674ee6 {
background: #fff;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 24rpx;
margin-bottom: 20rpx;
font-size: 28rpx;
color: #333;
line-height: 1.5;
}
.select-trigger.data-v-15674ee6 {
display: flex;
align-items: center;
justify-content: space-between;
background: #fff;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 24rpx;
margin-bottom: 20rpx;
}
.select-trigger .select-content.data-v-15674ee6 {
flex: 1;
font-size: 28rpx;
color: #333;
}
.user-popup.data-v-15674ee6 {
background: #fff;
}
.user-popup .popup-header.data-v-15674ee6 {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.user-popup .popup-header .popup-title.data-v-15674ee6 {
font-size: 32rpx;
color: #333;
}
.user-popup .popup-header .popup-close.data-v-15674ee6 {
font-size: 40rpx;
color: #999;
line-height: 1;
}
.user-popup .user-list-scroll.data-v-15674ee6 {
max-height: 600rpx;
padding: 0 30rpx;
box-sizing: border-box;
}
.user-popup .empty-tip.data-v-15674ee6 {
padding: 80rpx 20rpx;
text-align: center;
color: #909399;
font-size: 26rpx;
}
.user-popup .user-item.data-v-15674ee6 {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 0;
border-bottom: 1rpx solid #f5f5f5;
}
.user-popup .user-item.data-v-15674ee6:last-child {
border-bottom: none;
}
.user-popup .user-item.active .user-item-text.data-v-15674ee6 {
color: #2667E9;
font-weight: 600;
}
.user-popup .user-item .user-item-text.data-v-15674ee6 {
flex: 1;
font-size: 28rpx;
color: #333;
}
.user-popup .popup-footer.data-v-15674ee6 {
display: flex;
gap: 24rpx;
padding: 24rpx 30rpx;
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
background: #fff;
}
.user-popup .popup-footer button.data-v-15674ee6 {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
font-size: 30rpx;
margin: 0;
padding: 0;
}
.user-popup .popup-footer button.data-v-15674ee6::after {
border: none;
}
.user-popup .popup-footer .btn-cancel.data-v-15674ee6 {
background: #fff;
color: #2667E9;
border: 2rpx solid #2667E9;
}
.user-popup .popup-footer .btn-confirm.data-v-15674ee6 {
color: #fff;
border: none;
}

View File

@@ -0,0 +1,904 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
const utils_upload = require("../../utils/upload.js");
const utils_hazardNav = require("../../utils/hazardNav.js");
if (!Array) {
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_radio2 = common_vendor.resolveComponent("up-radio");
const _easycom_up_radio_group2 = common_vendor.resolveComponent("up-radio-group");
const _easycom_wd_signature2 = common_vendor.resolveComponent("wd-signature");
const _easycom_up_picker2 = common_vendor.resolveComponent("up-picker");
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
(_easycom_up_textarea2 + _easycom_up_radio2 + _easycom_up_radio_group2 + _easycom_wd_signature2 + _easycom_up_picker2 + _easycom_u_popup2)();
}
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_radio = () => "../../uni_modules/uview-plus/components/u-radio/u-radio.js";
const _easycom_up_radio_group = () => "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
const _easycom_wd_signature = () => "../../node-modules/wot-design-uni/components/wd-signature/wd-signature.js";
const _easycom_up_picker = () => "../../uni_modules/uview-plus/components/u-picker/u-picker.js";
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
if (!Math) {
(_easycom_up_textarea + _easycom_up_radio + _easycom_up_radio_group + _easycom_wd_signature + _easycom_up_picker + _easycom_u_popup)();
}
const FLOW_END_STEP_NAME = "隐患流程结束";
const _sfc_main = {
__name: "approval",
setup(__props) {
const showHazardPicker = common_vendor.ref(false);
const hazardLocked = common_vendor.ref(false);
const selectedHazard = common_vendor.ref("");
const selectedHazardId = common_vendor.ref("");
const applyId = common_vendor.ref("");
const assignId = common_vendor.ref("");
const taskId = common_vendor.ref("");
const hazardColumns = common_vendor.ref([["暂无数据"]]);
const acceptanceHazardList = common_vendor.ref([]);
const selectedDeptName = common_vendor.ref("");
const aiGenerating = common_vendor.ref(false);
const quickApproveRadio = common_vendor.ref("yes");
const quickApprove = common_vendor.computed(() => quickApproveRadio.value === "yes");
const sendMsgFlagRadio = common_vendor.ref("yes");
const sendMsgFlag = common_vendor.computed(() => sendMsgFlagRadio.value === "yes");
const nextStepName = common_vendor.ref("");
const nextStepLoading = common_vendor.ref(false);
const nextStepDisplay = common_vendor.computed(() => {
if (nextStepLoading.value)
return "加载中...";
return nextStepName.value || "暂无下一步流程";
});
const needNextAssignee = common_vendor.computed(() => {
if (formData.approvalResult !== 1)
return false;
if (quickApprove.value && nextStepName.value === FLOW_END_STEP_NAME)
return false;
return true;
});
const selectedAssigneeIdentityId = common_vendor.ref("");
const selectedAssigneeName = common_vendor.ref("");
const pickerAssigneeIdentityId = common_vendor.ref("");
const pickerAssigneeName = common_vendor.ref("");
const showAssigneePopup = common_vendor.ref(false);
const assigneeList = common_vendor.ref([]);
const assigneeLoading = common_vendor.ref(false);
const showCanvas = common_vendor.ref(true);
const signatureUrl = common_vendor.ref("");
const signatureServerPath = common_vendor.ref("");
const signatureWidth = common_vendor.ref(340);
const signatureRef = common_vendor.ref(null);
const isSignatureEmpty = common_vendor.ref(true);
const isSubmitting = common_vendor.ref(false);
const signatureLocalPath = common_vendor.ref("");
const approvalOptions = [
{ label: "重新整改", value: "rectify" },
{ label: "重新验收", value: "verify" }
];
const formData = common_vendor.reactive({
rectifyDeadline: "",
responsibleDeptId: "",
responsiblePerson: "",
mainTreatmentContent: "",
treatmentResult: "",
selfVerifyContent: "",
approvalResult: 1,
approvalOpinion: "",
opinionRemark: ""
});
const onApprovalResultChange = (result) => {
formData.approvalResult = result;
if (result === 2) {
quickApproveRadio.value = "no";
formData.approvalOpinion = "";
formData.opinionRemark = "";
} else {
formData.approvalOpinion = "";
formData.opinionRemark = "";
quickApproveRadio.value = "yes";
}
resetSignature();
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
if (result === 1) {
fetchNextStep();
} else {
nextStepName.value = "";
}
};
const fillHazardRelatedFields = (hazard) => {
formData.rectifyDeadline = hazard.deadline || "";
selectedDeptName.value = hazard.deptName || "";
formData.responsiblePerson = hazard.rectifierName || "";
formData.responsibleDeptId = hazard.deptId || "";
};
const applyWriteoffHazardPreview = (hazard) => {
if (!hazard)
return;
selectedHazard.value = hazard.title || hazard.hazardTitle || `隐患${hazard.hazardId}`;
selectedHazardId.value = String(hazard.hazardId);
if (hazard.assignId) {
assignId.value = String(hazard.assignId);
}
if (hazard.taskId) {
taskId.value = String(hazard.taskId);
}
fillHazardRelatedFields(hazard);
};
const resolveTaskIdFromHazard = (hazard) => {
var _a, _b;
if (!hazard)
return "";
const candidates = [
hazard.taskId,
hazard.flowTaskId,
hazard.currentTaskId,
(_a = hazard.flowTask) == null ? void 0 : _a.taskId,
(_b = hazard.currentTask) == null ? void 0 : _b.taskId
];
for (const id of candidates) {
if (id != null && id !== "")
return String(id);
}
return "";
};
const resolveTaskIdFromAssign = (assign) => {
var _a, _b, _c, _d, _e;
if (!assign)
return "";
const candidates = [
assign.taskId,
assign.flowTaskId,
assign.currentTaskId,
(_a = assign.rectify) == null ? void 0 : _a.taskId,
(_b = assign.rectify) == null ? void 0 : _b.flowTaskId,
(_c = assign.rectify) == null ? void 0 : _c.currentTaskId,
(_d = assign.flow) == null ? void 0 : _d.taskId,
(_e = assign.currentTask) == null ? void 0 : _e.taskId
];
for (const id of candidates) {
if (id != null && id !== "")
return String(id);
}
return "";
};
const resolveAssignWithRectify = (assigns, currentAssignId) => {
if (!(assigns == null ? void 0 : assigns.length))
return null;
if (currentAssignId) {
const byAssignId = assigns.find(
(item) => String(item.assignId) === String(currentAssignId) && item.rectify
);
if (byAssignId)
return byAssignId;
}
return assigns.find((item) => item.rectify) || assigns[0] || null;
};
const resolveTaskIdFromDetail = (data) => {
if (!data)
return "";
if (data.taskId)
return String(data.taskId);
if (data.flowTaskId)
return String(data.flowTaskId);
if (data.currentTaskId)
return String(data.currentTaskId);
const assigns = data.assigns || [];
const matchedAssign = resolveAssignWithRectify(assigns, assignId.value);
const fromMatched = resolveTaskIdFromAssign(matchedAssign);
if (fromMatched)
return fromMatched;
for (const assign of assigns) {
const id = resolveTaskIdFromAssign(assign);
if (id)
return id;
}
return "";
};
const resolveNextTaskName = (data) => {
var _a;
if (!data)
return "";
const branches = data.branches || [];
const matchedBranch = branches.find((item) => item.matched) || branches[0];
return ((_a = matchedBranch == null ? void 0 : matchedBranch.nextNode) == null ? void 0 : _a.taskName) || "";
};
const buildPreviewVariables = () => {
if (formData.approvalResult === 2) {
return { pass: false };
}
return {
pass: true,
quickApprove: quickApproveRadio.value === "yes",
type: "agree"
};
};
const getStoredUserInfo = () => {
try {
const stored = common_vendor.index.getStorageSync("userInfo");
if (!stored)
return {};
return typeof stored === "string" ? JSON.parse(stored) : stored;
} catch (error) {
return {};
}
};
const getCurrentDeptId = () => {
const userInfo = getStoredUserInfo();
const identity = userInfo.userIdentity;
if ((identity == null ? void 0 : identity.deptId) != null && identity.deptId !== "") {
return String(identity.deptId);
}
if (userInfo.deptId != null && userInfo.deptId !== "") {
return String(userInfo.deptId);
}
return "";
};
const resolveAssigneeIdentityId = (user) => {
if (!user)
return "";
const id = user.identityId ?? user.userIdentityId ?? user.userId ?? "";
return id === "" || id == null ? "" : String(id);
};
const getAssigneeItemKey = (user) => {
const identityId = resolveAssigneeIdentityId(user);
if (identityId)
return `identity-${identityId}`;
return `user-${user.userId || user.nickName || ""}`;
};
const formatAssigneeDisplayName = (user) => {
if (!user)
return "";
const name = user.nickName || user.userName || user.name || "";
const identityName = user.identityName || "";
if (name && identityName)
return `${name}${identityName}`;
return name || identityName || "未知人员";
};
const resolveAssigneeDeptUserType = () => {
if (formData.approvalResult === 2)
return 3;
return quickApproveRadio.value === "yes" ? 2 : 3;
};
const fetchAssigneeList = async () => {
const deptId = getCurrentDeptId();
if (!deptId) {
assigneeList.value = [];
return;
}
assigneeLoading.value = true;
try {
const res = await request_api.getDeptUsers(deptId, { type: resolveAssigneeDeptUserType() });
if (res.code === 0) {
assigneeList.value = res.data || [];
} else {
assigneeList.value = [];
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/approval.vue:500", "获取部门人员失败:", error);
assigneeList.value = [];
} finally {
assigneeLoading.value = false;
}
};
const openAssigneePopup = async () => {
pickerAssigneeIdentityId.value = selectedAssigneeIdentityId.value;
pickerAssigneeName.value = selectedAssigneeName.value;
showAssigneePopup.value = true;
await fetchAssigneeList();
};
const onAssigneeItemClick = (user) => {
const identityId = resolveAssigneeIdentityId(user);
if (!identityId)
return;
pickerAssigneeIdentityId.value = String(identityId);
pickerAssigneeName.value = formatAssigneeDisplayName(user);
};
const confirmAssigneeSelect = () => {
if (!pickerAssigneeIdentityId.value) {
common_vendor.index.showToast({ title: "请选择下一步处理人", icon: "none" });
return;
}
selectedAssigneeIdentityId.value = pickerAssigneeIdentityId.value;
selectedAssigneeName.value = pickerAssigneeName.value;
showAssigneePopup.value = false;
};
const cancelAssigneeSelect = () => {
showAssigneePopup.value = false;
};
const fetchNextStep = async () => {
nextStepLoading.value = true;
try {
const currentTaskId = taskId.value;
if (!currentTaskId) {
nextStepName.value = "";
return;
}
const res = await request_api.getFlowNextNodes({
taskId: currentTaskId,
previewVariables: buildPreviewVariables(),
includeSubProcess: true
});
if (res.code === 0) {
const payload = res.data && typeof res.data === "object" ? res.data : res;
nextStepName.value = resolveNextTaskName(payload);
if (!needNextAssignee.value) {
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
}
} else {
nextStepName.value = "";
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/approval.vue:559", "获取下一步流程失败:", error);
nextStepName.value = "";
} finally {
nextStepLoading.value = false;
}
};
const resolveTaskIdForHazard = async (hazard) => {
const presetTaskId = taskId.value;
const fromHazard = resolveTaskIdFromHazard(hazard);
if (fromHazard) {
taskId.value = fromHazard;
}
if (!(hazard == null ? void 0 : hazard.hazardId)) {
return;
}
if (!assignId.value && hazard.assignId) {
assignId.value = String(hazard.assignId);
}
if (taskId.value) {
return;
}
try {
const params = { hazardId: hazard.hazardId };
if (assignId.value) {
params.assignId = assignId.value;
}
const res = await request_api.getHiddenDangerDetail(params);
if (res.code === 0 && res.data) {
taskId.value = resolveTaskIdFromDetail(res.data) || presetTaskId;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/approval.vue:595", "获取隐患任务信息失败:", error);
}
if (!taskId.value && presetTaskId) {
taskId.value = presetTaskId;
}
};
const resetFlowSelection = () => {
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
nextStepName.value = "";
};
const applySelectedHazard = async (hazard) => {
if (!hazard)
return;
selectedHazard.value = hazard.title || hazard.hazardTitle || `隐患${hazard.hazardId}`;
selectedHazardId.value = hazard.hazardId;
assignId.value = hazard.assignId ? String(hazard.assignId) : "";
fillHazardRelatedFields(hazard);
resetFlowSelection();
await resolveTaskIdForHazard(hazard);
await fetchNextStep();
};
const formatDeadline = (value) => {
if (!value)
return "";
return String(value).split(" ")[0];
};
const applyWriteoffFormData = (data) => {
if (!data)
return;
if (data.hazardId != null) {
selectedHazardId.value = String(data.hazardId);
}
selectedHazard.value = data.title || "";
formData.rectifyDeadline = formatDeadline(data.rectifyDeadline);
formData.responsibleDeptId = data.responsibleDeptId ?? "";
selectedDeptName.value = data.responsibleDeptName || "";
formData.responsiblePerson = data.responsiblePerson || "";
if (data.applyId != null) {
applyId.value = String(data.applyId);
}
formData.mainTreatmentContent = data.mainTreatmentContent || "";
formData.treatmentResult = data.treatmentResult || "";
formData.selfVerifyContent = data.selfVerifyContent || "";
};
const fetchWriteoffForm = async (hazardId) => {
if (!hazardId)
return null;
try {
const res = await request_api.getWriteoffForm(hazardId);
if (res.code === 0 && res.data) {
applyWriteoffFormData(res.data);
} else {
common_vendor.index.showToast({ title: res.msg || "获取销号审批表单失败", icon: "none" });
}
return res;
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/approval.vue:654", "获取销号审批表单失败:", error);
common_vendor.index.showToast({ title: "获取销号审批表单失败", icon: "none" });
return null;
}
};
const onHazardConfirm = async (e) => {
if (e.value && e.value.length > 0) {
const index = e.indexs[0];
const hazard = acceptanceHazardList.value[index];
if (hazard) {
await applySelectedHazard(hazard);
}
}
showHazardPicker.value = false;
};
common_vendor.watch(quickApproveRadio, (value) => {
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
if (value === "yes") {
formData.approvalOpinion = "";
formData.opinionRemark = "";
}
fetchNextStep();
});
common_vendor.watch(needNextAssignee, (value) => {
if (!value) {
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
}
});
const applySignatureFromServer = (signPath) => {
const url = signPath ? utils_upload.toSubmitFileUrl(signPath) : "";
if (!url) {
showCanvas.value = true;
signatureServerPath.value = "";
signatureUrl.value = "";
signatureLocalPath.value = "";
isSignatureEmpty.value = true;
return;
}
signatureServerPath.value = url;
signatureUrl.value = url;
signatureLocalPath.value = "";
showCanvas.value = false;
isSignatureEmpty.value = false;
};
const resetSignature = () => {
showCanvas.value = true;
signatureUrl.value = "";
signatureServerPath.value = "";
signatureLocalPath.value = "";
isSignatureEmpty.value = true;
if (signatureRef.value) {
signatureRef.value.clear();
}
};
const onSignatureStart = () => {
isSignatureEmpty.value = false;
};
const onSignatureSigning = () => {
isSignatureEmpty.value = false;
};
const onSignatureClear = () => {
isSignatureEmpty.value = true;
signatureLocalPath.value = "";
};
const onSignatureEnd = () => {
isSignatureEmpty.value = false;
};
const clearSignature = () => {
isSignatureEmpty.value = true;
signatureLocalPath.value = "";
if (signatureRef.value) {
signatureRef.value.clear();
}
};
const reSign = () => {
isSignatureEmpty.value = true;
showCanvas.value = true;
signatureUrl.value = "";
signatureServerPath.value = "";
signatureLocalPath.value = "";
common_vendor.nextTick$1(() => {
if (signatureRef.value) {
signatureRef.value.clear();
}
});
};
const onSignatureConfirm = async (tempFilePath) => {
try {
const { url } = await utils_upload.uploadToCloud(tempFilePath);
applySignatureFromServer(url);
if (isSubmitting.value) {
await executeSubmit();
}
} catch (err) {
isSubmitting.value = false;
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/closeout/approval.vue:780", "签名上传失败:", err);
common_vendor.index.showToast({ title: "签名上传失败,请重试", icon: "none" });
}
};
const handleAiGenerate = async () => {
if (!selectedHazardId.value) {
common_vendor.index.showToast({ title: "请先选择隐患", icon: "none" });
return;
}
aiGenerating.value = true;
try {
const hazardRes = await request_api.getHiddenDangerDetail({ hazardId: selectedHazardId.value });
if (hazardRes.code !== 0 || !hazardRes.data) {
common_vendor.index.showToast({ title: "获取隐患详情失败", icon: "none" });
return;
}
const assigns = hazardRes.data.assigns;
if (!assigns || assigns.length === 0 || !assigns[0].rectify) {
common_vendor.index.showToast({ title: "该隐患暂无整改记录", icon: "none" });
return;
}
const rectifyId = assigns[0].rectify.rectifyId;
const rectifyRes = await request_api.getRectifyDetail({ rectifyId });
if (rectifyRes.code !== 0 || !rectifyRes.data) {
common_vendor.index.showToast({ title: "获取整改详情失败", icon: "none" });
return;
}
const rectifyPlan = rectifyRes.data.rectifyPlan;
if (!rectifyPlan) {
common_vendor.index.showToast({ title: "整改方案内容为空", icon: "none" });
return;
}
const aiRes = await request_api.generateWriteoffContent({ rectifyContent: rectifyPlan });
if (aiRes.code === 0 && aiRes.data) {
formData.mainTreatmentContent = aiRes.data.mainContent || "";
formData.treatmentResult = aiRes.data.completionContent || "";
formData.selfVerifyContent = aiRes.data.selfInspection || "";
common_vendor.index.showToast({ title: "AI生成成功", icon: "success" });
} else {
common_vendor.index.showToast({ title: aiRes.msg || "AI生成失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/approval.vue:828", "AI生成销号方案失败:", error);
common_vendor.index.showToast({ title: "AI生成失败请重试", icon: "none" });
} finally {
aiGenerating.value = false;
}
};
const handleCancel = () => {
common_vendor.index.navigateBack();
};
const ensureSignatureAndSubmit = async () => {
if (showCanvas.value) {
if (!signatureRef.value || isSignatureEmpty.value) {
common_vendor.index.showToast({ title: "请进行电子签名", icon: "none" });
return;
}
isSubmitting.value = true;
common_vendor.index.showLoading({ title: "正在提交...", mask: true });
signatureRef.value.confirm();
return;
}
if (!signatureServerPath.value && !signatureLocalPath.value) {
common_vendor.index.showToast({ title: "请进行电子签名", icon: "none" });
return;
}
isSubmitting.value = true;
common_vendor.index.showLoading({ title: "正在提交...", mask: true });
try {
if (!signatureServerPath.value && signatureLocalPath.value) {
const { url } = await utils_upload.uploadToCloud(signatureLocalPath.value);
applySignatureFromServer(url);
}
await executeSubmit();
} catch (err) {
isSubmitting.value = false;
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/closeout/approval.vue:865", "签名上传失败:", err);
common_vendor.index.showToast({ title: "签名上传失败,请重试", icon: "none" });
}
};
const handleSubmit = async () => {
var _a;
if (!selectedHazardId.value) {
common_vendor.index.showToast({ title: "请选择隐患", icon: "none" });
return;
}
if (!formData.approvalResult) {
common_vendor.index.showToast({ title: "请选择审批结果", icon: "none" });
return;
}
if (!applyId.value) {
common_vendor.index.showToast({ title: "缺少申请ID", icon: "none" });
return;
}
if (formData.approvalResult === 1) {
if (!quickApproveRadio.value) {
common_vendor.index.showToast({ title: "请选择是否快速审批", icon: "none" });
return;
}
if (needNextAssignee.value && !selectedAssigneeIdentityId.value) {
common_vendor.index.showToast({ title: "请选择下一步处理人", icon: "none" });
return;
}
await ensureSignatureAndSubmit();
return;
}
if (formData.approvalResult === 2) {
if (!formData.approvalOpinion) {
common_vendor.index.showToast({ title: "请选择审批意见", icon: "none" });
return;
}
if (!((_a = formData.opinionRemark) == null ? void 0 : _a.trim())) {
common_vendor.index.showToast({ title: "请输入意见说明", icon: "none" });
return;
}
await ensureSignatureAndSubmit();
}
};
const executeSubmit = async () => {
const hazardId = Number(selectedHazardId.value);
const applyIdNum = Number(applyId.value);
const signPath = signatureServerPath.value || "";
try {
let res;
if (formData.approvalResult === 1) {
const approvePayload = {
hazardId,
applyId: applyIdNum,
signPath,
type: "agree",
quickApprove: quickApproveRadio.value === "yes",
sendMsgFlag: sendMsgFlag.value
};
if (needNextAssignee.value) {
approvePayload.assigneeId = Number(selectedAssigneeIdentityId.value);
}
res = await request_api.writeoffApprove(approvePayload);
} else {
res = await request_api.writeoffReject({
hazardId,
applyId: applyIdNum,
signPath,
type: formData.approvalOpinion,
remark: formData.opinionRemark.trim(),
sendMsgFlag: sendMsgFlag.value
});
}
common_vendor.index.hideLoading();
if (res.code === 0) {
common_vendor.index.showToast({ title: "审批成功", icon: "success" });
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
} else {
common_vendor.index.showToast({ title: res.msg || "审批失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/approval.vue:952", "审批失败:", error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
} finally {
isSubmitting.value = false;
common_vendor.index.hideLoading();
}
};
common_vendor.onLoad(async (options) => {
try {
const sysInfo = common_vendor.index.getSystemInfoSync();
signatureWidth.value = sysInfo.windowWidth - 40;
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/approval.vue:965", "获取系统信息失败:", error);
}
const hazardId = options == null ? void 0 : options.hazardId;
hazardLocked.value = (options == null ? void 0 : options.locked) === "1";
if (options == null ? void 0 : options.assignId) {
assignId.value = String(options.assignId);
}
if (options == null ? void 0 : options.taskId) {
taskId.value = String(options.taskId);
}
const hazardFromOptions = utils_hazardNav.buildWriteoffHazardFromOptions(options);
if (hazardFromOptions) {
applyWriteoffHazardPreview(hazardFromOptions);
}
if (hazardId) {
selectedHazardId.value = String(hazardId);
await fetchWriteoffForm(hazardId);
if (taskId.value) {
await fetchNextStep();
}
} else if (taskId.value) {
await fetchNextStep();
}
});
return (_ctx, _cache) => {
return common_vendor.e({
a: hazardLocked.value
}, hazardLocked.value ? {
b: common_vendor.t(selectedHazard.value || "加载中..."),
c: common_vendor.n(selectedHazard.value ? "" : "text-gray")
} : {
d: common_vendor.t(selectedHazard.value || "请选择隐患"),
e: common_vendor.n(selectedHazard.value ? "" : "text-gray"),
f: common_vendor.o(($event) => showHazardPicker.value = true)
}, {
g: common_vendor.t(formData.rectifyDeadline || "请先选择隐患"),
h: common_vendor.n(formData.rectifyDeadline ? "" : "text-gray"),
i: common_vendor.t(selectedDeptName.value || "请先选择隐患"),
j: common_vendor.n(selectedDeptName.value ? "" : "text-gray"),
k: common_vendor.t(formData.responsiblePerson || "请先选择隐患"),
l: common_vendor.n(formData.responsiblePerson ? "" : "text-gray"),
m: !aiGenerating.value
}, !aiGenerating.value ? {} : {}, {
n: common_vendor.t(aiGenerating.value ? "AI生成中..." : "AI 生成销号方案"),
o: aiGenerating.value,
p: aiGenerating.value,
q: common_vendor.o(handleAiGenerate),
r: common_vendor.o(($event) => formData.mainTreatmentContent = $event),
s: common_vendor.p({
placeholder: "暂无",
disabled: true,
modelValue: formData.mainTreatmentContent
}),
t: common_vendor.o(($event) => formData.treatmentResult = $event),
v: common_vendor.p({
placeholder: "暂无",
disabled: true,
modelValue: formData.treatmentResult
}),
w: common_vendor.o(($event) => formData.selfVerifyContent = $event),
x: common_vendor.p({
placeholder: "暂无",
disabled: true,
modelValue: formData.selfVerifyContent
}),
y: common_vendor.n(formData.approvalResult === 1 ? "active" : ""),
z: common_vendor.o(($event) => onApprovalResultChange(1)),
A: common_vendor.n(formData.approvalResult === 2 ? "active" : ""),
B: common_vendor.o(($event) => onApprovalResultChange(2)),
C: formData.approvalResult === 1
}, formData.approvalResult === 1 ? {
D: common_vendor.p({
label: "是",
name: "yes",
customStyle: {
marginRight: "48rpx"
}
}),
E: common_vendor.p({
label: "否",
name: "no"
}),
F: common_vendor.o(($event) => quickApproveRadio.value = $event),
G: common_vendor.p({
placement: "row",
activeColor: "#2667e9",
modelValue: quickApproveRadio.value
})
} : {}, {
H: formData.approvalResult === 2
}, formData.approvalResult === 2 ? {
I: common_vendor.f(approvalOptions, (opt, index, i0) => {
return {
a: opt.value,
b: "367b7912-7-" + i0 + ",367b7912-6",
c: common_vendor.p({
label: opt.label,
name: opt.value,
customStyle: {
marginRight: index < approvalOptions.length - 1 ? "24rpx" : "0"
}
})
};
}),
J: common_vendor.o(($event) => formData.approvalOpinion = $event),
K: common_vendor.p({
placement: "row",
activeColor: "#2667e9",
modelValue: formData.approvalOpinion
}),
L: common_vendor.o(($event) => formData.opinionRemark = $event),
M: common_vendor.p({
placeholder: "请输入意见说明",
modelValue: formData.opinionRemark
})
} : {}, {
N: formData.approvalResult === 1
}, formData.approvalResult === 1 ? common_vendor.e({
O: common_vendor.t(nextStepDisplay.value),
P: needNextAssignee.value
}, needNextAssignee.value ? {
Q: common_vendor.t(selectedAssigneeName.value || "请选择下一步处理人"),
R: !selectedAssigneeName.value ? 1 : "",
S: common_vendor.o(openAssigneePopup)
} : {}) : {}, {
T: common_vendor.p({
label: "是",
name: "yes",
customStyle: {
marginRight: "48rpx"
}
}),
U: common_vendor.p({
label: "否",
name: "no"
}),
V: common_vendor.o(($event) => sendMsgFlagRadio.value = $event),
W: common_vendor.p({
placement: "row",
activeColor: "#2667e9",
modelValue: sendMsgFlagRadio.value
}),
X: formData.approvalResult === 1 || formData.approvalResult === 2
}, formData.approvalResult === 1 || formData.approvalResult === 2 ? common_vendor.e({
Y: showCanvas.value
}, showCanvas.value ? {
Z: common_vendor.o(clearSignature)
} : {
aa: common_vendor.o(reSign)
}, {
ab: !showCanvas.value
}, !showCanvas.value ? common_vendor.e({
ac: signatureUrl.value
}, signatureUrl.value ? {
ad: signatureUrl.value
} : {}) : {}, {
ae: showCanvas.value && !showAssigneePopup.value
}, showCanvas.value && !showAssigneePopup.value ? {
af: common_vendor.sr(signatureRef, "367b7912-12", {
"k": "signatureRef"
}),
ag: common_vendor.o((res) => onSignatureConfirm(res.tempFilePath)),
ah: common_vendor.o(onSignatureStart),
ai: common_vendor.o(onSignatureSigning),
aj: common_vendor.o(onSignatureEnd),
ak: common_vendor.o(onSignatureClear),
al: common_vendor.p({
width: signatureWidth.value,
height: 160,
backgroundColor: "#f8f8f8",
penColor: "#000000",
lineWidth: 3,
enableHistory: false
})
} : {}) : {}, {
am: common_vendor.o(handleCancel),
an: common_vendor.o(handleSubmit),
ao: !hazardLocked.value
}, !hazardLocked.value ? {
ap: common_vendor.o(onHazardConfirm),
aq: common_vendor.o(($event) => showHazardPicker.value = false),
ar: common_vendor.o(($event) => showHazardPicker.value = false),
as: common_vendor.p({
show: showHazardPicker.value,
columns: hazardColumns.value
})
} : {}, {
at: common_vendor.o(cancelAssigneeSelect),
av: assigneeLoading.value
}, assigneeLoading.value ? {} : assigneeList.value.length === 0 ? {} : {
ax: common_vendor.f(assigneeList.value, (user, k0, i0) => {
return common_vendor.e({
a: common_vendor.t(formatAssigneeDisplayName(user)),
b: String(pickerAssigneeIdentityId.value) === String(resolveAssigneeIdentityId(user))
}, String(pickerAssigneeIdentityId.value) === String(resolveAssigneeIdentityId(user)) ? {} : {}, {
c: getAssigneeItemKey(user),
d: String(pickerAssigneeIdentityId.value) === String(resolveAssigneeIdentityId(user)) ? 1 : "",
e: common_vendor.o(($event) => onAssigneeItemClick(user), getAssigneeItemKey(user))
});
})
}, {
aw: assigneeList.value.length === 0,
ay: common_vendor.o(cancelAssigneeSelect),
az: common_vendor.o(confirmAssigneeSelect),
aA: common_vendor.o(cancelAssigneeSelect),
aB: common_vendor.p({
show: showAssigneePopup.value,
mode: "bottom",
round: "20"
}),
aC: common_vendor.gei(_ctx, "")
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-367b7912"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/closeout/approval.js.map

View File

@@ -0,0 +1,11 @@
{
"navigationBarTitleText": "销号审批",
"usingComponents": {
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
"up-radio": "../../uni_modules/uview-plus/components/u-radio/u-radio",
"up-radio-group": "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group",
"wd-signature": "../../node-modules/wot-design-uni/components/wd-signature/wd-signature",
"up-picker": "../../uni_modules/uview-plus/components/u-picker/u-picker",
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,225 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page.data-v-367b7912 {
min-height: 100vh;
background: #EBF2FC;
}
.result-btn.data-v-367b7912 {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 8rpx;
background: #f5f5f5;
color: #666;
font-size: 28rpx;
}
.result-btn.data-v-367b7912::after {
border: none;
}
.result-btn.active.data-v-367b7912 {
background: #2667E9;
color: #fff;
}
.ai-btn-wrapper.data-v-367b7912 {
display: flex;
justify-content: flex-end;
}
.ai-analyze-btn.data-v-367b7912 {
display: flex;
align-items: center;
justify-content: center;
height: 72rpx;
padding: 0 32rpx;
font-size: 28rpx;
color: #fff;
background: linear-gradient(135deg, #4facfe 0%, #2668EA 100%);
border-radius: 36rpx;
border: none;
}
.ai-analyze-btn.data-v-367b7912::after {
border: none;
}
.ai-analyze-btn .ai-btn-icon.data-v-367b7912 {
margin-right: 8rpx;
font-size: 30rpx;
}
.ai-analyze-btn[disabled].data-v-367b7912 {
opacity: 0.7;
}
.picker-input.data-v-367b7912 {
background: #fff;
border-radius: 8rpx;
padding: 24rpx 20rpx;
margin-bottom: 20rpx;
border: 1rpx solid #eee;
}
.picker-input text.data-v-367b7912 {
font-size: 28rpx;
}
.picker-input.readonly.data-v-367b7912 {
background: #f5f5f5;
color: #666;
}
.static-field.data-v-367b7912 {
background: #fff;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 24rpx;
margin-bottom: 20rpx;
font-size: 28rpx;
color: #333;
line-height: 1.5;
}
.approval-radio-group.data-v-367b7912 {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.select-trigger.data-v-367b7912 {
display: flex;
align-items: center;
justify-content: space-between;
background: #fff;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 24rpx;
margin-bottom: 20rpx;
}
.select-trigger .select-content.data-v-367b7912 {
flex: 1;
font-size: 28rpx;
color: #333;
}
.user-popup.data-v-367b7912 {
background: #fff;
}
.user-popup .popup-header.data-v-367b7912 {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.user-popup .popup-header .popup-title.data-v-367b7912 {
font-size: 32rpx;
color: #333;
}
.user-popup .popup-header .popup-close.data-v-367b7912 {
font-size: 40rpx;
color: #999;
line-height: 1;
}
.user-popup .user-list-scroll.data-v-367b7912 {
max-height: 600rpx;
padding: 0 30rpx;
box-sizing: border-box;
}
.user-popup .empty-tip.data-v-367b7912 {
padding: 80rpx 20rpx;
text-align: center;
color: #909399;
font-size: 26rpx;
}
.user-popup .user-item.data-v-367b7912 {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 0;
border-bottom: 1rpx solid #f5f5f5;
}
.user-popup .user-item.data-v-367b7912:last-child {
border-bottom: none;
}
.user-popup .user-item.active .user-item-text.data-v-367b7912 {
color: #2667E9;
font-weight: 600;
}
.user-popup .user-item .user-item-text.data-v-367b7912 {
flex: 1;
font-size: 28rpx;
color: #333;
}
.user-popup .popup-footer.data-v-367b7912 {
display: flex;
gap: 24rpx;
padding: 24rpx 30rpx;
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
background: #fff;
}
.user-popup .popup-footer button.data-v-367b7912 {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
font-size: 30rpx;
margin: 0;
padding: 0;
}
.user-popup .popup-footer button.data-v-367b7912::after {
border: none;
}
.user-popup .popup-footer .btn-cancel.data-v-367b7912 {
background: #fff;
color: #2667E9;
border: 2rpx solid #2667E9;
}
.user-popup .popup-footer .btn-confirm.data-v-367b7912 {
color: #fff;
border: none;
}
.signature-action-btn.data-v-367b7912 {
margin: 0;
padding: 0 20rpx;
height: 50rpx;
font-size: 22rpx;
}
.signature-box.data-v-367b7912 {
width: 100%;
min-height: 240rpx;
background: #f8f8f8;
border: 1rpx dashed #dcdfe6;
border-radius: 8rpx;
}
.signature-box .signature-display.data-v-367b7912 {
width: 100%;
height: 160px;
background-color: #f8f8f8;
}
.signature-box .signature-pad-wrap.data-v-367b7912 {
border: 1px dashed #dcdfe6;
border-radius: 8rpx;
overflow: hidden;
background-color: #f8f8f8;
}
.signature-box .signature-img.data-v-367b7912 {
width: 100%;
height: 100%;
}
.signature-box .signature-placeholder.data-v-367b7912 {
color: #909399;
font-size: 28rpx;
}

View File

@@ -0,0 +1,928 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
const utils_upload = require("../../utils/upload.js");
const utils_hazardNav = require("../../utils/hazardNav.js");
if (!Array) {
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_radio2 = common_vendor.resolveComponent("up-radio");
const _easycom_up_radio_group2 = common_vendor.resolveComponent("up-radio-group");
const _easycom_wd_signature2 = common_vendor.resolveComponent("wd-signature");
const _easycom_up_picker2 = common_vendor.resolveComponent("up-picker");
(_easycom_up_textarea2 + _easycom_up_radio2 + _easycom_up_radio_group2 + _easycom_wd_signature2 + _easycom_up_picker2)();
}
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_radio = () => "../../uni_modules/uview-plus/components/u-radio/u-radio.js";
const _easycom_up_radio_group = () => "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
const _easycom_wd_signature = () => "../../node-modules/wot-design-uni/components/wd-signature/wd-signature.js";
const _easycom_up_picker = () => "../../uni_modules/uview-plus/components/u-picker/u-picker.js";
if (!Math) {
(_easycom_up_textarea + _easycom_up_radio + _easycom_up_radio_group + _easycom_wd_signature + _easycom_up_picker + FlowAssigneePickerPopup)();
}
const FlowAssigneePickerPopup = () => "../../components/flow/FlowAssigneePickerPopup.js";
const FLOW_END_STEP_NAME = "销号子流程结束";
const _sfc_main = {
__name: "leader-approval",
setup(__props) {
const showHazardPicker = common_vendor.ref(false);
const hazardLocked = common_vendor.ref(false);
const selectedHazard = common_vendor.ref("");
const selectedHazardId = common_vendor.ref("");
const applyId = common_vendor.ref("");
const assignId = common_vendor.ref("");
const taskId = common_vendor.ref("");
const hazardColumns = common_vendor.ref([["暂无数据"]]);
const acceptanceHazardList = common_vendor.ref([]);
const selectedDeptName = common_vendor.ref("");
const aiGenerating = common_vendor.ref(false);
const sendMsgFlagRadio = common_vendor.ref("yes");
const sendMsgFlag = common_vendor.computed(() => sendMsgFlagRadio.value === "yes");
const nextStepName = common_vendor.ref("");
const nextStepKey = common_vendor.ref("");
const nextStepLoading = common_vendor.ref(false);
const FIXED_NEXT_STEP_MAP = {
re_rectify: "隐患整改",
verify: "隐患验收"
};
const currentTaskKey = common_vendor.ref("");
const resolveFixedNextStepName = (opinion) => FIXED_NEXT_STEP_MAP[opinion] || "";
const isFixedNextStepOpinion = (opinion) => !!resolveFixedNextStepName(opinion);
const APPROVAL_TYPE_MAP = {
agree: "agree",
reject: "reject",
report: "report",
re_rectify: "rectify",
verify: "verify"
};
const APPROVAL_OPTIONS_AGREE_REJECT = [
{ label: "同意", value: "agree" },
{ label: "驳回", value: "reject" }
];
const APPROVAL_OPTIONS_WITH_REPORT = [
{ label: "同意", value: "agree" },
{ label: "驳回", value: "reject" },
{ label: "上报", value: "report" }
];
const APPROVAL_OPTIONS_ALL = [
{ label: "同意", value: "agree" },
{ label: "驳回", value: "reject" },
{ label: "上报", value: "report" },
{ label: "重新整改", value: "re_rectify" },
{ label: "重新验收", value: "verify" }
];
const APPROVAL_OPTIONS_LEADER_PREFECTURE = [
{ label: "同意", value: "agree" },
{ label: "驳回", value: "reject" },
{ label: "重新整改", value: "re_rectify" },
{ label: "重新验收", value: "verify" }
];
const resolveApprovalOptionsByCurrentTaskKey = (taskKey, deptType) => {
const key = String(taskKey || "");
const dept = String(deptType || "");
if (key === "supervising_leader_review_1" || key === "supervising_leader_review_2") {
if (dept === "prefecture") {
return APPROVAL_OPTIONS_LEADER_PREFECTURE;
}
return APPROVAL_OPTIONS_ALL;
}
if (key === "department_review" && dept === "town_street") {
return APPROVAL_OPTIONS_WITH_REPORT;
}
if (key === "department_review" || key === "section_chief_review" || key === "supervising_executive_review") {
return APPROVAL_OPTIONS_AGREE_REJECT;
}
return [];
};
const approvalOptions = common_vendor.computed(() => resolveApprovalOptionsByCurrentTaskKey(currentTaskKey.value, getCurrentDeptType()));
const needNextAssignee = common_vendor.computed(() => {
if (formData.approvalOpinion !== "agree" && formData.approvalOpinion !== "report") {
return false;
}
if (formData.approvalOpinion === "agree" && nextStepName.value === FLOW_END_STEP_NAME) {
return false;
}
return true;
});
const nextStepDisplay = common_vendor.computed(() => {
if (!formData.approvalOpinion)
return "请先选择审批意见";
const fixedName = resolveFixedNextStepName(formData.approvalOpinion);
if (fixedName)
return fixedName;
if (nextStepLoading.value)
return "加载中...";
return nextStepName.value || "暂无下一步流程";
});
const selectedAssigneeIdentityId = common_vendor.ref("");
const selectedAssigneeName = common_vendor.ref("");
const pickerAssigneeIdentityId = common_vendor.ref("");
const pickerAssigneeName = common_vendor.ref("");
const showAssigneePopup = common_vendor.ref(false);
const showCanvas = common_vendor.ref(true);
const signatureUrl = common_vendor.ref("");
const signatureServerPath = common_vendor.ref("");
const signatureWidth = common_vendor.ref(340);
const signatureRef = common_vendor.ref(null);
const isSignatureEmpty = common_vendor.ref(true);
const isSubmitting = common_vendor.ref(false);
const signatureLocalPath = common_vendor.ref("");
const formData = common_vendor.reactive({
rectifyDeadline: "",
responsibleDeptId: "",
responsiblePerson: "",
mainTreatmentContent: "",
treatmentResult: "",
selfVerifyContent: "",
approvalOpinion: "",
opinionRemark: ""
});
const syncApprovalOpinionWithOptions = () => {
const validValues = approvalOptions.value.map((item) => item.value);
if (formData.approvalOpinion && !validValues.includes(formData.approvalOpinion)) {
formData.approvalOpinion = "";
}
if (!needNextAssignee.value) {
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
pickerAssigneeIdentityId.value = "";
pickerAssigneeName.value = "";
}
};
const applyDefaultOpinionRemark = (opinion) => {
if (opinion === "agree") {
formData.opinionRemark = "同意";
} else if (opinion === "report") {
formData.opinionRemark = "上报";
} else if (opinion) {
formData.opinionRemark = "";
}
};
const resolveApproveType = (opinion) => APPROVAL_TYPE_MAP[opinion] || "";
const fillHazardRelatedFields = (hazard) => {
formData.rectifyDeadline = hazard.deadline || "";
selectedDeptName.value = hazard.deptName || "";
formData.responsiblePerson = hazard.rectifierName || "";
formData.responsibleDeptId = hazard.deptId || "";
};
const applyWriteoffHazardPreview = (hazard) => {
if (!hazard)
return;
selectedHazard.value = hazard.title || hazard.hazardTitle || `隐患${hazard.hazardId}`;
selectedHazardId.value = String(hazard.hazardId);
if (hazard.assignId) {
assignId.value = String(hazard.assignId);
}
if (hazard.taskId) {
taskId.value = String(hazard.taskId);
}
fillHazardRelatedFields(hazard);
};
const resolveTaskIdFromHazard = (hazard) => {
var _a, _b;
if (!hazard)
return "";
const candidates = [
hazard.taskId,
hazard.flowTaskId,
hazard.currentTaskId,
(_a = hazard.flowTask) == null ? void 0 : _a.taskId,
(_b = hazard.currentTask) == null ? void 0 : _b.taskId
];
for (const id of candidates) {
if (id != null && id !== "")
return String(id);
}
return "";
};
const resolveTaskIdFromAssign = (assign) => {
var _a, _b, _c, _d, _e;
if (!assign)
return "";
const candidates = [
assign.taskId,
assign.flowTaskId,
assign.currentTaskId,
(_a = assign.rectify) == null ? void 0 : _a.taskId,
(_b = assign.rectify) == null ? void 0 : _b.flowTaskId,
(_c = assign.rectify) == null ? void 0 : _c.currentTaskId,
(_d = assign.flow) == null ? void 0 : _d.taskId,
(_e = assign.currentTask) == null ? void 0 : _e.taskId
];
for (const id of candidates) {
if (id != null && id !== "")
return String(id);
}
return "";
};
const resolveAssignWithRectify = (assigns, currentAssignId) => {
if (!(assigns == null ? void 0 : assigns.length))
return null;
if (currentAssignId) {
const byAssignId = assigns.find(
(item) => String(item.assignId) === String(currentAssignId) && item.rectify
);
if (byAssignId)
return byAssignId;
}
return assigns.find((item) => item.rectify) || assigns[0] || null;
};
const resolveTaskIdFromDetail = (data) => {
if (!data)
return "";
if (data.taskId)
return String(data.taskId);
if (data.flowTaskId)
return String(data.flowTaskId);
if (data.currentTaskId)
return String(data.currentTaskId);
const assigns = data.assigns || [];
const matchedAssign = resolveAssignWithRectify(assigns, assignId.value);
const fromMatched = resolveTaskIdFromAssign(matchedAssign);
if (fromMatched)
return fromMatched;
for (const assign of assigns) {
const id = resolveTaskIdFromAssign(assign);
if (id)
return id;
}
return "";
};
const resolveNextTaskName = (data) => {
var _a;
if (!data)
return "";
const branches = data.branches || [];
const matchedBranch = branches.find((item) => item.matched) || branches[0];
return ((_a = matchedBranch == null ? void 0 : matchedBranch.nextNode) == null ? void 0 : _a.taskName) || "";
};
const resolveMatchedBranch = (data) => {
if (!data)
return null;
const branches = data.branches || [];
return branches.find((item) => item.matched) || branches[0] || null;
};
const resolveNextTaskKey = (data) => {
var _a;
return resolveNextNodeTaskKey((_a = resolveMatchedBranch(data)) == null ? void 0 : _a.nextNode);
};
const resolveNextNodeTaskKey = (node) => {
if (!(node == null ? void 0 : node.taskKey))
return "";
return String(node.taskKey);
};
const resolveCurrentTaskKey = (data) => {
if (!(data == null ? void 0 : data.currentTaskKey))
return "";
return String(data.currentTaskKey);
};
const buildPreviewVariables = (approvalOpinion) => {
const deptType = getCurrentDeptType();
const vars = {};
if (deptType) {
vars.deptType = deptType;
}
if (approvalOpinion === "report") {
vars.reportLeader = true;
} else if (approvalOpinion === "agree") {
vars.reportLeader = false;
}
return vars;
};
const buildFlowNextNodesParams = (currentTaskId, approvalOpinion) => {
const params = {
taskId: currentTaskId,
includeSubProcess: false
};
if (approvalOpinion === "reject") {
params.reject = true;
} else {
params.previewVariables = buildPreviewVariables(approvalOpinion);
}
return params;
};
const fetchFlowContext = async () => {
if (!taskId.value) {
currentTaskKey.value = "";
return;
}
try {
const res = await request_api.getFlowNextNodes({
taskId: taskId.value,
previewVariables: buildPreviewVariables(""),
includeSubProcess: false
});
if (res.code === 0) {
const payload = res.data && typeof res.data === "object" ? res.data : res;
currentTaskKey.value = resolveCurrentTaskKey(payload);
syncApprovalOpinionWithOptions();
} else {
currentTaskKey.value = "";
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/leader-approval.vue:547", "获取流程上下文失败:", error);
currentTaskKey.value = "";
}
};
const getCurrentDeptType = () => {
var _a;
const userInfo = getStoredUserInfo();
const deptType = (_a = userInfo.userIdentity) == null ? void 0 : _a.deptType;
return deptType != null && deptType !== "" ? String(deptType) : "";
};
const getStoredUserInfo = () => {
try {
const stored = common_vendor.index.getStorageSync("userInfo");
if (!stored)
return {};
return typeof stored === "string" ? JSON.parse(stored) : stored;
} catch (error) {
return {};
}
};
const openAssigneePopup = () => {
if (!taskId.value) {
common_vendor.index.showToast({ title: "缺少任务ID", icon: "none" });
return;
}
pickerAssigneeIdentityId.value = selectedAssigneeIdentityId.value;
pickerAssigneeName.value = selectedAssigneeName.value;
showAssigneePopup.value = true;
};
const confirmAssigneeSelect = ({ identityId, name }) => {
selectedAssigneeIdentityId.value = identityId;
selectedAssigneeName.value = name;
showAssigneePopup.value = false;
};
const cancelAssigneeSelect = () => {
showAssigneePopup.value = false;
};
const fetchNextStep = async () => {
if (!formData.approvalOpinion) {
nextStepName.value = "";
nextStepKey.value = "";
return;
}
const fixedName = resolveFixedNextStepName(formData.approvalOpinion);
if (fixedName) {
nextStepName.value = fixedName;
nextStepKey.value = "";
return;
}
nextStepLoading.value = true;
try {
const currentTaskId = taskId.value;
if (!currentTaskId) {
nextStepName.value = "";
nextStepKey.value = "";
return;
}
const res = await request_api.getFlowNextNodes(
buildFlowNextNodesParams(currentTaskId, formData.approvalOpinion)
);
if (res.code === 0) {
const payload = res.data && typeof res.data === "object" ? res.data : res;
nextStepName.value = resolveNextTaskName(payload);
nextStepKey.value = resolveNextTaskKey(payload);
if (!needNextAssignee.value) {
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
pickerAssigneeIdentityId.value = "";
pickerAssigneeName.value = "";
}
} else {
nextStepName.value = "";
nextStepKey.value = "";
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/leader-approval.vue:629", "获取下一步流程失败:", error);
nextStepName.value = "";
nextStepKey.value = "";
} finally {
nextStepLoading.value = false;
}
};
const resolveTaskIdForHazard = async (hazard) => {
const presetTaskId = taskId.value;
const fromHazard = resolveTaskIdFromHazard(hazard);
if (fromHazard) {
taskId.value = fromHazard;
}
if (!(hazard == null ? void 0 : hazard.hazardId)) {
return;
}
if (!assignId.value && hazard.assignId) {
assignId.value = String(hazard.assignId);
}
if (taskId.value) {
return;
}
try {
const params = { hazardId: hazard.hazardId };
if (assignId.value) {
params.assignId = assignId.value;
}
const res = await request_api.getHiddenDangerDetail(params);
if (res.code === 0 && res.data) {
taskId.value = resolveTaskIdFromDetail(res.data) || presetTaskId;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/leader-approval.vue:666", "获取隐患任务信息失败:", error);
}
if (!taskId.value && presetTaskId) {
taskId.value = presetTaskId;
}
};
const resetFlowSelection = () => {
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
nextStepName.value = "";
nextStepKey.value = "";
currentTaskKey.value = "";
};
const applySelectedHazard = async (hazard) => {
if (!hazard)
return;
selectedHazard.value = hazard.title || hazard.hazardTitle || `隐患${hazard.hazardId}`;
selectedHazardId.value = hazard.hazardId;
assignId.value = hazard.assignId ? String(hazard.assignId) : "";
fillHazardRelatedFields(hazard);
resetFlowSelection();
await resolveTaskIdForHazard(hazard);
await fetchFlowContext();
};
const formatDeadline = (value) => {
if (!value)
return "";
return String(value).split(" ")[0];
};
const applyWriteoffFormData = (data) => {
if (!data)
return;
if (data.hazardId != null) {
selectedHazardId.value = String(data.hazardId);
}
selectedHazard.value = data.title || "";
formData.rectifyDeadline = formatDeadline(data.rectifyDeadline);
formData.responsibleDeptId = data.responsibleDeptId ?? "";
selectedDeptName.value = data.responsibleDeptName || "";
formData.responsiblePerson = data.responsiblePerson || "";
if (data.applyId != null) {
applyId.value = String(data.applyId);
}
formData.mainTreatmentContent = data.mainTreatmentContent || "";
formData.treatmentResult = data.treatmentResult || "";
formData.selfVerifyContent = data.selfVerifyContent || "";
};
const fetchWriteoffForm = async (hazardId) => {
if (!hazardId)
return null;
try {
const res = await request_api.getWriteoffForm(hazardId);
if (res.code === 0 && res.data) {
applyWriteoffFormData(res.data);
} else {
common_vendor.index.showToast({ title: res.msg || "获取销号审批表单失败", icon: "none" });
}
return res;
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/leader-approval.vue:727", "获取销号审批表单失败:", error);
common_vendor.index.showToast({ title: "获取销号审批表单失败", icon: "none" });
return null;
}
};
const onHazardConfirm = async (e) => {
if (e.value && e.value.length > 0) {
const index = e.indexs[0];
const hazard = acceptanceHazardList.value[index];
if (hazard) {
await applySelectedHazard(hazard);
}
}
showHazardPicker.value = false;
};
common_vendor.watch(() => formData.approvalOpinion, (opinion) => {
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
pickerAssigneeIdentityId.value = "";
pickerAssigneeName.value = "";
nextStepName.value = "";
nextStepKey.value = "";
applyDefaultOpinionRemark(opinion);
if (opinion) {
fetchNextStep();
}
syncApprovalOpinionWithOptions();
});
common_vendor.watch(needNextAssignee, (value) => {
if (!value) {
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
pickerAssigneeIdentityId.value = "";
pickerAssigneeName.value = "";
}
});
const applySignatureFromServer = (signPath) => {
const url = signPath ? utils_upload.toSubmitFileUrl(signPath) : "";
if (!url) {
showCanvas.value = true;
signatureServerPath.value = "";
signatureUrl.value = "";
signatureLocalPath.value = "";
isSignatureEmpty.value = true;
return;
}
signatureServerPath.value = url;
signatureUrl.value = url;
signatureLocalPath.value = "";
showCanvas.value = false;
isSignatureEmpty.value = false;
};
const onSignatureStart = () => {
isSignatureEmpty.value = false;
};
const onSignatureSigning = () => {
isSignatureEmpty.value = false;
};
const onSignatureClear = () => {
isSignatureEmpty.value = true;
signatureLocalPath.value = "";
};
const onSignatureEnd = () => {
isSignatureEmpty.value = false;
};
const clearSignature = () => {
isSignatureEmpty.value = true;
signatureLocalPath.value = "";
if (signatureRef.value) {
signatureRef.value.clear();
}
};
const reSign = () => {
isSignatureEmpty.value = true;
showCanvas.value = true;
signatureUrl.value = "";
signatureServerPath.value = "";
signatureLocalPath.value = "";
common_vendor.nextTick$1(() => {
if (signatureRef.value) {
signatureRef.value.clear();
}
});
};
const onSignatureConfirm = async (tempFilePath) => {
try {
const { url } = await utils_upload.uploadToCloud(tempFilePath);
applySignatureFromServer(url);
if (isSubmitting.value) {
await executeSubmit();
}
} catch (err) {
isSubmitting.value = false;
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/closeout/leader-approval.vue:859", "签名上传失败:", err);
common_vendor.index.showToast({ title: "签名上传失败,请重试", icon: "none" });
}
};
const handleAiGenerate = async () => {
if (!selectedHazardId.value) {
common_vendor.index.showToast({ title: "请先选择隐患", icon: "none" });
return;
}
aiGenerating.value = true;
try {
const hazardRes = await request_api.getHiddenDangerDetail({ hazardId: selectedHazardId.value });
if (hazardRes.code !== 0 || !hazardRes.data) {
common_vendor.index.showToast({ title: "获取隐患详情失败", icon: "none" });
return;
}
const assigns = hazardRes.data.assigns;
if (!assigns || assigns.length === 0 || !assigns[0].rectify) {
common_vendor.index.showToast({ title: "该隐患暂无整改记录", icon: "none" });
return;
}
const rectifyId = assigns[0].rectify.rectifyId;
const rectifyRes = await request_api.getRectifyDetail({ rectifyId });
if (rectifyRes.code !== 0 || !rectifyRes.data) {
common_vendor.index.showToast({ title: "获取整改详情失败", icon: "none" });
return;
}
const rectifyPlan = rectifyRes.data.rectifyPlan;
if (!rectifyPlan) {
common_vendor.index.showToast({ title: "整改方案内容为空", icon: "none" });
return;
}
const aiRes = await request_api.generateWriteoffContent({ rectifyContent: rectifyPlan });
if (aiRes.code === 0 && aiRes.data) {
formData.mainTreatmentContent = aiRes.data.mainContent || "";
formData.treatmentResult = aiRes.data.completionContent || "";
formData.selfVerifyContent = aiRes.data.selfInspection || "";
common_vendor.index.showToast({ title: "AI生成成功", icon: "success" });
} else {
common_vendor.index.showToast({ title: aiRes.msg || "AI生成失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/leader-approval.vue:907", "AI生成销号方案失败:", error);
common_vendor.index.showToast({ title: "AI生成失败请重试", icon: "none" });
} finally {
aiGenerating.value = false;
}
};
const handleCancel = () => {
common_vendor.index.navigateBack();
};
const ensureSignatureAndSubmit = async () => {
if (showCanvas.value) {
if (!signatureRef.value || isSignatureEmpty.value) {
common_vendor.index.showToast({ title: "请进行电子签名", icon: "none" });
return;
}
isSubmitting.value = true;
common_vendor.index.showLoading({ title: "正在提交...", mask: true });
signatureRef.value.confirm();
return;
}
if (!signatureServerPath.value && !signatureLocalPath.value) {
common_vendor.index.showToast({ title: "请进行电子签名", icon: "none" });
return;
}
isSubmitting.value = true;
common_vendor.index.showLoading({ title: "正在提交...", mask: true });
try {
if (!signatureServerPath.value && signatureLocalPath.value) {
const { url } = await utils_upload.uploadToCloud(signatureLocalPath.value);
applySignatureFromServer(url);
}
await executeSubmit();
} catch (err) {
isSubmitting.value = false;
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/closeout/leader-approval.vue:944", "签名上传失败:", err);
common_vendor.index.showToast({ title: "签名上传失败,请重试", icon: "none" });
}
};
const validateFormBeforeSubmit = () => {
var _a;
if (!taskId.value) {
common_vendor.index.showToast({ title: "缺少任务ID", icon: "none" });
return false;
}
if (!applyId.value) {
common_vendor.index.showToast({ title: "缺少申请ID", icon: "none" });
return false;
}
if (!formData.approvalOpinion) {
common_vendor.index.showToast({ title: "请选择审批意见", icon: "none" });
return false;
}
if (!((_a = formData.opinionRemark) == null ? void 0 : _a.trim())) {
common_vendor.index.showToast({ title: "请输入意见说明", icon: "none" });
return false;
}
if (!nextStepName.value) {
common_vendor.index.showToast({ title: "暂无下一步流程", icon: "none" });
return false;
}
if (!isFixedNextStepOpinion(formData.approvalOpinion) && !nextStepKey.value) {
common_vendor.index.showToast({ title: "暂无下一步流程", icon: "none" });
return false;
}
if (needNextAssignee.value && !selectedAssigneeIdentityId.value) {
common_vendor.index.showToast({ title: "请选择下一步处理人", icon: "none" });
return false;
}
return true;
};
const handleSubmit = async () => {
if (!selectedHazardId.value) {
common_vendor.index.showToast({ title: "请选择隐患", icon: "none" });
return;
}
if (!validateFormBeforeSubmit()) {
return;
}
await ensureSignatureAndSubmit();
};
const executeSubmit = async () => {
const params = {
taskId: taskId.value,
bizId: Number(applyId.value),
comment: formData.opinionRemark.trim(),
type: resolveApproveType(formData.approvalOpinion),
signPath: signatureServerPath.value || "",
sendMsgFlag: sendMsgFlag.value,
nextStepName: nextStepName.value
};
if (nextStepKey.value) {
params.nextStepKey = nextStepKey.value;
}
if (needNextAssignee.value) {
params.nextAssigneeIdentityId = Number(selectedAssigneeIdentityId.value);
params.nextAssigneeName = selectedAssigneeName.value;
params.nextAssigneeCategory = "identity";
}
if (formData.approvalOpinion === "report") {
params.reportLeader = true;
}
try {
const res = await request_api.flowTaskApprove(params);
common_vendor.index.hideLoading();
if (res.code === 0) {
common_vendor.index.showToast({ title: "审批成功", icon: "success" });
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
} else {
common_vendor.index.showToast({ title: res.msg || "审批失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/leader-approval.vue:1028", "审批失败:", error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
} finally {
isSubmitting.value = false;
common_vendor.index.hideLoading();
}
};
common_vendor.onLoad(async (options) => {
try {
const sysInfo = common_vendor.index.getSystemInfoSync();
signatureWidth.value = sysInfo.windowWidth - 40;
} catch (error) {
common_vendor.index.__f__("error", "at pages/closeout/leader-approval.vue:1041", "获取系统信息失败:", error);
}
const hazardId = options == null ? void 0 : options.hazardId;
hazardLocked.value = (options == null ? void 0 : options.locked) === "1";
if (options == null ? void 0 : options.assignId) {
assignId.value = String(options.assignId);
}
if (options == null ? void 0 : options.taskId) {
taskId.value = String(options.taskId);
}
if (options == null ? void 0 : options.taskKey) {
currentTaskKey.value = String(options.taskKey);
}
const hazardFromOptions = utils_hazardNav.buildWriteoffHazardFromOptions(options);
if (hazardFromOptions) {
applyWriteoffHazardPreview(hazardFromOptions);
}
if (hazardId) {
selectedHazardId.value = String(hazardId);
await fetchWriteoffForm(hazardId);
if (taskId.value) {
await fetchFlowContext();
}
} else if (taskId.value) {
await fetchFlowContext();
}
});
return (_ctx, _cache) => {
return common_vendor.e({
a: hazardLocked.value
}, hazardLocked.value ? {
b: common_vendor.t(selectedHazard.value || "加载中..."),
c: common_vendor.n(selectedHazard.value ? "" : "text-gray")
} : {
d: common_vendor.t(selectedHazard.value || "请选择隐患"),
e: common_vendor.n(selectedHazard.value ? "" : "text-gray"),
f: common_vendor.o(($event) => showHazardPicker.value = true)
}, {
g: common_vendor.t(formData.rectifyDeadline || "请先选择隐患"),
h: common_vendor.n(formData.rectifyDeadline ? "" : "text-gray"),
i: common_vendor.t(selectedDeptName.value || "请先选择隐患"),
j: common_vendor.n(selectedDeptName.value ? "" : "text-gray"),
k: common_vendor.t(formData.responsiblePerson || "请先选择隐患"),
l: common_vendor.n(formData.responsiblePerson ? "" : "text-gray"),
m: !aiGenerating.value
}, !aiGenerating.value ? {} : {}, {
n: common_vendor.t(aiGenerating.value ? "AI生成中..." : "AI 生成销号方案"),
o: aiGenerating.value,
p: aiGenerating.value,
q: common_vendor.o(handleAiGenerate),
r: common_vendor.o(($event) => formData.mainTreatmentContent = $event),
s: common_vendor.p({
placeholder: "暂无",
disabled: true,
modelValue: formData.mainTreatmentContent
}),
t: common_vendor.o(($event) => formData.treatmentResult = $event),
v: common_vendor.p({
placeholder: "暂无",
disabled: true,
modelValue: formData.treatmentResult
}),
w: common_vendor.o(($event) => formData.selfVerifyContent = $event),
x: common_vendor.p({
placeholder: "暂无",
disabled: true,
modelValue: formData.selfVerifyContent
}),
y: common_vendor.f(approvalOptions.value, (opt, index, i0) => {
return {
a: opt.value,
b: "480a9a4b-4-" + i0 + ",480a9a4b-3",
c: common_vendor.p({
label: opt.label,
name: opt.value,
customStyle: {
marginRight: index < approvalOptions.value.length - 1 ? "24rpx" : "0"
}
})
};
}),
z: common_vendor.o(($event) => formData.approvalOpinion = $event),
A: common_vendor.p({
placement: "row",
activeColor: "#2667e9",
modelValue: formData.approvalOpinion
}),
B: common_vendor.o(($event) => formData.opinionRemark = $event),
C: common_vendor.p({
placeholder: "请输入意见说明",
modelValue: formData.opinionRemark
}),
D: common_vendor.t(nextStepDisplay.value),
E: needNextAssignee.value
}, needNextAssignee.value ? {} : {}, {
F: needNextAssignee.value
}, needNextAssignee.value ? {
G: common_vendor.t(selectedAssigneeName.value || "请选择下一步处理人"),
H: !selectedAssigneeName.value ? 1 : "",
I: common_vendor.o(openAssigneePopup)
} : {}, {
J: common_vendor.p({
label: "是",
name: "yes",
customStyle: {
marginRight: "48rpx"
}
}),
K: common_vendor.p({
label: "否",
name: "no"
}),
L: common_vendor.o(($event) => sendMsgFlagRadio.value = $event),
M: common_vendor.p({
placement: "row",
activeColor: "#2667e9",
modelValue: sendMsgFlagRadio.value
}),
N: showCanvas.value
}, showCanvas.value ? {
O: common_vendor.o(clearSignature)
} : {
P: common_vendor.o(reSign)
}, {
Q: !showCanvas.value
}, !showCanvas.value ? common_vendor.e({
R: signatureUrl.value
}, signatureUrl.value ? {
S: signatureUrl.value
} : {}) : {}, {
T: showCanvas.value && !showAssigneePopup.value
}, showCanvas.value && !showAssigneePopup.value ? {
U: common_vendor.sr(signatureRef, "480a9a4b-9", {
"k": "signatureRef"
}),
V: common_vendor.o((res) => onSignatureConfirm(res.tempFilePath)),
W: common_vendor.o(onSignatureStart),
X: common_vendor.o(onSignatureSigning),
Y: common_vendor.o(onSignatureEnd),
Z: common_vendor.o(onSignatureClear),
aa: common_vendor.p({
width: signatureWidth.value,
height: 160,
backgroundColor: "#f8f8f8",
penColor: "#000000",
lineWidth: 3,
enableHistory: false
})
} : {}, {
ab: common_vendor.o(handleCancel),
ac: common_vendor.o(handleSubmit),
ad: !hazardLocked.value
}, !hazardLocked.value ? {
ae: common_vendor.o(onHazardConfirm),
af: common_vendor.o(($event) => showHazardPicker.value = false),
ag: common_vendor.o(($event) => showHazardPicker.value = false),
ah: common_vendor.p({
show: showHazardPicker.value,
columns: hazardColumns.value
})
} : {}, {
ai: common_vendor.o(cancelAssigneeSelect),
aj: common_vendor.o(confirmAssigneeSelect),
ak: common_vendor.o(($event) => pickerAssigneeIdentityId.value = $event),
al: common_vendor.o(($event) => pickerAssigneeName.value = $event),
am: common_vendor.p({
show: showAssigneePopup.value,
["task-id"]: taskId.value,
["picker-identity-id"]: pickerAssigneeIdentityId.value,
["picker-name"]: pickerAssigneeName.value
}),
an: common_vendor.gei(_ctx, "")
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-480a9a4b"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/closeout/leader-approval.js.map

View File

@@ -0,0 +1,11 @@
{
"navigationBarTitleText": "领导审批",
"usingComponents": {
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
"up-radio": "../../uni_modules/uview-plus/components/u-radio/u-radio",
"up-radio-group": "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group",
"wd-signature": "../../node-modules/wot-design-uni/components/wd-signature/wd-signature",
"up-picker": "../../uni_modules/uview-plus/components/u-picker/u-picker",
"flow-assignee-picker-popup": "../../components/flow/FlowAssigneePickerPopup"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,148 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page.data-v-480a9a4b {
min-height: 100vh;
background: #EBF2FC;
}
.result-btn.data-v-480a9a4b {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 8rpx;
background: #f5f5f5;
color: #666;
font-size: 28rpx;
}
.result-btn.data-v-480a9a4b::after {
border: none;
}
.result-btn.active.data-v-480a9a4b {
background: #2667E9;
color: #fff;
}
.ai-btn-wrapper.data-v-480a9a4b {
display: flex;
justify-content: flex-end;
}
.ai-analyze-btn.data-v-480a9a4b {
display: flex;
align-items: center;
justify-content: center;
height: 72rpx;
padding: 0 32rpx;
font-size: 28rpx;
color: #fff;
background: linear-gradient(135deg, #4facfe 0%, #2668EA 100%);
border-radius: 36rpx;
border: none;
}
.ai-analyze-btn.data-v-480a9a4b::after {
border: none;
}
.ai-analyze-btn .ai-btn-icon.data-v-480a9a4b {
margin-right: 8rpx;
font-size: 30rpx;
}
.ai-analyze-btn[disabled].data-v-480a9a4b {
opacity: 0.7;
}
.picker-input.data-v-480a9a4b {
background: #fff;
border-radius: 8rpx;
padding: 24rpx 20rpx;
margin-bottom: 20rpx;
border: 1rpx solid #eee;
}
.picker-input text.data-v-480a9a4b {
font-size: 28rpx;
}
.picker-input.readonly.data-v-480a9a4b {
background: #f5f5f5;
color: #666;
}
.static-field.data-v-480a9a4b {
background: #fff;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 24rpx;
margin-bottom: 20rpx;
font-size: 28rpx;
color: #333;
line-height: 1.5;
}
.approval-radio-group.data-v-480a9a4b {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.select-trigger.data-v-480a9a4b {
display: flex;
align-items: center;
justify-content: space-between;
background: #fff;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 24rpx;
margin-bottom: 20rpx;
}
.select-trigger .select-content.data-v-480a9a4b {
flex: 1;
font-size: 28rpx;
color: #333;
}
.signature-action-btn.data-v-480a9a4b {
margin: 0;
padding: 0 20rpx;
height: 50rpx;
font-size: 22rpx;
}
.signature-box.data-v-480a9a4b {
width: 100%;
min-height: 240rpx;
background: #f8f8f8;
border: 1rpx dashed #dcdfe6;
border-radius: 8rpx;
}
.signature-box .signature-display.data-v-480a9a4b {
width: 100%;
height: 160px;
background-color: #f8f8f8;
}
.signature-box .signature-pad-wrap.data-v-480a9a4b {
border: 1px dashed #dcdfe6;
border-radius: 8rpx;
overflow: hidden;
background-color: #f8f8f8;
}
.signature-box .signature-img.data-v-480a9a4b {
width: 100%;
height: 100%;
}
.signature-box .signature-placeholder.data-v-480a9a4b {
color: #909399;
font-size: 28rpx;
}

View File

@@ -3,19 +3,21 @@ const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
if (!Array) {
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
const _easycom_up_picker2 = common_vendor.resolveComponent("up-picker");
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_picker2 = common_vendor.resolveComponent("up-picker");
const _easycom_up_datetime_picker2 = common_vendor.resolveComponent("up-datetime-picker");
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
(_easycom_up_input2 + _easycom_up_picker2 + _easycom_up_textarea2 + _easycom_up_datetime_picker2 + _easycom_u_popup2)();
const _easycom_xq_tree2 = common_vendor.resolveComponent("xq-tree");
(_easycom_up_input2 + _easycom_up_textarea2 + _easycom_up_picker2 + _easycom_up_datetime_picker2 + _easycom_u_popup2 + _easycom_xq_tree2)();
}
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_picker = () => "../../uni_modules/uview-plus/components/u-picker/u-picker.js";
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_picker = () => "../../uni_modules/uview-plus/components/u-picker/u-picker.js";
const _easycom_up_datetime_picker = () => "../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker.js";
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
const _easycom_xq_tree = () => "../../uni_modules/xq-tree/components/xq-tree/xq-tree.js";
if (!Math) {
(_easycom_up_input + _easycom_up_picker + _easycom_up_textarea + _easycom_up_datetime_picker + _easycom_u_popup)();
(_easycom_up_input + _easycom_up_textarea + _easycom_up_picker + _easycom_up_datetime_picker + _easycom_u_popup + _easycom_xq_tree)();
}
const _sfc_main = {
__name: "editchecklist",
@@ -147,11 +149,9 @@ const _sfc_main = {
const showDeptPicker = common_vendor.ref(false);
const showTypePicker = common_vendor.ref(false);
const showModePicker = common_vendor.ref(false);
common_vendor.ref(false);
const showCyclePicker = common_vendor.ref(false);
const showStartDatePicker = common_vendor.ref(false);
const showEndDatePicker = common_vendor.ref(false);
common_vendor.ref([["湘西自治州和谐网络科技有限公司", "湘西自治州和谐云大数据科技有限公司", "湘西网络有限公司"]]);
const typeColumns = common_vendor.ref([["日常检查", "专项检查", "设备检查"]]);
const modeColumns = common_vendor.ref([["单人完成", "全员"]]);
const cycleColumns = common_vendor.ref([["每天一次", "每周一次", "每月一次", "每季度一次"]]);
@@ -159,17 +159,78 @@ const _sfc_main = {
const executorList = common_vendor.ref([]);
const selectedExecutorId = common_vendor.ref(null);
const deptTree = common_vendor.ref([]);
const deptCascaderColumns = common_vendor.ref([]);
const deptCascaderIndexs = common_vendor.ref([0]);
const selectedDeptPath = common_vendor.ref([]);
const onDeptConfirm = () => {
const lastSelected = selectedDeptPath.value[selectedDeptPath.value.length - 1];
if (lastSelected) {
formData.deptId = lastSelected.deptId;
formData.deptName = selectedDeptPath.value.map((d) => d.deptName).join(" / ");
clearExecutorSelection();
fetchDeptUsers(lastSelected.deptId);
const deptTreeRef = common_vendor.ref(null);
const selectedDeptId = common_vendor.ref(null);
const deptDefaultCheckedKeys = common_vendor.ref([]);
const getDeptNodeId = (node) => {
var _a;
return (node == null ? void 0 : node.deptId) ?? ((_a = node == null ? void 0 : node.raw) == null ? void 0 : _a.deptId) ?? null;
};
const syncDeptTreeChecked = (deptId) => {
common_vendor.nextTick$1(() => {
var _a, _b, _c, _d;
if (deptId) {
(_b = (_a = deptTreeRef.value) == null ? void 0 : _a.setCheckedKeys) == null ? void 0 : _b.call(_a, [deptId]);
} else {
(_d = (_c = deptTreeRef.value) == null ? void 0 : _c.clearChecked) == null ? void 0 : _d.call(_c);
}
});
};
const findDeptPath = (tree, targetId, path = []) => {
var _a;
for (const node of tree) {
const currentPath = [...path, node];
if (String(node.deptId) === String(targetId)) {
return currentPath;
}
if ((_a = node.children) == null ? void 0 : _a.length) {
const found = findDeptPath(node.children, targetId, currentPath);
if (found)
return found;
}
}
return null;
};
const openDeptPopup = () => {
selectedDeptId.value = formData.deptId || null;
deptDefaultCheckedKeys.value = formData.deptId ? [formData.deptId] : [];
showDeptPicker.value = true;
syncDeptTreeChecked(formData.deptId);
};
const onDeptNodeClick = (node) => {
const deptId = getDeptNodeId(node);
selectedDeptId.value = deptId;
syncDeptTreeChecked(deptId);
};
const onDeptCheck = (node, { checkedKeys = [] } = {}) => {
const deptId = getDeptNodeId(node);
const isChecked = checkedKeys.some((key) => String(key) === String(deptId));
if (isChecked) {
selectedDeptId.value = deptId;
syncDeptTreeChecked(deptId);
return;
}
selectedDeptId.value = null;
syncDeptTreeChecked(null);
};
const cancelDeptSelect = () => {
showDeptPicker.value = false;
};
const confirmDeptSelect = () => {
if (!selectedDeptId.value) {
common_vendor.index.showToast({ title: "请选择分派单位", icon: "none" });
return;
}
const path = findDeptPath(deptTree.value, selectedDeptId.value);
if (!(path == null ? void 0 : path.length)) {
common_vendor.index.showToast({ title: "请选择分派单位", icon: "none" });
return;
}
const selected = path[path.length - 1];
formData.deptId = selected.deptId;
formData.deptName = path.map((d) => d.deptName).join(" / ");
clearExecutorSelection();
fetchDeptUsers(selected.deptId);
showDeptPicker.value = false;
};
const typeMap = {
@@ -211,7 +272,7 @@ const _sfc_main = {
executorList.value = [];
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:641", "获取部门用户失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:726", "获取部门用户失败:", error);
executorList.value = [];
}
};
@@ -243,47 +304,9 @@ const _sfc_main = {
if (res.code === 0 && res.data) {
const list = Array.isArray(res.data) ? res.data : [];
deptTree.value = handleTree(list, "deptId");
initDeptCascader(deptTree.value);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:680", "获取部门树失败:", error);
}
};
const initDeptCascader = (treeData) => {
const roots = Array.isArray(treeData) ? treeData : treeData ? [treeData] : [];
if (roots.length === 0)
return;
const firstColumn = roots.map((item) => ({ text: item.deptName, ...item }));
deptCascaderColumns.value = [firstColumn];
deptCascaderIndexs.value = [0];
selectedDeptPath.value = [roots[0]];
let current = roots[0];
while (current.children && current.children.length > 0) {
const nextColumn = current.children.map((item) => ({ text: item.deptName, ...item }));
deptCascaderColumns.value.push(nextColumn);
deptCascaderIndexs.value.push(0);
selectedDeptPath.value.push(current.children[0]);
current = current.children[0];
}
};
const onDeptCascaderChange = (e) => {
const { columnIndex, index, value } = e;
deptCascaderIndexs.value[columnIndex] = index;
selectedDeptPath.value[columnIndex] = value;
deptCascaderColumns.value = deptCascaderColumns.value.slice(0, columnIndex + 1);
deptCascaderIndexs.value = deptCascaderIndexs.value.slice(0, columnIndex + 1);
selectedDeptPath.value = selectedDeptPath.value.slice(0, columnIndex + 1);
if (value.children && value.children.length > 0) {
const nextColumn = value.children.map((item) => ({ text: item.deptName, ...item }));
deptCascaderColumns.value.push(nextColumn);
deptCascaderIndexs.value.push(0);
selectedDeptPath.value.push(value.children[0]);
if (value.children[0].children && value.children[0].children.length > 0) {
const thirdColumn = value.children[0].children.map((item) => ({ text: item.deptName, ...item }));
deptCascaderColumns.value.push(thirdColumn);
deptCascaderIndexs.value.push(0);
selectedDeptPath.value.push(value.children[0].children[0]);
}
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:764", "获取部门树失败:", error);
}
};
const onCycleConfirm = (e) => {
@@ -392,7 +415,7 @@ const _sfc_main = {
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:867", "删除检查项失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:892", "删除检查项失败:", error);
common_vendor.index.showToast({ title: "删除失败", icon: "none" });
}
} else {
@@ -468,7 +491,7 @@ const _sfc_main = {
hasMoreLaw.value = lawList.value.length < total;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:954", "获取法规列表失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:979", "获取法规列表失败:", error);
} finally {
lawLoading.value = false;
}
@@ -548,7 +571,7 @@ const _sfc_main = {
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1054", "添加检查项失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1079", "添加检查项失败:", error);
common_vendor.index.showToast({ title: "添加失败", icon: "none" });
}
};
@@ -597,7 +620,7 @@ const _sfc_main = {
hasMoreLibrary.value = libraryList.value.length < total;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1114", "获取检查库列表失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1139", "获取检查库列表失败:", error);
} finally {
libraryLoading.value = false;
}
@@ -700,7 +723,7 @@ const _sfc_main = {
selectedLibraries.value = [];
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1234", "获取检查库详情失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1259", "获取检查库详情失败:", error);
common_vendor.index.showToast({ title: "添加失败", icon: "none" });
}
};
@@ -797,7 +820,7 @@ const _sfc_main = {
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1349", "保存失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1374", "保存失败:", error);
common_vendor.index.showToast({ title: "保存失败", icon: "none" });
}
};
@@ -814,95 +837,86 @@ const _sfc_main = {
}),
c: common_vendor.t(formData.deptName || "请选择分派单位"),
d: common_vendor.n(formData.deptName ? "picker-value" : "picker-placeholder"),
e: common_vendor.o(($event) => showDeptPicker.value = true),
f: common_vendor.o(onDeptConfirm),
g: common_vendor.o(onDeptCascaderChange),
h: common_vendor.o(($event) => showDeptPicker.value = false),
i: common_vendor.o(($event) => showDeptPicker.value = false),
j: common_vendor.p({
show: showDeptPicker.value,
columns: deptCascaderColumns.value,
defaultIndex: deptCascaderIndexs.value
}),
k: common_vendor.o(($event) => formData.remark = $event),
l: common_vendor.p({
e: common_vendor.o(openDeptPopup),
f: common_vendor.o(($event) => formData.remark = $event),
g: common_vendor.p({
placeholder: "请输入补充说明",
modelValue: formData.remark
}),
m: common_vendor.t(formData.typeName || "请选择检查表类型"),
n: common_vendor.n(formData.typeName ? "picker-value" : "picker-placeholder"),
o: common_vendor.o(($event) => showTypePicker.value = true),
p: common_vendor.o(onTypeConfirm),
q: common_vendor.o(($event) => showTypePicker.value = false),
r: common_vendor.o(($event) => showTypePicker.value = false),
s: common_vendor.p({
h: common_vendor.t(formData.typeName || "请选择检查表类型"),
i: common_vendor.n(formData.typeName ? "picker-value" : "picker-placeholder"),
j: common_vendor.o(($event) => showTypePicker.value = true),
k: common_vendor.o(onTypeConfirm),
l: common_vendor.o(($event) => showTypePicker.value = false),
m: common_vendor.o(($event) => showTypePicker.value = false),
n: common_vendor.p({
show: showTypePicker.value,
columns: typeColumns.value
}),
t: common_vendor.t(formData.modeName || "请选择模式"),
v: common_vendor.n(formData.modeName ? "picker-value" : "picker-placeholder"),
w: common_vendor.o(($event) => showModePicker.value = true),
x: common_vendor.o(onModeConfirm),
y: common_vendor.o(($event) => showModePicker.value = false),
z: common_vendor.o(($event) => showModePicker.value = false),
A: common_vendor.p({
o: common_vendor.t(formData.modeName || "请选择模式"),
p: common_vendor.n(formData.modeName ? "picker-value" : "picker-placeholder"),
q: common_vendor.o(($event) => showModePicker.value = true),
r: common_vendor.o(onModeConfirm),
s: common_vendor.o(($event) => showModePicker.value = false),
t: common_vendor.o(($event) => showModePicker.value = false),
v: common_vendor.p({
show: showModePicker.value,
columns: modeColumns.value
}),
B: formData.modeName === "单人完成"
w: formData.modeName === "单人完成"
}, formData.modeName === "单人完成" ? {
C: common_vendor.t(formData.executorNames || (formData.deptId ? "请选择执行人员" : "请先选择分派单位")),
D: common_vendor.n(formData.executorNames ? "picker-value" : "picker-placeholder"),
E: common_vendor.o(openExecutorPopup)
x: common_vendor.t(formData.executorNames || (formData.deptId ? "请选择执行人员" : "请先选择分派单位")),
y: common_vendor.n(formData.executorNames ? "picker-value" : "picker-placeholder"),
z: common_vendor.o(openExecutorPopup)
} : {}, {
F: common_vendor.t(formData.cycleName || "请选择周期"),
G: common_vendor.n(formData.cycleName ? "picker-value" : "picker-placeholder"),
H: common_vendor.o(($event) => showCyclePicker.value = true),
I: common_vendor.o(onCycleConfirm),
J: common_vendor.o(($event) => showCyclePicker.value = false),
K: common_vendor.o(($event) => showCyclePicker.value = false),
L: common_vendor.p({
A: common_vendor.t(formData.cycleName || "请选择周期"),
B: common_vendor.n(formData.cycleName ? "picker-value" : "picker-placeholder"),
C: common_vendor.o(($event) => showCyclePicker.value = true),
D: common_vendor.o(onCycleConfirm),
E: common_vendor.o(($event) => showCyclePicker.value = false),
F: common_vendor.o(($event) => showCyclePicker.value = false),
G: common_vendor.p({
show: showCyclePicker.value,
columns: cycleColumns.value
}),
M: formData.isWeekend === 1 ? 1 : "",
N: common_vendor.o(($event) => setIsWeekend(1)),
O: formData.isWeekend === 2 ? 1 : "",
P: common_vendor.o(($event) => setIsWeekend(2)),
Q: common_vendor.t(formData.startDate || "请选择计划开始日期"),
R: common_vendor.n(formData.startDate ? "picker-value" : "picker-placeholder"),
S: common_vendor.o(openStartDatePicker),
T: common_vendor.o(onStartDatePickerChange),
U: common_vendor.o(onStartDateConfirm),
V: common_vendor.o(($event) => showStartDatePicker.value = false),
W: common_vendor.o(($event) => showStartDatePicker.value = false),
X: common_vendor.o(($event) => startDateValue.value = $event),
Y: common_vendor.p({
H: formData.isWeekend === 1 ? 1 : "",
I: common_vendor.o(($event) => setIsWeekend(1)),
J: formData.isWeekend === 2 ? 1 : "",
K: common_vendor.o(($event) => setIsWeekend(2)),
L: common_vendor.t(formData.startDate || "请选择计划开始日期"),
M: common_vendor.n(formData.startDate ? "picker-value" : "picker-placeholder"),
N: common_vendor.o(openStartDatePicker),
O: common_vendor.o(onStartDatePickerChange),
P: common_vendor.o(onStartDateConfirm),
Q: common_vendor.o(($event) => showStartDatePicker.value = false),
R: common_vendor.o(($event) => showStartDatePicker.value = false),
S: common_vendor.o(($event) => startDateValue.value = $event),
T: common_vendor.p({
show: showStartDatePicker.value,
mode: "date",
minDate: todayMinDate.value,
filter: startDateFilter.value,
modelValue: startDateValue.value
}),
Z: common_vendor.t(formData.endDate || "请选择计划结束日期"),
aa: common_vendor.n(formData.endDate ? "picker-value" : "picker-placeholder"),
ab: common_vendor.o(openEndDatePicker),
ac: common_vendor.o(onEndDatePickerChange),
ad: common_vendor.o(onEndDateConfirm),
ae: common_vendor.o(($event) => showEndDatePicker.value = false),
af: common_vendor.o(($event) => showEndDatePicker.value = false),
ag: common_vendor.o(($event) => endDateValue.value = $event),
ah: common_vendor.p({
U: common_vendor.t(formData.endDate || "请选择计划结束日期"),
V: common_vendor.n(formData.endDate ? "picker-value" : "picker-placeholder"),
W: common_vendor.o(openEndDatePicker),
X: common_vendor.o(onEndDatePickerChange),
Y: common_vendor.o(onEndDateConfirm),
Z: common_vendor.o(($event) => showEndDatePicker.value = false),
aa: common_vendor.o(($event) => showEndDatePicker.value = false),
ab: common_vendor.o(($event) => endDateValue.value = $event),
ac: common_vendor.p({
show: showEndDatePicker.value,
mode: "date",
minDate: endDateMinDate.value,
filter: endDateFilter.value,
modelValue: endDateValue.value
}),
ai: common_vendor.t(checkItemCount.value),
aj: checkItemCount.value === 0
ad: common_vendor.t(checkItemCount.value),
ae: checkItemCount.value === 0
}, checkItemCount.value === 0 ? {} : {}, {
ak: common_vendor.f(manualCheckItems.value, (item, index, i0) => {
af: common_vendor.f(manualCheckItems.value, (item, index, i0) => {
return {
a: common_vendor.t(index + 1),
b: common_vendor.t(item.name),
@@ -912,7 +926,7 @@ const _sfc_main = {
f: "manual-" + index
};
}),
al: common_vendor.f(libraryCheckItems.value, (item, index, i0) => {
ag: common_vendor.f(libraryCheckItems.value, (item, index, i0) => {
return {
a: common_vendor.t(item.sourceLibraryName || "-"),
b: common_vendor.t(item.name),
@@ -922,41 +936,41 @@ const _sfc_main = {
f: "lib-" + item.pointId
};
}),
am: common_vendor.o(($event) => showAddPopup.value = true),
an: common_vendor.o(openLibraryPopup),
ao: common_vendor.o(handleSave),
ap: common_vendor.o(($event) => showAddPopup.value = false),
aq: common_vendor.o(($event) => checkForm.name = $event),
ar: common_vendor.p({
ah: common_vendor.o(($event) => showAddPopup.value = true),
ai: common_vendor.o(openLibraryPopup),
aj: common_vendor.o(handleSave),
ak: common_vendor.o(($event) => showAddPopup.value = false),
al: common_vendor.o(($event) => checkForm.name = $event),
am: common_vendor.p({
placeholder: "请输入检查名称",
border: "surround",
modelValue: checkForm.name
}),
as: common_vendor.o(($event) => checkForm.point = $event),
at: common_vendor.p({
an: common_vendor.o(($event) => checkForm.point = $event),
ao: common_vendor.p({
placeholder: "请输入检查内容",
height: 150,
modelValue: checkForm.point
}),
av: common_vendor.t(checkForm.regulationName || "选择法规"),
aw: common_vendor.n(checkForm.regulationName ? "" : "text-gray"),
ax: common_vendor.o(openLawPopup),
ay: common_vendor.o(($event) => showAddPopup.value = false),
az: common_vendor.o(handleAddCheck),
aA: common_vendor.o(($event) => showAddPopup.value = false),
aB: common_vendor.p({
ap: common_vendor.t(checkForm.regulationName || "选择法规"),
aq: common_vendor.n(checkForm.regulationName ? "" : "text-gray"),
ar: common_vendor.o(openLawPopup),
as: common_vendor.o(($event) => showAddPopup.value = false),
at: common_vendor.o(handleAddCheck),
av: common_vendor.o(($event) => showAddPopup.value = false),
aw: common_vendor.p({
show: showAddPopup.value,
mode: "center",
round: "20"
}),
aC: common_vendor.o(($event) => showLawPopup.value = false),
aD: common_vendor.o(searchRegulation),
aE: lawKeyword.value,
aF: common_vendor.o(($event) => lawKeyword.value = $event.detail.value),
aG: common_vendor.o(searchRegulation),
aH: lawLoading.value && lawList.value.length === 0
ax: common_vendor.o(($event) => showLawPopup.value = false),
ay: common_vendor.o(searchRegulation),
az: lawKeyword.value,
aA: common_vendor.o(($event) => lawKeyword.value = $event.detail.value),
aB: common_vendor.o(searchRegulation),
aC: lawLoading.value && lawList.value.length === 0
}, lawLoading.value && lawList.value.length === 0 ? {} : !lawLoading.value && lawList.value.length === 0 ? {} : common_vendor.e({
aJ: common_vendor.f(lawList.value, (item, k0, i0) => {
aE: common_vendor.f(lawList.value, (item, k0, i0) => {
return {
a: common_vendor.t(item.depict),
b: common_vendor.t(item.legalBasis),
@@ -965,26 +979,26 @@ const _sfc_main = {
e: common_vendor.o(($event) => selectLaw(item), item.id)
};
}),
aK: lawLoading.value
aF: lawLoading.value
}, lawLoading.value ? {} : {}), {
aI: !lawLoading.value && lawList.value.length === 0,
aL: common_vendor.o(loadMoreLaw),
aM: common_vendor.o(($event) => showLawPopup.value = false),
aN: common_vendor.o(confirmLaw),
aO: common_vendor.o(($event) => showLawPopup.value = false),
aP: common_vendor.p({
aD: !lawLoading.value && lawList.value.length === 0,
aG: common_vendor.o(loadMoreLaw),
aH: common_vendor.o(($event) => showLawPopup.value = false),
aI: common_vendor.o(confirmLaw),
aJ: common_vendor.o(($event) => showLawPopup.value = false),
aK: common_vendor.p({
show: showLawPopup.value,
mode: "center",
round: "20"
}),
aQ: common_vendor.o(closeLibraryPopup),
aR: common_vendor.o(searchLibrary),
aS: libraryKeyword.value,
aT: common_vendor.o(($event) => libraryKeyword.value = $event.detail.value),
aU: common_vendor.o(searchLibrary),
aV: libraryLoading.value && libraryList.value.length === 0
aL: common_vendor.o(closeLibraryPopup),
aM: common_vendor.o(searchLibrary),
aN: libraryKeyword.value,
aO: common_vendor.o(($event) => libraryKeyword.value = $event.detail.value),
aP: common_vendor.o(searchLibrary),
aQ: libraryLoading.value && libraryList.value.length === 0
}, libraryLoading.value && libraryList.value.length === 0 ? {} : !libraryLoading.value && libraryList.value.length === 0 ? {} : common_vendor.e({
aX: common_vendor.f(libraryList.value, (item, k0, i0) => {
aS: common_vendor.f(libraryList.value, (item, k0, i0) => {
return common_vendor.e({
a: selectedLibraries.value.includes(item.id)
}, selectedLibraries.value.includes(item.id) ? {} : {}, {
@@ -995,21 +1009,54 @@ const _sfc_main = {
f: common_vendor.o(($event) => toggleLibrarySelect(item), item.id)
});
}),
aY: libraryLoading.value
aT: libraryLoading.value
}, libraryLoading.value ? {} : {}), {
aW: !libraryLoading.value && libraryList.value.length === 0,
aZ: common_vendor.o(loadMoreLibrary),
ba: common_vendor.o(addSelectedLibrary),
bb: common_vendor.o(closeLibraryPopup),
bc: common_vendor.p({
aR: !libraryLoading.value && libraryList.value.length === 0,
aU: common_vendor.o(loadMoreLibrary),
aV: common_vendor.o(addSelectedLibrary),
aW: common_vendor.o(closeLibraryPopup),
aX: common_vendor.p({
show: showLibraryPopup.value,
mode: "center",
round: "20"
}),
bd: common_vendor.o(($event) => showExecutorPopup.value = false),
be: executorList.value.length === 0
aY: common_vendor.o(cancelDeptSelect),
aZ: showDeptPicker.value
}, showDeptPicker.value ? common_vendor.e({
ba: deptTree.value.length
}, deptTree.value.length ? {
bb: common_vendor.sr(deptTreeRef, "98282eb3-13,98282eb3-12", {
"k": "deptTreeRef"
}),
bc: common_vendor.o(onDeptCheck),
bd: common_vendor.o(onDeptNodeClick),
be: common_vendor.p({
data: deptTree.value,
["node-key"]: "deptId",
["label-key"]: "deptName",
["children-key"]: "children",
["show-checkbox"]: true,
["check-strictly"]: true,
["default-expand-all"]: true,
height: 500,
width: 560,
["default-checked-keys"]: deptDefaultCheckedKeys.value,
["empty-text"]: "暂无部门数据"
})
} : {}) : {}, {
bf: common_vendor.o(cancelDeptSelect),
bg: common_vendor.o(confirmDeptSelect),
bh: common_vendor.o(cancelDeptSelect),
bi: common_vendor.p({
show: showDeptPicker.value,
mode: "center",
round: "20",
safeAreaInsetBottom: false
}),
bj: common_vendor.o(($event) => showExecutorPopup.value = false),
bk: executorList.value.length === 0
}, executorList.value.length === 0 ? {} : {
bf: common_vendor.f(executorList.value, (item, k0, i0) => {
bl: common_vendor.f(executorList.value, (item, k0, i0) => {
return common_vendor.e({
a: selectedExecutorId.value === item.userId
}, selectedExecutorId.value === item.userId ? {} : {}, {
@@ -1020,15 +1067,15 @@ const _sfc_main = {
});
})
}, {
bg: common_vendor.o(($event) => showExecutorPopup.value = false),
bh: common_vendor.o(confirmExecutorSelect),
bi: common_vendor.o(($event) => showExecutorPopup.value = false),
bj: common_vendor.p({
bm: common_vendor.o(($event) => showExecutorPopup.value = false),
bn: common_vendor.o(confirmExecutorSelect),
bo: common_vendor.o(($event) => showExecutorPopup.value = false),
bp: common_vendor.p({
show: showExecutorPopup.value,
mode: "center",
round: "20"
}),
bk: common_vendor.gei(_ctx, "")
bq: common_vendor.gei(_ctx, "")
});
};
}

View File

@@ -2,9 +2,10 @@
"navigationBarTitleText": "添加检查表",
"usingComponents": {
"up-input": "../../uni_modules/uview-plus/components/u-input/u-input",
"up-picker": "../../uni_modules/uview-plus/components/u-picker/u-picker",
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
"up-picker": "../../uni_modules/uview-plus/components/u-picker/u-picker",
"up-datetime-picker": "../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker",
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup"
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup",
"xq-tree": "../../uni_modules/xq-tree/components/xq-tree/xq-tree"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -435,6 +435,24 @@
.btn-add-library.data-v-98282eb3::after {
border: none;
}
.dept-popup.data-v-98282eb3 {
width: 600rpx;
background: #fff;
border-radius: 20rpx;
overflow: hidden;
}
.dept-popup .popup-footer button.data-v-98282eb3 {
margin: 0;
}
.dept-tree-body.data-v-98282eb3 {
height: 500rpx;
overflow: hidden;
}
.dept-tree-body.data-v-98282eb3 .checkbox-custom.checked,
.dept-tree-body.data-v-98282eb3 .checkbox-custom.indeterminate {
background-color: #2667E9;
border-color: #2667E9;
}
.executor-popup.data-v-98282eb3 {
width: 600rpx;
background: #fff;

View File

@@ -1,6 +1,17 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
const utils_hazardNav = require("../../utils/hazardNav.js");
const utils_userInfo = require("../../utils/userInfo.js");
if (!Array) {
const _easycom_u_loadmore2 = common_vendor.resolveComponent("u-loadmore");
_easycom_u_loadmore2();
}
const _easycom_u_loadmore = () => "../../uni_modules/uview-plus/components/u-loadmore/u-loadmore.js";
if (!Math) {
_easycom_u_loadmore();
}
const HAZARD_PAGE_SIZE = 10;
const _sfc_main = {
__name: "Inspection",
setup(__props) {
@@ -8,21 +19,16 @@ const _sfc_main = {
const checkPointId = common_vendor.ref("");
const oneTableId = common_vendor.ref("");
const userRole = common_vendor.ref("");
const canAcceptance = common_vendor.computed(() => {
return userRole.value === "admin" || userRole.value === "manage";
});
const getUserRole = () => {
try {
const userInfoStr = common_vendor.index.getStorageSync("userInfo");
if (userInfoStr) {
const userInfo = JSON.parse(userInfoStr);
userRole.value = userInfo.role || "";
userRole.value = utils_userInfo.resolveUserRoleKey(JSON.parse(userInfoStr));
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:86", "获取用户信息失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:104", "获取用户信息失败:", error);
}
};
getUserRole();
const fetchTaskInfo = async (oneTableId2) => {
try {
const startRes = await request_api.enterCheckPlan(oneTableId2);
@@ -35,37 +41,114 @@ const _sfc_main = {
}
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:103", "获取任务信息失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:120", "获取任务信息失败:", error);
}
};
common_vendor.onLoad((options) => {
getUserRole();
if (options.id) {
oneTableId.value = options.id;
fetchTaskInfo(options.id);
}
});
const hiddenDangerList = common_vendor.ref([]);
const pageNum = common_vendor.ref(1);
const listLoading = common_vendor.ref(false);
const loadStatus = common_vendor.ref("loadmore");
const statusTabs = common_vendor.ref([
{ label: "全部", value: null },
{ label: "待交办", value: 1 },
{ label: "待整改", value: 2 },
{ label: "待验收", value: 3 },
{ label: "待销号", value: 4 },
{ label: "已完成", value: 5 }
]);
const activeTab = common_vendor.ref(0);
const buildListParams = () => {
const params = {
pageNum: pageNum.value,
pageSize: HAZARD_PAGE_SIZE
};
const currentTab = statusTabs.value[activeTab.value];
if ((currentTab == null ? void 0 : currentTab.value) != null) {
params.status = currentTab.value;
}
return params;
};
const resetHiddenDangerList = () => {
pageNum.value = 1;
hiddenDangerList.value = [];
loadStatus.value = "loadmore";
};
const switchStatusTab = (index) => {
if (activeTab.value === index)
return;
activeTab.value = index;
resetHiddenDangerList();
fetchHiddenDangerList();
};
const fetchHiddenDangerList = async () => {
var _a, _b;
if (listLoading.value)
return;
if (pageNum.value > 1 && loadStatus.value === "nomore")
return;
listLoading.value = true;
if (pageNum.value > 1) {
loadStatus.value = "loading";
}
try {
const res = await request_api.getMyHiddenDangerList();
const res = await request_api.getMyHiddenDangerList(buildListParams());
if (res.code === 0) {
hiddenDangerList.value = res.data.records;
const records = ((_a = res.data) == null ? void 0 : _a.records) || [];
const total = Number(((_b = res.data) == null ? void 0 : _b.total) ?? 0);
if (pageNum.value === 1) {
hiddenDangerList.value = records;
} else {
hiddenDangerList.value = [...hiddenDangerList.value, ...records];
}
if (hiddenDangerList.value.length >= total || records.length < HAZARD_PAGE_SIZE) {
loadStatus.value = "nomore";
} else {
loadStatus.value = "loadmore";
}
} else {
if (pageNum.value === 1) {
hiddenDangerList.value = [];
}
loadStatus.value = "nomore";
common_vendor.index.showToast({
title: res.msg || "获取隐患列表失败",
icon: "none"
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:127", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/Inspection.vue:207", error);
if (pageNum.value > 1) {
pageNum.value--;
}
loadStatus.value = "loadmore";
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
});
} finally {
listLoading.value = false;
}
};
common_vendor.onShow(() => {
const loadMoreHiddenDangerList = () => {
if (loadStatus.value !== "loadmore" || listLoading.value)
return;
pageNum.value++;
fetchHiddenDangerList();
};
common_vendor.onShow(() => {
getUserRole();
resetHiddenDangerList();
fetchHiddenDangerList();
});
common_vendor.onReachBottom(() => {
loadMoreHiddenDangerList();
});
const goToAdd = () => {
let url = "/pages/hiddendanger/add";
@@ -86,53 +169,27 @@ const _sfc_main = {
};
const details = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/detail2?hazardId=${item.hazardId}&assignId=${item.assignId || ""}`
url: `/pages/hiddendanger/process-chain?hazardId=${item.hazardId}`
});
};
const Rectification = (item) => {
let url = `/pages/hiddendanger/rectification?hazardId=${item.hazardId}&assignId=${item.assignId}`;
if (item.deadline) {
url += `&deadline=${encodeURIComponent(item.deadline)}`;
}
if (item.assigneeId) {
url += `&assigneeId=${item.assigneeId}`;
}
if (item.assigneeName) {
url += `&assigneeName=${encodeURIComponent(item.assigneeName)}`;
}
common_vendor.index.navigateTo({ url });
common_vendor.index.navigateTo({ url: utils_hazardNav.buildRectificationUrl(item) });
};
const editRectification = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/rectification?rectifyId=${item.rectifyId}&isEdit=1`
});
common_vendor.index.navigateTo({ url: utils_hazardNav.buildEditRectificationUrl(item) });
};
const acceptance = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/acceptance?hazardId=${item.hazardId}&assignId=${item.assignId}&rectifyId=${item.rectifyId}`
});
common_vendor.index.navigateTo({ url: utils_hazardNav.buildAcceptanceUrl(item) });
};
const assignHazard = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/assignment?hazardId=${item.hazardId}&assignId=${item.assignId}`
});
common_vendor.index.navigateTo({ url: utils_hazardNav.buildAssignmentUrl(item) });
};
const goWriteoffApply = (item) => {
common_vendor.index.navigateTo({ url: utils_hazardNav.buildWriteoffApplyUrl(item) });
};
const goWriteoffApproval = (item) => {
common_vendor.index.navigateTo({ url: utils_hazardNav.buildWriteoffApprovalUrl(item) });
};
const statusTabs = common_vendor.ref([
{ label: "全部", value: null },
{ label: "待交办", value: 1 },
{ label: "待整改", value: 2 },
{ label: "待验收", value: 3 },
{ label: "待销号", value: 4 },
{ label: "已完成", value: 5 }
]);
const activeTab = common_vendor.ref(0);
const filteredList = common_vendor.computed(() => {
const currentTab = statusTabs.value[activeTab.value];
if (!currentTab || currentTab.value === null) {
return hiddenDangerList.value;
}
return hiddenDangerList.value.filter((item) => item.status === currentTab.value);
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.f(statusTabs.value, (tab, index, i0) => {
@@ -142,12 +199,12 @@ const _sfc_main = {
}, activeTab.value === index ? {} : {}, {
c: index,
d: activeTab.value === index ? 1 : "",
e: common_vendor.o(($event) => activeTab.value = index, index)
e: common_vendor.o(($event) => switchStatusTab(index), index)
});
}),
b: filteredList.value.length === 0
}, filteredList.value.length === 0 ? {} : {}, {
c: common_vendor.f(filteredList.value, (item, k0, i0) => {
b: hiddenDangerList.value.length === 0 && !listLoading.value
}, hiddenDangerList.value.length === 0 && !listLoading.value ? {} : {}, {
c: common_vendor.f(hiddenDangerList.value, (item, k0, i0) => {
return common_vendor.e({
a: common_vendor.t(item.title),
b: common_vendor.t(item.statusName),
@@ -170,19 +227,33 @@ const _sfc_main = {
}, item.statusName === "待验收" && item.canEdit ? {
o: common_vendor.o(($event) => editRectification(item), item.hazardId)
} : {}, {
p: item.statusName === "待验收" && canAcceptance.value
}, item.statusName === "待验收" && canAcceptance.value ? {
p: common_vendor.unref(utils_hazardNav.canShowAcceptanceButton)(item, userRole.value)
}, common_vendor.unref(utils_hazardNav.canShowAcceptanceButton)(item, userRole.value) ? {
q: common_vendor.o(($event) => acceptance(item), item.hazardId)
} : {}, {
r: item.statusName === "待交办"
}, item.statusName === "待交办" ? {
s: common_vendor.o(($event) => assignHazard(item), item.hazardId)
} : {}, {
t: item.hazardId
t: common_vendor.unref(utils_hazardNav.canShowWriteoffApplyButton)(item)
}, common_vendor.unref(utils_hazardNav.canShowWriteoffApplyButton)(item) ? {
v: common_vendor.o(($event) => goWriteoffApply(item), item.hazardId)
} : {}, {
w: common_vendor.unref(utils_hazardNav.canShowWriteoffApprovalButton)(item, userRole.value)
}, common_vendor.unref(utils_hazardNav.canShowWriteoffApprovalButton)(item, userRole.value) ? {
x: common_vendor.o(($event) => goWriteoffApproval(item), item.hazardId)
} : {}, {
y: item.hazardId
});
}),
d: common_vendor.o(goToAdd),
e: common_vendor.gei(_ctx, "")
d: hiddenDangerList.value.length > 0
}, hiddenDangerList.value.length > 0 ? {
e: common_vendor.p({
status: loadStatus.value
})
} : {}, {
f: common_vendor.o(goToAdd),
g: common_vendor.gei(_ctx, "")
});
};
}

View File

@@ -1,4 +1,6 @@
{
"navigationBarTitleText": "隐患排查",
"usingComponents": {}
"usingComponents": {
"u-loadmore": "../../uni_modules/uview-plus/components/u-loadmore/u-loadmore"
}
}

View File

@@ -1 +1 @@
<view class="{{['page', 'padding', 'data-v-b44c631d', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{e}}"><scroll-view class="status-tabs data-v-b44c631d" scroll-x show-scrollbar="{{false}}"><view class="status-tabs-inner data-v-b44c631d"><view wx:for="{{a}}" wx:for-item="tab" wx:key="c" class="{{['status-tab-item', 'data-v-b44c631d', tab.d && 'status-tab-active']}}" bindtap="{{tab.e}}"><text class="status-tab-text data-v-b44c631d">{{tab.a}}</text><view wx:if="{{tab.b}}" class="status-tab-bar data-v-b44c631d"></view></view></view></scroll-view><view wx:if="{{b}}" class="empty-tip text-gray text-center padding data-v-b44c631d">暂无数据</view><view wx:for="{{c}}" wx:for-item="item" wx:key="t" class="padding radius bg-white list-list margin-bottom data-v-b44c631d"><view class="flex justify-between margin-bottom data-v-b44c631d"><view class="text-bold text-black data-v-b44c631d" style="word-break:break-all;flex:1">{{item.a}}</view><view class="text-blue data-v-b44c631d" style="white-space:nowrap;flex-shrink:0;margin-left:16rpx">{{item.b}}</view></view><view class="flex margin-bottom data-v-b44c631d"><view class="text-gray data-v-b44c631d">隐患等级:</view><view class="{{['level-tag', 'data-v-b44c631d', item.d && 'level-minor', item.e && 'level-normal', item.f && 'level-major']}}">{{item.c}}</view></view><view class="flex margin-bottom data-v-b44c631d"><view class="text-gray data-v-b44c631d" style="white-space:nowrap">隐患位置:</view><view class="text-black data-v-b44c631d">{{item.g}}</view></view><view class="flex margin-bottom data-v-b44c631d"><view class="text-gray data-v-b44c631d">创建时间:</view><view class="text-black data-v-b44c631d">{{item.h}}</view></view><view class="flex justify-end card-actions data-v-b44c631d" style="gap:10rpx"><button class="round cu-btn light bg-blue data-v-b44c631d" bindtap="{{item.i}}">查看详情</button><button wx:if="{{item.j}}" class="round cu-btn light bg-blue data-v-b44c631d" bindtap="{{item.k}}">隐患交办</button><button wx:if="{{item.l}}" class="round cu-btn bg-blue data-v-b44c631d" bindtap="{{item.m}}">立即整改</button><button wx:if="{{item.n}}" class="round cu-btn light bg-blue data-v-b44c631d" bindtap="{{item.o}}">编辑整改信息</button><button wx:if="{{item.p}}" class="round cu-btn bg-blue data-v-b44c631d" bindtap="{{item.q}}">立即验收</button><button wx:if="{{item.r}}" class="round cu-btn bg-blue data-v-b44c631d" bindtap="{{item.s}}">隐患交办</button></view></view><view class="fixed-add-btn data-v-b44c631d" bindtap="{{d}}"><text class="cuIcon-add data-v-b44c631d"></text><text class="data-v-b44c631d">新增</text></view></view>
<view class="{{['page', 'padding', 'data-v-b44c631d', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{g}}"><scroll-view class="status-tabs data-v-b44c631d" scroll-x show-scrollbar="{{false}}"><view class="status-tabs-inner data-v-b44c631d"><view wx:for="{{a}}" wx:for-item="tab" wx:key="c" class="{{['status-tab-item', 'data-v-b44c631d', tab.d && 'status-tab-active']}}" bindtap="{{tab.e}}"><text class="status-tab-text data-v-b44c631d">{{tab.a}}</text><view wx:if="{{tab.b}}" class="status-tab-bar data-v-b44c631d"></view></view></view></scroll-view><view wx:if="{{b}}" class="empty-tip text-gray text-center padding data-v-b44c631d">暂无数据</view><view wx:for="{{c}}" wx:for-item="item" wx:key="y" class="padding radius bg-white list-list margin-bottom data-v-b44c631d"><view class="flex justify-between margin-bottom data-v-b44c631d"><view class="text-bold text-black data-v-b44c631d" style="word-break:break-all;flex:1">{{item.a}}</view><view class="text-blue data-v-b44c631d" style="white-space:nowrap;flex-shrink:0;margin-left:16rpx">{{item.b}}</view></view><view class="flex margin-bottom data-v-b44c631d"><view class="text-gray data-v-b44c631d">隐患等级:</view><view class="{{['level-tag', 'data-v-b44c631d', item.d && 'level-minor', item.e && 'level-normal', item.f && 'level-major']}}">{{item.c}}</view></view><view class="flex margin-bottom data-v-b44c631d"><view class="text-gray data-v-b44c631d" style="white-space:nowrap">隐患位置:</view><view class="text-black data-v-b44c631d">{{item.g}}</view></view><view class="flex margin-bottom data-v-b44c631d"><view class="text-gray data-v-b44c631d">创建时间:</view><view class="text-black data-v-b44c631d">{{item.h}}</view></view><view class="flex justify-end card-actions data-v-b44c631d" style="gap:10rpx"><button class="round cu-btn light bg-blue data-v-b44c631d" bindtap="{{item.i}}">查看详情</button><button wx:if="{{item.j}}" class="round cu-btn light bg-blue data-v-b44c631d" bindtap="{{item.k}}">隐患交办</button><button wx:if="{{item.l}}" class="round cu-btn bg-blue data-v-b44c631d" bindtap="{{item.m}}">立即整改</button><button wx:if="{{item.n}}" class="round cu-btn light bg-blue data-v-b44c631d" bindtap="{{item.o}}">编辑整改信息</button><button wx:if="{{item.p}}" class="round cu-btn bg-blue data-v-b44c631d" bindtap="{{item.q}}">立即验收</button><button wx:if="{{item.r}}" class="round cu-btn bg-blue data-v-b44c631d" bindtap="{{item.s}}">隐患交办</button><button wx:if="{{item.t}}" class="round cu-btn bg-blue data-v-b44c631d" bindtap="{{item.v}}">销号申请</button><button wx:if="{{item.w}}" class="round cu-btn bg-blue data-v-b44c631d" bindtap="{{item.x}}">销号审批</button></view></view><u-loadmore wx:if="{{d}}" class="data-v-b44c631d" virtualHostClass="data-v-b44c631d" style="margin-top:20rpx;margin-bottom:140rpx" virtualHostStyle="margin-top:20rpx;margin-bottom:140rpx" u-i="b44c631d-0" bind:__l="__l" u-p="{{e}}"/><view class="fixed-add-btn data-v-b44c631d" bindtap="{{f}}"><text class="cuIcon-add data-v-b44c631d"></text><text class="data-v-b44c631d">新增</text></view></view>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
{
"navigationBarTitleText": "验收审批",
"usingComponents": {
"up-radio": "../../uni_modules/uview-plus/components/u-radio/u-radio",
"up-radio-group": "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group",
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
"wd-signature": "../../node-modules/wot-design-uni/components/wd-signature/wd-signature",
"flow-assignee-picker-popup": "../../components/flow/FlowAssigneePickerPopup"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,88 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page.data-v-1ff36a41 {
min-height: 100vh;
background: #EBF2FC;
}
.result-btn.data-v-1ff36a41 {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 8rpx;
background: #f5f5f5;
color: #666;
font-size: 28rpx;
}
.result-btn.data-v-1ff36a41::after {
border: none;
}
.approval-radio-group.data-v-1ff36a41 {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.static-field.data-v-1ff36a41 {
background: #fff;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 24rpx;
margin-bottom: 20rpx;
font-size: 28rpx;
color: #333;
line-height: 1.5;
}
.select-trigger.data-v-1ff36a41 {
display: flex;
align-items: center;
justify-content: space-between;
background: #fff;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 24rpx;
margin-bottom: 20rpx;
}
.select-trigger .select-content.data-v-1ff36a41 {
flex: 1;
font-size: 28rpx;
color: #333;
}
.signature-box.data-v-1ff36a41 {
width: 100%;
min-height: 240rpx;
background: #f8f8f8;
border: 1rpx dashed #dcdfe6;
border-radius: 8rpx;
margin-top: 16rpx;
}
.signature-box .signature-img.data-v-1ff36a41 {
width: 100%;
height: 100%;
}
.signature-box .signature-placeholder.data-v-1ff36a41 {
color: #909399;
font-size: 28rpx;
}

View File

@@ -8,14 +8,16 @@ const utils_upload = require("../../utils/upload.js");
if (!Array) {
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
const _easycom_wd_signature2 = common_vendor.resolveComponent("wd-signature");
(_easycom_up_textarea2 + _easycom_up_upload2 + _easycom_wd_signature2)();
(_easycom_up_textarea2 + _easycom_up_upload2 + _easycom_u_popup2 + _easycom_wd_signature2)();
}
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_upload = () => "../../uni_modules/uview-plus/components/u-upload/u-upload.js";
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
const _easycom_wd_signature = () => "../../node-modules/wot-design-uni/components/wd-signature/wd-signature.js";
if (!Math) {
(_easycom_up_textarea + _easycom_up_upload + _easycom_wd_signature)();
(_easycom_up_textarea + _easycom_up_upload + _easycom_u_popup + _easycom_wd_signature)();
}
const _sfc_main = {
__name: "acceptance",
@@ -23,6 +25,224 @@ const _sfc_main = {
const rectifyId = common_vendor.ref("");
const hazardId = common_vendor.ref("");
const assignId = common_vendor.ref("");
const taskId = common_vendor.ref("");
const nextStepName = common_vendor.ref("");
const nextStepLoading = common_vendor.ref(false);
const nextStepDisplay = common_vendor.computed(() => {
if (nextStepLoading.value)
return "加载中...";
return nextStepName.value || "暂无下一步流程";
});
const resolveTaskIdFromAssign = (assign) => {
if (!assign)
return "";
if (assign.taskId)
return String(assign.taskId);
if (assign.flowTaskId)
return String(assign.flowTaskId);
if (assign.currentTaskId)
return String(assign.currentTaskId);
return "";
};
const resolveAssignWithRectify = (assigns) => {
if (!(assigns == null ? void 0 : assigns.length))
return null;
if (rectifyId.value) {
const byRectifyId = assigns.find(
(item) => item.rectify && String(item.rectify.rectifyId) === String(rectifyId.value)
);
if (byRectifyId)
return byRectifyId;
}
if (assignId.value) {
const byAssignId = assigns.find(
(item) => String(item.assignId) === String(assignId.value) && item.rectify
);
if (byAssignId)
return byAssignId;
}
return assigns.find((item) => item.rectify) || null;
};
const resolveTaskIdFromDetail = (data) => {
if (!data)
return "";
if (data.taskId)
return String(data.taskId);
if (data.flowTaskId)
return String(data.flowTaskId);
if (data.currentTaskId)
return String(data.currentTaskId);
const assigns = data.assigns || [];
const matchedAssign = resolveAssignWithRectify(assigns);
const fromMatched = resolveTaskIdFromAssign(matchedAssign);
if (fromMatched)
return fromMatched;
for (const assign of assigns) {
const id = resolveTaskIdFromAssign(assign);
if (id)
return id;
}
return "";
};
const resolveNextTaskName = (data) => {
var _a;
if (!data)
return "";
const branches = data.branches || [];
const matchedBranch = branches.find((item) => item.matched) || branches[0];
return ((_a = matchedBranch == null ? void 0 : matchedBranch.nextNode) == null ? void 0 : _a.taskName) || "";
};
const buildPreviewVariables = () => {
if (formData.result === 2) {
return { pass: false };
}
return {
pass: true,
quickApprove: formData.quickApproveRadio === "yes"
};
};
const getStoredUserInfo = () => {
try {
const stored = common_vendor.index.getStorageSync("userInfo");
if (!stored)
return {};
return typeof stored === "string" ? JSON.parse(stored) : stored;
} catch (error) {
return {};
}
};
const getCurrentDeptId = () => {
const userInfo = getStoredUserInfo();
const identity = userInfo.userIdentity;
if ((identity == null ? void 0 : identity.deptId) != null && identity.deptId !== "") {
return String(identity.deptId);
}
if (userInfo.deptId != null && userInfo.deptId !== "") {
return String(userInfo.deptId);
}
return "";
};
const rectifierDisplayName = common_vendor.computed(() => {
var _a;
return ((_a = rectifyData.rectifierName) == null ? void 0 : _a.trim()) || "暂无";
});
const selectedAssigneeIdentityId = common_vendor.ref("");
const selectedAssigneeName = common_vendor.ref("");
const pickerAssigneeIdentityId = common_vendor.ref("");
const pickerAssigneeName = common_vendor.ref("");
const showAssigneePopup = common_vendor.ref(false);
const assigneeList = common_vendor.ref([]);
const assigneeLoading = common_vendor.ref(false);
const resolveAssigneeIdentityId = (user) => {
if (!user)
return "";
const id = user.identityId ?? user.userIdentityId ?? user.userId ?? "";
return id === "" || id == null ? "" : String(id);
};
const getAssigneeItemKey = (user) => {
const identityId = resolveAssigneeIdentityId(user);
if (identityId)
return `identity-${identityId}`;
return `user-${user.userId || user.nickName || ""}`;
};
const formatAssigneeDisplayName = (user) => {
if (!user)
return "";
const name = user.nickName || user.userName || user.name || "";
const identityName = user.identityName || "";
if (name && identityName)
return `${name}${identityName}`;
return name || identityName || "未知人员";
};
const resolveAssigneeDeptUserType = () => formData.quickApproveRadio === "yes" ? 2 : 3;
const fetchAssigneeList = async () => {
const deptId = getCurrentDeptId();
if (!deptId) {
assigneeList.value = [];
return;
}
assigneeLoading.value = true;
try {
const res = await request_api.getDeptUsers(deptId, { type: resolveAssigneeDeptUserType() });
if (res.code === 0) {
assigneeList.value = res.data || [];
} else {
assigneeList.value = [];
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:352", "获取部门人员失败:", error);
assigneeList.value = [];
} finally {
assigneeLoading.value = false;
}
};
const openAssigneePopup = async () => {
pickerAssigneeIdentityId.value = selectedAssigneeIdentityId.value;
pickerAssigneeName.value = selectedAssigneeName.value;
showAssigneePopup.value = true;
await fetchAssigneeList();
};
const onAssigneeItemClick = (user) => {
const identityId = resolveAssigneeIdentityId(user);
if (!identityId)
return;
pickerAssigneeIdentityId.value = String(identityId);
pickerAssigneeName.value = formatAssigneeDisplayName(user);
};
const confirmAssigneeSelect = () => {
if (!pickerAssigneeIdentityId.value) {
common_vendor.index.showToast({ title: "请选择下一步处理人", icon: "none" });
return;
}
selectedAssigneeIdentityId.value = pickerAssigneeIdentityId.value;
selectedAssigneeName.value = pickerAssigneeName.value;
showAssigneePopup.value = false;
};
const cancelAssigneeSelect = () => {
showAssigneePopup.value = false;
};
const onResultChange = (result) => {
formData.result = result;
if (result === 2) {
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
} else if (!formData.quickApproveRadio) {
formData.quickApproveRadio = "yes";
}
fetchNextStep();
};
const onQuickApproveChange = (value) => {
formData.quickApproveRadio = value;
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
fetchNextStep();
};
const fetchNextStep = async () => {
nextStepLoading.value = true;
try {
const currentTaskId = taskId.value;
if (!currentTaskId) {
nextStepName.value = "";
return;
}
const res = await request_api.getFlowNextNodes({
taskId: currentTaskId,
previewVariables: buildPreviewVariables(),
includeSubProcess: true
});
if (res.code === 0) {
const payload = res.data && typeof res.data === "object" ? res.data : res;
nextStepName.value = resolveNextTaskName(payload);
} else {
nextStepName.value = "";
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:425", "获取下一步流程失败:", error);
nextStepName.value = "";
} finally {
nextStepLoading.value = false;
}
};
const rectifyData = common_vendor.reactive({
rectifyPlan: "",
rectificationMeasures: "",
@@ -32,6 +252,7 @@ const _sfc_main = {
actualCost: null,
managerNames: [],
memberNames: [],
rectifierName: "",
rectifyStatusName: ""
});
const formatPersonNames = (names) => {
@@ -60,8 +281,10 @@ const _sfc_main = {
const formData = common_vendor.reactive({
result: 1,
// 验收结果 1.通过 2.不通过
verifyRemark: ""
verifyRemark: "",
// 验收备注
quickApproveRadio: "yes"
// 是否快速审批 yes/no仅通过时有效
});
const fileList1 = common_vendor.ref([]);
const canvasWidth = common_vendor.ref(300);
@@ -122,8 +345,11 @@ const _sfc_main = {
getPayload: () => ({
formData: {
result: formData.result,
verifyRemark: formData.verifyRemark
verifyRemark: formData.verifyRemark,
quickApproveRadio: formData.quickApproveRadio
},
selectedAssigneeIdentityId: selectedAssigneeIdentityId.value,
selectedAssigneeName: selectedAssigneeName.value,
fileList1: fileList1.value,
signatureServerPath: signatureServerPath.value,
signatureUrl: signatureUrl.value,
@@ -137,6 +363,9 @@ const _sfc_main = {
const form = data.formData || {};
formData.result = form.result !== void 0 ? form.result : 1;
formData.verifyRemark = form.verifyRemark || "";
formData.quickApproveRadio = form.quickApproveRadio === "no" ? "no" : "yes";
selectedAssigneeIdentityId.value = data.selectedAssigneeIdentityId || "";
selectedAssigneeName.value = data.selectedAssigneeName || "";
fileList1.value = data.fileList1 || [];
signaturePaths.value = data.signaturePaths || [];
if (data.signatureServerPath || data.signatureUrl) {
@@ -154,6 +383,9 @@ const _sfc_main = {
clearForm: () => {
formData.result = 1;
formData.verifyRemark = "";
formData.quickApproveRadio = "yes";
selectedAssigneeIdentityId.value = "";
selectedAssigneeName.value = "";
fileList1.value = [];
signatureServerPath.value = "";
signatureUrl.value = "";
@@ -168,6 +400,7 @@ const _sfc_main = {
requireInitialized: true,
onAfterRestore: (data) => {
var _a;
fetchNextStep();
if (data.signatureServerPath || data.signatureUrl || data.signatureLocalPath) {
return;
}
@@ -183,6 +416,9 @@ const _sfc_main = {
bindAutoSave(() => [
formData.result,
formData.verifyRemark,
formData.quickApproveRadio,
selectedAssigneeIdentityId.value,
selectedAssigneeName.value,
fileList1.value,
signatureServerPath.value,
signatureUrl.value,
@@ -206,24 +442,23 @@ const _sfc_main = {
urls
});
};
const resolveAssignWithRectify = (assigns) => {
if (!(assigns == null ? void 0 : assigns.length))
return null;
if (rectifyId.value) {
const byRectifyId = assigns.find(
(item) => item.rectify && String(item.rectify.rectifyId) === String(rectifyId.value)
);
if (byRectifyId)
return byRectifyId;
const mapPersonListToNickNames = (people) => {
if (!Array.isArray(people) || people.length === 0)
return [];
const names = people.map((person) => person.nickName || person.userName || person.name || "").filter(Boolean);
return [...new Set(names)];
};
const resolveManagerNames = (rectify) => {
if (Array.isArray(rectify.managers) && rectify.managers.length > 0) {
return mapPersonListToNickNames(rectify.managers);
}
if (assignId.value) {
const byAssignId = assigns.find(
(item) => String(item.assignId) === String(assignId.value) && item.rectify
);
if (byAssignId)
return byAssignId;
return rectify.managerNames || [];
};
const resolveMemberNames = (rectify) => {
if (Array.isArray(rectify.members) && rectify.members.length > 0) {
return mapPersonListToNickNames(rectify.members);
}
return assigns.find((item) => item.rectify) || null;
return rectify.memberNames || [];
};
const applyRectifyData = (rectify) => {
if (!rectify)
@@ -234,11 +469,37 @@ const _sfc_main = {
rectifyData.rectifyResult = rectify.rectifyResult || "";
rectifyData.planCost = rectify.planCost ?? null;
rectifyData.actualCost = rectify.actualCost ?? null;
rectifyData.managerNames = rectify.managerNames || [];
rectifyData.memberNames = rectify.memberNames || [];
rectifyData.rectifyStatusName = rectify.rectifyStatusName || "";
rectifyData.managerNames = resolveManagerNames(rectify);
rectifyData.memberNames = resolveMemberNames(rectify);
rectifyData.rectifierName = rectify.rectifierName || "";
rectifyData.rectifyStatusName = rectify.rectifyStatusName || rectify.statusName || "";
rectifyAttachments.value = rectify.attachments || [];
};
const fetchRectifyDetail = async () => {
if (!rectifyId.value)
return;
try {
const res = await request_api.getRectifyDetail({ rectifyId: rectifyId.value });
if (res.code === 0 && res.data) {
applyRectifyData(res.data);
if (!hazardId.value && res.data.hazardId) {
hazardId.value = String(res.data.hazardId);
}
if (!assignId.value && res.data.assignId) {
assignId.value = String(res.data.assignId);
}
const resolvedTaskId = resolveTaskIdFromDetail(res.data);
if (resolvedTaskId) {
taskId.value = resolvedTaskId;
}
} else {
common_vendor.index.showToast({ title: res.msg || "获取整改详情失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:719", "获取整改详情失败:", error);
common_vendor.index.showToast({ title: "获取整改详情失败", icon: "none" });
}
};
const fetchDetail = async () => {
if (!hazardId.value)
return;
@@ -251,17 +512,43 @@ const _sfc_main = {
const assign = resolveAssignWithRectify(res.data.assigns);
if (assign == null ? void 0 : assign.rectify) {
applyRectifyData(assign.rectify);
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:423", "整改记录:", rectifyData);
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:424", "整改附件:", rectifyAttachments.value);
if (!rectifyId.value && assign.rectify.rectifyId) {
rectifyId.value = String(assign.rectify.rectifyId);
}
} else {
common_vendor.index.showToast({ title: "该隐患暂无整改记录", icon: "none" });
}
const resolvedTaskId = resolveTaskIdFromAssign(assign) || resolveTaskIdFromDetail(res.data);
if (resolvedTaskId) {
taskId.value = resolvedTaskId;
}
} else {
common_vendor.index.showToast({ title: res.msg || "获取详情失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:430", "获取隐患详情失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:751", "获取隐患详情失败:", error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
}
};
const loadPageData = async () => {
if (rectifyId.value) {
await fetchRectifyDetail();
} else if (hazardId.value) {
await fetchDetail();
}
await fetchNextStep();
};
const validateFormBeforeSubmit = () => {
if (formData.result === 1 && !formData.quickApproveRadio) {
common_vendor.index.showToast({ title: "请选择是否快速审批", icon: "none" });
return false;
}
if (formData.result === 1 && formData.quickApproveRadio === "no" && !selectedAssigneeIdentityId.value) {
common_vendor.index.showToast({ title: "请选择下一步处理人", icon: "none" });
return false;
}
return true;
};
const handleCancel = () => {
common_vendor.index.navigateBack();
};
@@ -273,6 +560,9 @@ const _sfc_main = {
});
return;
}
if (!validateFormBeforeSubmit()) {
return;
}
if (showCanvas.value) {
if (!signatureRef.value || isSignatureEmpty.value) {
common_vendor.index.showToast({
@@ -303,7 +593,7 @@ const _sfc_main = {
} catch (err) {
isSubmitting.value = false;
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:484", "签名上传失败:", err);
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:830", "签名上传失败:", err);
common_vendor.index.showToast({ title: "签名上传失败,请重试", icon: "none" });
}
}
@@ -319,7 +609,13 @@ const _sfc_main = {
// 电子签名路径
// sendMsgFlag: sendMsgFlag.value
};
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:506", "提交验收参数:", params);
if (formData.result === 1) {
params.quickApprove = formData.quickApproveRadio === "yes";
if (formData.quickApproveRadio === "no") {
params.assigneeIdentityId = selectedAssigneeIdentityId.value;
}
}
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:859", "提交验收参数:", params);
try {
const res = await request_api.acceptanceRectification(params);
common_vendor.index.hideLoading();
@@ -340,7 +636,7 @@ const _sfc_main = {
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:528", "验收失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:881", "验收失败:", error);
common_vendor.index.showToast({
title: "请求失败",
icon: "none"
@@ -420,7 +716,7 @@ const _sfc_main = {
} catch (err) {
isSubmitting.value = false;
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:637", "签名上传失败:", err);
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:990", "签名上传失败:", err);
common_vendor.index.showToast({ title: "签名上传失败,请重试", icon: "none" });
}
};
@@ -436,7 +732,7 @@ const _sfc_main = {
const sysInfo = common_vendor.index.getSystemInfoSync();
signatureWidth.value = sysInfo.windowWidth - 40;
} catch (e) {
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:656", "获取系统信息失败:", e);
common_vendor.index.__f__("error", "at pages/hiddendanger/acceptance.vue:1009", "获取系统信息失败:", e);
}
if (options.rectifyId) {
rectifyId.value = options.rectifyId;
@@ -447,8 +743,11 @@ const _sfc_main = {
if (options.assignId) {
assignId.value = options.assignId;
}
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:667", "验收页面参数:", { rectifyId: rectifyId.value, hazardId: hazardId.value, assignId: assignId.value });
fetchDetail();
if (options.taskId) {
taskId.value = options.taskId;
}
common_vendor.index.__f__("log", "at pages/hiddendanger/acceptance.vue:1023", "验收页面参数:", { rectifyId: rectifyId.value, hazardId: hazardId.value, assignId: assignId.value, taskId: taskId.value });
loadPageData();
restoreDraft();
});
return (_ctx, _cache) => {
@@ -473,9 +772,9 @@ const _sfc_main = {
})
} : {}, {
l: common_vendor.n(formData.result === 1 ? "active" : ""),
m: common_vendor.o(($event) => formData.result = 1),
m: common_vendor.o(($event) => onResultChange(1)),
n: common_vendor.n(formData.result === 2 ? "active" : ""),
o: common_vendor.o(($event) => formData.result = 2),
o: common_vendor.o(($event) => onResultChange(2)),
p: common_vendor.o(($event) => formData.verifyRemark = $event),
q: common_vendor.p({
placeholder: "请输入验收备注",
@@ -490,33 +789,74 @@ const _sfc_main = {
imageMode: "aspectFill",
maxCount: 10
}),
v: canvasWidth.value,
w: canvasHeight.value,
x: canvasWidth.value + "px",
y: canvasHeight.value + "px",
z: showCanvas.value
}, showCanvas.value ? {
A: common_vendor.o(clearSignature)
v: formData.result === 1
}, formData.result === 1 ? {} : {}, {
w: formData.result === 1
}, formData.result === 1 ? {
x: common_vendor.n(formData.quickApproveRadio === "yes" ? "active" : ""),
y: common_vendor.o(($event) => onQuickApproveChange("yes")),
z: common_vendor.n(formData.quickApproveRadio === "no" ? "active" : ""),
A: common_vendor.o(($event) => onQuickApproveChange("no"))
} : {}, {
B: canvasWidth.value,
C: canvasHeight.value,
D: canvasWidth.value + "px",
E: canvasHeight.value + "px",
F: common_vendor.t(nextStepDisplay.value),
G: formData.result === 2
}, formData.result === 2 ? {
H: common_vendor.t(rectifierDisplayName.value)
} : {
B: common_vendor.o(reSign)
I: common_vendor.t(selectedAssigneeName.value || "请选择下一步处理人"),
J: !selectedAssigneeName.value ? 1 : "",
K: common_vendor.o(openAssigneePopup)
}, {
C: !showCanvas.value
}, !showCanvas.value ? common_vendor.e({
D: signatureUrl.value
}, signatureUrl.value ? {
E: signatureUrl.value
} : {}) : {}, {
F: showCanvas.value
L: common_vendor.o(cancelAssigneeSelect),
M: assigneeLoading.value
}, assigneeLoading.value ? {} : assigneeList.value.length === 0 ? {} : {
O: common_vendor.f(assigneeList.value, (user, k0, i0) => {
return common_vendor.e({
a: common_vendor.t(formatAssigneeDisplayName(user)),
b: String(pickerAssigneeIdentityId.value) === String(resolveAssigneeIdentityId(user))
}, String(pickerAssigneeIdentityId.value) === String(resolveAssigneeIdentityId(user)) ? {} : {}, {
c: getAssigneeItemKey(user),
d: String(pickerAssigneeIdentityId.value) === String(resolveAssigneeIdentityId(user)) ? 1 : "",
e: common_vendor.o(($event) => onAssigneeItemClick(user), getAssigneeItemKey(user))
});
})
}, {
N: assigneeList.value.length === 0,
P: common_vendor.o(cancelAssigneeSelect),
Q: common_vendor.o(confirmAssigneeSelect),
R: common_vendor.o(cancelAssigneeSelect),
S: common_vendor.p({
show: showAssigneePopup.value,
mode: "bottom",
round: "20"
}),
T: showCanvas.value
}, showCanvas.value ? {
G: common_vendor.sr(signatureRef, "39f9b795-2", {
U: common_vendor.o(clearSignature)
} : {
V: common_vendor.o(reSign)
}, {
W: !showCanvas.value
}, !showCanvas.value ? common_vendor.e({
X: signatureUrl.value
}, signatureUrl.value ? {
Y: signatureUrl.value
} : {}) : {}, {
Z: showCanvas.value && !showAssigneePopup.value
}, showCanvas.value && !showAssigneePopup.value ? {
aa: common_vendor.sr(signatureRef, "39f9b795-3", {
"k": "signatureRef"
}),
H: common_vendor.o((res) => onSignatureConfirm(res.tempFilePath)),
I: common_vendor.o(onSignatureStart),
J: common_vendor.o(onSignatureSigning),
K: common_vendor.o(onSignatureEnd),
L: common_vendor.o(onSignatureClear),
M: common_vendor.p({
ab: common_vendor.o((res) => onSignatureConfirm(res.tempFilePath)),
ac: common_vendor.o(onSignatureStart),
ad: common_vendor.o(onSignatureSigning),
ae: common_vendor.o(onSignatureEnd),
af: common_vendor.o(onSignatureClear),
ag: common_vendor.p({
width: signatureWidth.value,
height: 160,
backgroundColor: "#f8f8f8",
@@ -525,9 +865,9 @@ const _sfc_main = {
enableHistory: false
})
} : {}, {
N: common_vendor.o(handleCancel),
O: common_vendor.o(handleSubmit),
P: common_vendor.gei(_ctx, "")
ah: common_vendor.o(handleCancel),
ai: common_vendor.o(handleSubmit),
aj: common_vendor.gei(_ctx, "")
});
};
}

View File

@@ -3,6 +3,7 @@
"usingComponents": {
"up-textarea": "../../uni_modules/uview-plus/components/u-textarea/u-textarea",
"up-upload": "../../uni_modules/uview-plus/components/u-upload/u-upload",
"u-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup",
"wd-signature": "../../node-modules/wot-design-uni/components/wd-signature/wd-signature"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -54,6 +54,98 @@
color: #333;
line-height: 1.5;
}
.select-trigger.data-v-39f9b795 {
display: flex;
align-items: center;
justify-content: space-between;
background: #fff;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 24rpx;
margin-bottom: 20rpx;
}
.select-trigger .select-content.data-v-39f9b795 {
flex: 1;
font-size: 28rpx;
color: #333;
}
.user-popup.data-v-39f9b795 {
background: #fff;
}
.user-popup .popup-header.data-v-39f9b795 {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.user-popup .popup-header .popup-title.data-v-39f9b795 {
font-size: 32rpx;
color: #333;
}
.user-popup .popup-header .popup-close.data-v-39f9b795 {
font-size: 40rpx;
color: #999;
line-height: 1;
}
.user-popup .user-list-scroll.data-v-39f9b795 {
max-height: 600rpx;
padding: 0 30rpx;
box-sizing: border-box;
}
.user-popup .empty-tip.data-v-39f9b795 {
padding: 80rpx 20rpx;
text-align: center;
color: #909399;
font-size: 26rpx;
}
.user-popup .user-item.data-v-39f9b795 {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 0;
border-bottom: 1rpx solid #f5f5f5;
}
.user-popup .user-item.data-v-39f9b795:last-child {
border-bottom: none;
}
.user-popup .user-item.active .user-item-text.data-v-39f9b795 {
color: #2667E9;
font-weight: 600;
}
.user-popup .user-item .user-item-text.data-v-39f9b795 {
flex: 1;
font-size: 28rpx;
color: #333;
}
.user-popup .popup-footer.data-v-39f9b795 {
display: flex;
gap: 24rpx;
padding: 24rpx 30rpx;
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
background: #fff;
}
.user-popup .popup-footer button.data-v-39f9b795 {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
font-size: 30rpx;
margin: 0;
padding: 0;
}
.user-popup .popup-footer button.data-v-39f9b795::after {
border: none;
}
.user-popup .popup-footer .btn-cancel.data-v-39f9b795 {
background: #fff;
color: #2667E9;
border: 2rpx solid #2667E9;
}
.user-popup .popup-footer .btn-confirm.data-v-39f9b795 {
color: #fff;
border: none;
}
.signature-box.data-v-39f9b795 {
width: 100%;
min-height: 240rpx;

View File

@@ -17,18 +17,34 @@ const _easycom_up_radio_group = () => "../../uni_modules/uview-plus/components/u
if (!Math) {
(_easycom_u_popup + _easycom_up_datetime_picker + _easycom_up_radio + _easycom_up_radio_group)();
}
const nextStepDisplay = "隐患整改";
const _sfc_main = {
__name: "assignment",
setup(__props) {
const hazardId = common_vendor.ref("");
const assignId = common_vendor.ref("");
const taskId = common_vendor.ref("");
const showUserPopup = common_vendor.ref(false);
const selectedUser = common_vendor.ref("");
const selectedIdentityId = common_vendor.ref("");
const selectedUserId = common_vendor.ref("");
const deptList = common_vendor.ref([]);
const activeDeptIndex = common_vendor.ref(0);
const userPickerSelectedId = common_vendor.ref("");
const userPickerSelectedIdentityId = common_vendor.ref("");
const findUserByIdentityId = (identityId) => {
if (!identityId)
return null;
for (const dept of deptList.value) {
const user = (dept.users || []).find((u) => String(u.identityId) === String(identityId));
if (user)
return user;
}
return null;
};
const formatUserDisplayName = (user) => {
if (user.identityName) {
return `${user.nickName}_${user.identityName}`;
}
if (user.postName) {
return `${user.nickName}_${user.postName}`;
}
@@ -39,43 +55,54 @@ const _sfc_main = {
return (dept == null ? void 0 : dept.users) || [];
});
const userPickerSelectedText = common_vendor.computed(() => {
if (!userPickerSelectedId.value)
return "";
for (const dept of deptList.value) {
const user = (dept.users || []).find((u) => String(u.userId) === String(userPickerSelectedId.value));
if (user)
return formatUserDisplayName(user);
}
return "";
const user = findUserByIdentityId(userPickerSelectedIdentityId.value);
return user ? formatUserDisplayName(user) : "";
});
const deptHasSelectedUser = (dept) => {
var _a;
if (!userPickerSelectedId.value || !((_a = dept.users) == null ? void 0 : _a.length))
if (!userPickerSelectedIdentityId.value || !((_a = dept.users) == null ? void 0 : _a.length))
return false;
return dept.users.some((user) => String(user.userId) === String(userPickerSelectedId.value));
return dept.users.some((user) => String(user.identityId) === String(userPickerSelectedIdentityId.value));
};
const onUserItemClick = (userId) => {
userPickerSelectedId.value = String(userId);
const onUserItemClick = (identityId) => {
userPickerSelectedIdentityId.value = String(identityId);
};
const openUserPopup = () => {
userPickerSelectedId.value = selectedUserId.value;
const firstDeptWithUsers = deptList.value.findIndex((dept) => {
var _a;
return ((_a = dept.users) == null ? void 0 : _a.length) > 0;
});
activeDeptIndex.value = firstDeptWithUsers >= 0 ? firstDeptWithUsers : 0;
userPickerSelectedIdentityId.value = selectedIdentityId.value;
let targetDeptIndex = 0;
if (selectedIdentityId.value) {
const deptIndex = deptList.value.findIndex(
(dept) => (dept.users || []).some((user) => String(user.identityId) === String(selectedIdentityId.value))
);
if (deptIndex >= 0)
targetDeptIndex = deptIndex;
} else {
const firstDeptWithUsers = deptList.value.findIndex((dept) => {
var _a;
return ((_a = dept.users) == null ? void 0 : _a.length) > 0;
});
if (firstDeptWithUsers >= 0)
targetDeptIndex = firstDeptWithUsers;
}
activeDeptIndex.value = targetDeptIndex;
showUserPopup.value = true;
};
const cancelUserSelect = () => {
showUserPopup.value = false;
};
const confirmUserSelect = () => {
if (!userPickerSelectedId.value) {
if (!userPickerSelectedIdentityId.value) {
common_vendor.index.showToast({ title: "请选择整改责任人", icon: "none" });
return;
}
selectedUserId.value = String(userPickerSelectedId.value);
selectedUser.value = userPickerSelectedText.value;
const user = findUserByIdentityId(userPickerSelectedIdentityId.value);
if (!user) {
common_vendor.index.showToast({ title: "所选身份无效,请重新选择", icon: "none" });
return;
}
selectedIdentityId.value = String(user.identityId);
selectedUserId.value = String(user.userId);
selectedUser.value = formatUserDisplayName(user);
showUserPopup.value = false;
};
const showDatePicker = common_vendor.ref(false);
@@ -116,10 +143,10 @@ const _sfc_main = {
});
if (res.code === 0 && res.data) {
deptList.value = res.data;
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:230", "部门人员树:", deptList.value);
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:257", "部门人员树:", deptList.value);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/assignment.vue:233", "获取部门人员失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/assignment.vue:260", "获取部门人员失败:", error);
}
};
const onDateConfirm = (e) => {
@@ -134,7 +161,7 @@ const _sfc_main = {
common_vendor.index.navigateBack();
};
const handleSubmit = async () => {
if (!selectedUserId.value) {
if (!selectedIdentityId.value) {
common_vendor.index.showToast({ title: "请选择整改人员", icon: "none" });
return;
}
@@ -142,11 +169,19 @@ const _sfc_main = {
common_vendor.index.showToast({ title: "请选择整改期限", icon: "none" });
return;
}
if (!taskId.value) {
common_vendor.index.showToast({ title: "缺少任务ID", icon: "none" });
return;
}
const params = {
hazardId: Number(hazardId.value),
// 隐患ID
taskId: taskId.value,
// 流程任务ID列表传入
assigneeId: Number(selectedUserId.value),
// 被指派人ID
// 被指派人用户ID
assigneeIdentityId: Number(selectedIdentityId.value),
// 被指派人身份ID
deadline: selectedDate.value,
// 处理期限
assignRemark: "",
@@ -154,7 +189,7 @@ const _sfc_main = {
sendMsgFlag: sendMsgFlag.value
// 是否短信提醒
};
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:272", "提交数据:", params);
common_vendor.index.__f__("log", "at pages/hiddendanger/assignment.vue:305", "提交数据:", params);
try {
const res = await request_api.assignHiddenDanger(params);
if (res.code === 0) {
@@ -167,7 +202,7 @@ const _sfc_main = {
common_vendor.index.showToast({ title: res.msg || "交办失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/assignment.vue:286", "交办失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/assignment.vue:319", "交办失败:", error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
}
};
@@ -176,6 +211,8 @@ const _sfc_main = {
hazardId.value = options.hazardId;
if (options.assignId)
assignId.value = options.assignId;
if (options.taskId)
taskId.value = options.taskId;
fetchDeptUsers();
restoreDraft();
});
@@ -185,15 +222,16 @@ const _sfc_main = {
}, common_vendor.unref(showRestoreBanner) ? {
b: common_vendor.o(($event) => common_vendor.unref(clearDraft)(true))
} : {}, {
c: common_vendor.t(selectedUser.value || "请选择整改责任人"),
d: !selectedUser.value ? 1 : "",
e: common_vendor.o(openUserPopup),
f: common_vendor.o(cancelUserSelect),
g: userPickerSelectedId.value
}, userPickerSelectedId.value ? {
h: common_vendor.t(userPickerSelectedText.value)
c: common_vendor.t(nextStepDisplay),
d: common_vendor.t(selectedUser.value || "请选择整改责任人"),
e: !selectedUser.value ? 1 : "",
f: common_vendor.o(openUserPopup),
g: common_vendor.o(cancelUserSelect),
h: userPickerSelectedIdentityId.value
}, userPickerSelectedIdentityId.value ? {
i: common_vendor.t(userPickerSelectedText.value)
} : {}, {
i: common_vendor.f(deptList.value, (dept, index, i0) => {
j: common_vendor.f(deptList.value, (dept, index, i0) => {
return common_vendor.e({
a: common_vendor.t(dept.deptName),
b: deptHasSelectedUser(dept)
@@ -205,60 +243,60 @@ const _sfc_main = {
e: common_vendor.o(($event) => activeDeptIndex.value = index, dept.deptId)
});
}),
j: currentDeptUsers.value.length === 0
k: currentDeptUsers.value.length === 0
}, currentDeptUsers.value.length === 0 ? {} : {
k: common_vendor.f(currentDeptUsers.value, (user, k0, i0) => {
l: common_vendor.f(currentDeptUsers.value, (user, k0, i0) => {
return common_vendor.e({
a: common_vendor.t(formatUserDisplayName(user)),
b: String(userPickerSelectedId.value) === String(user.userId)
}, String(userPickerSelectedId.value) === String(user.userId) ? {} : {}, {
c: "user-" + user.userId,
d: String(userPickerSelectedId.value) === String(user.userId) ? 1 : "",
e: common_vendor.o(($event) => onUserItemClick(user.userId), "user-" + user.userId)
b: String(userPickerSelectedIdentityId.value) === String(user.identityId)
}, String(userPickerSelectedIdentityId.value) === String(user.identityId) ? {} : {}, {
c: "identity-" + user.identityId,
d: String(userPickerSelectedIdentityId.value) === String(user.identityId) ? 1 : "",
e: common_vendor.o(($event) => onUserItemClick(user.identityId), "identity-" + user.identityId)
});
})
}, {
l: "dept-users-" + activeDeptIndex.value,
m: common_vendor.o(cancelUserSelect),
n: common_vendor.o(confirmUserSelect),
o: common_vendor.o(cancelUserSelect),
p: common_vendor.p({
m: "dept-users-" + activeDeptIndex.value,
n: common_vendor.o(cancelUserSelect),
o: common_vendor.o(confirmUserSelect),
p: common_vendor.o(cancelUserSelect),
q: common_vendor.p({
show: showUserPopup.value,
mode: "bottom",
round: "20"
}),
q: common_vendor.t(selectedDate.value || "请选择整改期限"),
r: common_vendor.n(selectedDate.value ? "" : "text-gray"),
s: common_vendor.o(($event) => showDatePicker.value = true),
t: common_vendor.o(onDateConfirm),
v: common_vendor.o(($event) => showDatePicker.value = false),
r: common_vendor.t(selectedDate.value || "请选择整改期限"),
s: common_vendor.n(selectedDate.value ? "" : "text-gray"),
t: common_vendor.o(($event) => showDatePicker.value = true),
v: common_vendor.o(onDateConfirm),
w: common_vendor.o(($event) => showDatePicker.value = false),
x: common_vendor.o(($event) => dateValue.value = $event),
y: common_vendor.p({
x: common_vendor.o(($event) => showDatePicker.value = false),
y: common_vendor.o(($event) => dateValue.value = $event),
z: common_vendor.p({
show: showDatePicker.value,
mode: "date",
modelValue: dateValue.value
}),
z: common_vendor.p({
A: common_vendor.p({
label: "是",
name: "yes",
customStyle: {
marginRight: "48rpx"
}
}),
A: common_vendor.p({
B: common_vendor.p({
label: "否",
name: "no"
}),
B: common_vendor.o(($event) => sendMsgFlagRadio.value = $event),
C: common_vendor.p({
C: common_vendor.o(($event) => sendMsgFlagRadio.value = $event),
D: common_vendor.p({
placement: "row",
activeColor: "#2667e9",
modelValue: sendMsgFlagRadio.value
}),
D: common_vendor.o(handleCancel),
E: common_vendor.o(handleSubmit),
F: common_vendor.gei(_ctx, "")
E: common_vendor.o(handleCancel),
F: common_vendor.o(handleSubmit),
G: common_vendor.gei(_ctx, "")
});
};
}

View File

@@ -1 +1 @@
<view class="{{['padding', 'page', 'data-v-6209e844', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{F}}"><view class="padding radius bg-white data-v-6209e844"><view wx:if="{{a}}" class="bg-orange-light text-orange padding-sm radius margin-bottom flex justify-between align-center data-v-6209e844" style="font-size:24rpx;background-color:#FFF7EB;border:1rpx solid #FFE4CC;width:100%;box-sizing:border-box;display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-bottom:20rpx"><view class="flex align-center data-v-6209e844" style="display:flex;flex-direction:row;align-items:center"><text class="cuIcon-info margin-right-xs data-v-6209e844" style="margin-right:10rpx"></text><text class="data-v-6209e844">已自动恢复您上次未提交的内容</text></view><text class="text-blue text-bold data-v-6209e844" style="cursor:pointer;padding:0 10rpx;color:#2667E9;font-weight:bold" bindtap="{{b}}">清空草稿</text></view><view class="flex margin-bottom data-v-6209e844"><view class="text-gray data-v-6209e844">下一步流程</view><view class="text-red data-v-6209e844">*</view></view><view class="static-field data-v-6209e844">隐患整改</view><view class="flex margin-bottom margin-top data-v-6209e844"><view class="text-gray data-v-6209e844">整改责任人</view><view class="text-red data-v-6209e844">*</view></view><view class="select-trigger data-v-6209e844" bindtap="{{e}}"><view class="{{['select-content', 'data-v-6209e844', d && 'text-gray']}}">{{c}}</view><text class="cuIcon-unfold data-v-6209e844"></text></view><u-popup wx:if="{{p}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" u-s="{{['d']}}" bindclose="{{o}}" u-i="6209e844-0" bind:__l="__l" u-p="{{p}}"><view class="user-popup cascader-user-popup data-v-6209e844"><view class="popup-header data-v-6209e844"><view class="popup-title text-bold data-v-6209e844">选择整改责任人</view><view class="popup-close data-v-6209e844" bindtap="{{f}}">×</view></view><view wx:if="{{g}}" class="selected-summary data-v-6209e844"><text class="summary-label data-v-6209e844">已选:</text><text class="summary-text data-v-6209e844">{{h}}</text></view><view class="cascader-body data-v-6209e844"><scroll-view class="cascader-col dept-col data-v-6209e844" scroll-y><view wx:for="{{i}}" wx:for-item="dept" wx:key="c" class="{{['data-v-6209e844', 'cascader-item', dept.d]}}" bindtap="{{dept.e}}"><text class="cascader-item-text data-v-6209e844">{{dept.a}}</text><text wx:if="{{dept.b}}" class="dept-dot data-v-6209e844"></text></view></scroll-view><scroll-view class="cascader-col user-col data-v-6209e844" scroll-y key="{{l}}"><view wx:if="{{j}}" class="empty-tip data-v-6209e844">该部门暂无人员</view><view wx:else class="data-v-6209e844"><view wx:for="{{k}}" wx:for-item="user" wx:key="c" class="{{['user-item', 'data-v-6209e844', user.d && 'active']}}" bindtap="{{user.e}}"><text class="user-item-text data-v-6209e844">{{user.a}}</text><text wx:if="{{user.b}}" class="cuIcon-check text-blue data-v-6209e844"></text></view></view></scroll-view></view><view class="popup-footer data-v-6209e844"><button class="btn-cancel data-v-6209e844" bindtap="{{m}}">取消</button><button class="btn-confirm bg-blue data-v-6209e844" bindtap="{{n}}">确定</button></view></view></u-popup><view class="flex margin-bottom margin-top data-v-6209e844"><view class="text-gray data-v-6209e844">整改期限</view><view class="text-red data-v-6209e844">*</view></view><view class="picker-input data-v-6209e844" bindtap="{{s}}"><text class="{{['data-v-6209e844', r]}}">{{q}}</text></view><up-datetime-picker wx:if="{{y}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" bindconfirm="{{t}}" bindcancel="{{v}}" bindclose="{{w}}" u-i="6209e844-1" bind:__l="__l" bindupdateModelValue="{{x}}" u-p="{{y}}"></up-datetime-picker><view class="flex margin-bottom margin-top data-v-6209e844"><view class="text-gray data-v-6209e844">短信提醒</view><view class="text-red data-v-6209e844">*</view></view><up-radio-group wx:if="{{C}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" u-s="{{['d']}}" u-i="6209e844-2" bind:__l="__l" bindupdateModelValue="{{B}}" u-p="{{C}}"><up-radio wx:if="{{z}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" u-i="6209e844-3,6209e844-2" bind:__l="__l" u-p="{{z}}"></up-radio><up-radio wx:if="{{A}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" u-i="6209e844-4,6209e844-2" bind:__l="__l" u-p="{{A}}"></up-radio></up-radio-group><view class="btn-group margin-top-xl data-v-6209e844"><button class="btn-cancel data-v-6209e844" bindtap="{{D}}">取消</button><button class="btn-confirm bg-blue data-v-6209e844" bindtap="{{E}}">确认</button></view></view></view>
<view class="{{['padding', 'page', 'data-v-6209e844', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{G}}"><view class="padding radius bg-white data-v-6209e844"><view wx:if="{{a}}" class="bg-orange-light text-orange padding-sm radius margin-bottom flex justify-between align-center data-v-6209e844" style="font-size:24rpx;background-color:#FFF7EB;border:1rpx solid #FFE4CC;width:100%;box-sizing:border-box;display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-bottom:20rpx"><view class="flex align-center data-v-6209e844" style="display:flex;flex-direction:row;align-items:center"><text class="cuIcon-info margin-right-xs data-v-6209e844" style="margin-right:10rpx"></text><text class="data-v-6209e844">已自动恢复您上次未提交的内容</text></view><text class="text-blue text-bold data-v-6209e844" style="cursor:pointer;padding:0 10rpx;color:#2667E9;font-weight:bold" bindtap="{{b}}">清空草稿</text></view><view class="flex margin-bottom data-v-6209e844"><view class="text-gray data-v-6209e844">下一步流程</view><view class="text-red data-v-6209e844">*</view></view><view class="static-field data-v-6209e844">{{c}}</view><view class="flex margin-bottom margin-top data-v-6209e844"><view class="text-gray data-v-6209e844">整改责任人</view><view class="text-red data-v-6209e844">*</view></view><view class="select-trigger data-v-6209e844" bindtap="{{f}}"><view class="{{['select-content', 'data-v-6209e844', e && 'text-gray']}}">{{d}}</view><text class="cuIcon-unfold data-v-6209e844"></text></view><u-popup wx:if="{{q}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" u-s="{{['d']}}" bindclose="{{p}}" u-i="6209e844-0" bind:__l="__l" u-p="{{q}}"><view class="user-popup cascader-user-popup data-v-6209e844"><view class="popup-header data-v-6209e844"><view class="popup-title text-bold data-v-6209e844">选择整改责任人</view><view class="popup-close data-v-6209e844" bindtap="{{g}}">×</view></view><view wx:if="{{h}}" class="selected-summary data-v-6209e844"><text class="summary-label data-v-6209e844">已选:</text><text class="summary-text data-v-6209e844">{{i}}</text></view><view class="cascader-body data-v-6209e844"><scroll-view class="cascader-col dept-col data-v-6209e844" scroll-y><view wx:for="{{j}}" wx:for-item="dept" wx:key="c" class="{{['data-v-6209e844', 'cascader-item', dept.d]}}" bindtap="{{dept.e}}"><text class="cascader-item-text data-v-6209e844">{{dept.a}}</text><text wx:if="{{dept.b}}" class="dept-dot data-v-6209e844"></text></view></scroll-view><scroll-view class="cascader-col user-col data-v-6209e844" scroll-y key="{{m}}"><view wx:if="{{k}}" class="empty-tip data-v-6209e844">该部门暂无人员</view><view wx:else class="data-v-6209e844"><view wx:for="{{l}}" wx:for-item="user" wx:key="c" class="{{['user-item', 'data-v-6209e844', user.d && 'active']}}" bindtap="{{user.e}}"><text class="user-item-text data-v-6209e844">{{user.a}}</text><text wx:if="{{user.b}}" class="cuIcon-check text-blue data-v-6209e844"></text></view></view></scroll-view></view><view class="popup-footer data-v-6209e844"><button class="btn-cancel data-v-6209e844" bindtap="{{n}}">取消</button><button class="btn-confirm bg-blue data-v-6209e844" bindtap="{{o}}">确定</button></view></view></u-popup><view class="flex margin-bottom margin-top data-v-6209e844"><view class="text-gray data-v-6209e844">整改期限</view><view class="text-red data-v-6209e844">*</view></view><view class="picker-input data-v-6209e844" bindtap="{{t}}"><text class="{{['data-v-6209e844', s]}}">{{r}}</text></view><up-datetime-picker wx:if="{{z}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" bindconfirm="{{v}}" bindcancel="{{w}}" bindclose="{{x}}" u-i="6209e844-1" bind:__l="__l" bindupdateModelValue="{{y}}" u-p="{{z}}"></up-datetime-picker><view class="flex margin-bottom margin-top data-v-6209e844"><view class="text-gray data-v-6209e844">短信提醒</view><view class="text-red data-v-6209e844">*</view></view><up-radio-group wx:if="{{D}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" u-s="{{['d']}}" u-i="6209e844-2" bind:__l="__l" bindupdateModelValue="{{C}}" u-p="{{D}}"><up-radio wx:if="{{A}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" u-i="6209e844-3,6209e844-2" bind:__l="__l" u-p="{{A}}"></up-radio><up-radio wx:if="{{B}}" class="data-v-6209e844" virtualHostClass="data-v-6209e844" u-i="6209e844-4,6209e844-2" bind:__l="__l" u-p="{{B}}"></up-radio></up-radio-group><view class="btn-group margin-top-xl data-v-6209e844"><button class="btn-cancel data-v-6209e844" bindtap="{{E}}">取消</button><button class="btn-confirm bg-blue data-v-6209e844" bindtap="{{F}}">确认</button></view></view></view>

View File

@@ -0,0 +1,110 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const request_api = require("../../request/api.js");
const components_hazardDetail_processChain = require("../../components/hazardDetail/processChain.js");
if (!Array) {
const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
_easycom_u_navbar2();
}
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
if (!Math) {
(_easycom_u_navbar + HazardProcessChainPanel)();
}
const HazardProcessChainPanel = () => "../../components/hazardDetail/HazardProcessChainPanel.js";
const _sfc_main = {
__name: "process-chain",
setup(__props) {
const instance = common_vendor.getCurrentInstance();
const queryScope = (instance == null ? void 0 : instance.proxy) || instance;
const chainData = common_vendor.ref({});
const loading = common_vendor.ref(false);
const panelBodyHeight = common_vendor.ref(0);
const summary = common_vendor.computed(() => components_hazardDetail_processChain.resolveProcessChainSummary(chainData.value));
const calcPanelBodyHeight = () => {
common_vendor.nextTick$1(() => {
const query = common_vendor.index.createSelectorQuery().in(queryScope);
query.select(".panel-wrap").boundingClientRect();
query.exec((res) => {
const rect = res == null ? void 0 : res[0];
if ((rect == null ? void 0 : rect.height) > 0) {
panelBodyHeight.value = Math.floor(rect.height);
return;
}
const sys = common_vendor.index.getSystemInfoSync();
panelBodyHeight.value = Math.floor(sys.windowHeight * 0.55);
});
});
};
const loadProcessChain = async (hazardId) => {
loading.value = true;
try {
const res = await request_api.getHazardProcessChain(hazardId);
if (res.code === 0 && res.data) {
chainData.value = res.data;
} else {
chainData.value = {};
common_vendor.index.showToast({ title: res.msg || "获取流程链失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/process-chain.vue:89", "获取隐患流程链失败:", error);
chainData.value = {};
common_vendor.index.showToast({ title: "获取流程链失败", icon: "none" });
} finally {
loading.value = false;
calcPanelBodyHeight();
setTimeout(calcPanelBodyHeight, 100);
setTimeout(calcPanelBodyHeight, 400);
}
};
common_vendor.onReady(() => {
calcPanelBodyHeight();
setTimeout(calcPanelBodyHeight, 100);
setTimeout(calcPanelBodyHeight, 400);
});
common_vendor.watch(loading, (isLoading) => {
if (!isLoading) {
calcPanelBodyHeight();
setTimeout(calcPanelBodyHeight, 100);
setTimeout(calcPanelBodyHeight, 400);
}
});
common_vendor.onLoad((options) => {
if (options.hazardId) {
loadProcessChain(options.hazardId);
return;
}
common_vendor.index.showToast({ title: "缺少隐患ID", icon: "none" });
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
});
return (_ctx, _cache) => {
return {
a: common_vendor.p({
title: "查看隐患",
placeholder: true,
safeAreaInsetTop: true,
bgColor: "transparent",
titleColor: "#ffffff",
leftIconColor: "#ffffff",
autoBack: true,
border: false
}),
b: common_assets._imports_0$2,
c: common_vendor.t(summary.value.statusName),
d: common_assets._imports_1,
e: common_vendor.t(summary.value.createdAt),
f: common_vendor.p({
["chain-data"]: chainData.value,
loading: loading.value,
["body-height"]: panelBodyHeight.value
}),
g: common_vendor.gei(_ctx, "")
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-18336741"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/hiddendanger/process-chain.js.map

View File

@@ -0,0 +1,10 @@
{
"navigationBarTitleText": "隐患详情",
"navigationStyle": "custom",
"navigationBarTextStyle": "white",
"disableScroll": true,
"usingComponents": {
"u-navbar": "../../uni_modules/uview-plus/components/u-navbar/u-navbar",
"hazard-process-chain-panel": "../../components/hazardDetail/HazardProcessChainPanel"
}
}

View File

@@ -0,0 +1 @@
<view class="{{['page', 'data-v-18336741', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{g}}"><view class="top-gradient-wrap data-v-18336741"><u-navbar wx:if="{{a}}" class="data-v-18336741" virtualHostClass="data-v-18336741" u-i="18336741-0" bind:__l="__l" u-p="{{a}}"/><view class="summary-card data-v-18336741"><view class="summary-side summary-side--left data-v-18336741"><image class="summary-icon data-v-18336741" src="{{b}}" mode="aspectFit"/><view class="summary-icon-gap data-v-18336741"><view class="summary-text data-v-18336741"><view class="summary-label data-v-18336741">隐患状态</view><view class="summary-status data-v-18336741">{{c}}</view></view></view></view><view class="summary-divider data-v-18336741"></view><view class="summary-side summary-side--right data-v-18336741"><image class="summary-icon data-v-18336741" src="{{d}}" mode="aspectFit"/><view class="summary-text data-v-18336741"><view class="summary-label data-v-18336741">提交日期</view><view class="summary-date data-v-18336741">{{e}}</view></view></view></view></view><view class="panel-wrap data-v-18336741"><hazard-process-chain-panel wx:if="{{f}}" class="data-v-18336741" virtualHostClass="data-v-18336741" u-i="18336741-1" bind:__l="__l" u-p="{{f}}"/></view></view>

View File

@@ -0,0 +1,128 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page.data-v-18336741 {
height: 100vh;
overflow: hidden;
display: flex;
flex-direction: column;
box-sizing: border-box;
background: #f5f7fa;
}
.top-gradient-wrap.data-v-18336741 {
flex-shrink: 0;
background: linear-gradient(180deg, #046CEA 0%, #2158C8 28.44%, rgba(4, 107, 234, 0) 100%);
}
.summary-card.data-v-18336741 {
margin: 32rpx 30rpx 0;
padding: 28rpx 30rpx 32rpx;
background: #fff;
border-radius: 20rpx;
display: flex;
align-items: flex-start;
box-sizing: border-box;
}
.summary-side.data-v-18336741 {
display: flex;
align-items: flex-start;
}
.summary-side--left.data-v-18336741 {
flex-shrink: 0;
align-items: center;
}
.summary-side--left .summary-text.data-v-18336741 {
padding-top: 0;
padding-bottom: 0;
}
.summary-side--right.data-v-18336741 {
flex: 1;
min-width: 0;
align-items: center;
}
.summary-side--right .summary-icon.data-v-18336741 {
margin-right: 22rpx;
}
.summary-side--right .summary-text.data-v-18336741 {
flex: 1;
min-width: 0;
padding-top: 0;
padding-bottom: 0;
}
.summary-icon-gap.data-v-18336741 {
width: 149rpx;
flex-shrink: 0;
box-sizing: border-box;
}
.summary-icon.data-v-18336741 {
width: 55rpx;
height: 65rpx;
flex-shrink: 0;
}
.summary-side--left .summary-icon.data-v-18336741 {
margin-right: 22rpx;
}
.summary-text.data-v-18336741 {
flex-shrink: 0;
box-sizing: border-box;
}
.summary-label.data-v-18336741 {
font-size: 24rpx;
color: #8f9ca2;
line-height: 34rpx;
}
.summary-status.data-v-18336741 {
margin-top: 8rpx;
font-size: 28rpx;
font-weight: 400;
color: #333333;
line-height: 40rpx;
}
.summary-date.data-v-18336741 {
margin-top: 8rpx;
font-size: 28rpx;
font-weight: 400;
color: #333333;
line-height: 40rpx;
white-space: nowrap;
}
.summary-divider.data-v-18336741 {
width: 2rpx;
height: 72rpx;
flex-shrink: 0;
background: #eee;
margin-right: 40rpx;
}
.panel-wrap.data-v-18336741 {
flex: 1;
min-height: 0;
height: 0;
margin-top: 12rpx;
padding: 0 30rpx 30rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
}

View File

@@ -28,13 +28,98 @@ const _easycom_wd_signature = () => "../../node-modules/wot-design-uni/component
if (!Math) {
(_easycom_up_textarea + _easycom_up_input + _easycom_up_datetime_picker + _easycom_up_checkbox + _easycom_u_popup + _easycom_up_upload + _easycom_up_radio + _easycom_up_radio_group + _easycom_wd_signature)();
}
const EDIT_NEXT_STEP_NAME = "隐患验收";
const _sfc_main = {
__name: "rectification",
setup(__props) {
const hazardId = common_vendor.ref("");
const assignId = common_vendor.ref("");
const taskId = common_vendor.ref("");
const rectifyId = common_vendor.ref("");
const isEdit = common_vendor.ref(false);
const nextStepName = common_vendor.ref("");
const nextStepLoading = common_vendor.ref(false);
const nextStepDisplay = common_vendor.computed(() => {
if (isEdit.value)
return EDIT_NEXT_STEP_NAME;
if (nextStepLoading.value)
return "加载中...";
return nextStepName.value || "暂无下一步流程";
});
const resolveTaskIdFromDetail = (data) => {
if (!data)
return "";
if (data.taskId)
return String(data.taskId);
if (data.flowTaskId)
return String(data.flowTaskId);
if (data.currentTaskId)
return String(data.currentTaskId);
const assigns = data.assigns || [];
for (const assign of assigns) {
if (assign == null ? void 0 : assign.taskId)
return String(assign.taskId);
}
return "";
};
const resolveNextTaskName = (data) => {
var _a;
if (!data)
return "";
const branches = data.branches || [];
const matchedBranch = branches.find((item) => item.matched) || branches[0];
return ((_a = matchedBranch == null ? void 0 : matchedBranch.nextNode) == null ? void 0 : _a.taskName) || "";
};
const fetchNextStep = async () => {
nextStepLoading.value = true;
try {
let currentTaskId = taskId.value;
if (!currentTaskId && rectifyId.value) {
const rectifyRes = await request_api.getRectifyDetail({ rectifyId: rectifyId.value });
if (rectifyRes.code === 0 && rectifyRes.data) {
const rectifyData = rectifyRes.data;
currentTaskId = resolveTaskIdFromDetail(rectifyData);
if (!hazardId.value && rectifyData.hazardId) {
hazardId.value = rectifyData.hazardId;
}
if (!assignId.value && rectifyData.assignId) {
assignId.value = rectifyData.assignId;
}
if (currentTaskId) {
taskId.value = currentTaskId;
}
}
}
if (!currentTaskId && hazardId.value) {
const detailRes = await request_api.getHiddenDangerDetail({
hazardId: hazardId.value,
assignId: assignId.value
});
if (detailRes.code === 0 && detailRes.data) {
currentTaskId = resolveTaskIdFromDetail(detailRes.data);
if (currentTaskId) {
taskId.value = currentTaskId;
}
}
}
if (!currentTaskId) {
nextStepName.value = "";
return;
}
const res = await request_api.getFlowNextNodes({ taskId: currentTaskId });
if (res.code === 0) {
const payload = res.data && typeof res.data === "object" ? res.data : res;
nextStepName.value = resolveNextTaskName(payload);
} else {
nextStepName.value = "";
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:392", "获取下一步流程失败:", error);
nextStepName.value = "";
} finally {
nextStepLoading.value = false;
}
};
const canvasWidth = common_vendor.ref(300);
const canvasHeight = common_vendor.ref(300);
const showCanvas = common_vendor.ref(true);
@@ -110,7 +195,7 @@ const _sfc_main = {
scheduleSignatureDraftExport();
};
const onSignatureImageError = () => {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:418", "签名图片加载失败:", signatureUrl.value);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:502", "签名图片加载失败:", signatureUrl.value);
common_vendor.index.showToast({ title: "签名图片加载失败", icon: "none" });
};
const reSign = () => {
@@ -176,32 +261,33 @@ const _sfc_main = {
selectedDeadlineDate.value = String(deadline).trim().replace("T", " ");
}
};
const applyAssigneeFromOptions = (assigneeId, assigneeName) => {
if (!assigneeId)
const applyAssigneeFromOptions = (assigneeId, assigneeName, assigneeIdentityId) => {
if (!assigneeIdentityId)
return;
const id = String(assigneeId);
const identityId = String(assigneeIdentityId);
const name = assigneeName ? decodeURIComponent(String(assigneeName)).trim() : "";
const exists = detailPersonPool.value.some((user) => String(user.userId) === id);
const exists = detailPersonPool.value.some((user) => String(user.identityId) === identityId);
if (!exists) {
detailPersonPool.value.push({
userId: assigneeId,
userId: assigneeId || "",
identityId: assigneeIdentityId,
nickName: name,
deptName: ""
});
}
if (!lockedUserIds.value.includes(id)) {
lockedUserIds.value = [...lockedUserIds.value, id];
if (!lockedIdentityIds.value.includes(identityId)) {
lockedIdentityIds.value = [...lockedIdentityIds.value, identityId];
}
selectedUserIds.value = mergeLockedUserIds([id]);
syncSelectedUsersFromIds(selectedUserIds.value);
selectedIdentityIds.value = mergeLockedIdentityIds([identityId]);
syncSelectedMembersFromIdentityIds(selectedIdentityIds.value);
};
const setLockedDefaultUsers = (ids) => {
const setLockedDefaultIdentities = (ids) => {
const normalized = parseIdList(ids);
if (!normalized.length)
return;
lockedUserIds.value = normalized;
selectedUserIds.value = mergeLockedUserIds(selectedUserIds.value);
syncSelectedUsersFromIds(selectedUserIds.value);
lockedIdentityIds.value = normalized;
selectedIdentityIds.value = mergeLockedIdentityIds(selectedIdentityIds.value);
syncSelectedMembersFromIdentityIds(selectedIdentityIds.value);
};
const parseIdList = (raw) => {
if (raw === null || raw === void 0 || raw === "")
@@ -211,41 +297,38 @@ const _sfc_main = {
}
return String(raw).split(",").map((id) => String(id).trim()).filter(Boolean);
};
const resolveManagerIdsFromDetail = (data) => {
const ids = parseIdList(data.manageIds ?? data.managerIds);
const resolveManagerIdentityIdsFromDetail = (data) => {
const ids = parseIdList(data.managerIds ?? data.manageIds ?? data.manageIdentityIds ?? data.managerIdentityIds);
if (ids.length > 0)
return ids;
if (Array.isArray(data.managers) && data.managers.length > 0) {
return data.managers.map((item) => String(item.userId)).filter(Boolean);
return data.managers.map((item) => String(item.identityId ?? item.userId)).filter(Boolean);
}
return [];
};
const buildUserItemFromDetail = (user) => ({
id: String(user.userId),
name: formatUserDisplayName(user),
deptName: user.deptName || ""
});
const getUsersByIdsFromTree = (ids, tree) => {
const userMap = /* @__PURE__ */ new Map();
const getMembersByIdentityIdsFromTree = (ids, tree) => {
const memberMap = /* @__PURE__ */ new Map();
(tree || []).forEach((dept) => {
(dept.users || []).forEach((user) => {
userMap.set(String(user.userId), buildUserItem(user, dept));
if (user.identityId != null && user.identityId !== "") {
memberMap.set(String(user.identityId), buildMemberItem(user, dept));
}
});
});
return ids.map((id) => userMap.get(String(id))).filter(Boolean);
return ids.map((id) => memberMap.get(String(id))).filter(Boolean);
};
const mergeUsersFromDetailPool = (ids, resolvedUsers) => {
const userMap = new Map(resolvedUsers.map((user) => [user.id, user]));
const mergeMembersFromDetailPool = (ids, resolvedMembers) => {
const memberMap = new Map(resolvedMembers.map((member) => [member.id, member]));
ids.forEach((id) => {
const key = String(id);
if (userMap.has(key))
if (memberMap.has(key))
return;
const found = detailPersonPool.value.find((user) => String(user.userId) === key);
const found = detailPersonPool.value.find((user) => String(user.identityId) === key);
if (found) {
userMap.set(key, buildUserItemFromDetail(found));
memberMap.set(key, buildMemberItemFromDetail(found));
}
});
return ids.map((id) => userMap.get(String(id))).filter(Boolean);
return ids.map((id) => memberMap.get(String(id))).filter(Boolean);
};
const applyRectifyTimeValue = (timeStr) => {
const ts = parseDeadlineToTimestamp(timeStr);
@@ -269,39 +352,48 @@ const _sfc_main = {
const deptList = common_vendor.ref([]);
const detailPersonPool = common_vendor.ref([]);
const showManagerPopup = common_vendor.ref(false);
const selectedManagerIds = common_vendor.ref([]);
const selectedManagerIdentityIds = common_vendor.ref([]);
const selectedManagers = common_vendor.ref([]);
const activeManagerDeptIndex = common_vendor.ref(0);
const managerPickerSelectedIds = common_vendor.ref([]);
const managerPickerSelectedIdentityIds = common_vendor.ref([]);
const showUserPopup = common_vendor.ref(false);
const selectedUserIds = common_vendor.ref([]);
const selectedIdentityIds = common_vendor.ref([]);
const selectedUsers = common_vendor.ref([]);
const lockedUserIds = common_vendor.ref([]);
const lockedIdentityIds = common_vendor.ref([]);
const activeDeptIndex = common_vendor.ref(0);
const userPickerSelectedIds = common_vendor.ref([]);
const isLockedUser = (userId) => lockedUserIds.value.includes(String(userId));
const mergeLockedUserIds = (ids) => {
const userPickerSelectedIdentityIds = common_vendor.ref([]);
const isLockedIdentity = (identityId) => lockedIdentityIds.value.includes(String(identityId));
const mergeLockedIdentityIds = (ids) => {
const merged = /* @__PURE__ */ new Set([
...(ids || []).map((id) => String(id)),
...lockedUserIds.value.map((id) => String(id))
...lockedIdentityIds.value.map((id) => String(id))
]);
return [...merged];
};
const formatUserPickerLabel = (user) => {
const name = formatUserDisplayName(user);
return isLockedUser(user.userId) ? `${name}(默认)` : name;
};
const formatUserDisplayName = (user) => {
const formatMemberDisplayName = (user) => {
if (user.identityName) {
return `${user.nickName}_${user.identityName}`;
}
if (user.postName) {
return `${user.nickName}_${user.postName}`;
}
return user.nickName || "";
};
const buildUserItem = (user, dept) => ({
id: String(user.userId),
name: formatUserDisplayName(user),
const formatUserPickerLabel = (user) => {
const name = formatMemberDisplayName(user);
return isLockedIdentity(user.identityId) ? `${name}(默认)` : name;
};
const buildMemberItem = (user, dept) => ({
id: String(user.identityId),
userId: user.userId,
name: formatMemberDisplayName(user),
deptName: dept.deptName
});
const buildMemberItemFromDetail = (user) => ({
id: String(user.identityId || user.userId),
name: formatMemberDisplayName(user),
deptName: user.deptName || ""
});
const buildSelectedPersonText = (users) => {
if (users.length === 0)
return "";
@@ -317,86 +409,86 @@ const _sfc_main = {
return (dept == null ? void 0 : dept.users) || [];
});
const managerPickerSelectedText = common_vendor.computed(() => {
const users = getManagerUsersByIds(managerPickerSelectedIds.value);
const users = getManagersByIdentityIds(managerPickerSelectedIdentityIds.value);
return buildSelectedPersonText(users);
});
const managerPickerSelectedSet = common_vendor.computed(() => {
return new Set(managerPickerSelectedIds.value.map((id) => String(id)));
return new Set(managerPickerSelectedIdentityIds.value.map((id) => String(id)));
});
const currentDeptUsers = common_vendor.computed(() => {
const dept = deptList.value[activeDeptIndex.value];
return (dept == null ? void 0 : dept.users) || [];
});
const userPickerSelectedText = common_vendor.computed(() => {
const users = getUsersByIds(userPickerSelectedIds.value);
const users = getMembersByIdentityIds(userPickerSelectedIdentityIds.value);
return buildSelectedPersonText(users);
});
const userPickerSelectedSet = common_vendor.computed(() => {
return new Set(userPickerSelectedIds.value.map((id) => String(id)));
return new Set(userPickerSelectedIdentityIds.value.map((id) => String(id)));
});
const getManagerUsersByIds = (ids) => {
let users = getUsersByIdsFromTree(ids, managerDeptList.value);
if (users.length < ids.length) {
const userDeptUsers = getUsersByIdsFromTree(ids, deptList.value);
const userMap = new Map(users.map((user) => [user.id, user]));
userDeptUsers.forEach((user) => {
if (!userMap.has(user.id))
userMap.set(user.id, user);
const getManagersByIdentityIds = (ids) => {
let members = getMembersByIdentityIdsFromTree(ids, managerDeptList.value);
if (members.length < ids.length) {
const deptMembers = getMembersByIdentityIdsFromTree(ids, deptList.value);
const memberMap = new Map(members.map((member) => [member.id, member]));
deptMembers.forEach((member) => {
if (!memberMap.has(member.id))
memberMap.set(member.id, member);
});
users = ids.map((id) => userMap.get(String(id))).filter(Boolean);
members = ids.map((id) => memberMap.get(String(id))).filter(Boolean);
}
return mergeUsersFromDetailPool(ids, users);
return mergeMembersFromDetailPool(ids, members);
};
const getUsersByIds = (ids) => {
let users = getUsersByIdsFromTree(ids, deptList.value);
return mergeUsersFromDetailPool(ids, users);
const getMembersByIdentityIds = (ids) => {
let members = getMembersByIdentityIdsFromTree(ids, deptList.value);
return mergeMembersFromDetailPool(ids, members);
};
const syncSelectedManagersFromIds = (ids) => {
selectedManagers.value = getManagerUsersByIds(ids);
const syncSelectedManagersFromIdentityIds = (ids) => {
selectedManagers.value = getManagersByIdentityIds(ids);
};
const syncSelectedUsersFromIds = (ids) => {
selectedUsers.value = getUsersByIds(ids);
const syncSelectedMembersFromIdentityIds = (ids) => {
selectedUsers.value = getMembersByIdentityIds(ids);
};
const getManagerDeptSelectedCount = (dept) => {
var _a;
if (!((_a = dept.users) == null ? void 0 : _a.length))
return 0;
const selectedSet = new Set(managerPickerSelectedIds.value.map(String));
return dept.users.filter((user) => selectedSet.has(String(user.userId))).length;
const selectedSet = new Set(managerPickerSelectedIdentityIds.value.map(String));
return dept.users.filter((user) => selectedSet.has(String(user.identityId))).length;
};
const getDeptSelectedCount = (dept) => {
var _a;
if (!((_a = dept.users) == null ? void 0 : _a.length))
return 0;
const selectedSet = new Set(userPickerSelectedIds.value.map(String));
return dept.users.filter((user) => selectedSet.has(String(user.userId))).length;
const selectedSet = new Set(userPickerSelectedIdentityIds.value.map(String));
return dept.users.filter((user) => selectedSet.has(String(user.identityId))).length;
};
function onManagerCheckChange(userId, checked) {
const id = String(userId);
function onManagerCheckChange(identityId, checked) {
const id = String(identityId);
if (checked) {
if (!managerPickerSelectedSet.value.has(id)) {
managerPickerSelectedIds.value = [...managerPickerSelectedIds.value, id];
managerPickerSelectedIdentityIds.value = [...managerPickerSelectedIdentityIds.value, id];
}
return;
}
managerPickerSelectedIds.value = managerPickerSelectedIds.value.filter((item) => String(item) !== id);
managerPickerSelectedIdentityIds.value = managerPickerSelectedIdentityIds.value.filter((item) => String(item) !== id);
}
function onUserCheckChange(userId, checked) {
const id = String(userId);
if (!checked && isLockedUser(id)) {
function onUserCheckChange(identityId, checked) {
const id = String(identityId);
if (!checked && isLockedIdentity(id)) {
common_vendor.index.showToast({ title: "默认整改责任人不可取消", icon: "none" });
return;
}
if (checked) {
if (!userPickerSelectedSet.value.has(id)) {
userPickerSelectedIds.value = [...userPickerSelectedIds.value, id];
userPickerSelectedIdentityIds.value = [...userPickerSelectedIdentityIds.value, id];
}
return;
}
userPickerSelectedIds.value = userPickerSelectedIds.value.filter((item) => String(item) !== id);
userPickerSelectedIdentityIds.value = userPickerSelectedIdentityIds.value.filter((item) => String(item) !== id);
}
const openManagerPopup = () => {
managerPickerSelectedIds.value = [...selectedManagerIds.value];
managerPickerSelectedIdentityIds.value = [...selectedManagerIdentityIds.value];
const firstDeptWithUsers = managerDeptList.value.findIndex((dept) => {
var _a;
return ((_a = dept.users) == null ? void 0 : _a.length) > 0;
@@ -408,7 +500,7 @@ const _sfc_main = {
showManagerPopup.value = false;
};
const openUserPopup = () => {
userPickerSelectedIds.value = mergeLockedUserIds(selectedUserIds.value);
userPickerSelectedIdentityIds.value = mergeLockedIdentityIds(selectedIdentityIds.value);
const firstDeptWithUsers = deptList.value.findIndex((dept) => {
var _a;
return ((_a = dept.users) == null ? void 0 : _a.length) > 0;
@@ -420,14 +512,14 @@ const _sfc_main = {
showUserPopup.value = false;
};
const confirmManagerSelect = () => {
selectedManagerIds.value = managerPickerSelectedIds.value.map((id) => String(id));
syncSelectedManagersFromIds(selectedManagerIds.value);
selectedManagerIdentityIds.value = managerPickerSelectedIdentityIds.value.map((id) => String(id));
syncSelectedManagersFromIdentityIds(selectedManagerIdentityIds.value);
showManagerPopup.value = false;
};
const confirmUserSelect = () => {
userPickerSelectedIds.value = mergeLockedUserIds(userPickerSelectedIds.value);
selectedUserIds.value = userPickerSelectedIds.value.map((id) => String(id));
syncSelectedUsersFromIds(selectedUserIds.value);
userPickerSelectedIdentityIds.value = mergeLockedIdentityIds(userPickerSelectedIdentityIds.value);
selectedIdentityIds.value = userPickerSelectedIdentityIds.value.map((id) => String(id));
syncSelectedMembersFromIdentityIds(selectedIdentityIds.value);
showUserPopup.value = false;
};
const fetchRelatedDeptUsers = async () => {
@@ -436,21 +528,21 @@ const _sfc_main = {
if (res.code === 0 && res.data) {
managerDeptList.value = res.data;
deptList.value = res.data;
if (selectedManagerIds.value.length > 0) {
syncSelectedManagersFromIds(selectedManagerIds.value);
if (selectedManagerIdentityIds.value.length > 0) {
syncSelectedManagersFromIdentityIds(selectedManagerIdentityIds.value);
}
if (selectedUserIds.value.length > 0) {
syncSelectedUsersFromIds(selectedUserIds.value);
if (selectedIdentityIds.value.length > 0) {
syncSelectedMembersFromIdentityIds(selectedIdentityIds.value);
}
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:788", "获取关联部门人员列表失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:881", "获取关联部门人员列表失败:", error);
}
};
const fetchPersonnelLists = async () => {
await fetchRelatedDeptUsers();
if (selectedManagerIds.value.length > 0) {
syncSelectedManagersFromIds(selectedManagerIds.value);
if (selectedManagerIdentityIds.value.length > 0) {
syncSelectedManagersFromIdentityIds(selectedManagerIdentityIds.value);
}
};
const fileList1 = common_vendor.ref([]);
@@ -463,11 +555,8 @@ const _sfc_main = {
instance: rectifyUploadInstance
}
});
const executeSubmit = async () => {
const attachments = fileList1.value.filter((f) => f.status === "success").map((file) => utils_upload.buildAttachmentItem(file));
const buildSharedRectifyParams = (attachments) => {
const params = {
hazardId: hazardId.value,
assignId: assignId.value,
rectifyPlan: formData.rectifyPlan,
rectificationMeasures: formData.rectificationMeasures,
controlMeasures: formData.controlMeasures,
@@ -475,17 +564,37 @@ const _sfc_main = {
planCost: Number(formData.planCost) || 0,
actualCost: Number(formData.actualCost) || 0,
attachments,
manageIds: selectedManagerIds.value.map((id) => Number(id)),
memberIds: selectedUserIds.value.map((id) => Number(id)),
managerIds: selectedManagerIdentityIds.value.map((id) => Number(id)),
memberIds: selectedIdentityIds.value.map((id) => Number(id)),
rectifyTime: selectedRectifyTime.value || formatDateValue(rectifyTimeValue.value),
signPath: signatureServerPath.value || "",
sendMsgFlag: sendMsgFlag.value
};
if (rectifyId.value) {
params.rectifyId = rectifyId.value;
if (selectedDeadlineDate.value) {
params.deadline = selectedDeadlineDate.value;
}
return params;
};
const executeSubmit = async () => {
const attachments = fileList1.value.filter((f) => f.status === "success").map((file) => utils_upload.buildAttachmentItem(file));
try {
const res = await request_api.submitRectification(params);
let res;
if (isEdit.value) {
const updateParams = {
rectifyId: Number(rectifyId.value),
hazardId: hazardId.value,
assignId: assignId.value,
...buildSharedRectifyParams(attachments)
};
res = await request_api.updateRectification(updateParams);
} else {
const params = {
hazardId: hazardId.value,
assignId: assignId.value,
...buildSharedRectifyParams(attachments)
};
res = await request_api.submitRectification(params);
}
common_vendor.index.hideLoading();
if (res.code === 0) {
clearDraft(false);
@@ -504,7 +613,7 @@ const _sfc_main = {
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:892", "提交整改失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:1000", isEdit.value ? "保存整改失败:" : "提交整改失败:", error);
common_vendor.index.showToast({
title: "操作失败",
icon: "none"
@@ -530,7 +639,7 @@ const _sfc_main = {
} catch (err) {
isSubmitting.value = false;
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:922", "签名上传失败:", err);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:1030", "签名上传失败:", err);
common_vendor.index.showToast({ title: "签名上传失败,请重试", icon: "none" });
}
};
@@ -614,7 +723,7 @@ const _sfc_main = {
} catch (err) {
isSubmitting.value = false;
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:1013", "签名上传失败:", err);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:1121", "签名上传失败:", err);
common_vendor.index.showToast({ title: "签名上传失败,请重试", icon: "none" });
}
}
@@ -639,28 +748,32 @@ const _sfc_main = {
applyRectifyTimeValue(data.rectifyTime);
}
const signPath = resolveSignPathFromData(data);
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:1116", "整改详情签名路径:", signPath);
common_vendor.index.__f__("log", "at pages/hiddendanger/rectification.vue:1224", "整改详情签名路径:", signPath);
applySignatureFromServer(signPath);
hazardId.value = data.hazardId || "";
assignId.value = data.assignId || "";
const resolvedTaskId = resolveTaskIdFromDetail(data);
if (resolvedTaskId) {
taskId.value = resolvedTaskId;
}
detailPersonPool.value = [
...Array.isArray(data.managers) ? data.managers : [],
...Array.isArray(data.members) ? data.members : []
];
const managerIdArr = resolveManagerIdsFromDetail(data);
const memberIdArr = parseIdList(data.memberIds);
if (managerIdArr.length > 0) {
selectedManagerIds.value = managerIdArr;
const managerIdentityIdArr = resolveManagerIdentityIdsFromDetail(data);
if (managerIdentityIdArr.length > 0) {
selectedManagerIdentityIds.value = managerIdentityIdArr;
}
if (memberIdArr.length > 0) {
selectedUserIds.value = memberIdArr;
} else if (data.rectifierId) {
selectedUserIds.value = [String(data.rectifierId)];
const memberIdentityIdArr = parseIdList(data.memberIds ?? data.memberIdentityIds);
if (memberIdentityIdArr.length > 0) {
selectedIdentityIds.value = memberIdentityIdArr;
} else if (data.rectifierIdentityId) {
selectedIdentityIds.value = [String(data.rectifierIdentityId)];
}
if (data.assigneeId) {
setLockedDefaultUsers(data.assigneeId);
} else if (data.rectifierId) {
setLockedDefaultUsers(data.rectifierId);
if (data.assigneeIdentityId) {
setLockedDefaultIdentities(data.assigneeIdentityId);
} else if (data.rectifierIdentityId) {
setLockedDefaultIdentities(data.rectifierIdentityId);
}
await fetchPersonnelLists();
if (data.attachments && data.attachments.length > 0) {
@@ -670,7 +783,7 @@ const _sfc_main = {
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:1155", "获取整改详情失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:1267", "获取整改详情失败:", error);
common_vendor.index.showToast({ title: "获取详情失败", icon: "none" });
}
};
@@ -701,7 +814,7 @@ const _sfc_main = {
common_vendor.index.showToast({ title: aiRes.msg || "AI生成失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:1192", "AI生成整改方案失败:", error);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:1304", "AI生成整改方案失败:", error);
common_vendor.index.showToast({ title: "AI生成失败请重试", icon: "none" });
} finally {
aiGenerating.value = false;
@@ -822,7 +935,7 @@ const _sfc_main = {
const sysInfo = common_vendor.index.getSystemInfoSync();
signatureWidth.value = sysInfo.windowWidth - 40;
} catch (e) {
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:1330", "获取系统信息失败:", e);
common_vendor.index.__f__("error", "at pages/hiddendanger/rectification.vue:1442", "获取系统信息失败:", e);
}
if (options.hazardId) {
hazardId.value = options.hazardId;
@@ -830,8 +943,11 @@ const _sfc_main = {
if (options.assignId) {
assignId.value = options.assignId;
}
if (!options.rectifyId && options.assigneeId) {
applyAssigneeFromOptions(options.assigneeId, options.assigneeName);
if (options.taskId) {
taskId.value = options.taskId;
}
if (!options.rectifyId && options.assigneeIdentityId) {
applyAssigneeFromOptions(options.assigneeId, options.assigneeName, options.assigneeIdentityId);
}
if (!options.rectifyId)
fetchPersonnelLists();
@@ -846,6 +962,9 @@ const _sfc_main = {
if (options.deadline) {
applyDeadlineFromOptions(options.deadline);
}
if (!options.rectifyId) {
fetchNextStep();
}
});
return (_ctx, _cache) => {
return common_vendor.e({
@@ -914,9 +1033,9 @@ const _sfc_main = {
I: selectedUsers.value.length === 0 ? 1 : "",
J: common_vendor.o(openUserPopup),
K: common_vendor.o(cancelManagerSelect),
L: managerPickerSelectedIds.value.length > 0
}, managerPickerSelectedIds.value.length > 0 ? {
M: common_vendor.t(managerPickerSelectedIds.value.length),
L: managerPickerSelectedIdentityIds.value.length > 0
}, managerPickerSelectedIdentityIds.value.length > 0 ? {
M: common_vendor.t(managerPickerSelectedIdentityIds.value.length),
N: common_vendor.t(managerPickerSelectedText.value)
} : {}, {
O: common_vendor.f(managerDeptList.value, (dept, index, i0) => {
@@ -937,16 +1056,16 @@ const _sfc_main = {
}, currentManagerDeptUsers.value.length === 0 ? {} : {
Q: common_vendor.f(currentManagerDeptUsers.value, (user, k0, i0) => {
return {
a: common_vendor.o((checked) => onManagerCheckChange(user.userId, checked), "manager-user-" + user.userId),
a: common_vendor.o((checked) => onManagerCheckChange(user.identityId, checked), "manager-identity-" + user.identityId),
b: "f18ba0ce-8-" + i0 + ",f18ba0ce-7",
c: common_vendor.p({
usedAlone: true,
checked: managerPickerSelectedSet.value.has(String(user.userId)),
label: formatUserDisplayName(user),
checked: managerPickerSelectedSet.value.has(String(user.identityId)),
label: formatMemberDisplayName(user),
activeColor: "#2667E9",
shape: "square"
}),
d: "manager-user-" + user.userId
d: "manager-identity-" + user.identityId
};
})
}, {
@@ -960,9 +1079,9 @@ const _sfc_main = {
round: "20"
}),
W: common_vendor.o(cancelUserSelect),
X: userPickerSelectedIds.value.length > 0
}, userPickerSelectedIds.value.length > 0 ? {
Y: common_vendor.t(userPickerSelectedIds.value.length),
X: userPickerSelectedIdentityIds.value.length > 0
}, userPickerSelectedIdentityIds.value.length > 0 ? {
Y: common_vendor.t(userPickerSelectedIdentityIds.value.length),
Z: common_vendor.t(userPickerSelectedText.value)
} : {}, {
aa: common_vendor.f(deptList.value, (dept, index, i0) => {
@@ -983,18 +1102,18 @@ const _sfc_main = {
}, currentDeptUsers.value.length === 0 ? {} : {
ac: common_vendor.f(currentDeptUsers.value, (user, k0, i0) => {
return {
a: common_vendor.o((checked) => onUserCheckChange(user.userId, checked), "user-" + user.userId),
a: common_vendor.o((checked) => onUserCheckChange(user.identityId, checked), "identity-" + user.identityId),
b: "f18ba0ce-10-" + i0 + ",f18ba0ce-9",
c: common_vendor.p({
usedAlone: true,
checked: userPickerSelectedSet.value.has(String(user.userId)),
checked: userPickerSelectedSet.value.has(String(user.identityId)),
label: formatUserPickerLabel(user),
disabled: isLockedUser(user.userId),
disabled: isLockedIdentity(user.identityId),
activeColor: "#2667E9",
shape: "square"
}),
d: "user-" + user.userId,
e: isLockedUser(user.userId) ? 1 : ""
d: "identity-" + user.identityId,
e: isLockedIdentity(user.identityId) ? 1 : ""
};
})
}, {
@@ -1030,47 +1149,48 @@ const _sfc_main = {
at: canvasWidth.value + "px",
av: canvasHeight.value + "px"
} : {}, {
aw: common_vendor.p({
aw: common_vendor.t(nextStepDisplay.value),
ax: common_vendor.p({
label: "是",
name: "yes",
customStyle: {
marginRight: "48rpx"
}
}),
ax: common_vendor.p({
ay: common_vendor.p({
label: "否",
name: "no"
}),
ay: common_vendor.o(($event) => sendMsgFlagRadio.value = $event),
az: common_vendor.p({
az: common_vendor.o(($event) => sendMsgFlagRadio.value = $event),
aA: common_vendor.p({
placement: "row",
activeColor: "#2667e9",
modelValue: sendMsgFlagRadio.value
}),
aA: showCanvas.value
aB: showCanvas.value
}, showCanvas.value ? {
aB: common_vendor.o(clearSignature)
aC: common_vendor.o(clearSignature)
} : {
aC: common_vendor.o(reSign)
aD: common_vendor.o(reSign)
}, {
aD: !showCanvas.value
aE: !showCanvas.value
}, !showCanvas.value ? common_vendor.e({
aE: signatureUrl.value
aF: signatureUrl.value
}, signatureUrl.value ? {
aF: signatureUrl.value,
aG: common_vendor.o(onSignatureImageError)
aG: signatureUrl.value,
aH: common_vendor.o(onSignatureImageError)
} : {}) : {}, {
aH: showCanvas.value && !showUserPopup.value && !showManagerPopup.value && !showRectifyTimePicker.value
aI: showCanvas.value && !showUserPopup.value && !showManagerPopup.value && !showRectifyTimePicker.value
}, showCanvas.value && !showUserPopup.value && !showManagerPopup.value && !showRectifyTimePicker.value ? {
aI: common_vendor.sr(signatureRef, "f18ba0ce-15", {
aJ: common_vendor.sr(signatureRef, "f18ba0ce-15", {
"k": "signatureRef"
}),
aJ: common_vendor.o((res) => onSignatureConfirm(res.tempFilePath)),
aK: common_vendor.o(onSignatureStart),
aL: common_vendor.o(onSignatureSigning),
aM: common_vendor.o(onSignatureEnd),
aN: common_vendor.o(onSignatureClear),
aO: common_vendor.p({
aK: common_vendor.o((res) => onSignatureConfirm(res.tempFilePath)),
aL: common_vendor.o(onSignatureStart),
aM: common_vendor.o(onSignatureSigning),
aN: common_vendor.o(onSignatureEnd),
aO: common_vendor.o(onSignatureClear),
aP: common_vendor.p({
width: signatureWidth.value,
height: 160,
backgroundColor: "#f8f8f8",
@@ -1079,9 +1199,9 @@ const _sfc_main = {
enableHistory: false
})
} : {}, {
aP: common_vendor.t(isEdit.value ? "保存修改" : "提交整改"),
aQ: common_vendor.o(handleSubmit),
aR: common_vendor.gei(_ctx, "")
aQ: common_vendor.t(isEdit.value ? "保存修改" : "提交整改"),
aR: common_vendor.o(handleSubmit),
aS: common_vendor.gei(_ctx, "")
});
};
}

File diff suppressed because one or more lines are too long

View File

@@ -4,18 +4,23 @@ const common_assets = require("../../common/assets.js");
const request_api = require("../../request/api.js");
const request_three_one_api_info = require("../../request/three_one_api/info.js");
const request_request = require("../../request/request.js");
const utils_userInfo = require("../../utils/userInfo.js");
const utils_hazardNav = require("../../utils/hazardNav.js");
if (!Array) {
const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
(_easycom_u_navbar2 + _easycom_u_icon2)();
const _easycom_u_loadmore2 = common_vendor.resolveComponent("u-loadmore");
(_easycom_u_navbar2 + _easycom_u_icon2 + _easycom_u_loadmore2)();
}
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
const _easycom_u_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
const _easycom_u_loadmore = () => "../../uni_modules/uview-plus/components/u-loadmore/u-loadmore.js";
if (!Math) {
(_easycom_u_navbar + _easycom_u_icon)();
(_easycom_u_navbar + _easycom_u_icon + _easycom_u_loadmore)();
}
const defaultAvatar = "/static/my/default_avater.png";
const PLAN_INITIAL_SIZE = 4;
const HAZARD_PAGE_SIZE = 10;
const _sfc_main = {
__name: "index",
setup(__props) {
@@ -28,11 +33,25 @@ const _sfc_main = {
deptName: "",
role: "",
avatar: "",
phone: ""
phone: "",
identityName: "",
userIdentity: null
});
const canAcceptance = common_vendor.computed(() => {
return userInfo.role === "admin" || userInfo.role === "manage";
const currentRoleKey = common_vendor.computed(() => utils_userInfo.resolveUserRoleKey(userInfo));
const isApprovalRole = common_vendor.computed(() => currentRoleKey.value === "approval");
const displayIdentityName = common_vendor.computed(() => {
return utils_userInfo.resolveIdentityName(userInfo, userInfo.userIdentity);
});
const loadUserInfoFromStorage = () => {
try {
const storedUserInfo = common_vendor.index.getStorageSync("userInfo");
if (storedUserInfo) {
utils_userInfo.applyStoredUserInfo(userInfo, JSON.parse(storedUserInfo));
}
} catch (storageError) {
common_vendor.index.__f__("error", "at pages/index/index.vue:318", "从本地存储获取用户信息失败:", storageError);
}
};
const getImageUrl = (path) => {
if (!path)
return "";
@@ -42,35 +61,11 @@ const _sfc_main = {
try {
const res = await request_three_one_api_info.getProfileDetail();
if (res.code === 0 && res.data) {
userInfo.userId = res.data.userId || "";
userInfo.username = res.data.userName || "";
userInfo.nickName = res.data.nickName || "";
userInfo.deptId = res.data.deptId || "";
userInfo.deptName = res.data.deptName || "";
userInfo.avatar = res.data.avatar || "";
userInfo.phone = res.data.phonenumber || res.data.phone || "";
if (res.data.roles && res.data.roles.length > 0) {
userInfo.role = res.data.roles[0].roleKey || "";
}
utils_userInfo.applyProfileToUserInfo(userInfo, res.data);
}
} catch (e) {
common_vendor.index.__f__("error", "at pages/index/index.vue:249", "获取用户信息失败:", e);
try {
const storedUserInfo = common_vendor.index.getStorageSync("userInfo");
if (storedUserInfo) {
const info = JSON.parse(storedUserInfo);
userInfo.userId = info.userId || "";
userInfo.username = info.username || "";
userInfo.nickName = info.nickName || "";
userInfo.deptId = info.deptId || "";
userInfo.deptName = info.deptName || "";
userInfo.role = info.role || "";
userInfo.avatar = info.avatar || "";
userInfo.phone = info.phone || "";
}
} catch (storageError) {
common_vendor.index.__f__("error", "at pages/index/index.vue:265", "从本地存储获取用户信息失败:", storageError);
}
common_vendor.index.__f__("error", "at pages/index/index.vue:336", "获取用户信息失败:", e);
loadUserInfoFromStorage();
}
};
const allMenuList = [
@@ -109,7 +104,10 @@ const _sfc_main = {
];
const commonMenuNames = ["隐患排查", "隐患销号"];
const infoList = common_vendor.computed(() => {
if (userInfo.role === "common") {
if (currentRoleKey.value === "approval") {
return [];
}
if (currentRoleKey.value === "common") {
return allMenuList.filter((item) => commonMenuNames.includes(item.name));
}
return allMenuList;
@@ -216,7 +214,7 @@ const _sfc_main = {
initPlanExpandedState(records, { reset: true, expandFirst: true });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/index/index.vue:435", error);
common_vendor.index.__f__("error", "at pages/index/index.vue:509", error);
} finally {
loading.value = false;
}
@@ -240,7 +238,7 @@ const _sfc_main = {
common_vendor.index.showToast({ title: res.msg || "加载失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/index/index.vue:458", error);
common_vendor.index.__f__("error", "at pages/index/index.vue:532", error);
common_vendor.index.showToast({ title: "加载失败", icon: "none" });
}
};
@@ -250,15 +248,20 @@ const _sfc_main = {
return dateStr.split(" ")[0];
};
common_vendor.onShow(() => {
getUserInfo();
getCheckPlanLists();
getHiddenDangerLists();
});
const hiddenDangerParams = common_vendor.ref({
pageNum: 1,
pageSize: 10,
name: ""
loadUserInfoFromStorage();
getUserInfo().then(() => {
if (isApprovalRole.value) {
fetchWorkbenchList();
} else {
getCheckPlanLists();
resetHiddenDangerList();
fetchHiddenDangerList();
}
});
});
const hiddenDangerPageNum = common_vendor.ref(1);
const hiddenDangerLoading = common_vendor.ref(false);
const hiddenDangerLoadStatus = common_vendor.ref("loadmore");
const hiddenDangerData = common_vendor.ref([]);
const dangerTabs = common_vendor.ref([
{ label: "全部", value: null },
@@ -269,64 +272,198 @@ const _sfc_main = {
{ label: "已完成", value: 5 }
]);
const activeDangerTab = common_vendor.ref(0);
const switchDangerTab = (index) => {
activeDangerTab.value = index;
};
const filteredDangerData = common_vendor.computed(() => {
const buildHiddenDangerListParams = () => {
const params = {
pageNum: hiddenDangerPageNum.value,
pageSize: HAZARD_PAGE_SIZE
};
const activeTab = dangerTabs.value[activeDangerTab.value];
if (!activeTab || activeTab.value === null) {
return hiddenDangerData.value;
if ((activeTab == null ? void 0 : activeTab.value) != null) {
params.status = activeTab.value;
}
return params;
};
const resetHiddenDangerList = () => {
hiddenDangerPageNum.value = 1;
hiddenDangerData.value = [];
hiddenDangerLoadStatus.value = "loadmore";
};
const switchDangerTab = (index) => {
if (activeDangerTab.value === index)
return;
activeDangerTab.value = index;
resetHiddenDangerList();
fetchHiddenDangerList();
};
const fetchHiddenDangerList = async () => {
var _a, _b;
if (hiddenDangerLoading.value)
return;
if (hiddenDangerPageNum.value > 1 && hiddenDangerLoadStatus.value === "nomore")
return;
hiddenDangerLoading.value = true;
if (hiddenDangerPageNum.value > 1) {
hiddenDangerLoadStatus.value = "loading";
}
return hiddenDangerData.value.filter((item) => item.status === activeTab.value);
});
const getHiddenDangerLists = async () => {
try {
const res = await request_api.getHiddenDangerList(hiddenDangerParams.value);
common_vendor.index.__f__("log", "at pages/index/index.vue:516", res);
const res = await request_api.getHiddenDangerList(buildHiddenDangerListParams());
if (res.code === 0) {
hiddenDangerData.value = res.data.records;
common_vendor.index.__f__("log", "at pages/index/index.vue:519", hiddenDangerData.value, 1111);
const records = ((_a = res.data) == null ? void 0 : _a.records) || [];
const total = Number(((_b = res.data) == null ? void 0 : _b.total) ?? 0);
if (hiddenDangerPageNum.value === 1) {
hiddenDangerData.value = records;
} else {
hiddenDangerData.value = [...hiddenDangerData.value, ...records];
}
if (hiddenDangerData.value.length >= total || records.length < HAZARD_PAGE_SIZE) {
hiddenDangerLoadStatus.value = "nomore";
} else {
hiddenDangerLoadStatus.value = "loadmore";
}
} else {
if (hiddenDangerPageNum.value === 1) {
hiddenDangerData.value = [];
}
hiddenDangerLoadStatus.value = "nomore";
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/index/index.vue:522", error);
common_vendor.index.__f__("error", "at pages/index/index.vue:635", error);
if (hiddenDangerPageNum.value > 1) {
hiddenDangerPageNum.value--;
}
hiddenDangerLoadStatus.value = "loadmore";
} finally {
hiddenDangerLoading.value = false;
loading.value = false;
}
};
const loadMoreHiddenDangerList = () => {
if (hiddenDangerLoadStatus.value !== "loadmore" || hiddenDangerLoading.value)
return;
hiddenDangerPageNum.value++;
fetchHiddenDangerList();
};
common_vendor.onLoad(() => {
getHiddenDangerLists();
if (!isApprovalRole.value) {
resetHiddenDangerList();
fetchHiddenDangerList();
}
});
common_vendor.onReachBottom(() => {
if (isApprovalRole.value)
return;
loadMoreHiddenDangerList();
});
const workbenchTabs = [
{ label: "待办", value: "todo" },
{ label: "已办", value: "done" }
];
const activeWorkbenchTab = common_vendor.ref(0);
const workbenchList = common_vendor.ref([]);
const workbenchLoading = common_vendor.ref(false);
const normalizeWorkbenchItem = (item) => {
if (!item)
return {};
const hazard = item.hazard || item.hazardInfo || {};
return {
...item,
hazardId: item.hazardId ?? hazard.hazardId ?? "",
assignId: item.assignId ?? hazard.assignId ?? "",
rectifyId: item.rectifyId ?? hazard.rectifyId ?? "",
taskId: item.taskId ?? item.flowTaskId ?? item.currentTaskId ?? "",
taskKey: item.taskKey ?? item.flowTaskKey ?? item.currentTaskKey ?? "",
title: item.title ?? hazard.title ?? item.hazardTitle ?? "",
address: item.address ?? hazard.address ?? "",
source: item.source ?? hazard.source ?? item.hazardSourceName ?? "",
statusName: item.statusName ?? hazard.statusName ?? item.hazardStatusName ?? hazard.hazardStatusName ?? item.taskName ?? "",
hazardStatus: item.hazardStatus ?? hazard.hazardStatus ?? item.status ?? hazard.status ?? "",
createdAt: item.discoveredAt ?? hazard.discoveredAt ?? "",
levelName: item.levelName ?? hazard.levelName ?? ""
};
};
const resolveWorkbenchRecords = (data) => {
if (!data)
return [];
if (Array.isArray(data))
return data;
if (Array.isArray(data.records))
return data.records;
if (Array.isArray(data.list))
return data.list;
return [];
};
const getWorkbenchItemKey = (item) => {
const taskId = item.taskId || item.flowTaskId || "";
const hazardId = item.hazardId || "";
if (taskId && hazardId)
return `${taskId}-${hazardId}`;
return taskId || hazardId || item.rectifyId || JSON.stringify(item);
};
const switchWorkbenchTab = (index) => {
if (activeWorkbenchTab.value === index)
return;
activeWorkbenchTab.value = index;
fetchWorkbenchList();
};
const fetchWorkbenchList = async () => {
workbenchLoading.value = true;
try {
const isTodo = activeWorkbenchTab.value === 0;
const res = isTodo ? await request_api.getFlowTodoList() : await request_api.getFlowDoneList();
if (res.code === 0) {
workbenchList.value = resolveWorkbenchRecords(res.data).map(normalizeWorkbenchItem);
} else {
workbenchList.value = [];
common_vendor.index.showToast({ title: res.msg || "获取工作台数据失败", icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/index/index.vue:727", "获取工作台数据失败:", error);
workbenchList.value = [];
common_vendor.index.showToast({ title: "获取工作台数据失败", icon: "none" });
} finally {
workbenchLoading.value = false;
loading.value = false;
}
};
const goLeaderApproval = (item) => {
const hazardStatus = Number(item.hazardStatus);
const statusName = item.statusName || item.hazardStatusName || "";
if (hazardStatus === 4 || statusName === "待销号") {
common_vendor.index.navigateTo({ url: utils_hazardNav.buildLeaderWriteoffApprovalUrl(item) });
return;
}
if (hazardStatus === 3 || statusName === "待验收") {
common_vendor.index.navigateTo({ url: utils_hazardNav.buildAcceptanceApprovalUrl(item) });
return;
}
common_vendor.index.showToast({ title: "当前状态不支持领导审批", icon: "none" });
};
const viewHazardDetail = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/detail2?hazardId=${item.hazardId}&assignId=${item.assignId || ""}`
url: `/pages/hiddendanger/process-chain?hazardId=${item.hazardId}`
});
};
const goRectification = (item) => {
let url = `/pages/hiddendanger/rectification?hazardId=${item.hazardId}&assignId=${item.assignId}`;
if (item.deadline) {
url += `&deadline=${encodeURIComponent(item.deadline)}`;
}
if (item.assigneeId) {
url += `&assigneeId=${item.assigneeId}`;
}
if (item.assigneeName) {
url += `&assigneeName=${encodeURIComponent(item.assigneeName)}`;
}
common_vendor.index.navigateTo({ url });
common_vendor.index.navigateTo({ url: utils_hazardNav.buildRectificationUrl(item) });
};
const editRectification = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/rectification?rectifyId=${item.rectifyId}&isEdit=1`
});
common_vendor.index.navigateTo({ url: utils_hazardNav.buildEditRectificationUrl(item) });
};
const goAcceptance = (item) => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/acceptance?hazardId=${item.hazardId}&assignId=${item.assignId}&rectifyId=${item.rectifyId}`
});
common_vendor.index.navigateTo({ url: utils_hazardNav.buildAcceptanceUrl(item) });
};
const assignHazard = (item) => {
common_vendor.index.navigateTo({ url: utils_hazardNav.buildAssignmentUrl(item) });
};
const goWriteoffApply = (item) => {
common_vendor.index.navigateTo({ url: utils_hazardNav.buildWriteoffApplyUrl(item) });
};
const goWriteoffApproval = (item) => {
common_vendor.index.navigateTo({ url: utils_hazardNav.buildWriteoffApprovalUrl(item) });
};
const goSwitchIdentity = () => {
common_vendor.index.navigateTo({
url: `/pages/hiddendanger/assignment?hazardId=${item.hazardId}&assignId=${item.assignId}`
url: "/pages/personalcenter/identity"
});
};
return (_ctx, _cache) => {
@@ -345,20 +482,35 @@ const _sfc_main = {
c: getImageUrl(userInfo.avatar) || defaultAvatar,
d: common_vendor.t(userInfo.deptName || "未知部门"),
e: common_vendor.t(userInfo.phone || "未绑定"),
f: common_vendor.f(infoList.value, (item, index, i0) => {
f: displayIdentityName.value
}, displayIdentityName.value ? {
g: common_vendor.t(displayIdentityName.value)
} : {}, {
h: common_vendor.p({
name: "list",
color: "#285CE9",
size: "14"
}),
i: common_vendor.o(goSwitchIdentity),
j: !isApprovalRole.value
}, !isApprovalRole.value ? {
k: common_vendor.f(infoList.value, (item, index, i0) => {
return {
a: item.src,
b: common_vendor.t(item.name),
c: index,
d: common_vendor.o(($event) => handleMenuClick(item), index)
};
}),
g: checkPlanData.value.length === 0
})
} : {}, {
l: !isApprovalRole.value
}, !isApprovalRole.value ? common_vendor.e({
m: checkPlanData.value.length === 0
}, checkPlanData.value.length === 0 ? {} : {}, {
h: common_vendor.f(checkPlanData.value, (item, k0, i0) => {
n: common_vendor.f(checkPlanData.value, (item, k0, i0) => {
return {
a: common_vendor.t(item.name),
b: "1cf27b2a-1-" + i0,
b: "1cf27b2a-2-" + i0,
c: common_vendor.p({
name: isPlanExpanded(item.id) ? "arrow-down" : "arrow-up",
color: "#ffffff",
@@ -383,11 +535,13 @@ const _sfc_main = {
t: item.id
};
}),
i: hasMoreCheckPlans.value
o: hasMoreCheckPlans.value
}, hasMoreCheckPlans.value ? {
j: common_vendor.o(loadMoreCheckPlans)
} : {}, {
k: common_vendor.f(dangerTabs.value, (tab, index, i0) => {
p: common_vendor.o(loadMoreCheckPlans)
} : {}) : {}, {
q: !isApprovalRole.value
}, !isApprovalRole.value ? common_vendor.e({
r: common_vendor.f(dangerTabs.value, (tab, index, i0) => {
return {
a: common_vendor.t(tab.label),
b: activeDangerTab.value === index ? 1 : "",
@@ -395,9 +549,9 @@ const _sfc_main = {
d: common_vendor.o(($event) => switchDangerTab(index), index)
};
}),
l: filteredDangerData.value.length === 0
}, filteredDangerData.value.length === 0 ? {} : {}, {
m: common_vendor.f(filteredDangerData.value, (item, index, i0) => {
s: hiddenDangerData.value.length === 0 && !hiddenDangerLoading.value
}, hiddenDangerData.value.length === 0 && !hiddenDangerLoading.value ? {} : {}, {
t: common_vendor.f(hiddenDangerData.value, (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.title),
b: common_vendor.t(item.levelName),
@@ -421,18 +575,65 @@ const _sfc_main = {
}, item.statusName === "待验收" && item.canEdit ? {
p: common_vendor.o(($event) => editRectification(item), item.hazardId)
} : {}, {
q: item.statusName === "待验收" && canAcceptance.value
}, item.statusName === "待验收" && canAcceptance.value ? {
q: common_vendor.unref(utils_hazardNav.canShowAcceptanceButton)(item, currentRoleKey.value)
}, common_vendor.unref(utils_hazardNav.canShowAcceptanceButton)(item, currentRoleKey.value) ? {
r: common_vendor.o(($event) => goAcceptance(item), item.hazardId)
} : {}, {
s: item.statusName === "待交办"
}, item.statusName === "待交办" ? {
t: common_vendor.o(($event) => assignHazard(item), item.hazardId)
} : {}, {
v: item.hazardId
v: common_vendor.unref(utils_hazardNav.canShowWriteoffApplyButton)(item)
}, common_vendor.unref(utils_hazardNav.canShowWriteoffApplyButton)(item) ? {
w: common_vendor.o(($event) => goWriteoffApply(item), item.hazardId)
} : {}, {
x: common_vendor.unref(utils_hazardNav.canShowWriteoffApprovalButton)(item, currentRoleKey.value)
}, common_vendor.unref(utils_hazardNav.canShowWriteoffApprovalButton)(item, currentRoleKey.value) ? {
y: common_vendor.o(($event) => goWriteoffApproval(item), item.hazardId)
} : {}, {
z: item.hazardId
});
}),
n: common_vendor.gei(_ctx, "")
v: hiddenDangerData.value.length > 0
}, hiddenDangerData.value.length > 0 ? {
w: common_vendor.p({
status: hiddenDangerLoadStatus.value
})
} : {}) : {}, {
x: isApprovalRole.value
}, isApprovalRole.value ? common_vendor.e({
y: common_vendor.f(workbenchTabs, (tab, index, i0) => {
return {
a: common_vendor.t(tab.label),
b: activeWorkbenchTab.value === index ? 1 : "",
c: tab.value,
d: common_vendor.o(($event) => switchWorkbenchTab(index), tab.value)
};
}),
z: workbenchLoading.value
}, workbenchLoading.value ? {} : workbenchList.value.length === 0 ? {} : {}, {
A: workbenchList.value.length === 0,
B: common_vendor.f(workbenchList.value, (item, k0, i0) => {
return common_vendor.e({
a: common_vendor.t(item.title),
b: common_vendor.t(item.levelName),
c: item.levelName === "轻微隐患" ? 1 : "",
d: item.levelName === "一般隐患" ? 1 : "",
e: item.levelName === "重大隐患" ? 1 : "",
f: common_vendor.t(item.address),
g: common_vendor.t(item.source),
h: common_vendor.t(item.statusName),
i: common_vendor.t(item.createdAt),
j: common_vendor.o(($event) => viewHazardDetail(item), getWorkbenchItemKey(item))
}, activeWorkbenchTab.value === 0 ? {
k: common_vendor.o(($event) => goLeaderApproval(item), getWorkbenchItemKey(item))
} : {}, {
l: getWorkbenchItemKey(item)
});
}),
C: activeWorkbenchTab.value === 0
}) : {}, {
D: common_vendor.gei(_ctx, "")
});
};
}

View File

@@ -4,6 +4,7 @@
"navigationBarTextStyle": "white",
"usingComponents": {
"u-navbar": "../../uni_modules/uview-plus/components/u-navbar/u-navbar",
"u-icon": "../../uni_modules/uview-plus/components/u-icon/u-icon"
"u-icon": "../../uni_modules/uview-plus/components/u-icon/u-icon",
"u-loadmore": "../../uni_modules/uview-plus/components/u-loadmore/u-loadmore"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -73,11 +73,19 @@
color: rgba(255, 255, 255, 0.9);
margin-top: 10rpx;
}
.user-card .user-info .user-identity.data-v-1cf27b2a {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.85);
margin-top: 8rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.user-card .switch-btn.data-v-1cf27b2a {
display: flex;
align-items: center;
background: #fff;
padding: 16rpx 24rpx;
padding: 8rpx 24rpx;
border-radius: 30rpx;
color: #285CE9;
font-size: 26rpx;
@@ -281,6 +289,9 @@
gap: 42rpx;
margin-left: 10rpx;
}
.workbench-tab-list.data-v-1cf27b2a {
margin-bottom: 20rpx;
}
.danger-tab-item.data-v-1cf27b2a {
font-size: 28rpx;
color: #666;

View File

@@ -194,36 +194,6 @@ const _sfc_main = {
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
}
};
const Lock = (item) => {
const isLocked = item.status === "1";
const actionText = isLocked ? "解锁" : "锁定";
const newStatus = isLocked ? "0" : "1";
common_vendor.index.showModal({
title: "提示",
content: `确定要${actionText}该成员吗?`,
confirmColor: "#2667E9",
success: async (res) => {
if (res.confirm) {
try {
const result = await request_api.lockOrUnlockMember({
userId: item.userId,
lockStatus: Number(newStatus)
});
if (result.code === 0) {
common_vendor.index.showToast({ title: `${actionText}成功`, icon: "success" });
item.status = newStatus;
item.statusName = newStatus === "1" ? "已锁定" : "正常";
} else {
common_vendor.index.showToast({ title: result.msg || `${actionText}失败`, icon: "none" });
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/membermanagemen/membermanagemen.vue:380", `${actionText}成员失败:`, error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
}
}
}
});
};
common_vendor.onMounted(() => {
getUserInfo();
fetchMemberList();
@@ -238,10 +208,8 @@ const _sfc_main = {
b: common_vendor.t(item.statusName),
c: common_vendor.n(item.statusName === "正常" ? "status-normal" : "status-locked"),
d: common_vendor.t(item.phonenumber || "未设置"),
e: common_vendor.t(item.status === "1" ? "解锁" : "锁定"),
f: common_vendor.o(($event) => Lock(item), item.userId),
g: item.userId,
h: index < list.value.length - 1 ? 1 : ""
e: item.userId,
f: index < list.value.length - 1 ? 1 : ""
};
}),
d: common_vendor.o(openAddMemberPopup),

View File

@@ -1 +1 @@
<view class="{{['page', 'padding', 'data-v-06d9f81b', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{G}}"><view class="member-card bg-white radius data-v-06d9f81b"><view class="card-header data-v-06d9f81b"><view class="flex align-center data-v-06d9f81b"><view class="border-line data-v-06d9f81b"></view><view class="text-bold margin-left-sm data-v-06d9f81b">{{a}}</view></view><view class="role-tag data-v-06d9f81b">{{b}}</view></view><view class="member-list data-v-06d9f81b"><view wx:for="{{c}}" wx:for-item="item" wx:key="g" class="{{['member-item', 'data-v-06d9f81b', item.h && 'border-bottom']}}"><view class="cu-avatar radius lg bg-gray data-v-06d9f81b" style="background-image:url(https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png)"></view><view class="member-info data-v-06d9f81b"><view class="flex align-center data-v-06d9f81b"><text class="member-name data-v-06d9f81b">{{item.a}}</text><view class="{{['status-tag', 'data-v-06d9f81b', item.c]}}">{{item.b}}</view></view><view class="member-phone text-gray data-v-06d9f81b"><text class="data-v-06d9f81b">手机:{{item.d}}</text></view></view><button class="btn-lock bg-blue data-v-06d9f81b" bindtap="{{item.f}}">{{item.e}}</button></view></view><view class="add-btn-wrapper data-v-06d9f81b"><button class="add-btn data-v-06d9f81b" bindtap="{{d}}"><text class="cuIcon-add data-v-06d9f81b"></text><text class="data-v-06d9f81b">添加成员</text></button></view></view><u-popup wx:if="{{x}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-s="{{['d']}}" bindclose="{{w}}" u-i="06d9f81b-0" bind:__l="__l" u-p="{{x}}"><view class="popup-content data-v-06d9f81b"><view class="popup-header data-v-06d9f81b"><view class="popup-title text-bold data-v-06d9f81b">添加成员</view><view class="popup-close data-v-06d9f81b" bindtap="{{e}}">×</view></view><scroll-view class="popup-body data-v-06d9f81b" scroll-y><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">用户名<text class="text-red data-v-06d9f81b">*</text></view><up-input wx:if="{{g}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="06d9f81b-1,06d9f81b-0" bind:__l="__l" bindupdateModelValue="{{f}}" u-p="{{g}}"></up-input></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">昵称</view><up-input wx:if="{{i}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="06d9f81b-2,06d9f81b-0" bind:__l="__l" bindupdateModelValue="{{h}}" u-p="{{i}}"></up-input></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">手机号</view><up-input wx:if="{{k}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="06d9f81b-3,06d9f81b-0" bind:__l="__l" bindupdateModelValue="{{j}}" u-p="{{k}}"></up-input></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">密码<text class="text-red data-v-06d9f81b">*</text></view><up-input wx:if="{{m}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="06d9f81b-4,06d9f81b-0" bind:__l="__l" bindupdateModelValue="{{l}}" u-p="{{m}}"></up-input></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">角色类型<text class="text-red data-v-06d9f81b">*</text></view><view class="form-select data-v-06d9f81b" bindtap="{{p}}"><text class="{{['data-v-06d9f81b', o]}}">{{n}}</text><text class="cuIcon-unfold data-v-06d9f81b"></text></view></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">岗位</view><view class="form-select data-v-06d9f81b" bindtap="{{s}}"><text class="{{['data-v-06d9f81b', r]}}">{{q}}</text><text class="cuIcon-unfold data-v-06d9f81b"></text></view></view><view class="data-v-06d9f81b" style="height:40rpx"></view></scroll-view><view class="popup-footer data-v-06d9f81b"><button class="btn-cancel data-v-06d9f81b" bindtap="{{t}}">取消</button><button class="btn-confirm bg-blue data-v-06d9f81b" bindtap="{{v}}">确定</button></view></view></u-popup><up-picker wx:if="{{B}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" bindconfirm="{{y}}" bindcancel="{{z}}" bindclose="{{A}}" u-i="06d9f81b-5" bind:__l="__l" u-p="{{B}}"></up-picker><up-picker wx:if="{{F}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" bindconfirm="{{C}}" bindcancel="{{D}}" bindclose="{{E}}" u-i="06d9f81b-6" bind:__l="__l" u-p="{{F}}"></up-picker><tab-bar class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="06d9f81b-7" bind:__l="__l"/></view>
<view class="{{['page', 'padding', 'data-v-06d9f81b', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{G}}"><view class="member-card bg-white radius data-v-06d9f81b"><view class="card-header data-v-06d9f81b"><view class="flex align-center data-v-06d9f81b"><view class="border-line data-v-06d9f81b"></view><view class="text-bold margin-left-sm data-v-06d9f81b">{{a}}</view></view><view class="role-tag data-v-06d9f81b">{{b}}</view></view><view class="member-list data-v-06d9f81b"><view wx:for="{{c}}" wx:for-item="item" wx:key="e" class="{{['member-item', 'data-v-06d9f81b', item.f && 'border-bottom']}}"><view class="cu-avatar radius lg bg-gray data-v-06d9f81b" style="background-image:url(https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png)"></view><view class="member-info data-v-06d9f81b"><view class="flex align-center data-v-06d9f81b"><text class="member-name data-v-06d9f81b">{{item.a}}</text><view class="{{['status-tag', 'data-v-06d9f81b', item.c]}}">{{item.b}}</view></view><view class="member-phone text-gray data-v-06d9f81b"><text class="data-v-06d9f81b">手机:{{item.d}}</text></view></view></view></view><view class="add-btn-wrapper data-v-06d9f81b"><button class="add-btn data-v-06d9f81b" bindtap="{{d}}"><text class="cuIcon-add data-v-06d9f81b"></text><text class="data-v-06d9f81b">添加成员</text></button></view></view><u-popup wx:if="{{x}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-s="{{['d']}}" bindclose="{{w}}" u-i="06d9f81b-0" bind:__l="__l" u-p="{{x}}"><view class="popup-content data-v-06d9f81b"><view class="popup-header data-v-06d9f81b"><view class="popup-title text-bold data-v-06d9f81b">添加成员</view><view class="popup-close data-v-06d9f81b" bindtap="{{e}}">×</view></view><scroll-view class="popup-body data-v-06d9f81b" scroll-y><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">用户名<text class="text-red data-v-06d9f81b">*</text></view><up-input wx:if="{{g}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="06d9f81b-1,06d9f81b-0" bind:__l="__l" bindupdateModelValue="{{f}}" u-p="{{g}}"></up-input></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">昵称</view><up-input wx:if="{{i}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="06d9f81b-2,06d9f81b-0" bind:__l="__l" bindupdateModelValue="{{h}}" u-p="{{i}}"></up-input></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">手机号</view><up-input wx:if="{{k}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="06d9f81b-3,06d9f81b-0" bind:__l="__l" bindupdateModelValue="{{j}}" u-p="{{k}}"></up-input></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">密码<text class="text-red data-v-06d9f81b">*</text></view><up-input wx:if="{{m}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="06d9f81b-4,06d9f81b-0" bind:__l="__l" bindupdateModelValue="{{l}}" u-p="{{m}}"></up-input></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">角色类型<text class="text-red data-v-06d9f81b">*</text></view><view class="form-select data-v-06d9f81b" bindtap="{{p}}"><text class="{{['data-v-06d9f81b', o]}}">{{n}}</text><text class="cuIcon-unfold data-v-06d9f81b"></text></view></view><view class="form-item data-v-06d9f81b"><view class="form-label data-v-06d9f81b">岗位</view><view class="form-select data-v-06d9f81b" bindtap="{{s}}"><text class="{{['data-v-06d9f81b', r]}}">{{q}}</text><text class="cuIcon-unfold data-v-06d9f81b"></text></view></view><view class="data-v-06d9f81b" style="height:40rpx"></view></scroll-view><view class="popup-footer data-v-06d9f81b"><button class="btn-cancel data-v-06d9f81b" bindtap="{{t}}">取消</button><button class="btn-confirm bg-blue data-v-06d9f81b" bindtap="{{v}}">确定</button></view></view></u-popup><up-picker wx:if="{{B}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" bindconfirm="{{y}}" bindcancel="{{z}}" bindclose="{{A}}" u-i="06d9f81b-5" bind:__l="__l" u-p="{{B}}"></up-picker><up-picker wx:if="{{F}}" class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" bindconfirm="{{C}}" bindcancel="{{D}}" bindclose="{{E}}" u-i="06d9f81b-6" bind:__l="__l" u-p="{{F}}"></up-picker><tab-bar class="data-v-06d9f81b" virtualHostClass="data-v-06d9f81b" u-i="06d9f81b-7" bind:__l="__l"/></view>

View File

@@ -0,0 +1,140 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_identity = require("../../request/identity.js");
const utils_identitySwitch = require("../../utils/identitySwitch.js");
if (!Array) {
const _easycom_u_loading_icon2 = common_vendor.resolveComponent("u-loading-icon");
_easycom_u_loading_icon2();
}
const _easycom_u_loading_icon = () => "../../uni_modules/uview-plus/components/u-loading-icon/u-loading-icon.js";
if (!Math) {
_easycom_u_loading_icon();
}
const _sfc_main = {
__name: "identity",
setup(__props) {
const loading = common_vendor.ref(false);
const switchingId = common_vendor.ref(null);
const identityList = common_vendor.ref([]);
const currentIdentity = common_vendor.ref(null);
function unwrapIdentityData(res) {
if (!res)
return { identities: [], currentIdentity: null };
const data = res.data && typeof res.data === "object" ? res.data : res;
return {
identities: data.identities || [],
currentIdentity: data.currentIdentity || null
};
}
function getIdentityTitle(item) {
return item.identityName || item.roleName || "未命名身份";
}
function getIdentitySubtitle(item) {
const parts = [];
if (item.deptName)
parts.push(item.deptName);
if (item.roleName && item.roleName !== item.identityName)
parts.push(item.roleName);
return parts.join(" · ") || "-";
}
function isCurrentIdentity(item) {
if (item.current)
return true;
return currentIdentity.value && currentIdentity.value.identityId === item.identityId;
}
async function fetchIdentityList() {
loading.value = true;
try {
const res = await request_identity.getMyIdentity();
if (res.code === 0 || res.code === 200) {
const { identities, currentIdentity: current } = unwrapIdentityData(res);
identityList.value = identities;
currentIdentity.value = current;
} else {
identityList.value = [];
currentIdentity.value = null;
common_vendor.index.showToast({ title: res.msg || "获取身份列表失败", icon: "none" });
}
} catch (e) {
common_vendor.index.__f__("error", "at pages/personalcenter/identity.vue:123", "获取身份列表失败:", e);
identityList.value = [];
currentIdentity.value = null;
} finally {
loading.value = false;
}
}
async function handleSwitch(item) {
if (isCurrentIdentity(item) || switchingId.value)
return;
const identityName = getIdentityTitle(item);
const confirmMsg = `确认切换到「${identityName}」吗?切换后数据将按新身份刷新。`;
common_vendor.index.showModal({
title: "切换身份",
content: confirmMsg,
confirmText: "确认切换",
success: async (modalRes) => {
if (!modalRes.confirm)
return;
switchingId.value = item.identityId;
try {
await utils_identitySwitch.performIdentitySwitch(item.identityId);
utils_identitySwitch.reLaunchAfterSwitch();
} catch (e) {
common_vendor.index.__f__("error", "at pages/personalcenter/identity.vue:149", "身份切换失败:", e);
} finally {
switchingId.value = null;
}
}
});
}
common_vendor.onShow(() => {
fetchIdentityList();
});
return (_ctx, _cache) => {
return common_vendor.e({
a: currentIdentity.value
}, currentIdentity.value ? {
b: common_vendor.t(getIdentityTitle(currentIdentity.value)),
c: common_vendor.t(getIdentitySubtitle(currentIdentity.value))
} : {}, {
d: loading.value
}, loading.value ? {
e: common_vendor.p({
mode: "circle",
color: "#007aff"
})
} : !identityList.value.length ? {} : {
g: common_vendor.f(identityList.value, (item, k0, i0) => {
return common_vendor.e({
a: common_vendor.t(getIdentityTitle(item)),
b: isCurrentIdentity(item)
}, isCurrentIdentity(item) ? {} : {}, {
c: item.isDefault
}, item.isDefault ? {} : {}, {
d: common_vendor.t(item.deptName || "-"),
e: common_vendor.t(item.roleName || "-"),
f: common_vendor.t(item.roleKey || "-"),
g: item.postName
}, item.postName ? {
h: common_vendor.t(item.postName)
} : {}, {
i: common_vendor.t(isCurrentIdentity(item) ? "当前使用中" : "切换到此身份"),
j: isCurrentIdentity(item) ? 1 : "",
k: switchingId.value === item.identityId,
l: isCurrentIdentity(item) || !!switchingId.value,
m: common_vendor.o(($event) => handleSwitch(item), item.identityId),
n: item.identityId,
o: isCurrentIdentity(item) ? 1 : "",
p: item.isDefault ? 1 : ""
});
})
}, {
f: !identityList.value.length,
h: common_vendor.gei(_ctx, "")
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-a3555b62"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/personalcenter/identity.js.map

View File

@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "切换身份",
"usingComponents": {
"u-loading-icon": "../../uni_modules/uview-plus/components/u-loading-icon/u-loading-icon"
}
}

View File

@@ -0,0 +1 @@
<view class="{{['page', 'data-v-a3555b62', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{h}}"><view wx:if="{{a}}" class="current-banner data-v-a3555b62"><view class="banner-label data-v-a3555b62">当前生效身份</view><view class="banner-name data-v-a3555b62">{{b}}</view><view class="banner-sub data-v-a3555b62">{{c}}</view></view><view wx:if="{{d}}" class="state-box data-v-a3555b62"><u-loading-icon wx:if="{{e}}" class="data-v-a3555b62" virtualHostClass="data-v-a3555b62" u-i="a3555b62-0" bind:__l="__l" u-p="{{e}}"></u-loading-icon><text class="state-text data-v-a3555b62">加载中...</text></view><view wx:elif="{{f}}" class="state-box data-v-a3555b62"><text class="state-text data-v-a3555b62">暂无可用身份</text></view><view wx:else class="identity-list data-v-a3555b62"><view wx:for="{{g}}" wx:for-item="item" wx:key="n" class="{{['identity-card', 'data-v-a3555b62', item.o && 'is-current', item.p && 'is-default']}}"><view class="card-header data-v-a3555b62"><view class="card-title data-v-a3555b62">{{item.a}}</view><view class="card-tags data-v-a3555b62"><view wx:if="{{item.b}}" class="tag tag-current data-v-a3555b62">当前使用</view><view wx:if="{{item.c}}" class="tag tag-default data-v-a3555b62">默认</view></view></view><view class="info-list data-v-a3555b62"><view class="info-row data-v-a3555b62"><text class="info-label data-v-a3555b62">所属部门</text><text class="info-value data-v-a3555b62">{{item.d}}</text></view><view class="info-row data-v-a3555b62"><text class="info-label data-v-a3555b62">所属角色</text><text class="info-value data-v-a3555b62">{{item.e}}</text></view><view class="info-row data-v-a3555b62"><text class="info-label data-v-a3555b62">角色标识</text><text class="info-value data-v-a3555b62">{{item.f}}</text></view><view wx:if="{{item.g}}" class="info-row data-v-a3555b62"><text class="info-label data-v-a3555b62">所属岗位</text><text class="info-value data-v-a3555b62">{{item.h}}</text></view></view><button class="{{['switch-btn', 'data-v-a3555b62', item.j && 'switch-btn--disabled']}}" loading="{{item.k}}" disabled="{{item.l}}" bindtap="{{item.m}}">{{item.i}}</button></view></view></view>

View File

@@ -0,0 +1,159 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page.data-v-a3555b62 {
min-height: 100vh;
background: #f4f7fb;
padding: 24rpx;
padding-bottom: 48rpx;
}
.current-banner.data-v-a3555b62 {
background: linear-gradient(135deg, #3e95f1 0%, #4269f5 100%);
border-radius: 20rpx;
padding: 32rpx;
margin-bottom: 24rpx;
color: #fff;
}
.current-banner .banner-label.data-v-a3555b62 {
font-size: 24rpx;
opacity: 0.85;
}
.current-banner .banner-name.data-v-a3555b62 {
font-size: 34rpx;
font-weight: bold;
margin-top: 12rpx;
}
.current-banner .banner-sub.data-v-a3555b62 {
font-size: 26rpx;
opacity: 0.9;
margin-top: 8rpx;
}
.state-box.data-v-a3555b62 {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 120rpx 0;
}
.state-box .state-text.data-v-a3555b62 {
margin-top: 24rpx;
font-size: 28rpx;
color: #999;
}
.identity-list.data-v-a3555b62 {
display: flex;
flex-direction: column;
gap: 24rpx;
}
.identity-card.data-v-a3555b62 {
background: #fff;
border-radius: 20rpx;
padding: 32rpx;
border: 2rpx solid transparent;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
}
.identity-card.is-current.data-v-a3555b62 {
border-color: #67c23a;
}
.identity-card.is-default.data-v-a3555b62 {
border-color: #e6a23c;
}
.identity-card.is-current.is-default.data-v-a3555b62 {
border-color: #67c23a;
}
.card-header.data-v-a3555b62 {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16rpx;
margin-bottom: 24rpx;
}
.card-title.data-v-a3555b62 {
flex: 1;
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.card-tags.data-v-a3555b62 {
display: flex;
flex-wrap: wrap;
gap: 8rpx;
flex-shrink: 0;
}
.tag.data-v-a3555b62 {
font-size: 22rpx;
padding: 4rpx 12rpx;
border-radius: 8rpx;
}
.tag-current.data-v-a3555b62 {
background: #e8f8ef;
color: #67c23a;
}
.tag-default.data-v-a3555b62 {
background: #fdf6ec;
color: #e6a23c;
}
.info-list.data-v-a3555b62 {
margin-bottom: 28rpx;
}
.info-row.data-v-a3555b62 {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 16rpx 0;
border-bottom: 1rpx dashed #eee;
font-size: 28rpx;
}
.info-row.data-v-a3555b62:last-child {
border-bottom: none;
}
.info-label.data-v-a3555b62 {
color: #999;
flex-shrink: 0;
margin-right: 24rpx;
}
.info-value.data-v-a3555b62 {
color: #333;
text-align: right;
word-break: break-all;
}
.switch-btn.data-v-a3555b62 {
width: 100%;
height: 80rpx;
line-height: 80rpx;
background: linear-gradient(90deg, #3e95f1 0%, #4269f5 100%);
color: #fff;
font-size: 30rpx;
border-radius: 40rpx;
border: none;
}
.switch-btn.data-v-a3555b62::after {
border: none;
}
.switch-btn--disabled.data-v-a3555b62 {
background: #e8e8e8;
color: #999;
}

View File

@@ -93,6 +93,13 @@ function getHazardDetail(hazardId) {
method: "GET"
});
}
function getHazardProcessChain(hazardId) {
return request_request.requestAPI({
url: "/frontend/hazard/process-chain",
method: "GET",
data: { hazardId }
});
}
function getHiddenDangerList(params) {
return request_request.requestAPI({
url: "/frontend/hazard/my/list",
@@ -114,6 +121,13 @@ function getRectifyDetail(params) {
data: params
});
}
function updateRectification(params) {
return request_request.requestAPI({
url: "/frontend/hazard/rectify/update",
method: "POST",
data: params
});
}
function getHiddenDangerLabelList() {
return request_request.requestAPI({
url: "/frontend/hazard/tag/list",
@@ -147,13 +161,6 @@ function getMemberList(params) {
data: params
});
}
function lockOrUnlockMember(params) {
return request_request.requestAPI({
url: "/frontend/member/lock",
method: "POST",
data: params
});
}
function getSystemUserFormOptions() {
return request_request.requestAPI({
url: "/system/user/",
@@ -175,13 +182,6 @@ function applyDelete(params) {
data: params
});
}
function getAcceptanceList(params) {
return request_request.requestAPI({
url: "/frontend/hazard/verified/list",
method: "GET",
data: params
});
}
function getMyWriteOffList(params) {
return request_request.requestAPI({
url: "/frontend/hazard/writeoff/my/list",
@@ -195,6 +195,30 @@ function getWriteOffApplyDetail(applyId) {
method: "GET"
});
}
function getWriteoffForm(hazardId) {
return request_request.requestAPI({
url: "/frontend/hazard/writeoff/form",
method: "GET",
data: { hazardId }
});
}
function writeoffApprove(params) {
return request_request.requestAPI({
url: "/admin/hazard/writeoff/approve",
method: "POST",
data: {
...params,
type: "agree"
}
});
}
function writeoffReject(params) {
return request_request.requestAPI({
url: "/admin/hazard/writeoff/reject",
method: "POST",
data: params
});
}
function acceptanceRectification(params) {
return request_request.requestAPI({
url: "/frontend/hazard/verify",
@@ -304,10 +328,18 @@ function getCheckItemListDetail(params) {
data: params
});
}
function getDeptUsers(deptId) {
function getDeptUsers(deptId, params = {}) {
return request_request.requestAPI({
url: deptId ? `/admin/user/dept/users/${deptId}` : "/admin/user/dept/users",
method: "GET"
method: "GET",
data: params
});
}
function getFlowApproverCandidates(taskId) {
return request_request.requestAPI({
url: "/admin/user/flow/approver-candidates",
method: "GET",
data: { taskId }
});
}
function getDeptChildren() {
@@ -347,6 +379,36 @@ function generateWriteoffContent(params) {
loadingText: "AI生成销号方案中"
});
}
function getFlowNextNodes(params) {
return request_request.requestAPI({
url: "/flow/task/next-nodes",
method: "POST",
data: params,
loadingText: false
});
}
function flowTaskApprove(params) {
return request_request.requestAPI({
url: "/flow/task/approve",
method: "POST",
data: params,
loadingText: false
});
}
function getFlowTodoList(params) {
return request_request.requestAPI({
url: "/frontend/flow/todo",
method: "GET",
data: params
});
}
function getFlowDoneList(params) {
return request_request.requestAPI({
url: "/frontend/flow/done",
method: "GET",
data: params
});
}
exports.acceptanceRectification = acceptanceRectification;
exports.addCheckPoint = addCheckPoint;
exports.addCheckTable = addCheckTable;
@@ -359,9 +421,9 @@ exports.assignHiddenDanger = assignHiddenDanger;
exports.deleteCheckPoint = deleteCheckPoint;
exports.detailcheckPoint = detailcheckPoint;
exports.enterCheckPlan = enterCheckPlan;
exports.flowTaskApprove = flowTaskApprove;
exports.generateRectifyPlan = generateRectifyPlan;
exports.generateWriteoffContent = generateWriteoffContent;
exports.getAcceptanceList = getAcceptanceList;
exports.getAllTask = getAllTask;
exports.getCheckItemList = getCheckItemList;
exports.getCheckItemListDetail = getCheckItemListDetail;
@@ -372,7 +434,12 @@ exports.getDeptChildren = getDeptChildren;
exports.getDeptUsers = getDeptUsers;
exports.getEnterpriseinfo = getEnterpriseinfo;
exports.getEnterprisetype = getEnterprisetype;
exports.getFlowApproverCandidates = getFlowApproverCandidates;
exports.getFlowDoneList = getFlowDoneList;
exports.getFlowNextNodes = getFlowNextNodes;
exports.getFlowTodoList = getFlowTodoList;
exports.getHazardDetail = getHazardDetail;
exports.getHazardProcessChain = getHazardProcessChain;
exports.getHazardSourceList = getHazardSourceList;
exports.getHiddenDangerDetail = getHiddenDangerDetail;
exports.getHiddenDangerLabelList = getHiddenDangerLabelList;
@@ -389,12 +456,15 @@ exports.getRegulationList = getRegulationList;
exports.getRelatedDeptUsers = getRelatedDeptUsers;
exports.getSystemUserFormOptions = getSystemUserFormOptions;
exports.getWriteOffApplyDetail = getWriteOffApplyDetail;
exports.getWriteoffForm = getWriteoffForm;
exports.getindustry = getindustry;
exports.listPostByDeptId = listPostByDeptId;
exports.lockOrUnlockMember = lockOrUnlockMember;
exports.login = login;
exports.submitAllTask = submitAllTask;
exports.submitCheckResult = submitCheckResult;
exports.submitRectification = submitRectification;
exports.updateEnterprise = updateEnterprise;
exports.updateRectification = updateRectification;
exports.writeoffApprove = writeoffApprove;
exports.writeoffReject = writeoffReject;
//# sourceMappingURL=../../.sourcemap/mp-weixin/request/api.js.map

View File

@@ -0,0 +1,18 @@
"use strict";
const request_request = require("./request.js");
function getMyIdentity() {
return request_request.requestAPI({
url: "/system/identity/my",
method: "GET"
});
}
function switchIdentity(identityId) {
return request_request.requestAPI({
url: "/system/identity/switch",
method: "POST",
data: { identityId }
});
}
exports.getMyIdentity = getMyIdentity;
exports.switchIdentity = switchIdentity;
//# sourceMappingURL=../../.sourcemap/mp-weixin/request/identity.js.map

View File

@@ -1,7 +1,7 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const request_luchRequest_core_Request = require("./luch-request/core/Request.js");
const baseUrl = "http://192.168.1.140:5004";
const baseUrl = "https://yingji.hexieapi.com/prod-api";
const imageBaseUrl = baseUrl.replace(/\/prod-api\/?$/, "");
new request_luchRequest_core_Request.Request({
baseURL: baseUrl,

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -66,5 +66,6 @@ const install = (Vue, upuiParams = "") => {
const uviewPlus = {
install
};
exports.setConfig = setConfig;
exports.uviewPlus = uviewPlus;
//# sourceMappingURL=../../../.sourcemap/mp-weixin/uni_modules/uview-plus/index.js.map

View File

@@ -0,0 +1,398 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
if (!Array) {
const _component_TransitionGroup = common_vendor.resolveComponent("TransitionGroup");
_component_TransitionGroup();
}
const _sfc_main = {
__name: "xq-tree",
props: {
data: { type: Array, default: () => [] },
nodeKey: { type: String, default: "id" },
labelKey: { type: String, default: "label" },
childrenKey: { type: String, default: "children" },
indent: { type: Number, default: 20 },
showCheckbox: { type: Boolean, default: false },
defaultExpandAll: { type: Boolean, default: false },
defaultExpandedKeys: { type: Array, default: () => [] },
defaultCheckedKeys: { type: Array, default: () => [] },
checkStrictly: { type: Boolean, default: true },
// 是否严格模式(父子互不关联)
emptyText: { type: String, default: "暂无数据" },
checkedKey: {
// 节点的 checked 状态字段名
type: String,
default: "_checked"
},
accordion: {
// 手风琴
type: Boolean,
default: false
},
multiple: {
// 多选
type: Boolean,
default: false
},
isDeepExpand: {
// 方法是否深层展开
type: Boolean,
default: true
},
height: { type: Number, default: 500 },
width: { type: Number, default: 300 },
labelSlot: {
// 微信小程序不适用插槽的时候就不要打开了,真的无语了
type: Boolean,
default: false
}
},
emits: ["node-click", "node-expand", "node-collapse", "check-change", "check"],
setup(__props, { expose: __expose, emit: __emit }) {
const props = __props;
const emit = __emit;
const getNodeKey = (node) => node[props.nodeKey];
function hasChildren(node) {
const children = node[props.childrenKey];
return children && Array.isArray(children) && children.length > 0;
}
const expandedState = common_vendor.reactive({});
function initExpanded() {
Object.keys(expandedState).forEach((k) => delete expandedState[k]);
if (props.defaultExpandAll) {
const setAll = (list) => {
list.forEach((item) => {
expandedState[getNodeKey(item)] = true;
const children = item[props.childrenKey];
if (children)
setAll(children);
});
};
setAll(props.data);
} else if (props.defaultExpandedKeys.length) {
props.defaultExpandedKeys.forEach((key) => {
expandedState[key] = true;
});
}
}
initExpanded();
common_vendor.watch(() => props.data, initExpanded, { deep: false });
const flatData = common_vendor.computed(() => {
const result = [];
const flatten = (list, level = 0, parent = null) => {
if (!(list == null ? void 0 : list.length))
return;
list.forEach((node, idx) => {
const key = getNodeKey(node);
const expanded = !!expandedState[key];
const _node = common_vendor.reactive({
...node,
_level: level,
_expanded: expanded,
[props.checkedKey]: false,
_indeterminate: false,
_parent: parent,
_siblingIndex: idx,
// 关键:同级索引
raw: node
});
result.push(_node);
if (expanded && hasChildren(node)) {
flatten(node[props.childrenKey], level + 1, _node);
}
});
};
flatten(props.data);
return result;
});
const checkedKeys = common_vendor.reactive(/* @__PURE__ */ new Set());
common_vendor.watch(() => props.defaultCheckedKeys, (keys) => {
checkedKeys.clear();
keys.forEach((k) => checkedKeys.add(k));
}, { immediate: true });
function updateCheckedState() {
if (props.checkStrictly) {
flatData.value.forEach((node) => {
const key = getNodeKey(node);
node[props.checkedKey] = checkedKeys.has(key);
node._indeterminate = false;
});
return;
}
const flatNodeMap = /* @__PURE__ */ new Map();
flatData.value.forEach((n) => flatNodeMap.set(getNodeKey(n), n));
const syncRecursive = (node) => {
if (!node)
return { checked: false, indeterminate: false };
const children = node[props.childrenKey] || [];
let allChildrenChecked = true;
let hasCheckedChild = false;
let hasIndeterminateChild = false;
for (const child of children) {
const childResult = syncRecursive(child);
if (!childResult.checked)
allChildrenChecked = false;
if (childResult.checked)
hasCheckedChild = true;
if (childResult.indeterminate)
hasIndeterminateChild = true;
}
const nodeKey = getNodeKey(node);
let finalChecked, finalIndeterminate;
if (children.length === 0) {
finalChecked = checkedKeys.has(nodeKey);
finalIndeterminate = false;
} else {
if (allChildrenChecked && children.length > 0) {
checkedKeys.add(nodeKey);
finalChecked = true;
finalIndeterminate = false;
} else if (hasCheckedChild || hasIndeterminateChild) {
checkedKeys.delete(nodeKey);
finalChecked = false;
finalIndeterminate = true;
} else {
checkedKeys.delete(nodeKey);
finalChecked = false;
finalIndeterminate = false;
}
}
if (flatNodeMap.has(nodeKey)) {
const flatNode = flatNodeMap.get(nodeKey);
flatNode[props.checkedKey] = finalChecked;
flatNode._indeterminate = finalIndeterminate;
}
return { checked: finalChecked, indeterminate: finalIndeterminate };
};
props.data.forEach((root) => syncRecursive(root));
}
function handleCheck(node) {
const key = getNodeKey(node);
if (props.checkStrictly) {
if (checkedKeys.has(key)) {
checkedKeys.delete(key);
} else {
checkedKeys.add(key);
}
updateCheckedState();
emit("check-change", node, checkedKeys.has(key));
emit("check", node, { checkedKeys: [...checkedKeys] });
return;
}
const shouldCheck = !checkedKeys.has(key);
const toggleRecursive = (n) => {
const nKey = getNodeKey(n);
if (shouldCheck) {
checkedKeys.add(nKey);
} else {
checkedKeys.delete(nKey);
}
const children = n[props.childrenKey] || [];
children.forEach((child) => toggleRecursive(child));
};
toggleRecursive(node);
updateCheckedState();
emit("check-change", node, shouldCheck);
emit("check", node, { checkedKeys: [...checkedKeys] });
}
function toggleExpand(node) {
const key = getNodeKey(node);
const wasExpanded = expandedState[key];
if (wasExpanded) {
delete expandedState[key];
emit("node-collapse", node);
} else {
if (props.accordion) {
const siblings = node._parent ? node._parent[props.childrenKey] || [] : props.data;
siblings.forEach((sib) => {
const sibKey = getNodeKey(sib);
if (sibKey !== key && expandedState[sibKey]) {
delete expandedState[sibKey];
}
});
}
expandedState[key] = true;
emit("node-expand", node);
}
common_vendor.nextTick$1(() => updateCheckedState());
}
function handleNodeClick(node) {
emit("node-click", node);
}
const getCheckedKeys = () => [...checkedKeys];
const getCheckedNodes = () => flatData.value.filter((n) => n[props.checkedKey]).map((n) => n.raw);
function setCheckedKeys(keys) {
checkedKeys.clear();
keys.forEach((k) => checkedKeys.add(k));
updateCheckedState();
}
function expandAll() {
if (!props.isDeepExpand) {
flatData.value.forEach((node) => {
const key = getNodeKey(node);
if (hasChildren(node))
expandedState[key] = true;
});
} else {
const expandRecursively = (list) => {
if (!(list == null ? void 0 : list.length))
return;
list.forEach((item) => {
if (hasChildren(item)) {
expandedState[getNodeKey(item)] = true;
expandRecursively(item[props.childrenKey]);
}
});
};
expandRecursively(props.data);
}
common_vendor.nextTick$1(() => updateCheckedState());
}
function collapseAll() {
Object.keys(expandedState).forEach((k) => delete expandedState[k]);
common_vendor.nextTick$1(() => updateCheckedState());
}
function clearChecked() {
checkedKeys.clear();
updateCheckedState();
}
function resolveKeyAndNode(keyOrNode) {
let key, node;
if (typeof keyOrNode === "object" && keyOrNode !== null) {
node = keyOrNode;
key = getNodeKey(node);
} else {
node = findNodeByKey(keyOrNode, props.data);
if (node) {
key = getNodeKey(node);
} else {
key = keyOrNode;
}
}
return { key, node };
}
function findNodeByKey(key, list) {
if (!list)
return null;
for (const item of list) {
const itemKey = getNodeKey(item);
if (itemKey === key)
return item;
if (typeof itemKey === "number" && itemKey === Number(key))
return item;
if (typeof itemKey === "string" && itemKey === String(key))
return item;
const found = findNodeByKey(key, item[props.childrenKey]);
if (found)
return found;
}
return null;
}
function setNodeChecked(keyOrNode, checked) {
const { key, node } = resolveKeyAndNode(keyOrNode);
if (!key)
return;
if (checked) {
checkedKeys.add(key);
} else {
checkedKeys.delete(key);
}
if (!props.checkStrictly && node && hasChildren(node)) {
const toggleChildren = (children) => {
if (!children)
return;
children.forEach((child) => {
const childKey = getNodeKey(child);
if (checked) {
checkedKeys.add(childKey);
} else {
checkedKeys.delete(childKey);
}
toggleChildren(child[props.childrenKey]);
});
};
toggleChildren(node[props.childrenKey]);
}
updateCheckedState();
emit("check-change", node || key, checked);
emit("check", node || key, { checkedKeys: [...checkedKeys] });
}
function checkAll() {
const selectAllNodes = (list) => {
if (!(list == null ? void 0 : list.length))
return;
list.forEach((item) => {
checkedKeys.add(getNodeKey(item));
if (hasChildren(item)) {
selectAllNodes(item[props.childrenKey]);
}
});
};
selectAllNodes(props.data);
updateCheckedState();
emit("check", null, { checkedKeys: [...checkedKeys] });
}
__expose({ getCheckedKeys, getCheckedNodes, setCheckedKeys, expandAll, collapseAll, clearChecked, setNodeChecked, checkAll });
updateCheckedState();
return (_ctx, _cache) => {
return common_vendor.e({
a: flatData.value.length === 0
}, flatData.value.length === 0 ? {
b: common_vendor.t(__props.emptyText)
} : {
c: common_vendor.f(flatData.value, (node, index, i0) => {
return common_vendor.e({
a: hasChildren(node)
}, hasChildren(node) ? {
b: node._expanded ? 1 : ""
} : {}, {
c: common_vendor.o(($event) => toggleExpand(node), node[__props.nodeKey] || index)
}, __props.showCheckbox ? common_vendor.e({
d: node[__props.checkedKey]
}, node[__props.checkedKey] ? {} : node._indeterminate ? {} : {}, {
e: node._indeterminate,
f: common_vendor.n({
checked: node[__props.checkedKey],
indeterminate: node._indeterminate
}),
g: common_vendor.o(($event) => handleCheck(node), node[__props.nodeKey] || index)
}) : {}, __props.labelSlot ? {
h: "node-" + i0,
i: common_vendor.r("node", {
node,
data: node,
level: node._level,
expanded: node._expanded,
checked: node[__props.checkedKey],
indeterminate: node._indeterminate
}, i0)
} : {
j: common_vendor.t(node[__props.labelKey])
}, {
k: common_vendor.o(($event) => handleNodeClick(node), node[__props.nodeKey] || index),
l: node[__props.nodeKey] || index,
m: common_vendor.n({
"is-expanded": node._expanded,
"is-leaf": !hasChildren(node)
}),
n: `${(node._level || 0) * __props.indent}px`,
o: `${(node._siblingIndex || 0) * 0.03}s`
});
}),
d: __props.showCheckbox,
e: __props.labelSlot,
f: common_vendor.p({
name: "tree-node",
tag: "view"
})
}, {
g: `${__props.width}rpx`,
h: `${__props.height}rpx`,
i: common_vendor.gei(_ctx, "")
});
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e21fa87f"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/xq-tree/components/xq-tree/xq-tree.js.map

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<scroll-view scroll-x scroll-y enable-flex class="{{['tree-wrapper', 'data-v-e21fa87f', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}" id="{{i}}"><view class="xq-tree-scroll data-v-e21fa87f"><view class="xq-tree data-v-e21fa87f" style="{{'min-width:' + g + ';' + ('min-height:' + h)}}"><view wx:if="{{a}}" class="xq-tree-empty data-v-e21fa87f">{{b}}</view><transition-group wx:else u-s="{{['d']}}" class="xq-tree-list data-v-e21fa87f" virtualHostClass="xq-tree-list data-v-e21fa87f" u-i="e21fa87f-0" bind:__l="__l" u-p="{{f||''}}"><view wx:for="{{c}}" wx:for-item="node" wx:key="l" class="{{['xq-tree-node', 'data-v-e21fa87f', node.m]}}" style="{{'padding-left:' + node.n + ';' + ('animation-delay:' + node.o)}}"><view class="xq-tree-node-content data-v-e21fa87f" bindtap="{{node.k}}"><view class="xq-tree-node-icon data-v-e21fa87f" catchtap="{{node.c}}"><text wx:if="{{node.a}}" class="{{['icon-arrow', 'data-v-e21fa87f', node.b && 'is-expanded']}}"> ▶ </text><view wx:else class="leaf-icon-placeholder data-v-e21fa87f"></view></view><view wx:if="{{d}}" class="xq-tree-node-checkbox data-v-e21fa87f" catchtap="{{node.g}}"><view class="{{['checkbox-custom', 'data-v-e21fa87f', node.f]}}"><text wx:if="{{node.d}}" class="data-v-e21fa87f"> ✓ </text><text wx:elif="{{node.e}}" class="data-v-e21fa87f"> — </text></view></view><slot wx:if="{{e}}" name="{{node.h}}"/><text wx:else class="xq-tree-node-label data-v-e21fa87f">{{node.j}}</text></view></view></transition-group></view></view></scroll-view>

View File

@@ -0,0 +1,191 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* uni.scss */
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.xq-tree.data-v-e21fa87f {
display: inline-block;
/* ⚠️ 关键:宽度由内容撑开,不继承父容器宽度 */
/* 内容不换行 */
/* 至少撑满容器 */
box-sizing: border-box;
width: -webkit-max-content;
width: max-content;
/* 宽度由内容决定,不换行 */
white-space: nowrap;
}
.tree-wrapper.data-v-e21fa87f {
width: 100%;
height: 100%;
/* 确保节点不换行 */
}
.xq-tree-scroll.data-v-e21fa87f {
display: inline-block;
/* ⚠️ 关键:宽度由内容撑开,不继承父容器宽度 */
white-space: nowrap;
/* 内容不换行 */
min-width: 100%;
/* 至少撑满容器 */
box-sizing: border-box;
background-color: #fff;
padding: 16rpx;
}
/* 小程序下 scroll-view 的滚动条样式由原生控制通常无法自定义H5 端同样可用 ::-webkit-scrollbar */
/* 下面的样式仅对 H5 端生效 */
.tree-wrapper.data-v-e21fa87f::-webkit-scrollbar {
height: 8rpx;
width: 8rpx;
}
.tree-wrapper.data-v-e21fa87f::-webkit-scrollbar-track {
background: #f1f1f1;
}
.tree-wrapper.data-v-e21fa87f::-webkit-scrollbar-thumb {
background: #888;
border-radius: 4rpx;
}
.tree-node-enter-active.data-v-e21fa87f {
animation: treeExpandIn-e21fa87f 0.3s ease-out both;
}
.tree-node-leave-active.data-v-e21fa87f {
animation: treeCollapseOut-e21fa87f 0.3s ease-in both;
overflow: hidden;
}
.tree-node-leave-to.data-v-e21fa87f {
max-height: 0;
padding-top: 0;
padding-bottom: 0;
opacity: 0;
}
@keyframes treeExpandIn-e21fa87f {
0% {
max-height: 0;
opacity: 0;
padding-top: 0;
padding-bottom: 0;
}
100% {
max-height: 500px;
opacity: 1;
padding-top: 8rpx;
padding-bottom: 8rpx;
}
}
@keyframes treeCollapseOut-e21fa87f {
0% {
max-height: 500px;
opacity: 1;
padding-top: 8rpx;
padding-bottom: 8rpx;
}
100% {
max-height: 0;
opacity: 0;
padding-top: 0;
padding-bottom: 0;
}
}
.xq-tree-node.data-v-e21fa87f {
padding: 8rpx 0;
overflow: hidden;
transform-origin: top;
}
.xq-tree.data-v-e21fa87f {
width: 100%;
}
.xq-tree-empty.data-v-e21fa87f {
padding: 40rpx;
text-align: center;
color: #999;
}
.xq-tree-node.data-v-e21fa87f {
padding: 8rpx 0;
}
.xq-tree-node-content.data-v-e21fa87f {
display: flex;
align-items: center;
}
.xq-tree-node-icon.data-v-e21fa87f {
width: 40rpx;
text-align: center;
flex-shrink: 0;
}
.xq-tree-node-checkbox.data-v-e21fa87f {
margin-right: 12rpx;
flex-shrink: 0;
}
.xq-tree-node-label.data-v-e21fa87f {
flex: 1;
white-space: nowrap;
}
.checkbox-custom.data-v-e21fa87f {
width: 32rpx;
height: 32rpx;
border: 2rpx solid #ccc;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4rpx;
}
.checkbox-custom.checked.data-v-e21fa87f {
background-color: #007aff;
border-color: #007aff;
color: #fff;
}
.checkbox-custom.indeterminate.data-v-e21fa87f {
background-color: #007aff;
border-color: #007aff;
color: #fff;
}
.leaf-icon-placeholder.data-v-e21fa87f {
width: 100%;
height: 100%;
}
.uni-icon-warp.data-v-e21fa87f {
display: inline-flex;
align-items: center;
justify-content: center;
width: 40rpx;
height: 40rpx;
}
.icon-arrow.is-expanded.data-v-e21fa87f {
transform: rotate(90deg);
}
.icon-arrow.data-v-e21fa87f {
display: inline-block;
transition: transform 0.3s ease;
}
page.data-v-e21fa87f {
box-sizing: border-box;
}
view.data-v-e21fa87f,
text.data-v-e21fa87f,
image.data-v-e21fa87f,
button.data-v-e21fa87f,
input.data-v-e21fa87f,
textarea.data-v-e21fa87f,
navigator.data-v-e21fa87f,
scroll-view.data-v-e21fa87f {
box-sizing: border-box;
}

View File

@@ -3,6 +3,7 @@ const common_vendor = require("../common/vendor.js");
const DRAFT_NS = {
ASSIGN: "draft_assign",
ACCEPT: "draft_accept",
ACCEPT_APPROVAL: "draft_accept_approval",
RECTIFY: "draft_rectify",
INSPECTION_RESULT: "draft_inspection_result",
INSPECTION_SHEET: "draft_inspection_sheet",
@@ -38,7 +39,7 @@ function loadDraft(key) {
try {
return typeof raw === "string" ? JSON.parse(raw) : raw;
} catch (error) {
common_vendor.index.__f__("error", "at utils/draftCache.js:62", "[draftCache] 解析草稿失败:", key, error);
common_vendor.index.__f__("error", "at utils/draftCache.js:63", "[draftCache] 解析草稿失败:", key, error);
return null;
}
}

View File

@@ -0,0 +1,181 @@
"use strict";
function resolveItemTaskId(item) {
if (!item)
return "";
const id = item.taskId ?? item.flowTaskId ?? item.currentTaskId ?? "";
return id === "" || id == null ? "" : String(id);
}
function resolveAssigneeIdentityId(item) {
if (!item)
return "";
return item.assigneeIdentityId ?? item.identityId ?? "";
}
function appendAssigneeQuery(url, item) {
if (!item)
return url;
let result = url;
if (item.assigneeId) {
result += `&assigneeId=${item.assigneeId}`;
}
const assigneeIdentityId = resolveAssigneeIdentityId(item);
if (assigneeIdentityId) {
result += `&assigneeIdentityId=${assigneeIdentityId}`;
}
if (item.assigneeName) {
result += `&assigneeName=${encodeURIComponent(item.assigneeName)}`;
}
return result;
}
function buildRectificationUrl(item) {
let url = `/pages/hiddendanger/rectification?hazardId=${item.hazardId}&assignId=${item.assignId || ""}`;
if (item.taskId) {
url += `&taskId=${encodeURIComponent(item.taskId)}`;
}
if (item.deadline) {
url += `&deadline=${encodeURIComponent(item.deadline)}`;
}
return appendAssigneeQuery(url, item);
}
function buildEditRectificationUrl(item) {
let url = `/pages/hiddendanger/rectification?rectifyId=${item.rectifyId}&isEdit=1`;
if (item.hazardId) {
url += `&hazardId=${item.hazardId}`;
}
if (item.assignId) {
url += `&assignId=${item.assignId}`;
}
if (item.taskId) {
url += `&taskId=${encodeURIComponent(item.taskId)}`;
}
return url;
}
function buildAcceptanceUrl(item) {
let url = `/pages/hiddendanger/acceptance?hazardId=${item.hazardId}&assignId=${item.assignId || ""}&rectifyId=${item.rectifyId || ""}`;
if (item.taskId) {
url += `&taskId=${encodeURIComponent(item.taskId)}`;
}
return url;
}
function buildAcceptanceApprovalUrl(item) {
let url = `/pages/hiddendanger/acceptance-approval?hazardId=${item.hazardId}&assignId=${item.assignId || ""}&rectifyId=${item.rectifyId || ""}`;
if (item.taskId) {
url += `&taskId=${encodeURIComponent(item.taskId)}`;
}
if (item.taskKey) {
url += `&taskKey=${encodeURIComponent(item.taskKey)}`;
}
return url;
}
function buildAssignmentUrl(item) {
let url = `/pages/hiddendanger/assignment?hazardId=${item.hazardId}&assignId=${item.assignId || ""}`;
const taskId = resolveItemTaskId(item);
if (taskId) {
url += `&taskId=${encodeURIComponent(taskId)}`;
}
return url;
}
function buildWriteoffApplyUrl(item) {
let url = `/pages/closeout/apply?hazardId=${item.hazardId}&locked=1`;
if (item.assignId) {
url += `&assignId=${item.assignId}`;
}
if (item.taskId) {
url += `&taskId=${encodeURIComponent(item.taskId)}`;
}
return appendWriteoffHazardQuery(url, item);
}
function buildWriteoffApprovalUrl(item) {
let url = `/pages/closeout/approval?hazardId=${item.hazardId}&locked=1`;
if (item.assignId) {
url += `&assignId=${item.assignId}`;
}
if (item.taskId) {
url += `&taskId=${encodeURIComponent(item.taskId)}`;
}
return appendWriteoffHazardQuery(url, item);
}
function buildLeaderWriteoffApprovalUrl(item) {
let url = `/pages/closeout/leader-approval?hazardId=${item.hazardId}&locked=1`;
if (item.assignId) {
url += `&assignId=${item.assignId}`;
}
if (item.taskId) {
url += `&taskId=${encodeURIComponent(item.taskId)}`;
}
if (item.taskKey) {
url += `&taskKey=${encodeURIComponent(item.taskKey)}`;
}
return appendWriteoffHazardQuery(url, item);
}
const decodeQueryValue = (value) => {
if (value == null || value === "")
return "";
try {
return decodeURIComponent(String(value));
} catch (error) {
return String(value);
}
};
function appendWriteoffHazardQuery(url, item) {
if (!item)
return url;
let result = url;
const title = item.title || item.hazardTitle;
if (title) {
result += `&title=${encodeURIComponent(title)}`;
}
if (item.deadline) {
result += `&deadline=${encodeURIComponent(item.deadline)}`;
}
if (item.deptName) {
result += `&deptName=${encodeURIComponent(item.deptName)}`;
}
if (item.deptId != null && item.deptId !== "") {
result += `&deptId=${item.deptId}`;
}
if (item.rectifierName) {
result += `&rectifierName=${encodeURIComponent(item.rectifierName)}`;
}
return result;
}
function buildWriteoffHazardFromOptions(options) {
if (!(options == null ? void 0 : options.hazardId))
return null;
return {
hazardId: options.hazardId,
assignId: options.assignId || "",
taskId: options.taskId || "",
title: decodeQueryValue(options.title),
hazardTitle: decodeQueryValue(options.title),
deadline: decodeQueryValue(options.deadline),
deptName: decodeQueryValue(options.deptName),
deptId: options.deptId || "",
rectifierName: decodeQueryValue(options.rectifierName)
};
}
const isTruthyFlag = (value) => value === true || value === 1 || value === "1";
function canShowAcceptanceButton(item, roleKey) {
const canAcceptance = roleKey === "admin" || roleKey === "manage";
const nodeType = item == null ? void 0 : item.nodeType;
const canAcceptByNodeType = nodeType == null || nodeType === 1 || nodeType === "1" || nodeType === 2 || nodeType === "2" || nodeType === 3 || nodeType === "3";
return (item == null ? void 0 : item.statusName) === "待验收" && canAcceptance && canAcceptByNodeType;
}
function canShowWriteoffApplyButton(item) {
return (item == null ? void 0 : item.statusName) === "待销号" && isTruthyFlag(item == null ? void 0 : item.applyFlag);
}
function canShowWriteoffApprovalButton(item, roleKey) {
return (item == null ? void 0 : item.statusName) === "待销号" && roleKey === "manage" && isTruthyFlag(item == null ? void 0 : item.writeOffFlag);
}
exports.buildAcceptanceApprovalUrl = buildAcceptanceApprovalUrl;
exports.buildAcceptanceUrl = buildAcceptanceUrl;
exports.buildAssignmentUrl = buildAssignmentUrl;
exports.buildEditRectificationUrl = buildEditRectificationUrl;
exports.buildLeaderWriteoffApprovalUrl = buildLeaderWriteoffApprovalUrl;
exports.buildRectificationUrl = buildRectificationUrl;
exports.buildWriteoffApplyUrl = buildWriteoffApplyUrl;
exports.buildWriteoffApprovalUrl = buildWriteoffApprovalUrl;
exports.buildWriteoffHazardFromOptions = buildWriteoffHazardFromOptions;
exports.canShowAcceptanceButton = canShowAcceptanceButton;
exports.canShowWriteoffApplyButton = canShowWriteoffApplyButton;
exports.canShowWriteoffApprovalButton = canShowWriteoffApprovalButton;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/hazardNav.js.map

View File

@@ -0,0 +1,47 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const request_identity = require("../request/identity.js");
const request_three_one_api_info = require("../request/three_one_api/info.js");
const utils_userInfo = require("./userInfo.js");
function unwrapPayload(res) {
if (!res)
return {};
const data = res.data;
if (data && typeof data === "object" && (data.token || data.identities || data.currentIdentity || data.roles)) {
return data;
}
return res;
}
async function refreshUserInfoStorage() {
const res = await request_three_one_api_info.getProfileDetail();
if (res.code === 0 && res.data) {
return utils_userInfo.saveUserInfoToStorage(res.data);
}
return null;
}
async function performIdentitySwitch(identityId) {
const res = await request_identity.switchIdentity(identityId);
const payload = unwrapPayload(res);
if (payload.token) {
common_vendor.index.setStorageSync("token", payload.token);
}
if (payload.currentIdentity) {
common_vendor.index.setStorageSync("currentIdentity", JSON.stringify(payload.currentIdentity));
}
await refreshUserInfoStorage();
return payload;
}
function reLaunchAfterSwitch() {
common_vendor.index.showToast({
title: "身份切换成功",
icon: "success"
});
setTimeout(() => {
common_vendor.index.reLaunch({
url: "/pages/index/index"
});
}, 1500);
}
exports.performIdentitySwitch = performIdentitySwitch;
exports.reLaunchAfterSwitch = reLaunchAfterSwitch;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/identitySwitch.js.map

View File

@@ -0,0 +1,140 @@
"use strict";
const common_vendor = require("../common/vendor.js");
function normalizeUserIdentity(raw) {
if (!raw)
return null;
if (typeof raw === "string") {
try {
return JSON.parse(raw);
} catch (e) {
return null;
}
}
return raw;
}
function getCurrentIdentityFromStorage() {
try {
const raw = common_vendor.index.getStorageSync("currentIdentity");
if (!raw)
return null;
return normalizeUserIdentity(raw);
} catch (e) {
return null;
}
}
function normalizeRoleKey(value) {
if (value == null || value === "")
return "";
return String(value).trim();
}
function resolveRoleKey(roles, fallback = "") {
if (!(roles == null ? void 0 : roles.length))
return normalizeRoleKey(fallback);
const first = roles[0];
if (typeof first === "string")
return normalizeRoleKey(first);
return normalizeRoleKey(first.roleKey || first.role || fallback);
}
function resolveUserRoleKey(userInfo) {
if (!userInfo)
return "";
const identity = normalizeUserIdentity(userInfo.userIdentity);
const currentIdentity = getCurrentIdentityFromStorage();
const identityRoleKey = normalizeRoleKey(identity == null ? void 0 : identity.roleKey);
if (identityRoleKey)
return identityRoleKey;
const currentRoleKey = normalizeRoleKey(currentIdentity == null ? void 0 : currentIdentity.roleKey);
if (currentRoleKey)
return currentRoleKey;
const storedRole = normalizeRoleKey(userInfo.role);
if (storedRole)
return storedRole;
const nameHint = [
identity == null ? void 0 : identity.roleName,
identity == null ? void 0 : identity.identityName,
userInfo.identityName,
currentIdentity == null ? void 0 : currentIdentity.roleName,
currentIdentity == null ? void 0 : currentIdentity.identityName
].filter(Boolean).join(" ");
if (/审批|approval/i.test(nameHint))
return "approval";
return "";
}
function resolveIdentityName(profile, userIdentity) {
const identity = userIdentity || normalizeUserIdentity(profile == null ? void 0 : profile.userIdentity);
if (identity == null ? void 0 : identity.identityName) {
return identity.identityName;
}
if (profile == null ? void 0 : profile.identityName) {
return profile.identityName;
}
if (identity) {
const parts = [identity.deptName, identity.roleName, identity.postName].filter(Boolean);
if (parts.length)
return parts.join("-");
}
return "";
}
function mapProfileToUserInfo(profile) {
if (!profile)
return {};
const userIdentity = normalizeUserIdentity(profile.userIdentity);
const currentIdentity = getCurrentIdentityFromStorage();
const roleKey = normalizeRoleKey(
(userIdentity == null ? void 0 : userIdentity.roleKey) || (currentIdentity == null ? void 0 : currentIdentity.roleKey) || resolveRoleKey(profile.roles, "")
);
return {
userId: profile.userId || "",
username: profile.userName || "",
nickName: profile.nickName || "",
deptId: (userIdentity == null ? void 0 : userIdentity.deptId) ?? (currentIdentity == null ? void 0 : currentIdentity.deptId) ?? profile.deptId ?? "",
deptName: (userIdentity == null ? void 0 : userIdentity.deptName) ?? (currentIdentity == null ? void 0 : currentIdentity.deptName) ?? profile.deptName ?? "",
role: roleKey,
avatar: profile.avatar || "",
phone: profile.phonenumber || profile.phone || "",
identityName: resolveIdentityName(profile, userIdentity),
userIdentity: userIdentity || currentIdentity
};
}
function saveUserInfoToStorage(profile) {
const userInfo = mapProfileToUserInfo(profile);
common_vendor.index.setStorageSync("userInfo", JSON.stringify(userInfo));
return userInfo;
}
function applyProfileToUserInfo(target, profile) {
const mapped = mapProfileToUserInfo(profile);
Object.keys(mapped).forEach((key) => {
target[key] = mapped[key];
});
common_vendor.index.setStorageSync("userInfo", JSON.stringify(mapped));
return mapped;
}
function applyStoredUserInfo(target, stored) {
if (!stored)
return;
const userIdentity = normalizeUserIdentity(stored.userIdentity);
const currentIdentity = getCurrentIdentityFromStorage();
const mergedIdentity = userIdentity || currentIdentity;
const mapped = {
userId: stored.userId || "",
username: stored.username || "",
nickName: stored.nickName || "",
deptId: stored.deptId || (mergedIdentity == null ? void 0 : mergedIdentity.deptId) || "",
deptName: stored.deptName || (mergedIdentity == null ? void 0 : mergedIdentity.deptName) || "",
role: resolveUserRoleKey({ role: stored.role, userIdentity: mergedIdentity, identityName: stored.identityName }),
avatar: stored.avatar || "",
phone: stored.phone || "",
userIdentity: mergedIdentity,
identityName: stored.identityName || resolveIdentityName(stored, mergedIdentity)
};
Object.keys(mapped).forEach((key) => {
target[key] = mapped[key];
});
return mapped;
}
exports.applyProfileToUserInfo = applyProfileToUserInfo;
exports.applyStoredUserInfo = applyStoredUserInfo;
exports.resolveIdentityName = resolveIdentityName;
exports.resolveUserRoleKey = resolveUserRoleKey;
exports.saveUserInfoToStorage = saveUserInfoToStorage;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/userInfo.js.map