diff --git a/.idea/gz_car_ui.iml b/.idea/gz_car_ui.iml new file mode 100644 index 0000000..0c8867d --- /dev/null +++ b/.idea/gz_car_ui.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/js/car_application_audit/car_audit_detail.js b/js/car_application_audit/car_audit_detail.js new file mode 100644 index 0000000..f30f99e --- /dev/null +++ b/js/car_application_audit/car_audit_detail.js @@ -0,0 +1,591 @@ +let idParam, objParam; +let details; +let form, layer, table; +let isPage = getUrlParam('isPage'); +let token; +if (isPage) { // 首页跳转 + $('#plan-detail-box>div').eq(0).remove(); + $('#plan-detail-box').css({'justify-content': 'end', 'height': '50px'}); + $('body').css('margin', '0'); + let obj = decodeURIComponent(getUrlParam('obj')) + setParams(obj); +} + +// 获取 URL 参数 +function getParamsFromUrl() { + const urlParams = new URLSearchParams(window.location.search); + const result = {}; + for (const [key, value] of urlParams.entries()) { + result[key] = value; + } + return result; +} + + +// 页面加载完成后执行 +window.addEventListener("DOMContentLoaded", () => { + const params = getParamsFromUrl(); + console.log(params) + if (!params.token) { + return; + } + + token = params.token; + sessionStorage.setItem('gz-token', params.token); + let url = dataUrl + `backstage/carPlanAudit/getCarAuditById/${params.id}`; + ajaxRequest(url, "GET", {}, true, function () { + }, function (result) { + if (result.code === 200) { + params.isFinish === '1' ? result.data.checkType = 0 : result.data.checkType = 2 + setParams(JSON.stringify(result.data)); + } else { + } + }, function (xhr, status, error) { + errorFn(xhr, status, error) + }, null); + +}); + +function setParams(obj) { + objParam = JSON.parse(obj); + if (objParam.checkType === 2) { + $('#print').before(''); + } + idParam = objParam.id; + layui.use(['form', 'layer', 'table'], function () { + form = layui.form; + layer = layui.layer; + table = layui.table; + getNeedPlanDetails(); + initTable(); + }); +} + +// 详情 +function getNeedPlanDetails() { + let params = { + encryptedData: JSON.stringify({ + 'id': objParam.id + }) + }; + let url = dataUrl + 'backstage/carNeedPlan/getNeedPlanDetails'; + ajaxRequest(url, "POST", params, true, function () { + }, function (result) { + + if (result.code === 200) { + setPlanBasicTableInfo(result.data); + setOperRecordInfo(result.data.recordList, result.data); + setCheckStatus(result.data); + } + }, function (xhr, status, error) { + errorFn(xhr, status, error) + }, null); +} + +// 基本信息 +function setPlanBasicTableInfo(obj) { + $('#proName').html(obj.proName); + $('#projectPart').html(obj.projectPart); + $('#projectContent').html(obj.projectContent); + $('#needTime').html(obj.needTime); + $('#remark').html(obj.remark); + + $('#carLength').html(obj.carLength); + $('#carWidth').html(obj.carWidth); + $('#carHeight').html(obj.carHeight); + $('#carWeight').html(obj.carWeight); + $('#carStart').html(obj.carStart); + $('#carEnd').html(obj.carEnd); + + setRoutePoint(obj.routePoint); + + // 附件文档 + setFileTable(obj.fileList); +} + +function setRoutePoint(data) { + // 清空之前的表格 + $('#routePoint').empty(); + let html = ''; + html += ""; + if (data != null && data !== "") { + // 分割数据并过滤掉空值 + let result = data.split("routePoint;").filter(item => item.trim() !== ""); + if (result && result.length > 0) { + // 动态生成表头 + html += ""; + for (let i = 0; i < Math.min(result.length, 4); i++) { + html += ""; + } + html += ""; + // 动态生成表格内容,每行最多 4 列 + let rowCount = Math.ceil(result.length / 4); // 计算需要多少行 + for (let row = 0; row < rowCount; row++) { + html += ""; + for (let col = 0; col < 4; col++) { + let index = row * 4 + col; + if (index < result.length) { + html += ""; + } else { + html += ""; // 如果没有数据,填充空白单元格 + } + } + html += ""; + } + } + } + html += "
途经点
" + result[index] + "
"; + // 将生成的 HTML 插入到页面中 + $('#routePoint').append(html); +} + +// 附件文档赋值 +function setFileTable(fileList) { + $('#file-table tr:not(:first)').remove(); + let html = ''; + if (fileList && fileList.length > 0) { + $.each(fileList, function (index, item) { + html += '' + + '' + handleFileType(item.fileName) + item.fileName + '' + + '' + (item.type) + '' + + '' + item.createName + '' + + '' + item.createTime + '' + + '预览' + + '下载' + + '' + + ''; + }) + } else { + html = '暂无数据'; + } + $('#file-table tbody').after(html); +} + + +// 处理文件类型 +function handleFileType(value) { + value = value.toLowerCase(); + let src = ''; + if (value.indexOf('docx') > -1 || value.indexOf('doc') > -1) { + src = '../../../images/docx.png' + } else if (value.indexOf('xls') > -1 || value.indexOf('xlsx') > -1) { + src = '../../../images/xlsx.png' + } else if (value.indexOf('pdf') > -1) { + src = '../../../images/pdf.png' + } else if (value.indexOf('png') > -1 || value.indexOf('jpg') > -1 || value.indexOf('jpeg') > -1) { + src = '../../../images/img_icon.png' + } + return '' +} + +// 预览文件 +function viewFile(obj) { + let fileName = obj.fileName.toLowerCase(); + if (fileName.indexOf('png') > -1 || fileName.indexOf('jpg') > -1 || fileName.indexOf('jpeg') > -1) { + layer.photos({ + shade: 0.5, + photos: { + "title": "图片预览", + "start": 0, + "data": [ + { + "alt": "layer", + "pid": 1, + "src": fileUrl + obj.fileUrl + '?token=' + sessionStorage.getItem("gz-token"), + } + ] + } + }); + } else { + // 调用公司的预览文件的服务 + commonViewFile(obj.fileUrl); + } +} + +// 下载文件 +function downLoadFile(obj) { + let url = dataUrl + "sys/file/download?fileId=" + obj.id; + downLoadFileUtil(url, obj.fileName, null); +} + +// 查询/重置 +function queryTable(type) { + if (type === 1) { + let name = $('#name').val(); + let flag = checkValue(name); + if (flag) { + $('#name').val(''); + return layer.msg('名称查询包含特殊字符,请重新输入', {icon: 2}); + } + let model = $('#model').val(); + let flag2 = checkValue(model); + if (flag2) { + $('#model').val(''); + return layer.msg('规格查询包含特殊字符,请重新输入', {icon: 2}); + } + reloadTable(1); + } else if (type === 2) { + $('#name').val(''); + $('#model').val(''); + layui.form.render(); + reloadTable(1); + } +} + +// 刷新页面数据 +function reloadData() { + reloadTable(1); +} + +// 重载表格 +function reloadTable(pageNum) { + table.reload("currentTableId", { + page: { + curr: pageNum ? pageNum : 1, + }, + where: { + encryptedData: JSON.stringify({ + 'name': $('#name').val(), + 'model': $('#model').val(), + 'id': objParam.id + }), + }, + }, + ); +} + +// 初始化表格 +function initTable() { + tableIns = table.render({ + elem: "#currentTableId", + id: 'currentTableId', + headers: { + authorization: sessionStorage.getItem("gz-token"), + }, + height: "full", + url: dataUrl + "backstage/carNeedPlan/getNeedPlanDetailsList", + where: { + encryptedData: JSON.stringify({ + 'name': $('#name').val(), + 'model': $('#model').val(), + 'id': objParam.id + }), + }, + request: { + pageName: 'pageNum', + limitName: 'pageSize' + }, + parseData: function (res) { // res 即为原始返回的数据 + if (res.code === 401) { + closeWindowOpen(); + } + return { + "code": 0, // 解析接口状态 + "msg": '获取成功', // 解析提示文本 + "count": res.total, // 解析数据长度 + "data": res.list // 解析数据列表 + }; + }, + cols: [ + [ + { + width: '8%', + title: "序号", + align: "center", + templet: function (d) { + return d.LAY_NUM; + }, + }, + { + field: "type", + width: '10%', + title: "类型", + unresize: true, + align: "center", + sort: true, + }, + { + field: "name", + width: '10%', + title: "名称", + unresize: true, + align: "center", + sort: true, + }, + { + field: "model", + width: '15%', + title: "规格", + unresize: true, + align: "center", + sort: true, + }, + { + field: "unit", + width: '10%', + title: "单位", + unresize: true, + align: "center", + sort: true, + templet: function (d) { + return setNullValue(d.unit); + }, + }, + { + field: "carSpec", + width: '14%', + title: "所需规格", + unresize: true, + align: "center", + }, + { + field: "needNum", + width: '10%', + title: "需用量", + unresize: true, + align: "center", + sort: true, + templet: function (d) { + return setNumColor(d.needNum); + }, + }, + { + field: "backDate", + width: '12%', + title: "预计使用时间(天)", + unresize: true, + align: "center", + sort: true, + templet: function (d) { + return d.backDate; + }, + + }, + { + field: "remark", + width: '10%', + title: "备注", + sort: true, + unresize: true, + align: "center", + templet: function (d) { + if (d.remark) { + if (d.remark.length > 60) { + return '' + d.remark.substring(0, 60) + '...' + } else { + return '' + d.remark + '' + } + } else { + return ''; + } + }, + }, + ], + ], + limits: [10, 15, 20, 25, 50, 100], + limit: 10, + page: true, + done: function (res, curr, count) { + pageNum = tableIns.config.page.curr; + table.resize("currentTableId"); + }, + }); +} + +// 数量颜色 +function setNumColor(value, isNeedNum) { + if (isNeedNum) { + return '' + value + ""; + } else { + return '' + value + ""; + } +} + +// 导出 +function exportData() { + let params = { + "id": objParam.id, + 'name': $('#name').val(), + 'model': $('#model').val(), + + } + let url = dataUrl + "backstage/carNeedPlan/exportDetails"; + exportExcelUtil(url, '申请明细', JSON.stringify(params)); +} + + +// 操作记录 +function setOperRecordInfo(list, obj) { + let html = ''; + if (list && list.length > 0) { + let imgUrl = '../../../images/user_head_icon.png'; + let imgUrl2 = '../../../images/time_icon.png'; + $.each(list, function (index, item) { + const creator = (item.nikeName ? item.nikeName : item.userName); + // 1. 容错处理(统一处理空值、类型转换) + const remark = setNullValue(item.auditRemark); // 已有空值处理,保留 + const auditType = item.auditType + ''; // 确保为字符串(匹配原条件的字符串判断) + const auditStatus = item.auditStatus + ''; // 确保为字符串 + const times = setNullValue(item.times) || '0'; // 时间间隔容错(避免拼接 undefined) + +// 2. 部门映射表(替代多 if-else,清晰直观) + const deptMap = { + '0': '项目部', + '1': '项目部', + '-1': '项目部', + '2': '分公司', + '3': '项管中心', + '4': '智联装备云控公司', + '5': '供应商' + }; + const dept = deptMap[auditType] || '未知部门'; // 默认值容错 + +// 3. 操作流程规则(按「优先级+条件组合」定义,避免逻辑冲突) + const operRules = [ + // 规则:[条件函数, 操作文案],按优先级排序(先匹配先执行) + [() => index === 0 && auditType === '1', '发起申请'], + [() => index !== 0 && auditType === '1', '提交派车申请'], + [() => index !== 0 && auditType === '9' && auditStatus === '9', `驳回-给发起人${creator},共间隔:${times} 原因备注:${remark}`], + [() => index !== 0 && auditType === '2' && auditStatus === '1', `审核确认通过,共间隔:${times} 原因备注:${remark}`], + [() => index !== 0 && auditType === '2' && auditStatus === '2', `完结-审核确认通过,共耗时:${times} 原因备注:${remark}`], + [() => auditType === '2' && auditStatus === '2', `审核确认通过,共间隔:${times} 原因备注:${remark}`], // 原逻辑:无 index 限制 + [() => auditType === '2' && auditStatus === '3', `驳回-给发起人${creator},共间隔:${times} 原因备注:${remark}`], + [() => auditType === '3' && auditStatus === '2', `审核确认通过,共间隔:${times} 原因备注:${remark}`], + [() => auditType === '3' && auditStatus === '3', `驳回-给发起人${creator},共间隔:${times} 原因备注:${remark}`], + [() => auditType === '4' && auditStatus === '2', `完结-审核确认通过,共耗时:${times} 原因备注:${remark}`], + [() => auditType === '4' && auditStatus === '3', `驳回-给发起人${creator},共间隔:${times} 原因备注:${remark}`], + [() => auditType === '5' && auditStatus === '2', `派车情况-${remark},共耗时:${times}`] + ]; + +// 匹配操作文案(默认值容错) + let operData = '未知操作'; + for (const [condition, text] of operRules) { + if (condition()) { + operData = text; + break; // 找到匹配规则,立即退出(保证优先级) + } + } + html += '
' + + '' + + '
' + + '

' + item.auditTime.substring(0, 10) + '

' + + '
' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + + '' + (item.nikeName ? item.nikeName : item.userName) + '(' + item.phone + ')' + dept + '' + + '
' + + '
' + + '' + operData + '' + + '
' + + '
' + + '
' + + '' + + '' + item.auditTime + '' + + '
' + + '
' + + '
' + + '
' + + '
'; + }) + } + $('.layui-timeline').empty().append(html); +} + +// 设置计划编号/审核状态 +function setCheckStatus(obj) { + $('#code').empty().html(obj.code); + $('#checkStatus').html(getCheckStatus(obj.statusType, obj.status)); + if (obj.statusType === 2 && obj.status === 1 && objParam.checkType !== 2) { // 待分公司审核可以撤回 && 申请人可以撤回 && 不是审核页面跳转 + let user = sessionStorage.getItem('us'); + if (user) { + let userObj = JSON.parse(user); + if (userObj.username === obj.userName) { + $('#print').before(""); + } + } + } +} + +// 审核状态 +function getCheckStatus(statusType, status) { + var company = ""; + if (statusType === 0 && status === 0) { + return "已撤回"; + } + if (statusType === 1) { + return "审核通过"; + } else if (statusType === 2) { + company = "分公司"; + } else if (statusType === 3) { + company = "项管中心"; + } else if (statusType === 4) { + company = "智联装备云控公司"; + } + if (status === 1) { + return "待" + company + "审核"; + } else if (status === 2) { + return "审核通过"; + } else if (status === 3) { + return "" + company + "审核驳回"; + } + return "待审核"; +} + + +// 打印 +function print() { + $("#main-box").print({ + globalStyles: true, + mediaPrint: false, + stylesheet: '../../../css/aq_demand_plan/apply_plan_detail.css', + noPrintSelector: ".no-print", + iframe: true, + append: null, + prepend: null, + manuallyCopyFormValues: true, + deferred: $.Deferred() + }); +} + +// 撤回 +function withdrawData(data) { + layer.confirm("确定撤回此条数据吗?", {'title': '操作提示', move: false}, function () { + let loadingMsg = layer.msg('数据撤回中,请稍候...', {icon: 16, scrollbar: false, time: 0}); + let url = dataUrl + "backstage/carNeedPlan/withdrawData" + let obj = {id: data.id} + let params = { + encryptedData: JSON.stringify(obj) + } + ajaxRequest(url, "POST", params, true, function () { + }, function (result) { + console.error(result); + layer.close(loadingMsg); // 关闭提示层 + if (result.code === 200) { + parent.layer.msg(result.msg, {icon: 1}) + closePage(); + } else { + layer.msg(result.msg, {icon: 2}) + } + }, function (xhr) { + layer.close(loadingMsg); // 关闭提示层 + error(xhr) + }); + }) +} + +// 需求计划申请审核 +function check() { + objParam.checkType = '2'; // 需求计划申请审核 + objParam.token = token; + openIframeByParamObj("check", "审核", "./car_audit_form.html", "40%", "50%", objParam, 1); +} + +function closePage() { + let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引 + window.parent.queryTable(1); + parent.layer.close(index); // 再执行关闭 +} diff --git a/js/car_application_audit/car_audit_detail_list.js b/js/car_application_audit/car_audit_detail_list.js new file mode 100644 index 0000000..6aea297 --- /dev/null +++ b/js/car_application_audit/car_audit_detail_list.js @@ -0,0 +1,224 @@ +let form, table, laydate; +let tableIns; +let pageNum = 1; // 定义分页 +let objParam; +function setParams(params) { + objParam = JSON.parse(params); + layui.use(["form", "table", 'laydate'], function () { + form = layui.form; + table = layui.table; + laydate = layui.laydate; + initTable(); + }); +} + +// 查询/重置 +function queryTable(type) { + if (type === 1) { + let keyWord = $('#keyWord').val(); + let flag = checkValue(keyWord); + if (flag) { + $('#keyWord').val(''); + return layer.msg('关键字查询包含特殊字符,请重新输入', { icon: 2 }); + } + reloadTable(1); + } else if (type === 2) { + $('#keyWord').val(''); + $('#status').val(''); + layui.form.render(); + reloadTable(1); + } +} + +// 刷新页面数据 +function reloadData() { + reloadTable(1); +} + +// 重载表格 +function reloadTable(pageNum) { + table.reload("currentTableId", { + page: { + curr: pageNum ? pageNum : 1, + }, + where: { + encryptedData: JSON.stringify({ + 'keyWord': $('#keyWord').val(), + 'status': $('#status').val(), + 'contractId': objParam.contractId, + 'supId': objParam.supId, + }), + }, + }, + ); +} + +// 初始化表格 +function initTable() { + tableIns = table.render({ + elem: "#currentTableId", + id: 'currentTableId', + headers: { + authorization: sessionStorage.getItem("gz-token"), + }, + height: "full-170", + url: dataUrl + "backstage/carBalance/getSltDetailsList", + where: { + encryptedData: JSON.stringify({ + 'keyWord': $('#keyWord').val(), + 'status': $('#status').val(), + 'contractId': objParam.contractId, + 'supId': objParam.supId, + }), + }, + request: { + pageName: 'pageNum', + limitName: 'pageSize' + }, + parseData: function (res) { // res 即为原始返回的数据 + if (res.code === 401) { + closeWindowOpen(); + } + return { + "code": 0, // 解析接口状态 + "msg": '获取成功', // 解析提示文本 + "count": res.total, // 解析数据长度 + "data": res.list // 解析数据列表 + }; + }, + cols: [ + [ + { + width: '5.9%', + title: "序号", + align: "center", + templet: function (d) { + return d.LAY_NUM; + }, + }, + { + field: "type", + width: '10%', + title: "类型", + unresize: true, + align: "center", + sort:true, + templet: function (d) { + return d.type === '1' ? '车辆':'吊车'; + }, + }, + { + field: "supName", + width: '15%', + title: "供应商名称", + unresize: true, + align: "center", + sort:true, + }, + { + field: "code", + width: '14%', + title: "需求计划编号", + unresize: true, + align: "center", + sort:true, + templet: function (d) { + let html = ""; + html += "" + d.code + ""; + return html; + }, + }, + { + field: "carNum", + width: '10%', + title: "用车数量", + unresize: true, + align: "center", + sort:true, + }, + { + field: "money", + width: '10%', + title: "应付金额", + unresize: true, + align: "center", + sort:true, + templet: function (d) { + return ' ¥ ' + (d.money ? d.money : 0); + }, + }, + { + field: "status", + width: '10%', + title: "已付金额", + unresize: true, + align: "center", + sort:true, + templet: function (d) { + let payMoney = d.payMoney || 0; + if (d.status === '已付') { + return ' ¥ ' + payMoney; + } else { + return '

待付

'; + } + + }, + }, + { + field: "proName", + width: '15%', + title: "工程名称", + unresize: true, + align: "center", + sort:true, + }, + { + title: "操作", + width: '10%', + align: "center", + unresize: true, + templet: function (d) { + let html = ""; + html += "详情"; + return html; + }, + }, + ], + ], + limits: [10, 15, 20, 25, 50, 100], + limit: 10, + page: true, + done: function (res, curr, count) { + pageNum = tableIns.config.page.curr; + table.resize("currentTableId"); + }, + }); +} + +// 导出 +function exportExcel() { + let params = { + 'keyWord': $('#keyWord').val(), + 'status': $('#status').val(), + 'supId': objParam.supId + } + let url = dataUrl + "backstage/carBalance/export2"; + exportExcelUtil(url, '付款单录入详情', JSON.stringify(params)); +} + +// 详情 +function paymentDetail(obj) { + openIframeByParamObj2("paymentDetail2", "详情", "./car_audit_detail.html", "92%", "95%", obj); +} + + +// 需求计划详情 +function openPlanDetail(obj) { + obj.id = obj.planId; + obj.code = obj.code; + let content = '../car_demand_plan/child/apply_plan_detail.html'; + if (obj.code.indexOf('spec-') > -1) { + content = '../car_demand_plan/child/emerg_internal_car_detail.html'; + } + openIframeByParamObj2("planDetail", "车辆需求计划", content, "92%", "95%", obj); +} diff --git a/js/car_application_audit/car_audit_form.js b/js/car_application_audit/car_audit_form.js new file mode 100644 index 0000000..8708921 --- /dev/null +++ b/js/car_application_audit/car_audit_form.js @@ -0,0 +1,102 @@ +var form, layer; +let objParam, idParam; + +function setParams(params) { + objParam = JSON.parse(params); + console.log(objParam); + idParam = objParam.id; + layui.use(['form'], function () { + form = layui.form; + layer = layui.layer; + form.verify(); + form.on('submit(formData)', function (data) { + submitApply(data); + }); + form.on('radio(auditStatus)', function (data) { + if (data.value === '2') { // 通过 + $('#remark').removeAttr('lay-verify'); + $('#remark').val("申请通过"); // textarea 设置内容用 val() + $('#auditRemarksLabel').removeClass('required'); + } else if (data.value === '3') { // 不通过 + $('#remark').attr('lay-verify', 'required'); + $('#remark').val("申请驳回"); // textarea 设置内容用 val() + $('#auditRemarksLabel').addClass('required'); + } + }); + form.render(); + }); +} + +function saveData2() { + $('#formSubmit').trigger('click') +} + +// 提交 +function submitApply(data) { + let loadingMsg = layer.msg('正在提交保存,请稍等...', { + icon: 16, + shade: 0.01, + time: '0' + }); + + let url = ''; + if (objParam.checkType === '1') { // 派车录入审核 + url = dataUrl + 'backstage/dispatchCar/dispatchAudit'; + // 出库单ID、合同ID + data.field.id = idParam; + data.field.contractId = objParam.contractId; + data.field.outId = objParam.outId; + data.field.planId = objParam.planId; + data.field.supId = objParam.supId; + data.field.status = data.field.status === '2' ? '1' : '2'; + } else if (objParam.checkType === '2') { // 需求计划审核 + url = dataUrl + 'backstage/carPlanAudit/auditInfo'; + data.field.id = idParam; + } + let params = { + encryptedData: JSON.stringify(data.field) + }; + ajaxRequest(url, "POST", params, true, function () { + $('.save').addClass("layui-btn-disabled").attr("disabled", true); + $('.cancel').addClass("layui-btn-disabled").attr("disabled", true); + }, function (result) { + layer.close(loadingMsg); + $('.save').removeClass("layui-btn-disabled").attr("disabled", false); + $('.cancel').removeClass("layui-btn-disabled").attr("disabled", false); + if (result.code === 200) { + top.layer.msg(result.msg, {icon: 1}); + if (objParam.token) { + // 如果没有 token,直接关闭整个窗口 + window.parent.open('', '_self'); + window.parent.close(); + return; + } else { + closePage(1); + } + + } else { + layer.msg(result.msg, {icon: 2}); + } + }, function (xhr, status, error) { + layer.close(loadingMsg); // 关闭提示层 + layer.msg('服务异常,请稍后重试', {icon: 16, scrollbar: false, time: 2000}); + $('.save').removeClass("layui-btn-disabled").attr("disabled", false); + $('.cancel').removeClass("layui-btn-disabled").attr("disabled", false); + errorFn(xhr, status, error) + }, null); +} + +// 关闭页面 +function closePage(type) { + let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引 + + + if (type == 1) { + if (objParam.checkType === '1') { // 派车录入审核 + window.parent.reloadAuditData(); + } else if (objParam.checkType === '2') { // 需求计划审核 + window.parent.closePage(); + } + } + parent.layer.close(index); // 再执行关闭 +} diff --git a/js/car_application_audit/car_audit_list.js b/js/car_application_audit/car_audit_list.js new file mode 100644 index 0000000..a1ff94f --- /dev/null +++ b/js/car_application_audit/car_audit_list.js @@ -0,0 +1,282 @@ +let form, table, element; +let tableIns; +let pageNum = 1; // 定义分页 +layui.use(["form", "table", 'element'], function () { + form = layui.form; + table = layui.table; + element = layui.element; + // tab 切换事件 + element.on('tab(demo-filter-tab)', function (data) { + let status = $(this).attr('value'); + $('#status').val(status); + queryTable(1); + }); + initTable(); +}); + +// 查询/重置 +function queryTable(type) { + if (type === 1) { + let supName = $('#supName').val(); + let flag = checkValue(supName); + if (flag) { + $('#supName').val(''); + return layer.msg('关键字查询包含特殊字符,请重新输入', { icon: 2 }); + } + reloadTable(1); + } else if (type === 2) { + $('#supName').val(''); + layui.form.render(); + reloadTable(1); + } +} + +// 刷新页面数据 +function reloadData() { + reloadTable(1); +} + +// 重载表格 +function reloadTable(pageNum) { + table.reload("currentTableId", { + page: { + curr: pageNum ? pageNum : 1, + }, + where: { + encryptedData: JSON.stringify({ + 'supName': $('#supName').val(), + 'status': $('#status').val() + }), + }, + }, + ); +} + +// 初始化表格 +function initTable() { + tableIns = table.render({ + elem: "#currentTableId", + id: 'currentTableId', + headers: { + authorization: sessionStorage.getItem("gz-token"), + }, + height: "full-220", + url: dataUrl + "backstage/carBalance/getBalanceData", + where: { + encryptedData: JSON.stringify({ + 'supName': $('#supName').val(), + 'status': $('#status').val() + }), + }, + request: { + pageName: 'pageNum', + limitName: 'pageSize' + }, + parseData: function (res) { // res 即为原始返回的数据 + if(res.code === 401){ + closeWindowOpen(); + } + return { + "code": 0, // 解析接口状态 + "msg": '获取成功', // 解析提示文本 + "count": res.total, // 解析数据长度 + "data": res.list // 解析数据列表 + }; + }, + cols: [ + [ + { + width: '6.9%', + title: "序号", + type: 'numbers', + align: "center", + templet: function (d) { + return d.LAY_NUM; + }, + }, + { + field: "supName", + width: '14%', + title: "供应商名称", + unresize: true, + align: "center", + sort:true, + }, + { + field: "ygMoney", + width: '14%', + title: "预估金额(元) ", + unresize: true, + align: "center", + sort:true, + + }, + { + field: "money", + width: '14%', + title: "租赁金额(元) ", + unresize: true, + align: "center", + sort:true, + }, + { + field: "status", + width: '10%', + title: "审核状态", + unresize: true, + sort:true, + align: "center", + templet: function (d) { + return getCheckStatus(d.status); + }, + }, + { + field: "userName", + width: '8%', + title: "提交人", + unresize: true, + align: "center", + sort:true, + }, + { + field: "createTime", + width: '15%', + title: "提交时间", + unresize: true, + align: "center", + sort:true, + }, + { + field: "remark", + width: '14%', + title: "备注", + unresize: true, + align: "center", + sort:true, + templet: function (d) { + if (d.remark) { + if (d.remark.length > 60) { + return '' + d.remark.substring(0, 60) + '...' + } else { + return '' + d.remark + '' + } + } else { + return ''; + } + }, + }, + { + title: "操作", + width: '15%', + align: "center", + fixed: 'right', + unresize: true, + templet: function (d) { + let html = ""; + let content = getCheckStatus(d.status); + if(!(content.indexOf('驳回') > -1)){ + html += "提交
|
" + } + + if(!(content.indexOf('驳回') > -1)){ + html += "驳回
|
" + } + + html += "详情"; + + if (!(content.indexOf('驳回') > -1 || content.indexOf('已撤回') > -1 || content.indexOf('通过') > -1)) { + html += "
|
审核"; + } + return html; + }, + }, + ], + ], + limits: [10, 15, 20, 25, 50, 100], + limit: 10, + page: true, + done: function (res, curr, count) { + pageNum = tableIns.config.page.curr; + table.resize("currentTableId"); + }, + }); +} + +// 导出 +function exportExcel() { + let params = { + 'supName': $('#supName').val(), + 'status': $('#status').val() + } + let url = dataUrl + "backstage/carPlanAudit/export"; + exportExcelUtil(url, '计划申请审核', JSON.stringify(params)); +} + +//审核状态 +function getCheckStatus(status) { + if(status === 0){ + return "全部通过"; + } + /*var company = ""; + if (statusType === 1) { + return "审核通过"; + } else if (statusType === 2) { + company = "分公司"; + } else if (statusType === 3) { + company = "项目管理中心"; + } else if (statusType === 4) { + company = "机具公司"; + }*/ + if (status === 1) { + return "待审核"; + } else if (status === 2) { + return "审核驳回"; + } else if (status === -3) { + return "待提交"; + } + return "待提交"; +} + +// 详情 +function planAuditDetail(obj) { + openIframeByParamObj("plan_audit_detail", "详情", "./child/car_audit_detail_list.html", "92%", "95%", obj); +} + +// 需求计划申请审核 +function checkDetail(obj) { + obj.checkType = 2; + openIframeByParamObj("check_detail", "审核", "./child/car_audit_detail.html", "92%", "95%", obj,1); +} + +//提交 +function checkSubmit(obj) { + layer.confirm("确定提交此条数据吗?", { 'title': '操作提示', move: false }, function () { + let loadingMsg = layer.msg('数据提交中,请稍候...', { icon: 16, scrollbar: false, time: 0 }); + let url = dataUrl + "backstage/carType/deleteType" + let obj = { 'id': id } + let params = { + encryptedData: JSON.stringify(obj) + } + ajaxRequest(url, "POST", params, true, function () { + }, function (result) { + layer.close(loadingMsg); // 关闭提示层 + if (result.code === 200) { + layer.msg(result.msg, { icon: 1 }) + if (type === 1) { + fitTypeTree.partialRefreshDel($div); // 删除节点 + } else if (type === 2) { + dtreeData = getDTreeData(); + dtree.reload("fitTypeTree", { + data: dtreeData + }); + } + queryTable(1); + } else { + layer.msg(result.msg, { icon: 2 }) + } + }, function (xhr) { + layer.close(loadingMsg); // 关闭提示层 + error(xhr) + }); + }) +} diff --git a/page/car_application_audit/car_audit_list.html b/page/car_application_audit/car_audit_list.html new file mode 100644 index 0000000..8d6bf16 --- /dev/null +++ b/page/car_application_audit/car_audit_list.html @@ -0,0 +1,84 @@ + + + + + + 需求计划审核 + + + + + + + + + + +
+
+
+
    +
  • 全部
  • +
  • 待提交
  • +
  • 待审核
  • +
  • 已通过
  • +
  • 已驳回
  • +
+
+
+ 搜索信息 +
+
+ +
+
+
+ +
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+ + + + + + + + diff --git a/page/car_application_audit/child/car_audit_detail.html b/page/car_application_audit/child/car_audit_detail.html new file mode 100644 index 0000000..29a5c2b --- /dev/null +++ b/page/car_application_audit/child/car_audit_detail.html @@ -0,0 +1,148 @@ + + + + + + + 付款单审核-详情信息 + + + + + + + +
+
+
+ +
+

付款单详情

+
+

+ +
+
+
+
+ +
+
+ +
+
+ +

基本信息

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
项目名称项目部分工程内容需用日期
计划说明
预计运输物品重量(吨)运输起点运输终点
+
+
+ +
+
+ +

附件文档

+
+
+ + + + + + + + +
文件名文件类型上传人员上传时间操作
+
+
+
+ +
+
+ +

申请明细

+
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+ + + +
+
+
+
+
+
+
+
+ +
+
+ +

操作记录

+
+
+ +
+
+
+ + + + + + + + + diff --git a/page/car_application_audit/child/car_audit_detail_list.html b/page/car_application_audit/child/car_audit_detail_list.html new file mode 100644 index 0000000..10628ef --- /dev/null +++ b/page/car_application_audit/child/car_audit_detail_list.html @@ -0,0 +1,68 @@ + + + + + + 供应商付款单详情列表 + + + + + + + + + + +
+
+
+ 搜索信息 +
+
+
+
+
+ +
+
+
+
+ +
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+ + + + + + + + diff --git a/page/car_application_audit/child/car_audit_form.html b/page/car_application_audit/child/car_audit_form.html new file mode 100644 index 0000000..a25fb88 --- /dev/null +++ b/page/car_application_audit/child/car_audit_form.html @@ -0,0 +1,45 @@ + + + + + + + 审核 + + + + + + +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + + + \ No newline at end of file