diff --git a/index.html b/index.html index 2ae7521..620b422 100644 --- a/index.html +++ b/index.html @@ -204,7 +204,7 @@ // 初始化页面 function initPage(miniAdmin){ var options = { - iniUrl: "api/init.json", // 初始化接口 + iniUrl: "api/initback.json", // 初始化接口 clearUrl: "api/clear.json", // 缓存清理接口 urlHashLocation: true, // 是否打开hash定位 bgColorDefault: false, // 主题默认配置 diff --git a/js/demandPlan/apply_plan_list.js b/js/demandPlan/apply_plan_list.js index bdc5916..969a812 100644 --- a/js/demandPlan/apply_plan_list.js +++ b/js/demandPlan/apply_plan_list.js @@ -20,7 +20,7 @@ function queryTable(type) { let flag = checkValue(keyWord); if (flag) { $('#keyWord').val(''); - return layer.msg('关键字查询包含特殊字符,请重新输入', { icon: 2 }); + return layer.msg('关键字查询包含特殊字符,请重新输入', {icon: 2}); } reloadTable(1); } else if (type === 2) { @@ -40,17 +40,17 @@ function reloadData() { // 重载表格 function reloadTable(pageNum) { table.reload("currentTableId", { - page: { - curr: pageNum ? pageNum : 1, + page: { + curr: pageNum ? pageNum : 1, + }, + where: { + encryptedData: JSON.stringify({ + 'keyWord': $('#keyWord').val(), + 'startDate': $('#startDate').val(), + 'endDate': $('#endDate').val() + }), + }, }, - where: { - encryptedData: JSON.stringify({ - 'keyWord': $('#keyWord').val(), - 'startDate': $('#startDate').val(), - 'endDate': $('#endDate').val() - }), - }, - }, ); } @@ -76,7 +76,7 @@ function initTable() { limitName: 'pageSize' }, parseData: function (res) { // res 即为原始返回的数据 - if(res.code === 401){ + if (res.code === 401) { closeWindowOpen(); } return { @@ -89,7 +89,7 @@ function initTable() { cols: [ [ { - width: '5.9%', + width: '5%', title: "序号", align: "center", templet: function (d) { @@ -102,7 +102,7 @@ function initTable() { title: "计划编号", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "proName", @@ -110,23 +110,23 @@ function initTable() { title: "工程名称", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "needTime", - width: '10%', + width: '8%', title: "需用日期", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "creator", - width: '10%', + width: '8%', title: "申请人", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "createTime", @@ -134,15 +134,15 @@ function initTable() { title: "申请时间", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "remark", - width: '14%', + width: '10%', title: "备注", unresize: true, align: "center", - sort:true, + sort: true, templet: function (d) { if (d.remark) { if (d.remark.length > 100) { @@ -162,9 +162,26 @@ function initTable() { title: "审核状态", unresize: true, align: "center", - sort:true, + sort: true, templet: function (d) { - return getCheckStatus(d.statusType, d.status); + return getCheckStatus(d.statusType, d.status, d.mode); + }, + }, + { + field: "mode", + width: '8%', + title: "状态", + unresize: true, + align: "center", + sort: true, + templet: function (d) { + if (d.mode == '0') { + return "草稿"; + } else { + return "已提交"; + } + + }, }, { @@ -176,7 +193,7 @@ function initTable() { let status = getCheckStatus(d.statusType, d.status); let html = ""; html += "详情"; - if (status.indexOf('驳回') > -1 || status.indexOf('已撤回') > -1) { + if (status.indexOf('驳回') > -1 || status.indexOf('已撤回') > -1 || d.mode == '0') { html += "
|
修改"; } return html; @@ -204,12 +221,14 @@ function exportExcel() { } - //审核状态 -function getCheckStatus(statusType, status) { +function getCheckStatus(statusType, status, mode) { var company = ""; - if(statusType === '0' && status === '0'){ - return "已撤回"; + if (mode == '0') { + return "未提交"; + } + if (statusType === '0' && status === '0') { + return "已撤回"; } if (statusType === '1') { return "审核通过"; diff --git a/js/demandPlan/child/apply_plan_edit_form.js b/js/demandPlan/child/apply_plan_edit_form.js index f9eb306..bdc6db0 100644 --- a/js/demandPlan/child/apply_plan_edit_form.js +++ b/js/demandPlan/child/apply_plan_edit_form.js @@ -5,6 +5,7 @@ let jjDataArr = []; // 配件数据 let proList = []; // 工程下拉选 let delIdArr = []; let detailIdArr = []; + function setParams(obj) { objParam = JSON.parse(obj); layui.use(['form', 'layer', 'laydate', 'upload', 'table'], function () { @@ -106,14 +107,15 @@ function getPlanDetailsList() { jjDataArr.push(obj); detailIdArr.push(item.id); }) - $('#no_data_title').css({ 'display': 'none' }); + $('#no_data_title').css({'display': 'none'}); $('#search-info').removeAttr('style'); $('#table-box').removeAttr('style'); setTableData(jjDataArr); } } -function saveData2() { +function saveData2(mode) { + $('#mode').val(mode); $('#formSubmit').trigger('click') } @@ -135,11 +137,11 @@ function submitApply(data) { let list = getBaseTableData(); // 校验配件入库数量 if (list.length === 0) { - return layer.msg('未添加机具数据', { icon: 7 }); + return layer.msg('未添加机具数据', {icon: 7}); } for (let i = 0; i < list.length; i++) { if (parseInt(list[i].needNum) === 0) { - return layer.msg('机具明细,第' + (i + 1) + '行,未填写需用量', { icon: 7 }); + return layer.msg('机具明细,第' + (i + 1) + '行,未填写需用量', {icon: 7}); } // if (parseInt(list[i].times) === 0) { // return layer.msg('机具明细,第' + (i + 1) + '行,未填写需用天数', { icon: 7 }); @@ -160,7 +162,7 @@ function submitApply(data) { if (delDetailArr && delDetailArr.length > 0) { data.field.delIds = delDetailArr; } - let loadingMsg = layer.msg('正在提交保存,请稍等...', { icon: 16, shade: 0.01, time: '0' }); + let loadingMsg = layer.msg('正在提交保存,请稍等...', {icon: 16, shade: 0.01, time: '0'}); let url = dataUrl + 'backstage/planApplication/updatePlan'; let params = { encryptedData: JSON.stringify(data.field) @@ -173,14 +175,14 @@ function submitApply(data) { $('.save').removeClass("layui-btn-disabled").attr("disabled", false); $('.cancel').removeClass("layui-btn-disabled").attr("disabled", false); if (result.code === 200) { - parent.layer.msg(result.msg, { icon: 1 }); + parent.layer.msg(result.msg, {icon: 1}); closePage(1); } else { - layer.msg(result.msg, { icon: 2 }); + layer.msg(result.msg, {icon: 2}); } }, function (xhr, status, error) { layer.close(loadingMsg); // 关闭提示层 - layer.msg('服务异常,请稍后重试', { icon: 16, scrollbar: false, time: 2000 }); + 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) @@ -226,6 +228,7 @@ function chooseFitType() { let params = {}; openIframeByParamObj("choose_fit_type", '选择需求计划机具类型(设备类请备注大、中、小)', "./choose_tool_type_list.html", '92%', '95%', params); } + // 查询 function search() { let keyWord = $('#pName').val(); @@ -270,7 +273,7 @@ function addFitDatas(data) { } else { // 第一次添加数据 jjDataArr = JSON.parse(data); if (jjDataArr && jjDataArr.length > 0) { - $('#no_data_title').css({ 'display': 'none' }); + $('#no_data_title').css({'display': 'none'}); $('#search-info').removeAttr('style'); $('#table-box').removeAttr('style'); setTableData(jjDataArr); @@ -316,7 +319,7 @@ function setTableData(results) { html += "没有相关数据"; } $("#baseTable tbody").empty().append(html); - $('.refund-date').each(function(){ + $('.refund-date').each(function () { laydate.render({ elem: this, // 指定元素 type: 'date' // 可选,指定为日期类型,默认即是'date' @@ -376,10 +379,10 @@ function sel(selectStatus, that, id) { // 删除选中 function delFitType() { if (delIdArr.length == 0) { - layer.msg('请先选择需要删除的数据!', { icon: 7 }) + layer.msg('请先选择需要删除的数据!', {icon: 7}) return; } - let layerIndex = layer.confirm('
确定要删除选中数据吗!
', { title: '操作提示' }, function () { + let layerIndex = layer.confirm('
确定要删除选中数据吗!
', {title: '操作提示'}, function () { layer.close(layerIndex); for (let i = 0; i < delIdArr.length; i++) { for (let j = 0; j < jjDataArr.length; j++) { @@ -393,8 +396,8 @@ function delFitType() { if (jjDataArr.length === 0) { $('#no_data_title').removeAttr('style'); - $('#search-info').css({ 'display': 'none' }); - $('#table-box').css({ 'display': 'none' }); + $('#search-info').css({'display': 'none'}); + $('#table-box').css({'display': 'none'}); } else { // setTableData(jjDataArr); handleDelTableData(delIdArr); @@ -457,7 +460,7 @@ function checkValue(that, type, name) { if (type === 1 || type === 2) { // 需用量 / 需用天数 const regex = /^(0|[1-9]\d{0,6})$/; if (!regex.test(value) && value) { - layer.msg('' + name + '输入有误,请重新输入!', { icon: 5 }) + layer.msg('' + name + '输入有误,请重新输入!', {icon: 5}) $(that).val(0); } } diff --git a/js/demandPlan/child/apply_plan_form.js b/js/demandPlan/child/apply_plan_form.js index bc5d22c..c28b16a 100644 --- a/js/demandPlan/child/apply_plan_form.js +++ b/js/demandPlan/child/apply_plan_form.js @@ -4,6 +4,7 @@ let pageNum = 1, tableIns; // 定义分页 let jjDataArr = []; // 配件数据 let proList = []; // 工程下拉选 let delIdArr = []; + function setParams(obj) { objParam = JSON.parse(obj); layui.use(['form', 'layer', 'laydate', 'upload', 'table'], function () { @@ -48,7 +49,8 @@ function setSelectData(proList) { layui.form.render(); } -function saveData2() { +function saveData2(mode) { + $('#mode').val(mode); $('#formSubmit').trigger('click') } @@ -68,23 +70,22 @@ function setNumColor(value, type) { // 1.需要量 2.已发货量 3.差缺量 // 提交 function submitApply(data) { let list = getBaseTableData(); + console.log(list.length) // 校验配件入库数量 if (list.length === 0) { - return layer.msg('未添加机具数据', { icon: 7 }); + return layer.msg('未添加机具数据', {icon: 7}); } for (let i = 0; i < list.length; i++) { if (list[i].needNum === 0) { - return layer.msg('机具明细,第' + (i + 1) + '行,未填写需用量', { icon: 7 }); + return layer.msg('机具明细,第' + (i + 1) + '行,未填写需用量', {icon: 7}); } - // if (list[i].times === 0) { - // return layer.msg('机具明细,第' + (i + 1) + '行,未填写需用天数', { icon: 7 }); - // } + } data.field.jsonData = JSON.stringify(list); - let loadingMsg = layer.msg('正在提交保存,请稍等...', { icon: 16, shade: 0.01, time: '0' }); + let loadingMsg = layer.msg('正在提交保存,请稍等...', {icon: 16, shade: 0.01, time: '0'}); let url = dataUrl + 'backstage/planApplication/addPlan'; let params = { - encryptedData:JSON.stringify(data.field) + encryptedData: JSON.stringify(data.field) }; ajaxRequest(url, 'POST', params, true, function () { $('.save').addClass("layui-btn-disabled").attr("disabled", true); @@ -94,14 +95,14 @@ function submitApply(data) { $('.save').removeClass("layui-btn-disabled").attr("disabled", false); $('.cancel').removeClass("layui-btn-disabled").attr("disabled", false); if (result.code === 200) { - parent.layer.msg(result.msg, { icon: 1 }); + parent.layer.msg(result.msg, {icon: 1}); closePage(1); } else { - layer.msg(result.msg, { icon: 2 }); + layer.msg(result.msg, {icon: 2}); } }, function (xhr, status, error) { layer.close(loadingMsg); // 关闭提示层 - layer.msg('服务异常,请稍后重试', { icon: 16, scrollbar: false, time: 2000 }); + 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) @@ -180,7 +181,7 @@ function addFitDatas(data) { } else { // 第一次添加数据 jjDataArr = JSON.parse(data); if (jjDataArr && jjDataArr.length > 0) { - $('#no_data_title').css({ 'display': 'none' }); + $('#no_data_title').css({'display': 'none'}); $('#search-info').removeAttr('style'); $('#table-box').removeAttr('style'); setTableData(jjDataArr); @@ -277,10 +278,10 @@ function sel(selectStatus, that, id) { // 删除选中 function delFitType() { if (delIdArr.length == 0) { - layer.msg('请先选择需要删除的数据!', { icon: 7 }) + layer.msg('请先选择需要删除的数据!', {icon: 7}) return; } - let layerIndex = layer.confirm('
确定要删除选中数据吗!
', { title: '操作提示' }, function () { + let layerIndex = layer.confirm('
确定要删除选中数据吗!
', {title: '操作提示'}, function () { layer.close(layerIndex); for (let i = 0; i < delIdArr.length; i++) { for (let j = 0; j < jjDataArr.length; j++) { @@ -293,13 +294,13 @@ function delFitType() { } if (jjDataArr.length === 0) { $('#no_data_title').removeAttr('style'); - $('#search-info').css({ 'display': 'none' }); - $('#table-box').css({ 'display': 'none' }); + $('#search-info').css({'display': 'none'}); + $('#table-box').css({'display': 'none'}); } else { // setTableData(jjDataArr); handleDelTableData(delIdArr); } - delIdArr.splice(0,delIdArr.length); + delIdArr.splice(0, delIdArr.length); }); } @@ -356,7 +357,7 @@ function checkValue(that, type, name) { if (type === 1 || type === 2) { // 需用量 / 需用天数 const regex = /^(0|[1-9]\d{0,6})$/; if (!regex.test(value) && value) { - layer.msg('' + name + '输入不合法,请重新输入!', { icon: 5 }) + layer.msg('' + name + '输入不合法,请重新输入!', {icon: 5}) $(that).val(0); } } diff --git a/js/demandPlan/child/choose_tool_type_list.js b/js/demandPlan/child/choose_tool_type_list.js index d35681d..6c18d4a 100644 --- a/js/demandPlan/child/choose_tool_type_list.js +++ b/js/demandPlan/child/choose_tool_type_list.js @@ -8,12 +8,36 @@ let cjList = []; let jjDetailArr = []; // 入库配件类型数据 function setParams(obj) { objParam = JSON.parse(obj); - layui.use(["form", "table", 'element', 'layer', 'util'], function () { + layui.use(["form", "table", 'element', 'layer', 'util', 'upload'], function () { + form = layui.form; table = layui.table; element = layui.element; layer = layui.layer; util = layui.util; + upload = layui.upload; + // 渲染 + upload.render({ + elem: '#file', // 绑定多个元素 + headers: { + authorization: sessionStorage.getItem("gz-token"), + }, + url: dataUrl + "backstage/planApplication/importExcelTools", // 此处配置你自己的上传接口即可 + accept: 'file', // 普通文件 + acceptMime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel', + exts: 'xlsx|xls', // 为空表示不限制文件后缀(如需限制特定类型,写如:'doc|docx|pdf|xlsx|jpg') + done: function (res) { + if (res.code == 200){ + $.each(res.data, function (index, value) { + huancun.push(value.id); + huancunObj.push(value); + }) + $('#num').html(huancun.length); + } + layer.msg('上传成功'); + console.log(res); + } + }); initTable(); }); } @@ -25,13 +49,13 @@ function queryTable(type) { let flag = checkValue(pName); if (flag) { $('#pName').val(''); - return layer.msg('物机名称查询包含特殊字符,请重新输入', { icon: 2 }); + return layer.msg('物机名称查询包含特殊字符,请重新输入', {icon: 2}); } let name = $('#name').val(); let flag2 = checkValue(name); if (flag2) { $('#name').val(''); - return layer.msg('规格查询包含特殊字符,请重新输入', { icon: 2 }); + return layer.msg('规格查询包含特殊字符,请重新输入', {icon: 2}); } reloadTable(1); } else if (type === 2) { @@ -45,16 +69,16 @@ function queryTable(type) { // 重载表格 function reloadTable(pageNum) { table.reload("currentTableId", { - page: { - curr: pageNum ? pageNum : 1, + page: { + curr: pageNum ? pageNum : 1, + }, + where: { + encryptedData: JSON.stringify({ + 'pName': $('#pName').val(), + 'name': $('#name').val(), + }), + }, }, - where: { - encryptedData: JSON.stringify({ - 'pName': $('#pName').val(), - 'name': $('#name').val(), - }), - }, - }, ); } @@ -80,7 +104,7 @@ function initTable() { limitName: 'pageSize' }, parseData: function (res) { // res 即为原始返回的数据 - if(res.code === 401){ + if (res.code === 401) { closeWindowOpen(); } if (jjDetailArr && res.list) { @@ -103,7 +127,7 @@ function initTable() { }, cols: [ [ - { type: 'checkbox', width: '5%' }, + {type: 'checkbox', width: '5%'}, { width: '6%', title: "序号", @@ -118,7 +142,7 @@ function initTable() { title: "物机类型", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "pName", @@ -126,7 +150,7 @@ function initTable() { title: "物机名称", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "name", @@ -134,7 +158,7 @@ function initTable() { title: "规格", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "unit", @@ -142,7 +166,7 @@ function initTable() { width: '10%', unresize: true, align: "center", - sort:true, + sort: true, }, { field: "needNum", @@ -212,14 +236,14 @@ function initTable() { const regex = /^(0|[1-9]\d{0,6})$/; if (!regex.test(value)) { obj.reedit(); - return layer.msg('格式不正确,最大输入6位数,且为正整数!', { icon: 7 }) + return layer.msg('格式不正确,最大输入6位数,且为正整数!', {icon: 7}) } } } else if (field === 'remarks') { // 备注 if (value) { if (value.length > 255) { obj.reedit(); - return layer.msg('备注最多输入255位!', { icon: 7 }) + return layer.msg('备注最多输入255位!', {icon: 7}) } } } @@ -298,7 +322,7 @@ function removeByValue(arr, val) { function saveData2(params) { let dataArr = []; if (huancun.length === 0) { - return layer.msg('未添加数据', { icon: 7 }); + return layer.msg('未添加数据', {icon: 7}); } else { $.each(huancunObj, function (index, item) { dataArr.push(item); @@ -313,10 +337,11 @@ function saveData2(params) { } } } - let layerIndex = layer.confirm('
数据即将被添加,请仔细检查数据是否有错误!
', { title: '操作提示' }, function () { + let layerIndex = layer.confirm('
数据即将被添加,请仔细检查数据是否有错误!
', {title: '操作提示'}, function () { layer.close(layerIndex); closePage(1, JSON.stringify(dataArr)); }); + // 替换对象 function updateOrAddObject2(id, newObject) { const index = dataArr.findIndex(obj => obj.id === id); @@ -336,4 +361,8 @@ function closePage(type, params) { window.parent.addFitDatas(params); } parent.layer.close(index); // 再执行关闭 -} \ No newline at end of file +} + +function toolsDownload() { + window.location.href = '../../../template/机具类型导入模板.xlsx'; +} diff --git a/js/demandPlan/plan_check_list.js b/js/demandPlan/plan_check_list.js index 3c29f18..a9e248b 100644 --- a/js/demandPlan/plan_check_list.js +++ b/js/demandPlan/plan_check_list.js @@ -46,6 +46,7 @@ function reloadTable(pageNum) { encryptedData: JSON.stringify({ 'keyWord': $('#keyWord').val(), 'auditStatus': $('#auditStatus').val(), + 'mode': $('#mode').val(), }), }, }, @@ -66,6 +67,7 @@ function initTable() { encryptedData: JSON.stringify({ 'keyWord': $('#keyWord').val(), 'auditStatus': $('#auditStatus').val(), + 'mode': $('#mode').val(), }), }, request: { diff --git a/page/demandPlan/child/apply_plan_edit_form.html b/page/demandPlan/child/apply_plan_edit_form.html index c16e136..55db864 100644 --- a/page/demandPlan/child/apply_plan_edit_form.html +++ b/page/demandPlan/child/apply_plan_edit_form.html @@ -12,121 +12,126 @@ -
-
-
-
-
- -
- +
+ +
+ -
-
-
- -
-
- -
- -
+
-
-
- -
- -
-
-
- -
- +
+ +
+
+
+
-
- -
+
+
+
+ +
+ +
+
+ + + + + + + +
+
+ +
-
+ class="layui-textarea" maxLength="250" lay-affix="clear">
- - -
- -

