Compare commits
	
		
			6 Commits
		
	
	
		
			75f0175013
			...
			2c6f508f4f
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								
								 | 
						2c6f508f4f | |
| 
							
							
								
								 | 
						ef5b1bd319 | |
| 
							
							
								
								 | 
						443b22845a | |
| 
							
							
								
								 | 
						60a7e49a7d | |
| 
							
							
								
								 | 
						4c6a5805c1 | |
| 
							
							
								
								 | 
						c94d978e83 | 
| 
						 | 
				
			
			@ -312,7 +312,7 @@
 | 
			
		|||
            <if test="auditStatus != null">audit_status,</if>
 | 
			
		||||
            <if test="infoFileUrl != null">info_file_url,</if>
 | 
			
		||||
            <if test="applyMan != null">apply_man,</if>
 | 
			
		||||
            <if test="createTime != null">create_time,</if>
 | 
			
		||||
            create_time,
 | 
			
		||||
            status,
 | 
			
		||||
        </trim>
 | 
			
		||||
        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,624 @@
 | 
			
		|||
let form, table, tree;
 | 
			
		||||
let alreadyChooseTrees = [];
 | 
			
		||||
let selectData = [];
 | 
			
		||||
let workTypeList = [];
 | 
			
		||||
 | 
			
		||||
let infoFileUrl = "";
 | 
			
		||||
let faceUrl = "";
 | 
			
		||||
const sexList = [
 | 
			
		||||
    {
 | 
			
		||||
        id: 1,
 | 
			
		||||
        name: "男",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        id: 2,
 | 
			
		||||
        name: "女",
 | 
			
		||||
    },
 | 
			
		||||
];
 | 
			
		||||
