From c49086f8ab33dc1e53fb6fb18bfa2040eb2dacc2 Mon Sep 17 00:00:00 2001
From: cwchen <1048842385@qq.com>
Date: Wed, 13 Nov 2024 14:54:59 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E6=96=99=E5=87=BA=E5=BA=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
css/public.css | 77 +++++++++++
.../child/accessory_out_bound_detail.js | 130 +++++++++++++++++-
js/accessory/child/accessory_store_detail.js | 10 --
js/accessory/child/audit_form.js | 77 ++++++-----
.../child/accessory_out_bound_detail.html | 22 ++-
.../accessory/child/accessory_store_form.html | 2 -
page/accessory/child/audit_form.html | 2 +-
7 files changed, 262 insertions(+), 58 deletions(-)
diff --git a/css/public.css b/css/public.css
index 26268d1..f4cf9e6 100644
--- a/css/public.css
+++ b/css/public.css
@@ -190,6 +190,83 @@ body {
}
/* 表格样式 end */
+
+
+.layui-upload {
+ padding: 0 39px;
+}
+
+.upload-file {
+ flex-direction: column;
+ justify-content: space-around;
+ width: 200px;
+ height: 120px;
+}
+
+blockquote {
+ display: flex;
+ align-items: center;
+}
+
+#test2 {
+ width: 120px;
+ height: 100px;
+ background-color: rgb(240, 240, 240);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+}
+
+.uploader-list {
+ margin-left: -15px;
+ max-width: calc(100% - 200px);
+}
+
+.uploader-list .handle {
+ position: relative;
+ background-color: red;
+ color: white;
+ filter: alpha(Opacity=80);
+ -moz-opacity: 0.5;
+ opacity: 1;
+ /*width: 212px;*/
+ text-align: right;
+ height: 18px;
+ width: 18px;
+ border-radius: 18px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ left: 87%;
+ margin-bottom: -12px;
+ /*display: none;*/
+}
+
+.uploader-list .handle p {
+ font-size: 18px;
+ color: #fff;
+ cursor: pointer;
+}
+
+.uploader-list .handle i {
+ margin-right: 5px;
+}
+
+.uploader-list .handle i:hover {
+ cursor: pointer;
+}
+
+.uploader-list .file-iteme {
+ margin: 0 0 0 10px;
+ padding: 1px;
+ float: left;
+}
+
+.layui-upload-list {
+ margin: 0;
+}
+
/**自定义滚动条样式 */
::-webkit-scrollbar {
width: 6px;
diff --git a/js/accessory/child/accessory_out_bound_detail.js b/js/accessory/child/accessory_out_bound_detail.js
index 46caeba..ab34469 100644
--- a/js/accessory/child/accessory_out_bound_detail.js
+++ b/js/accessory/child/accessory_out_bound_detail.js
@@ -1,4 +1,4 @@
-let objParam;
+let objParam, fileList = new Array(), imgListUp = new Array();;
let form, table, upload, tableIns, layer;
let pageNum = 1;
@@ -8,7 +8,8 @@ function setParams(params) {
if (objParam.type === 2) { // 审核
$('#print').before('');
} else if (objParam.type === 3) { // 出库
- $('#print').before('');
+ $('#print').before('');
+ $('#upload').removeAttr('style');
}
if (objParam.devType === '2') { // 设备
let html = '';
@@ -16,7 +17,7 @@ function setParams(params) {
'
内部编号 | 使用机型 | 使用单位 | | '
'';
html += '' +
- '| GS511 | 机动绞磨 柴油 5T | xxxxxxxxxxxx工程 | | '
+ 'GS511 | 机动绞磨 柴油 5T | xxxxxxxxxxxx工程 | | '
'
';
$('#lastTr').before(html);
}
@@ -27,11 +28,119 @@ function setParams(params) {
table = layui.table;
upload = layui.upload;
layer = layui.layer;
+ let uploadObj = upload.render({
+ elem: '#test2',
+ multiple: true,
+ dataType: "json",
+ exts: 'jpg|png|jpeg|doc|docx|pdf|xlsx|xls',
+ acceptMime: 'image/jpg,image/png,image/jpeg,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ number: 5, //最大上传数量
+ size: 1024 * 10, //最大文件大小,单位k
+ auto: false, //是否自动上传 ,默认为true
+ bindAction: '#hideUpload', //绑定的按钮
+ choose: function (obj) {
+ let length = $('.file-iteme').length;
+ if (length >= 5) {
+ return layer.msg('最多上传5个附件证明', { icon: 7 });
+ }
+ uploadObj.config.elem.next()[0].value = '';
+ obj.preview(function (index, file, result) {
+ console.log(file);
+ $('#uploader-list').append(
+ '' +
+ '
' +
+ handleFileType(index, file, result) +
+ '
'
+ );
+ let map = new Map();//将选择的图片索引和图片写成对象存入集合
+ map.index = index;
+ map.file = file;
+ fileList.push(map);
+ });
+ }
+ });
getInputDetails();
initTable();
+ // 设置文件类型
+ function handleFileType(index, file, result) {
+ let html = '', img = '';
+ if (file.ext === 'doc' || file.ext === 'docx') {
+ img = '../../../images/docx.png';
+ } else if (file.ext === 'xls' || file.ext === 'xlsx') {
+ img = '../../../images/xlsx.png';
+ } else if (file.ext === 'pdf') {
+ img = '../../../images/PDF.png';
+ } else {
+ return '
';
+ }
+ html += '' +
+ '

' +
+ '
' + file.name + '
' +
+ '
';
+ return html;
+ }
});
}
+// 删除文件
+$(document).on("click", ".file-iteme .handle", function (event) {
+ imgListUp.splice(0, imgListUp.length);
+ let index = $(this).next().attr('data-index');
+ $.each(fileList, function (inx, ele) {
+ //对比删除文件索引
+ //将未删除的存入新集合
+ if (index != ele.index) {
+ imgListUp.push(ele);
+ }
+ });
+ $(this).parent().remove();
+ //将新文件集合替换老集合
+ fileList.splice(0, fileList.length);
+ $.each(imgListUp, function (inx, ele) {
+ fileList.push(ele)
+ });
+});
+
+// 提交
+function submitApply() {
+ // 校验出库附件是否上传
+ let length = $('.file-iteme').length;
+ if (length === 0) {
+ return layer.msg('请上传附件证明', { icon: 7 });
+ }
+ let formData = new FormData();
+ //遍历最终文件集合
+ for (let i = 0; i < fileList.length; i++) {
+ formData.append("file[]", fileList[i].file)
+ }
+ let obj = {
+ id: objParam.id
+ }
+ formData.append('params', JSON.stringify(obj));
+ console.log(JSON.stringify(data.field));
+ let loadingMsg = layer.msg('正在提交保存,请稍等...', { icon: 16, shade: 0.01, time: '0' });
+ console.log(JSON.stringify(data.field));
+ let url = dataUrl + 'backstage/partInput/addInputData';
+ ajaxRequestByUploadFile(url, formData, function () {
+ $('.save').addClass("layui-btn-disabled").attr("disabled", true);
+ }, function (result) {
+ console.log(result);
+ layer.close(loadingMsg);
+ $('.save').removeClass("layui-btn-disabled").attr("disabled", false);
+ if (result.code === 200) {
+ parent.layer.msg(result.msg, { icon: 1 });
+ closePage();
+ } 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);
+ errorFn(xhr, status, error)
+ }, null);
+}
+
// 获取配件到货入库详情
function getInputDetails() {
let params = {
@@ -239,7 +348,6 @@ function initTable() {
page: true,
done: function (res, curr, count) {
pageNum = tableIns.config.page.curr;
- element.render();
table.resize("currentTableId");
},
});
@@ -348,4 +456,18 @@ function print() {
console.log('onEnd', new Date())
}
})
+}
+
+
+// 审核
+function check() {
+ objParam.checkType = '1'; // 出库审核
+ openIframeByParamObj("check", "审核", "./audit_form.html", "40%", "50%", objParam);
+}
+
+
+function closePage() {
+ let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
+ parent.layer.close(index); // 再执行关闭
+ window.parent.queryTable(1);
}
\ No newline at end of file
diff --git a/js/accessory/child/accessory_store_detail.js b/js/accessory/child/accessory_store_detail.js
index 67558f1..7d97f9a 100644
--- a/js/accessory/child/accessory_store_detail.js
+++ b/js/accessory/child/accessory_store_detail.js
@@ -332,14 +332,4 @@ function print() {
console.log('onEnd', new Date())
}
})
-}
-
-// 审核
-function check() {
- alert('审核');
-}
-
-// 出库
-function outBand() {
- alert('出库');
}
\ No newline at end of file
diff --git a/js/accessory/child/audit_form.js b/js/accessory/child/audit_form.js
index 6d3ee48..f55981d 100644
--- a/js/accessory/child/audit_form.js
+++ b/js/accessory/child/audit_form.js
@@ -1,22 +1,22 @@
var form, layer;
-let idParam;
-function setParams(id) {
- idParam = id;
- layui.use([ 'form' ], function() {
+let objParam, idParam;
+function setParams(params) {
+ objParam = JSON.parse(params);
+ idParam = objParam.id;
+ layui.use(['form'], function () {
form = layui.form;
layer = layui.layer;
form.verify();
- form.on('submit(formData)', function(data) {
+ form.on('submit(formData)', function (data) {
submitApply(data);
});
- form.on('radio(auditStatus)', function(data) {
+ form.on('radio(auditStatus)', function (data) {
if (data.value === '2') { // 通过
- $('#auditRemarksLabel').empty().append('审核意见');
$('#auditRemarks').removeAttr('lay-verify');
+ $('#auditRemarksLabel').removeClass('required');
} else if (data.value === '3') { // 不通过
- $('#auditRemarksLabel').empty().append(
- '*审核意见');
$('#auditRemarks').attr('lay-verify', 'required');
+ $('#auditRemarksLabel').addClass('required');
}
});
form.render();
@@ -30,52 +30,53 @@ function saveData2() {
// 提交
function submitApply(data) {
let loadingMsg = layer.msg('正在提交保存,请稍等...', {
- icon : 16,
- shade : 0.01,
- time : '0'
+ icon: 16,
+ shade: 0.01,
+ time: '0'
});
+
+ let url = '';
+ if (objParam.checkType === '1') {
+ url = '';
+ data.field.id = idParam;
+ }
console.log(JSON.stringify(data.field));
- data.field.applyId = idParam;
$.ajax({
- url : bonuspath + '/backstage/planAudit/planAudit',
- type : 'POST',
- data : JSON.stringify(data.field),
- dataType : 'json',
- contentType : "application/json",
- beforeSend : function() {
+ url: url,
+ type: 'POST',
+ data: JSON.stringify(data.field),
+ dataType: 'json',
+ contentType: "application/json",
+ beforeSend: function () {
$('.save').addClass("layui-btn-disabled").attr("disabled", true);
$('.cancel').addClass("layui-btn-disabled").attr("disabled", true);
},
- success : function(result) {
+ success: function (result) {
layer.close(loadingMsg); // 关闭提示层
if (result.res === 1) {
- top.layer.msg(result.resMsg, {
- icon : 1
+ parent.layer.msg(result.msg, {
+ icon: 1
});
closePage(1);
} else {
- var indexMsg = layer.confirm(result.resMsg, {
- btn : [ '关闭' ]
- }, function() {
+ var indexMsg = layer.confirm(result.msg, {
+ btn: ['关闭']
+ }, function () {
layer.close(indexMsg);
});
- $('.save').removeClass("layui-btn-disabled").attr("disabled",
- false);
- $('.cancel').removeClass("layui-btn-disabled").attr("disabled",
- false);
+ $('.save').removeClass("layui-btn-disabled").attr("disabled", false);
+ $('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
}
},
- error : function(result) {
+ error: function (result) {
layer.close(loadingMsg); // 关闭提示层
layer.msg('服务异常,请稍后重试', {
- icon : 16,
- scrollbar : false,
- time : 2000
+ icon: 16,
+ scrollbar: false,
+ time: 2000
});
- $('.save').removeClass("layui-btn-disabled")
- .attr("disabled", false);
- $('.cancel').removeClass("layui-btn-disabled").attr("disabled",
- false);
+ $('.save').removeClass("layui-btn-disabled").attr("disabled", false);
+ $('.cancel').removeClass("layui-btn-disabled").attr("disabled", false);
}
});
}
@@ -83,8 +84,8 @@ function submitApply(data) {
// 关闭页面
function closePage(type) {
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
+ parent.layer.close(index); // 再执行关闭
if (type == 1) {
window.parent.closePage();
}
- parent.layer.close(index); // 再执行关闭
}
\ No newline at end of file
diff --git a/page/accessory/child/accessory_out_bound_detail.html b/page/accessory/child/accessory_out_bound_detail.html
index 68264e2..be7ecfd 100644
--- a/page/accessory/child/accessory_out_bound_detail.html
+++ b/page/accessory/child/accessory_out_bound_detail.html
@@ -9,6 +9,7 @@
+