机具明细

-
- -
- 无数据 -

您还没选择需用机具类型

-

请先添加机具类型后再执申请操作

- -
- +
+
+ + + +
+
diff --git a/page/demandPlan/child/apply_plan_form.html b/page/demandPlan/child/apply_plan_form.html index 383a50f..03c7396 100644 --- a/page/demandPlan/child/apply_plan_form.html +++ b/page/demandPlan/child/apply_plan_form.html @@ -12,120 +12,125 @@ -
-
-
-
-
- -
- +
+ +
+ -
-
-
- -
-
- -
- -
+
-
-
- -
- +
+ +
+
+
+
- - - - - -
-
- -
+
+
+
+ +
+ +
+
+ + + + + + +
+
+ +
-
+ class="layui-textarea" maxLength="250" lay-affix="clear">
- - -
- -

机具明细

-
- -
- 无数据 -

您还没选择需用机具类型

-

请先添加机具类型后再执申请操作

- -
- +
+
+ + + +
+
diff --git a/page/demandPlan/child/choose_tool_type_list.html b/page/demandPlan/child/choose_tool_type_list.html index 04c6bb3..2378de8 100644 --- a/page/demandPlan/child/choose_tool_type_list.html +++ b/page/demandPlan/child/choose_tool_type_list.html @@ -34,47 +34,56 @@ -
-
-
- 搜索信息 -
-
-
-
-
- -
-
-
-
- -
-
-
- - -
-
-

已选:0

+
+
+
+ 搜索信息 +
+ +
+
+
+
- -
-
-
-
-
-
- - +
+
+ +
+
+
+ + +
+
+

已选:0

+
+
+ + +
+
+
+
+
+
+
+
+ +
+
diff --git a/page/demandPlan/plan_check_list.html b/page/demandPlan/plan_check_list.html index 6b9bac4..5a9059f 100644 --- a/page/demandPlan/plan_check_list.html +++ b/page/demandPlan/plan_check_list.html @@ -49,6 +49,8 @@
+ +
diff --git a/template/机具类型导入模板.xlsx b/template/机具类型导入模板.xlsx new file mode 100644 index 0000000..c270b02 Binary files /dev/null and b/template/机具类型导入模板.xlsx differ