let memberInfoList = [
 | 
			
		||||
    {
 | 
			
		||||
        name: "", // 姓名
 | 
			
		||||
        phone: "", // 联系方式
 | 
			
		||||
        idCard: "", // 身份证号码
 | 
			
		||||
        workType: "", // 工种
 | 
			
		||||
        sex: "", // 性别
 | 
			
		||||
        isTeamLeader: 1, // 是否是班长
 | 
			
		||||
        faceUrl: "", // 人脸照片
 | 
			
		||||
    },
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
function setParams(id,index){
 | 
			
		||||
    layui.use(["table", "form", "upload", "tree"], function () {
 | 
			
		||||
        const $ = layui.$;
 | 
			
		||||
        form = layui.form;
 | 
			
		||||
        upload = layui.upload;
 | 
			
		||||
        table = layui.table;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        //查询数据
 | 
			
		||||
        $.ajax({
 | 
			
		||||
            url: `${ctxPath}` + '/organizational/getRegisterTeamGroup?id=' + id,
 | 
			
		||||
            type: 'GET',
 | 
			
		||||
            dataType: "JSON",
 | 
			
		||||
            success: function (result) {
 | 
			
		||||
                $("#id").val(id)
 | 
			
		||||
                if (result.res === 1) {
 | 
			
		||||
                    setFormData(result.obj);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        //回显数据
 | 
			
		||||
        function setFormData(data) {
 | 
			
		||||
            if (!data) return
 | 
			
		||||
            // 填充主表单字段
 | 
			
		||||
            if (data.teamGroupName) $("#teamGroupName").val(data.teamGroupName)
 | 
			
		||||
            if (data.subContractor) $("#subContractor").val(data.subContractor)
 | 
			
		||||
            if (data.teamType) $("#teamType").val(data.teamType)
 | 
			
		||||
            if (data.name) $("#name").val(data.name)
 | 
			
		||||
            if (data.phone) $("#phone").val(data.phone)
 | 
			
		||||
            if (data.idCard) $("#idCard").val(data.idCard)
 | 
			
		||||
            if (data.workType) $("#workType").val(data.workType)
 | 
			
		||||
            if (data.sex) $("#sex").val(data.sex)
 | 
			
		||||
 | 
			
		||||
            // 设置文件URL
 | 
			
		||||
            if (data.faceUrl) {
 | 
			
		||||
                faceUrl = data.faceUrl
 | 
			
		||||
                $("#fileInfo").html("已上传文件")
 | 
			
		||||
            }
 | 
			
		||||
            if (data.infoFileUrl) {
 | 
			
		||||
                infoFileUrl = data.infoFileUrl
 | 
			
		||||
                $("#fileInfo1").html("已上传文件")
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 处理班组成员信息
 | 
			
		||||
            if (data.teamPersons && data.teamPersons.length > 0) {
 | 
			
		||||
                // 清空现有成员信息
 | 
			
		||||
                memberInfoList.length = 0
 | 
			
		||||
                $("#memberInfo").empty()
 | 
			
		||||
 | 
			
		||||
                // 添加新的成员信息
 | 
			
		||||
                data.teamPersons.forEach((member, index) => {
 | 
			
		||||
                    memberInfoList.push({
 | 
			
		||||
                        name: member.name || "",
 | 
			
		||||
                        phone: member.phone || "",
 | 
			
		||||
                        idCard: member.idCard || "",
 | 
			
		||||
                        workType: member.workType || "",
 | 
			
		||||
                        sex: member.sex || "",
 | 
			
		||||
                        isTeamLeader: member.isTeamLeader || 1,
 | 
			
		||||
                        faceUrl: member.faceUrl || "",
 | 
			
		||||
                    })
 | 
			
		||||
 | 
			
		||||
                    // 构建成员信息UI
 | 
			
		||||
                    constructMemberInfo(index).then(() => {
 | 
			
		||||
                        // 填充成员数据
 | 
			
		||||
                        $(`#name-${index}`).val(member.name || "")
 | 
			
		||||
                        $(`#phone-${index}`).val(member.phone || "")
 | 
			
		||||
                        $(`#idCard-${index}`).val(member.idCard || "")
 | 
			
		||||
                        $(`#workType-${index}`).val(member.workType || "")
 | 
			
		||||
                        $(`#sex-${index}`).val(member.sex || "")
 | 
			
		||||
 | 
			
		||||
                        if (member.faceUrl) {
 | 
			
		||||
                            $(`#fileInfo-${index}`).html("已上传文件")
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        // 重新渲染表单
 | 
			
		||||
                        form.render()
 | 
			
		||||
                    })
 | 
			
		||||
                })
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 重新渲染所有表单元素
 | 
			
		||||
            form.render()
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 使用 layui 的 form.on 监听下拉框变化
 | 
			
		||||
        form.on("select(subContractor)", function (obj) {
 | 
			
		||||
            const subContractorId = obj.value; // 获取选中的值
 | 
			
		||||
            console.log("subContractorId:", subContractorId);
 | 
			
		||||
 | 
			
		||||
            if (subContractorId) {
 | 
			
		||||
                getPromanagerSelect(subContractorId);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // 让点击上传按钮触发文件输入框的点击事件
 | 
			
		||||
        $("#uploadBtn").on("click", function () {
 | 
			
		||||
            $("#fileInput").click();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // 让点击上传按钮触发文件输入框的点击事件
 | 
			
		||||
        $("#uploadBtn1").on("click", function () {
 | 
			
		||||
            $("#fileInput1").click();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // 班组成员人脸照片上传事件委托
 | 
			
		||||
        $("#memberInfo").on("click", ".uploadBtn", function () {
 | 
			
		||||
            const index = $(this).attr("id").split("-")[1]
 | 
			
		||||
            $(`#fileInput-${index}`).click()
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        // 班组成员人脸照片文件选择处理
 | 
			
		||||
        $("#memberInfo").on("change", "input[type='file']", function () {
 | 
			
		||||
            const index = $(this).attr("id").split("-")[1]
 | 
			
		||||
            const file = $(this)[0].files[0]
 | 
			
		||||
 | 
			
		||||
            if (!file) return
 | 
			
		||||
 | 
			
		||||
            const fileName = file.name
 | 
			
		||||
            const fileExtension = fileName.split(".").pop().toLowerCase()
 | 
			
		||||
 | 
			
		||||
            // 校验文件类型,确保是 .jpg 或 .png 文件
 | 
			
		||||
            if (fileExtension !== "jpg" && fileExtension !== "png") {
 | 
			
		||||
                layer.msg("请选择图片文件(.jpg 或 .png)", {
 | 
			
		||||
                    icon: 2,
 | 
			
		||||
                    time: 2000,
 | 
			
		||||
                })
 | 
			
		||||
                $(this).val("")
 | 
			
		||||
                $(`#fileInfo-${index}`).html("")
 | 
			
		||||
                return
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $(`#fileInfo-${index}`).html("选中的文件:" + fileName)
 | 
			
		||||
 | 
			
		||||
            const formData = new FormData()
 | 
			
		||||
            formData.append("file", file)
 | 
			
		||||
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: ctxPath + "/organizational/uploadFaceImg",
 | 
			
		||||
                type: "POST",
 | 
			
		||||
                data: formData,
 | 
			
		||||
                processData: false,
 | 
			
		||||
                contentType: false,
 | 
			
		||||
                success: (res) => {
 | 
			
		||||
                    console.log(res, `成员${index}人脸上传成功`)
 | 
			
		||||
                    if (res.res == "1" || res.res == 1) {
 | 
			
		||||
                        // 将上传成功的URL存储到对应成员的数据中
 | 
			
		||||
                        if (memberInfoList[index]) {
 | 
			
		||||
                            memberInfoList[index].faceUrl = res.obj
 | 
			
		||||
                        }
 | 
			
		||||
                        layer.msg("上传成功", { icon: 6, time: 1500 })
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
                error: (err) => {
 | 
			
		||||
                    console.error(err)
 | 
			
		||||
                    layer.msg("上传失败,请重试", { icon: 5, time: 2000 })
 | 
			
		||||
                },
 | 
			
		||||
            })
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        // 文件选择后的回调处理
 | 
			
		||||
        $("#fileInput").on("change", function () {
 | 
			
		||||
            const file = $("#fileInput")[0].files[0];
 | 
			
		||||
            const fileName = file.name;
 | 
			
		||||
            const fileExtension = fileName.split(".").pop().toLowerCase();
 | 
			
		||||
 | 
			
		||||
            // 校验文件类型,确保是 .jpg 或 .png 文件
 | 
			
		||||
            if (fileExtension !== "jpg" && fileExtension !== "png") {
 | 
			
		||||
                layer.msg("请选择 图片 文件(.jpg 或 .png)", {
 | 
			
		||||
                    icon: 2,
 | 
			
		||||
                    time: 2000,
 | 
			
		||||
                });
 | 
			
		||||
                $("#fileInput").val("");
 | 
			
		||||
                $("#fileInfo").html("");
 | 
			
		||||
            } else {
 | 
			
		||||
                $("#fileInfo").html("选中的文件:" + fileName);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            const formData = new FormData();
 | 
			
		||||
            formData.append("file", file);
 | 
			
		||||
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: ctxPath + "/organizational/uploadFaceImg",
 | 
			
		||||
                type: "POST",
 | 
			
		||||
                data: formData,
 | 
			
		||||
                processData: false, // 告诉jQuery不要处理数据
 | 
			
		||||
                contentType: false,
 | 
			
		||||
                success: function (res) {
 | 
			
		||||
                    console.log(res, "人脸上传成功");
 | 
			
		||||
                    if(res.res == "1" || res.res == 1){
 | 
			
		||||
                        faceUrl = res.obj;
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
                error: function (err) {
 | 
			
		||||
                    console.error(err);
 | 
			
		||||
                },
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
        // 文件选择后的回调处理
 | 
			
		||||
        $("#fileInput1").on("change", function () {
 | 
			
		||||
            const file = $("#fileInput1")[0].files[0];
 | 
			
		||||
            const fileName = file.name;
 | 
			
		||||
            const fileExtension = fileName.split(".").pop().toLowerCase();
 | 
			
		||||
 | 
			
		||||
            // 校验文件类型,确保是 .xls 或 .xlsx 文件
 | 
			
		||||
            if (
 | 
			
		||||
                fileExtension !== "doc" &&
 | 
			
		||||
                fileExtension !== "docx" &&
 | 
			
		||||
                fileExtension !== "png" &&
 | 
			
		||||
                fileExtension !== "jpg" &&
 | 
			
		||||
                fileExtension !== "pdf"
 | 
			
		||||
            ) {
 | 
			
		||||
                layer.msg("请选择word、pdf或图片文件", { icon: 2, time: 2000 });
 | 
			
		||||
                $("#fileInput1").val("");
 | 
			
		||||
                $("#fileInfo1").html("");
 | 
			
		||||
            } else {
 | 
			
		||||
                $("#fileInfo1").html("选中的文件:" + fileName);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            const formData = new FormData();
 | 
			
		||||
            formData.append("file", file);
 | 
			
		||||
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: ctxPath + "/organizational/uploadInfo",
 | 
			
		||||
                type: "POST",
 | 
			
		||||
                data: formData,
 | 
			
		||||
                processData: false, // 告诉jQuery不要处理数据
 | 
			
		||||
                contentType: false,
 | 
			
		||||
                success: function (res) {
 | 
			
		||||
                    console.log(res, "上传成功");
 | 
			
		||||
                    if(res.res == "1" || res.res == 1){
 | 
			
		||||
                        infoFileUrl = res.obj;
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
                error: function (err) {
 | 
			
		||||
                    console.error(err);
 | 
			
		||||
                },
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
        // 初始化下拉框
 | 
			
		||||
        getOutSourceSelected();
 | 
			
		||||
        getTeamGroupType();
 | 
			
		||||
        getWorkType();
 | 
			
		||||
 | 
			
		||||
        // 设置下拉框选项
 | 
			
		||||
        function setSelectValue(list, selectName) {
 | 
			
		||||
            let html = '<option value="">请选择</option>';
 | 
			
		||||
            if (list && list.length > 0) {
 | 
			
		||||
                $.each(list, function (index, item) {
 | 
			
		||||
                    html += `<option value="${item.id}">${item.name}</option>`;
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $("#" + selectName)
 | 
			
		||||
                .empty()
 | 
			
		||||
                .append(html);
 | 
			
		||||
            form.render("select");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 获取外包商下拉数据
 | 
			
		||||
        function getOutSourceSelected() {
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                type: "POST",
 | 
			
		||||
                url: ctxPath + "/organizational/getSubContractorSelected",
 | 
			
		||||
                success: function (data) {
 | 
			
		||||
                    setSelectValue(data.obj, "subContractor");
 | 
			
		||||
                },
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 根据外包商获取项目下拉数据(支持传参)
 | 
			
		||||
        function getPromanagerSelect(subContractorId) {
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                type: "POST",
 | 
			
		||||
                url: ctxPath + "/organizational/getProjectBySubContractor",
 | 
			
		||||
                data: {
 | 
			
		||||
                    id: subContractorId,
 | 
			
		||||
                },
 | 
			
		||||
                success: function (data) {
 | 
			
		||||
                    setSelectValue(data.obj, "project");
 | 
			
		||||
                },
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 获取班组类型下拉框
 | 
			
		||||
        function getTeamGroupType() {
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                type: "POST",
 | 
			
		||||
                url: ctxPath + "/organizational/getTeamGroupType",
 | 
			
		||||
                success: function (data) {
 | 
			
		||||
                    setSelectValue(data.obj, "teamType");
 | 
			
		||||
                },
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 获取工种类型下拉框
 | 
			
		||||
        function getWorkType() {
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                type: "POST",
 | 
			
		||||
                url: ctxPath + "/organizational/getWorkType",
 | 
			
		||||
                success: function (data) {
 | 
			
		||||
                    setSelectValue(data.obj, "workType");
 | 
			
		||||
                },
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $("#stagingBtn").on("click", () => {
 | 
			
		||||
            const formData = {}
 | 
			
		||||
            formData.teamGroupName = $("#teamGroupName").val()
 | 
			
		||||
            formData.subContractor = $("#subContractor").val()
 | 
			
		||||
            formData.teamType = $("#teamType").val()
 | 
			
		||||
            formData.name = $("#name").val()
 | 
			
		||||
            formData.phone = $("#phone").val()
 | 
			
		||||
            formData.idCard = $("#idCard").val()
 | 
			
		||||
            formData.workType = $("#workType").val()
 | 
			
		||||
            formData.sex = $("#sex").val()
 | 
			
		||||
            formData.id = $("#id").val()
 | 
			
		||||
 | 
			
		||||
            console.log("暂存表单数据:", JSON.stringify(formData))
 | 
			
		||||
 | 
			
		||||
            const groupMemberList = memberInfoList.map((e, index) => {
 | 
			
		||||
                return {
 | 
			
		||||
                    name: $(`#name-${index}`).val() || "",
 | 
			
		||||
                    phone: $(`#phone-${index}`).val() || "",
 | 
			
		||||
                    idCard: $(`#idCard-${index}`).val() || "",
 | 
			
		||||
                    workType: $(`#workType-${index}`).val() || "",
 | 
			
		||||
                    sex: $(`#sex-${index}`).val() || "",
 | 
			
		||||
                    isTeamLeader: 1,
 | 
			
		||||
                    faceUrl: e.faceUrl || "",
 | 
			
		||||
                }
 | 
			
		||||
            })
 | 
			
		||||
 | 
			
		||||
            console.log("暂存班组成员信息数据:", groupMemberList)
 | 
			
		||||
 | 
			
		||||
            const submitData = {
 | 
			
		||||
                teamGroupName: formData.teamGroupName || "",
 | 
			
		||||
                subContractor: formData.subContractor || "",
 | 
			
		||||
                infoFileUrl: infoFileUrl || "",
 | 
			
		||||
                teamType: formData.teamType || "",
 | 
			
		||||
                name: formData.name || "",
 | 
			
		||||
                tableSource: "pm_dept",
 | 
			
		||||
                level: 5,
 | 
			
		||||
                phone: formData.phone || "",
 | 
			
		||||
                idCard: formData.idCard || "",
 | 
			
		||||
                workType: formData.workType || "",
 | 
			
		||||
                sex: formData.sex || "",
 | 
			
		||||
                auditStatus: 0,
 | 
			
		||||
                isTeamLeader: 0,
 | 
			
		||||
                faceUrl: faceUrl || "",
 | 
			
		||||
                teamPersons: groupMemberList,
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: ctxPath + "/organizational/updateRegisterTeamGroup",
 | 
			
		||||
                type: "POST",
 | 
			
		||||
                contentType: "application/json;charset=utf-8",
 | 
			
		||||
                data: JSON.stringify(submitData),
 | 
			
		||||
                success: (res) => {
 | 
			
		||||
                    if (res.res === 1) {
 | 
			
		||||
                        layer.msg("暂存成功", { icon: 6 }, () => {
 | 
			
		||||
                            parent.layer.close(parent.layer.getFrameIndex(window.name))
 | 
			
		||||
                            window.parent.location.reload()
 | 
			
		||||
                        })
 | 
			
		||||
                    } else {
 | 
			
		||||
                        layer.msg(res.resMsg)
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
            })
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        form.on("submit(formSubmit)", function (data) {
 | 
			
		||||
            // 表单提交事件监听
 | 
			
		||||
            const field = data.field;
 | 
			
		||||
            // 校验文件是否选择
 | 
			
		||||
            /* const file = $("#fileInput1")[0].files[0];
 | 
			
		||||
             if (!file) {
 | 
			
		||||
                 layer.msg("请上传信息评审表文件", { icon: 2, time: 2000 });
 | 
			
		||||
                 return false;
 | 
			
		||||
             }
 | 
			
		||||
             console.log("表单数据:", JSON.stringify(field));*/
 | 
			
		||||
 | 
			
		||||
            if(!infoFileUrl){
 | 
			
		||||
                layer.msg("请上传信息评审表文件", { icon: 2, time: 2000 });
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 班组成员信息数据
 | 
			
		||||
            const groupMemberList = memberInfoList.map((e, index) => {
 | 
			
		||||
                return {
 | 
			
		||||
                    name: $(`#name-${index}`).val(),
 | 
			
		||||
                    phone: $(`#phone-${index}`).val(),
 | 
			
		||||
                    idCard: $(`#idCard-${index}`).val(),
 | 
			
		||||
                    workType: $(`#workType-${index}`).val(),
 | 
			
		||||
                    sex: $(`#sex-${index}`).val(),
 | 
			
		||||
                    isTeamLeader: 1,
 | 
			
		||||
                    faceUrl: e.faceUrl || "",
 | 
			
		||||
                };
 | 
			
		||||
            });
 | 
			
		||||
            const submitData = {
 | 
			
		||||
                id:field.id,
 | 
			
		||||
                teamGroupName: field.teamGroupName,
 | 
			
		||||
                subContractor: field.subContractor,
 | 
			
		||||
                infoFileUrl: infoFileUrl,
 | 
			
		||||
                teamType: field.teamType,
 | 
			
		||||
                name: field.name,
 | 
			
		||||
                tableSource:"pm_dept",
 | 
			
		||||
                level: 5,
 | 
			
		||||
                phone: field.phone,
 | 
			
		||||
                idCard: field.idCard,
 | 
			
		||||
                workType: field.workType,
 | 
			
		||||
                sex: field.sex,
 | 
			
		||||
                auditStatus: 1,
 | 
			
		||||
                isTeamLeader: 0,
 | 
			
		||||
                faceUrl: faceUrl, // 上传后返回的 URL
 | 
			
		||||
                teamPersons: groupMemberList
 | 
			
		||||
            };
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: ctxPath + "/organizational/updateRegisterTeamGroup",
 | 
			
		||||
                type: "POST",
 | 
			
		||||
                contentType: "application/json;charset=utf-8",
 | 
			
		||||
                data: JSON.stringify(submitData),
 | 
			
		||||
                success: res => {
 | 
			
		||||
                    if (res.res === 1) {
 | 
			
		||||
                        layer.msg("成功", { icon: 6 }, () => {
 | 
			
		||||
                            parent.layer.close(parent.layer.getFrameIndex(window.name));
 | 
			
		||||
                            window.parent.location.reload();
 | 
			
		||||
                        });
 | 
			
		||||
                    } else {
 | 
			
		||||
                        layer.msg(res.resMsg);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
            return false; // 阻止默认提交行为
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        // 获取工种类型下拉框
 | 
			
		||||
        async function getWorkTypeNew() {
 | 
			
		||||
            await new Promise((resolve) => {
 | 
			
		||||
                $.ajax({
 | 
			
		||||
                    type: "POST",
 | 
			
		||||
                    url: ctxPath + "/organizational/getWorkType",
 | 
			
		||||
                    success: function (data) {
 | 
			
		||||
                        // setSelectValue(data.obj, element);
 | 
			
		||||
                        workTypeList = data.obj;
 | 
			
		||||
                        resolve();
 | 
			
		||||
                    },
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 初始化班组成员信息
 | 
			
		||||
        function initMemberInfo() {
 | 
			
		||||
            memberInfoList.forEach((item, index) => {
 | 
			
		||||
                constructMemberInfo(index);
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 添加班组成员
 | 
			
		||||
        $("#addMemberBtn").on("click", function (e) {
 | 
			
		||||
            e.preventDefault();
 | 
			
		||||
            const index = memberInfoList.length;
 | 
			
		||||
            memberInfoList.push({
 | 
			
		||||
                name: "",
 | 
			
		||||
                phone: "",
 | 
			
		||||
                idCard: "",
 | 
			
		||||
                workType: "",
 | 
			
		||||
                sex: "",
 | 
			
		||||
                isTeamLeader: 1,
 | 
			
		||||
                faceUrl: "",
 | 
			
		||||
            });
 | 
			
		||||
            constructMemberInfo(index);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // 构造成员信息
 | 
			
		||||
        async function constructMemberInfo(index) {
 | 
			
		||||
            $("#memberInfo").append(`
 | 
			
		||||
            <div id="memberInfo-${index}" class="memberInfoItem">
 | 
			
		||||
                        <div class="layui-row">
 | 
			
		||||
                            <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                                <div class="layui-form-item">
 | 
			
		||||
                                    <label class="layui-form-label"><span class="required_icon">*</span>姓名</label>
 | 
			
		||||
                                    <div class="layui-input-block">
 | 
			
		||||
                                        <input type="text" required lay-verify="required" id="name-${index}" name="name"
 | 
			
		||||
                                            autocomplete="off" class="layui-input">
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                                <div class="layui-form-item">
 | 
			
		||||
                                    <label class="layui-form-label"><span class="required_icon">*</span>联系方式</label>
 | 
			
		||||
                                    <div class="layui-input-block">
 | 
			
		||||
                                        <input type="text" required lay-verify="required" id="phone-${index}" name="phone"
 | 
			
		||||
                                            autocomplete="off" class="layui-input">
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div class="layui-row">
 | 
			
		||||
                            <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                                <div class="layui-form-item">
 | 
			
		||||
                                    <label class="layui-form-label"><span
 | 
			
		||||
                                            class="required_icon">*</span>身份证号码</label>
 | 
			
		||||
                                    <div class="layui-input-block">
 | 
			
		||||
                                        <input type="text" required lay-verify="required" id="idCard-${index}" name="idCard"
 | 
			
		||||
                                            autocomplete="off" class="layui-input">
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                                <div class="layui-form-item">
 | 
			
		||||
                                    <label class="layui-form-label"><span class="required_icon">*</span>工种</label>
 | 
			
		||||
                                    <div class="layui-input-block">
 | 
			
		||||
                                        <select id="workType-${index}" name="workType" class="layui-select" lay-search
 | 
			
		||||
                                            lay-verify="required" style="height: 36px;">
 | 
			
		||||
                                        </select>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div class="layui-row">
 | 
			
		||||
                            <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                                <div class="layui-form-item">
 | 
			
		||||
                                    <label class="layui-form-label"><span class="required_icon">*</span>性别</label>
 | 
			
		||||
                                    <div class="layui-input-block">
 | 
			
		||||
                                        <select id="sex-${index}" name="sex" class="layui-select" lay-search
 | 
			
		||||
                                            lay-verify="required" style="height: 36px;">
 | 
			
		||||
                                        </select>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                                <div class="layui-form-item">
 | 
			
		||||
                                    <label class="layui-form-label"><span class="required_icon"></span>人脸照片</label>
 | 
			
		||||
                                    <div class="layui-input-block">
 | 
			
		||||
                                        <button type="button" class="layui-btn uploadBtn"  id="uploadBtn-${index}">
 | 
			
		||||
                                            <i class="layui-icon"></i> 上传文件
 | 
			
		||||
                                        </button>
 | 
			
		||||
                                        <input type="file" id="fileInput-${index}" name="file" accept=".jpg,.png"
 | 
			
		||||
                                            style="display: none;">
 | 
			
		||||
                                        <div id="fileInfo-${index}"></div>
 | 
			
		||||
                                    </div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div style="display: flex;align-items: center;justify-content: flex-end;">                         
 | 
			
		||||
                             <button type="button" class="layui-btn layui-btn-sm layui-bg-red deleteBtn" id="deleteMemberBtn-${index}">
 | 
			
		||||
                                <i class="layui-icon layui-icon-delete"></i>
 | 
			
		||||
                            </button>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
        `);
 | 
			
		||||
 | 
			
		||||
            if (workTypeList.length < 1) {
 | 
			
		||||
                await getWorkTypeNew();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            setSelectValue(workTypeList, `workType-${index}`);
 | 
			
		||||
 | 
			
		||||
            setSelectValue(sexList, `sex-${index}`);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        initMemberInfo();
 | 
			
		||||
 | 
			
		||||
        // 删除操作
 | 
			
		||||
        $("#memberInfo").on("click", ".deleteBtn", function (e) {
 | 
			
		||||
            e.preventDefault();
 | 
			
		||||
            const index = $(this).attr("id").split("-")[1];
 | 
			
		||||
            console.log("删除", index);
 | 
			
		||||
            memberInfoList.splice(index, 1);
 | 
			
		||||
            console.log("删除", memberInfoList);
 | 
			
		||||
            $(`#memberInfo-${index}`).remove();
 | 
			
		||||
 | 
			
		||||
            // 重新渲染所有成员信息以更新索引
 | 
			
		||||
            $("#memberInfo").empty()
 | 
			
		||||
            memberInfoList.forEach((item, newIndex) => {
 | 
			
		||||
                constructMemberInfo(newIndex)
 | 
			
		||||
            })
 | 
			
		||||
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2,6 +2,9 @@ let form, table, tree;
 | 
			
		|||
let alreadyChooseTrees = [];
 | 
			
		||||
let selectData = [];
 | 
			
		||||
let workTypeList = [];
 | 
			
		||||
 | 
			
		||||
let infoFileUrl = "";
 | 
			
		||||
let faceUrl = "";
 | 
			
		||||
const sexList = [
 | 
			
		||||
    {
 | 
			
		||||
        id: 1,
 | 
			
		||||
| 
						 | 
				
			
			@ -19,8 +22,8 @@ let memberInfoList = [
 | 
			
		|||
        idCard: "", // 身份证号码
 | 
			
		||||
        workType: "", // 工种
 | 
			
		||||
        sex: "", // 性别
 | 
			
		||||
        faceUrl: "", // 人脸照片
 | 
			
		||||
        isTeamLeader: 1, // 是否是班长
 | 
			
		||||
        faceUrl: "", // 人脸照片
 | 
			
		||||
    },
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -49,6 +52,63 @@ layui.use(["table", "form", "upload", "tree"], function () {
 | 
			
		|||
        $("#fileInput1").click();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // 班组成员人脸照片上传事件委托
 | 
			
		||||
    $("#memberInfo").on("click", ".uploadBtn", function () {
 | 
			
		||||
        const index = $(this).attr("id").split("-")[1]
 | 
			
		||||
        $(`#fileInput-${index}`).click()
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    // 班组成员人脸照片文件选择处理
 | 
			
		||||
    $("#memberInfo").on("change", "input[type='file']", function () {
 | 
			
		||||
        const index = $(this).attr("id").split("-")[1]
 | 
			
		||||
        const file = $(this)[0].files[0]
 | 
			
		||||
 | 
			
		||||
        if (!file) return
 | 
			
		||||
 | 
			
		||||
        const fileName = file.name
 | 
			
		||||
        const fileExtension = fileName.split(".").pop().toLowerCase()
 | 
			
		||||
 | 
			
		||||
        // 校验文件类型,确保是 .jpg 或 .png 文件
 | 
			
		||||
        if (fileExtension !== "jpg" && fileExtension !== "png") {
 | 
			
		||||
            layer.msg("请选择图片文件(.jpg 或 .png)", {
 | 
			
		||||
                icon: 2,
 | 
			
		||||
                time: 2000,
 | 
			
		||||
            })
 | 
			
		||||
            $(this).val("")
 | 
			
		||||
            $(`#fileInfo-${index}`).html("")
 | 
			
		||||
            return
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $(`#fileInfo-${index}`).html("选中的文件:" + fileName)
 | 
			
		||||
 | 
			
		||||
        const formData = new FormData()
 | 
			
		||||
        formData.append("file", file)
 | 
			
		||||
 | 
			
		||||
        $.ajax({
 | 
			
		||||
            url: ctxPath + "/organizational/uploadFaceImg",
 | 
			
		||||
            type: "POST",
 | 
			
		||||
            data: formData,
 | 
			
		||||
            processData: false,
 | 
			
		||||
            contentType: false,
 | 
			
		||||
            success: (res) => {
 | 
			
		||||
                console.log(res, `成员${index}人脸上传成功`)
 | 
			
		||||
                if (res.res == "1" || res.res == 1) {
 | 
			
		||||
                    // 将上传成功的URL存储到对应成员的数据中
 | 
			
		||||
                    if (memberInfoList[index]) {
 | 
			
		||||
                        memberInfoList[index].faceUrl = res.obj
 | 
			
		||||
                    }
 | 
			
		||||
                    layer.msg("上传成功", { icon: 6, time: 1500 })
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            error: (err) => {
 | 
			
		||||
                console.error(err)
 | 
			
		||||
                layer.msg("上传失败,请重试", { icon: 5, time: 2000 })
 | 
			
		||||
            },
 | 
			
		||||
        })
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // 文件选择后的回调处理
 | 
			
		||||
    $("#fileInput").on("change", function () {
 | 
			
		||||
        const file = $("#fileInput")[0].files[0];
 | 
			
		||||
| 
						 | 
				
			
			@ -66,6 +126,27 @@ layui.use(["table", "form", "upload", "tree"], function () {
 | 
			
		|||
        } else {
 | 
			
		||||
            $("#fileInfo").html("选中的文件:" + fileName);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        const formData = new FormData();
 | 
			
		||||
        formData.append("file", file);
 | 
			
		||||
 | 
			
		||||
        $.ajax({
 | 
			
		||||
            url: ctxPath + "/organizational/uploadFaceImg",
 | 
			
		||||
            type: "POST",
 | 
			
		||||
            data: formData,
 | 
			
		||||
            processData: false, // 告诉jQuery不要处理数据
 | 
			
		||||
            contentType: false,
 | 
			
		||||
            success: function (res) {
 | 
			
		||||
                console.log(res, "人脸上传成功");
 | 
			
		||||
                if(res.res == "1" || res.res == 1){
 | 
			
		||||
                    faceUrl = res.obj;
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            error: function (err) {
 | 
			
		||||
                console.error(err);
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    // 文件选择后的回调处理
 | 
			
		||||
    $("#fileInput1").on("change", function () {
 | 
			
		||||
| 
						 | 
				
			
			@ -99,6 +180,9 @@ layui.use(["table", "form", "upload", "tree"], function () {
 | 
			
		|||
            contentType: false,
 | 
			
		||||
            success: function (res) {
 | 
			
		||||
                console.log(res, "上传成功");
 | 
			
		||||
                if(res.res == "1" || res.res == 1){
 | 
			
		||||
                    infoFileUrl = res.obj;
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            error: function (err) {
 | 
			
		||||
                console.error(err);
 | 
			
		||||
| 
						 | 
				
			
			@ -172,13 +256,76 @@ layui.use(["table", "form", "upload", "tree"], function () {
 | 
			
		|||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $("#stagingBtn").on("click", () => {
 | 
			
		||||
        const formData = {}
 | 
			
		||||
        formData.teamGroupName = $("#teamGroupName").val()
 | 
			
		||||
        formData.subContractor = $("#subContractor").val()
 | 
			
		||||
        formData.teamType = $("#teamType").val()
 | 
			
		||||
        formData.name = $("#name").val()
 | 
			
		||||
        formData.phone = $("#phone").val()
 | 
			
		||||
        formData.idCard = $("#idCard").val()
 | 
			
		||||
        formData.workType = $("#workType").val()
 | 
			
		||||
        formData.sex = $("#sex").val()
 | 
			
		||||
 | 
			
		||||
        console.log("暂存表单数据:", JSON.stringify(formData))
 | 
			
		||||
 | 
			
		||||
        const groupMemberList = memberInfoList.map((e, index) => {
 | 
			
		||||
            return {
 | 
			
		||||
                name: $(`#name-${index}`).val() || "",
 | 
			
		||||
                phone: $(`#phone-${index}`).val() || "",
 | 
			
		||||
                idCard: $(`#idCard-${index}`).val() || "",
 | 
			
		||||
                workType: $(`#workType-${index}`).val() || "",
 | 
			
		||||
                sex: $(`#sex-${index}`).val() || "",
 | 
			
		||||
                isTeamLeader: 1,
 | 
			
		||||
                faceUrl: e.faceUrl || "",
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        console.log("暂存班组成员信息数据:", groupMemberList)
 | 
			
		||||
 | 
			
		||||
        const submitData = {
 | 
			
		||||
            teamGroupName: formData.teamGroupName || "",
 | 
			
		||||
            subContractor: formData.subContractor || "",
 | 
			
		||||
            infoFileUrl: infoFileUrl || "",
 | 
			
		||||
            teamType: formData.teamType || "",
 | 
			
		||||
            name: formData.name || "",
 | 
			
		||||
            tableSource: "pm_dept",
 | 
			
		||||
            level: 5,
 | 
			
		||||
            phone: formData.phone || "",
 | 
			
		||||
            idCard: formData.idCard || "",
 | 
			
		||||
            workType: formData.workType || "",
 | 
			
		||||
            sex: formData.sex || "",
 | 
			
		||||
            auditStatus: 0,
 | 
			
		||||
            isTeamLeader: 0,
 | 
			
		||||
            faceUrl: faceUrl || "",
 | 
			
		||||
            teamPersons: groupMemberList,
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $.ajax({
 | 
			
		||||
            url: ctxPath + "/organizational/registerTeamGroup",
 | 
			
		||||
            type: "POST",
 | 
			
		||||
            contentType: "application/json;charset=utf-8",
 | 
			
		||||
            data: JSON.stringify(submitData),
 | 
			
		||||
            success: (res) => {
 | 
			
		||||
                if (res.res === 1) {
 | 
			
		||||
                    layer.msg("暂存成功", { icon: 6 }, () => {
 | 
			
		||||
                        parent.layer.close(parent.layer.getFrameIndex(window.name))
 | 
			
		||||
                        window.parent.location.reload()
 | 
			
		||||
                    })
 | 
			
		||||
                } else {
 | 
			
		||||
                    layer.msg(res.resMsg)
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
        })
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    form.on("submit(formSubmit)", function (data) {
 | 
			
		||||
        // 表单提交事件监听
 | 
			
		||||
        const field = data.field;
 | 
			
		||||
        // 校验文件是否选择
 | 
			
		||||
        const file = $("#fileInput1")[0].files[0];
 | 
			
		||||
        if (!file) {
 | 
			
		||||
            layer.msg("请上传文件", { icon: 2, time: 2000 });
 | 
			
		||||
            layer.msg("请上传信息评审表文件", { icon: 2, time: 2000 });
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        console.log("表单数据:", JSON.stringify(field));
 | 
			
		||||
| 
						 | 
				
			
			@ -193,6 +340,7 @@ layui.use(["table", "form", "upload", "tree"], function () {
 | 
			
		|||
                workType: $(`#workType-${index}`).val(),
 | 
			
		||||
                sex: $(`#sex-${index}`).val(),
 | 
			
		||||
                isTeamLeader: 1,
 | 
			
		||||
                faceUrl: e.faceUrl || "",
 | 
			
		||||
            };
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -201,45 +349,60 @@ layui.use(["table", "form", "upload", "tree"], function () {
 | 
			
		|||
 | 
			
		||||
        formDataWithFile.append("teamGroupName", field.teamGroupName);
 | 
			
		||||
        formDataWithFile.append("subContractor", field.subContractor);
 | 
			
		||||
        formDataWithFile.append("infoFileUrl", file); // 信息评审表url
 | 
			
		||||
        formDataWithFile.append("infoFileUrl", infoFileUrl); // 信息评审表url
 | 
			
		||||
        formDataWithFile.append("teamType", field.teamType);
 | 
			
		||||
        formDataWithFile.append("name", field.name);
 | 
			
		||||
        formDataWithFile.append("tableSource", "pm_dept");
 | 
			
		||||
        formDataWithFile.append("level", 5); // 固定值
 | 
			
		||||
        formDataWithFile.append("phone", field.phone);
 | 
			
		||||
        formDataWithFile.append("idCard", field.idCard);
 | 
			
		||||
        formDataWithFile.append("workType", field.workType);
 | 
			
		||||
        formDataWithFile.append("sex", field.sex);
 | 
			
		||||
        formDataWithFile.append("faceUrl", file); // 人脸照片url
 | 
			
		||||
        formDataWithFile.append("level", 5); // 固定值
 | 
			
		||||
        formDataWithFile.append("tableSource", "pm_dept");
 | 
			
		||||
        formDataWithFile.append("isTeamLeader", 0); // 固定值
 | 
			
		||||
        formDataWithFile.append("auditStatus", 1);
 | 
			
		||||
        formDataWithFile.append("teamPersons", groupMemberList);
 | 
			
		||||
        formDataWithFile.append("isTeamLeader", 0); // 固定值
 | 
			
		||||
        formDataWithFile.append("faceUrl", file); // 人脸照片url
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        const submitData = {
 | 
			
		||||
            teamGroupName: field.teamGroupName,
 | 
			
		||||
            subContractor: field.subContractor,
 | 
			
		||||
            infoFileUrl: infoFileUrl,
 | 
			
		||||
            teamType: field.teamType,
 | 
			
		||||
            name: field.name,
 | 
			
		||||
            tableSource:"pm_dept",
 | 
			
		||||
            level: 5,
 | 
			
		||||
            phone: field.phone,
 | 
			
		||||
            idCard: field.idCard,
 | 
			
		||||
            workType: field.workType,
 | 
			
		||||
            sex: field.sex,
 | 
			
		||||
            auditStatus: 1,
 | 
			
		||||
            isTeamLeader: 0,
 | 
			
		||||
            faceUrl: faceUrl, // 上传后返回的 URL
 | 
			
		||||
            teamPersons: groupMemberList
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        //班组成员信息
 | 
			
		||||
        formDataWithFile.append("teamPersons", JSON.stringify(groupMemberList));
 | 
			
		||||
        $.ajax({
 | 
			
		||||
            url: ctxPath + "/organizational/registerTeamGroup",
 | 
			
		||||
            type: "POST",
 | 
			
		||||
            dataType: "json",
 | 
			
		||||
            processData: false,
 | 
			
		||||
            contentType: false,
 | 
			
		||||
            data: formDataWithFile,
 | 
			
		||||
            success: function (res) {
 | 
			
		||||
            contentType: "application/json;charset=utf-8",
 | 
			
		||||
            data: JSON.stringify(submitData),
 | 
			
		||||
            success: res => {
 | 
			
		||||
                if (res.res === 1) {
 | 
			
		||||
                    layer.msg("新增成功", { icon: 6, time: 1500 }, function () {
 | 
			
		||||
                        var index = parent.layer.getFrameIndex(window.name); // 获取当前 iframe 层的索引
 | 
			
		||||
                    layer.msg("成功", { icon: 6 }, () => {
 | 
			
		||||
                        parent.layer.close(parent.layer.getFrameIndex(window.name));
 | 
			
		||||
                        window.parent.location.reload();
 | 
			
		||||
                        parent.layer.close(index); // 关闭弹窗
 | 
			
		||||
                    });
 | 
			
		||||
                } else if (res.res === 0) {
 | 
			
		||||
                    layer.msg(res.resMsg, { icon: 5 });
 | 
			
		||||
                } else {
 | 
			
		||||
                    layer.msg(res.resMsg);
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            error: function () {
 | 
			
		||||
                layer.msg("网络异常,请重试", { icon: 5 });
 | 
			
		||||
            },
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        return false; // 阻止默认提交行为
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // 获取工种类型下拉框
 | 
			
		||||
    async function getWorkTypeNew() {
 | 
			
		||||
        await new Promise((resolve) => {
 | 
			
		||||
| 
						 | 
				
			
			@ -272,8 +435,8 @@ layui.use(["table", "form", "upload", "tree"], function () {
 | 
			
		|||
            idCard: "",
 | 
			
		||||
            workType: "",
 | 
			
		||||
            sex: "",
 | 
			
		||||
            faceUrl: "",
 | 
			
		||||
            isTeamLeader: 1,
 | 
			
		||||
            faceUrl: "",
 | 
			
		||||
        });
 | 
			
		||||
        constructMemberInfo(index);
 | 
			
		||||
    });
 | 
			
		||||
| 
						 | 
				
			
			@ -379,5 +542,12 @@ layui.use(["table", "form", "upload", "tree"], function () {
 | 
			
		|||
        memberInfoList.splice(index, 1);
 | 
			
		||||
        console.log("删除", memberInfoList);
 | 
			
		||||
        $(`#memberInfo-${index}`).remove();
 | 
			
		||||
 | 
			
		||||
        // 重新渲染所有成员信息以更新索引
 | 
			
		||||
        $("#memberInfo").empty()
 | 
			
		||||
        memberInfoList.forEach((item, newIndex) => {
 | 
			
		||||
            constructMemberInfo(newIndex)
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -101,9 +101,12 @@ function initTable() {
 | 
			
		|||
                    align: "center",
 | 
			
		||||
                    templet: (d) => {
 | 
			
		||||
                        let text = "";
 | 
			
		||||
                        text +=
 | 
			
		||||
                            '<a lay-event="edit" style="color: #009688;cursor: pointer;font-size: 15px"' +
 | 
			
		||||
                            '  id="edit">编辑</a>';
 | 
			
		||||
                        let auditStatus = d.auditStatus;
 | 
			
		||||
                        if(auditStatus ==0 || auditStatus == 5){
 | 
			
		||||
                            text +=
 | 
			
		||||
                                '<a lay-event="edit" style="color: #009688;cursor: pointer;font-size: 15px"' +
 | 
			
		||||
                                '  id="edit">编辑</a>';
 | 
			
		||||
                        }
 | 
			
		||||
                        text +=
 | 
			
		||||
                            '<a lay-event="del" style="color: #009688;cursor: pointer;font-size:' +
 | 
			
		||||
                            ' 15px;margin-left: 10px"' +
 | 
			
		||||
| 
						 | 
				
			
			@ -177,17 +180,18 @@ function initTable() {
 | 
			
		|||
                type: 2,
 | 
			
		||||
                title: title,
 | 
			
		||||
                shade: 0.3,
 | 
			
		||||
                area: ["50%", "40%"],
 | 
			
		||||
                area: ["95%", "95%"],
 | 
			
		||||
                scrollbar: true,
 | 
			
		||||
                move: true,
 | 
			
		||||
                anim: 2,
 | 
			
		||||
                name: "editTeamGroup",
 | 
			
		||||
                shadeClose: false,
 | 
			
		||||
                content:
 | 
			
		||||
                    './editForm.html',
 | 
			
		||||
                // content:
 | 
			
		||||
                //     './editForm.html',
 | 
			
		||||
                content:'./registerEdit.html',
 | 
			
		||||
                success: function (layero, index) {
 | 
			
		||||
                    let iframeWin = window["layui-layer-iframe" + index];
 | 
			
		||||
                    iframeWin.setParams(JSON.stringify(data), index);
 | 
			
		||||
                    iframeWin.setParams(data.id, index);
 | 
			
		||||
                },
 | 
			
		||||
            });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,266 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html>
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
    <link rel="stylesheet" href="../../../layui/css/layui.css" />
 | 
			
		||||
    <link rel="stylesheet" href="../../../layui/layui_ext/dtree/dtree.css">
 | 
			
		||||
    <link rel="stylesheet" href="../../../layui/layui_ext/dtree/font/dtreefont.css">
 | 
			
		||||
    <title>修改班组</title>
 | 
			
		||||
 | 
			
		||||
    <style type="text/css">
 | 
			
		||||
        #main-box {
 | 
			
		||||
            width: 100%;
 | 
			
		||||
            height: 100%;
 | 
			
		||||
            display: flex;
 | 
			
		||||
            flex-direction: column;
 | 
			
		||||
            justify-content: space-between;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        div p {
 | 
			
		||||
            font-weight: bold;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .layui-form-label {
 | 
			
		||||
            width: 120px;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .layui-form-item .layui-input-inline {
 | 
			
		||||
            width: 256px;
 | 
			
		||||
            /* 统一宽度 */
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .required_icon,
 | 
			
		||||
        th span {
 | 
			
		||||
            font-size: 16px;
 | 
			
		||||
            color: red;
 | 
			
		||||
            margin: 0 5px;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .layui-form {
 | 
			
		||||
            padding: 20px;
 | 
			
		||||
            overflow-y: auto;
 | 
			
		||||
            flex-grow: 1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .btn-box {
 | 
			
		||||
            width: 100%;
 | 
			
		||||
            height: 80px;
 | 
			
		||||
            box-sizing: border-box;
 | 
			
		||||
            display: flex;
 | 
			
		||||
            justify-content: flex-end;
 | 
			
		||||
            align-items: center;
 | 
			
		||||
            padding-right: 4%;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .submit {
 | 
			
		||||
            display: flex;
 | 
			
		||||
            justify-content: flex-end;
 | 
			
		||||
            /* 水平向右对齐 */
 | 
			
		||||
            align-items: center;
 | 
			
		||||
            /* 垂直居中 */
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ::-webkit-scrollbar {
 | 
			
		||||
            width: 10px;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ::-webkit-scrollbar-track {
 | 
			
		||||
            background: rgb(233 233 233);
 | 
			
		||||
            border-radius: 10px;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ::-webkit-scrollbar-thumb {
 | 
			
		||||
            background: rgb(207 207 207);
 | 
			
		||||
            border-radius: 10px;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ::-webkit-scrollbar-thumb:hover {
 | 
			
		||||
            background: rgb(100, 100, 100);
 | 
			
		||||
            border-radius: 10px;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ::-webkit-scrollbar-thumb:active {
 | 
			
		||||
            background: rgb(68, 68, 68);
 | 
			
		||||
            border-radius: 10px;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .layui-input-block {
 | 
			
		||||
            margin-left: 150px !important;
 | 
			
		||||
            min-height: 36px;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .memberInfoItem {
 | 
			
		||||
            padding: 10px 0;
 | 
			
		||||
            margin-bottom: 10px;
 | 
			
		||||
            border-bottom: 1px solid #e6e6e6;
 | 
			
		||||
        }
 | 
			
		||||
    </style>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
    <div id="main-box">
 | 
			
		||||
        <div class="form">
 | 
			
		||||
            <form class="layui-form" onsubmit="return false;" id="form" lay-filter="formFilter">
 | 
			
		||||
                <input type="hidden" id="id" name="id">
 | 
			
		||||
                <div style="width: 100%;height: 100%">
 | 
			
		||||
                    <div>
 | 
			
		||||
                        <p>班组信息</p>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <!-- 班组名称 -->
 | 
			
		||||
                    <div class="layui-row">
 | 
			
		||||
                        <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                            <div class="layui-form-item">
 | 
			
		||||
                                <label class="layui-form-label"><span class="required_icon">*</span>班组名称</label>
 | 
			
		||||
                                <div class="layui-input-block">
 | 
			
		||||
                                    <input type="text" required lay-verify="required" id="teamGroupName"
 | 
			
		||||
                                        name="teamGroupName" autocomplete="off" class="layui-input">
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <!-- 所属分包商 -->
 | 
			
		||||
                        <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                            <div class="layui-form-item">
 | 
			
		||||
                                <label class="layui-form-label"><span class="required_icon">*</span>所属分包商</label>
 | 
			
		||||
                                <div class="layui-input-block">
 | 
			
		||||
                                    <select id="subContractor" name="subContractor" class="layui-select" lay-search
 | 
			
		||||
                                        lay-filter="subContractor" lay-verify="required" style="height: 36px;"></select>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <div class="layui-row">
 | 
			
		||||
                        <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                            <div class="layui-form-item">
 | 
			
		||||
                                <label class="layui-form-label"><span class="required_icon">*</span>信息评审表</label>
 | 
			
		||||
                                <div class="layui-input-block">
 | 
			
		||||
                                    <button type="button" class="layui-btn" id="uploadBtn1">
 | 
			
		||||
                                        <i class="layui-icon"></i> 上传文件
 | 
			
		||||
                                    </button>
 | 
			
		||||
                                    <input type="file" id="fileInput1" name="file" accept=".jpg,.png"
 | 
			
		||||
                                        style="display: none;">
 | 
			
		||||
                                    <div id="fileInfo1"></div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                            <div class="layui-form-item">
 | 
			
		||||
                                <label class="layui-form-label"><span class="required_icon">*</span>班组类型</label>
 | 
			
		||||
                                <div class="layui-input-block">
 | 
			
		||||
                                    <select id="teamType" name="teamType" class="layui-select" lay-search
 | 
			
		||||
                                        lay-verify="required" style="height: 36px;"></select>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <div>
 | 
			
		||||
                        <p>班长信息</p>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <div class="layui-row">
 | 
			
		||||
                        <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                            <div class="layui-form-item">
 | 
			
		||||
                                <label class="layui-form-label"><span class="required_icon">*</span>班长姓名</label>
 | 
			
		||||
                                <div class="layui-input-block">
 | 
			
		||||
                                    <input type="text" required lay-verify="required" id="name" name="name"
 | 
			
		||||
                                        autocomplete="off" class="layui-input">
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                            <div class="layui-form-item">
 | 
			
		||||
                                <label class="layui-form-label"><span class="required_icon">*</span>联系方式</label>
 | 
			
		||||
                                <div class="layui-input-block">
 | 
			
		||||
                                    <input type="text" required lay-verify="required" id="phone" name="phone"
 | 
			
		||||
                                        autocomplete="off" class="layui-input">
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <div class="layui-row">
 | 
			
		||||
                        <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                            <div class="layui-form-item">
 | 
			
		||||
                                <label class="layui-form-label"><span class="required_icon">*</span>身份证号</label>
 | 
			
		||||
                                <div class="layui-input-block">
 | 
			
		||||
                                    <input type="text" required lay-verify="required" id="idCard" name="idCard"
 | 
			
		||||
                                        autocomplete="off" class="layui-input">
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                            <div class="layui-form-item">
 | 
			
		||||
                                <label class="layui-form-label"><span class="required_icon">*</span>工种</label>
 | 
			
		||||
                                <div class="layui-input-block">
 | 
			
		||||
                                    <select id="workType" name="workType" class="layui-select" lay-search
 | 
			
		||||
                                        lay-verify="required" style="height: 36px;">
 | 
			
		||||
                                    </select>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <div class="layui-row">
 | 
			
		||||
                        <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                            <div class="layui-form-item">
 | 
			
		||||
                                <label class="layui-form-label"><span class="required_icon">*</span>性别</label>
 | 
			
		||||
                                <div class="layui-input-block">
 | 
			
		||||
                                    <select id="sex" name="sex" class="layui-select" lay-search lay-verify="required"
 | 
			
		||||
                                        style="height: 36px;">
 | 
			
		||||
                                        <option value="1">男</option>
 | 
			
		||||
                                        <option value="2">女</option>
 | 
			
		||||
                                    </select>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="layui-col-md6" style="float: left;width: 50%;margin-top: 1%">
 | 
			
		||||
                            <div class="layui-form-item">
 | 
			
		||||
                                <label class="layui-form-label"><span style="color: red"></span>人脸照片</label>
 | 
			
		||||
                                <div class="layui-input-block">
 | 
			
		||||
                                    <button type="button" class="layui-btn" id="uploadBtn">
 | 
			
		||||
                                        <i class="layui-icon"></i> 上传文件
 | 
			
		||||
                                    </button>
 | 
			
		||||
                                    <input type="file" id="fileInput" name="file" accept=".jpg,.png"
 | 
			
		||||
                                        style="display: none;">
 | 
			
		||||
                                    <div id="fileInfo"></div>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <div style="display: flex;align-items: center;justify-content: space-between;">
 | 
			
		||||
                        <p style="margin-right: 10px;">
 | 
			
		||||
                            班组成员信息
 | 
			
		||||
                        </p>
 | 
			
		||||
                        <button class="layui-btn layui-bg-blue" lay-filter="addMember" id="addMemberBtn">添加</button>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <!-- 动态添加的人员信息 -->
 | 
			
		||||
                    <div id="memberInfo">
 | 
			
		||||
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <!-- 提交按钮 -->
 | 
			
		||||
                    <div class="layui-form-item">
 | 
			
		||||
                        <div class="layui-input-block submit">
 | 
			
		||||
                            <button class="layui-btn" lay-submit lay-filter="formSubmit">保存</button>
 | 
			
		||||
 | 
			
		||||
                            <button class="layui-btn" type="button" lay-filter="formStaging" id="stagingBtn">暂存</button>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                </div>
 | 
			
		||||
            </form>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</body>
 | 
			
		||||
<script src="../../../js/publicJs.js"></script>
 | 
			
		||||
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
 | 
			
		||||
<script type="text/javascript" src="../../../js/jq.js"></script>
 | 
			
		||||
<script type="text/javascript" src="../../../js/my/permission.js"></script>
 | 
			
		||||
<script src="../../../layui/layui.js"></script>
 | 
			
		||||
<script src="../../../layui/layui_ext/dtree/dtree.js"></script>
 | 
			
		||||
<script src="../../../js/evaluate/teamGroup/registerEdit.js?v=1"></script>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
| 
						 | 
				
			
			@ -244,6 +244,8 @@
 | 
			
		|||
                    <div class="layui-form-item">
 | 
			
		||||
                        <div class="layui-input-block submit">
 | 
			
		||||
                            <button class="layui-btn" lay-submit lay-filter="formSubmit">保存</button>
 | 
			
		||||
 | 
			
		||||
                            <button class="layui-btn" type="button" lay-filter="formStaging" id="stagingBtn">暂存</button>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue