提交 9c7e11e7 编写于 作者: Skyeye云's avatar Skyeye云

新增tagEditorGetItemData,tagEditorGetAllData,uploadCommon003Config工具类函数,测试成功

上级 4793aeff
...@@ -15,52 +15,22 @@ layui.config({ ...@@ -15,52 +15,22 @@ layui.config({
laydate = layui.laydate; laydate = layui.laydate;
// 初始化上传 // 初始化上传
$("#vehicleImg").upload({ $("#vehicleImg").upload(systemCommonUtil.uploadCommon003Config('vehicleImg', 6, '', 1));
"action": reqBasePath + "common003",
"data-num": "1",
"data-type": "PNG,JPG,jpeg,gif",
"uploadType": 6,
"function": function (_this, data) {
show("#vehicleImg", data);
}
});
// 生产日期 // 生产日期
laydate.render({ laydate.render({elem: '#manufactureTime', type: 'date', max: getYMDFormatDate(), trigger: 'click'});
elem: '#manufactureTime',
type: 'date',
max: getYMDFormatDate(),
trigger: 'click'
});
// 采购日期 // 采购日期
laydate.render({ laydate.render({elem: '#purchaseTime', type: 'date', max: getYMDFormatDate(), trigger: 'click'});
elem: '#purchaseTime',
type: 'date',
max: getYMDFormatDate(),
trigger: 'click'
});
// 下次年检时间 // 下次年检时间
laydate.render({ laydate.render({elem: '#nextInspectionTime', type: 'date', trigger: 'click'});
elem: '#nextInspectionTime',
type: 'date',
trigger: 'click'
});
// 保险截止期限 // 保险截止期限
laydate.render({ laydate.render({elem: '#insuranceDeadline', type: 'date', trigger: 'click'});
elem: '#insuranceDeadline',
type: 'date',
trigger: 'click'
});
// 上次保养日期 // 上次保养日期
laydate.render({ laydate.render({elem: '#prevMaintainTime', type: 'date', trigger: 'click'});
elem: '#prevMaintainTime',
type: 'date',
trigger: 'click'
});
skyeyeEnclosure.init('enclosureUpload'); skyeyeEnclosure.init('enclosureUpload');
matchingLanguage(); matchingLanguage();
...@@ -85,23 +55,19 @@ layui.config({ ...@@ -85,23 +55,19 @@ layui.config({
nextInspectionTime: $("#nextInspectionTime").val(), nextInspectionTime: $("#nextInspectionTime").val(),
insuranceDeadline: $("#insuranceDeadline").val(), insuranceDeadline: $("#insuranceDeadline").val(),
prevMaintainTime: $("#prevMaintainTime").val(), prevMaintainTime: $("#prevMaintainTime").val(),
enclosureInfo: skyeyeEnclosure.getEnclosureIdsByBoxId('enclosureUpload') enclosureInfo: skyeyeEnclosure.getEnclosureIdsByBoxId('enclosureUpload'),
vehicleAdmin: systemCommonUtil.tagEditorGetItemData('vehicleAdmin', userList)
}; };
params.vehicleImg = $("#vehicleImg").find("input[type='hidden'][name='upload']").attr("oldurl"); params.vehicleImg = $("#vehicleImg").find("input[type='hidden'][name='upload']").attr("oldurl");
if(isNull(params.vehicleImg)){ if (isNull(params.vehicleImg)) {
winui.window.msg('请上传车辆图片', {icon: 2,time: 2000}); winui.window.msg('请上传车辆图片', {icon: 2, time: 2000});
return false; return false;
} }
if(userList.length == 0 || isNull($('#vehicleAdmin').tagEditor('getTags')[0].tags)){ AjaxPostUtil.request({url: flowableBasePath + "vehicle002", params: params, type: 'json', callback: function(json) {
params.vehicleAdmin = ""; if (json.returnCode == 0) {
}else{
params.vehicleAdmin = userList[0].id;
}
AjaxPostUtil.request({url: flowableBasePath + "vehicle002", params: params, type: 'json', callback: function(json){
if(json.returnCode == 0){
parent.layer.close(index); parent.layer.close(index);
parent.refreshCode = '0'; parent.refreshCode = '0';
}else{ } else {
winui.window.msg(json.returnMessage, {icon: 2, time: 2000}); winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
} }
}}); }});
......
...@@ -89,40 +89,19 @@ layui.config({ ...@@ -89,40 +89,19 @@ layui.config({
fromId: $("#fromId").val(), fromId: $("#fromId").val(),
subDepartments: $("#subDepartments").val(), subDepartments: $("#subDepartments").val(),
enclosureInfo: skyeyeEnclosure.getEnclosureIdsByBoxId('enclosureUpload'), enclosureInfo: skyeyeEnclosure.getEnclosureIdsByBoxId('enclosureUpload'),
partId: systemCommonUtil.tagEditorGetAllData('partId', partIdList), // 商机参与人
followId: systemCommonUtil.tagEditorGetAllData('followId', followIdList), // 商机关注人
subType: subType, // 表单类型 1.保存草稿 2.提交审批 subType: subType, // 表单类型 1.保存草稿 2.提交审批
approvalId: approvalId approvalId: approvalId
}; };
// 如果商机负责人为空 // 商机负责人
if(responsIdList.length == 0 || isNull($('#responsId').tagEditor('getTags')[0].tags)){ params.responsId = systemCommonUtil.tagEditorGetItemData('responsId', responsIdList);
winui.window.msg('请选择商机负责人', {icon: 2,time: 2000}); if (isNull(params.responsId)) {
winui.window.msg('请选择商机负责人', {icon: 2, time: 2000});
return false; return false;
}else{
$.each(responsIdList, function (i, item) {
params.responsId = item.id;
});
}
// 如果商机参与人为空
if(partIdList.length == 0 || isNull($('#partId').tagEditor('getTags')[0].tags)){
params.partId = "";
}else{
var partId = "";
$.each(partIdList, function (i, item) {
partId += item.id + ',';
});
params.partId = partId;
}
// 如果商机关注人为空
if(followIdList.length == 0 || isNull($('#followId').tagEditor('getTags')[0].tags)){
params.followId = "";
}else{
var followId = "";
$.each(followIdList, function (i, item) {
followId += item.id + ',';
});
params.followId = followId;
} }
AjaxPostUtil.request({url: flowableBasePath + "opportunity011", params: params, type: 'json', callback: function(json){ AjaxPostUtil.request({url: flowableBasePath + "opportunity011", params: params, type: 'json', callback: function(json) {
if (json.returnCode == 0){ if (json.returnCode == 0) {
parent.layer.close(index); parent.layer.close(index);
parent.refreshCode = '0'; parent.refreshCode = '0';
} else { } else {
......
...@@ -286,11 +286,11 @@ var systemCommonUtil = { ...@@ -286,11 +286,11 @@ var systemCommonUtil = {
$('#' + id).tagEditor('removeTag', tags[i]); $('#' + id).tagEditor('removeTag', tags[i]);
} }
}, },
/** /**
* tagEditor组件重置数据 * tagEditor组件重置数据
* *
* @param id 对象id * @param id 对象id
* @param data 数据
*/ */
tagEditorResetData: function(id, data) { tagEditorResetData: function(id, data) {
// 移除所有tag // 移除所有tag
...@@ -301,6 +301,40 @@ var systemCommonUtil = { ...@@ -301,6 +301,40 @@ var systemCommonUtil = {
}); });
return data; return data;
}, },
/**
* tagEditor组件获取第一条数据
*
* @param id 组件id
* @param list 集合
* @returns {string|*}
*/
tagEditorGetItemData: function (id, list) {
var tags = $('#' + id).tagEditor('getTags')[0].tags;
if (list.length == 0 || isNull(tags)) {
return "";
} else {
return list[0].id;
}
},
/**
* tagEditor组件获取所有数据的id
*
* @param id 组件id
* @param list 集合
* @returns {string|*}
*/
tagEditorGetAllData: function (id, list) {
var tags = $('#' + id).tagEditor('getTags')[0].tags;
if (list.length == 0 || isNull(tags)) {
return "";
} else {
var ids = "";
$.each(list, function (i, item) {
ids += item.id + ',';
});
return ids;
}
},
/** /**
* 表格禁止指定行数据选择 * 表格禁止指定行数据选择
...@@ -536,4 +570,25 @@ var systemCommonUtil = { ...@@ -536,4 +570,25 @@ var systemCommonUtil = {
return params; return params;
}, },
/**
* 统一上传到common003接口文件的配置信息
*
* @param id 组件id
* @param uploadType 上传类型
* @param uploadDefaultValue 默认展示的值
* @param uploadNum 允许上传的图片数量
*/
uploadCommon003Config: function (id, uploadType, uploadDefaultValue, uploadNum) {
return {
"action": reqBasePath + "common003",
"data-num": uploadNum,
"data-type": "PNG,JPG,jpeg,gif",
"uploadType": uploadType,
"data-value": uploadDefaultValue,
"function": function (_this, data) {
show('#' + id, data);
}
};
}
}; };
\ No newline at end of file
...@@ -5,16 +5,16 @@ layui.define(["jquery"], function(exports) { ...@@ -5,16 +5,16 @@ layui.define(["jquery"], function(exports) {
(function(a) { (function(a) {
a.fn.upload = function(D) { a.fn.upload = function(D) {
var options = { var options = {
"action":"/upload", "action": "/upload",
"data-num":"10", "data-num": "10",
"data-type":"png,jpg,jpeg,gif,zip,pdf,doc,docx,rar", "data-type": "png,jpg,jpeg,gif,zip,pdf,doc,docx,rar",
// "data-height":"992", // "data-height":"992",
"data-width":"1920", "data-width": "1920",
"data-value":"", "data-value": "",
"data-size":1024*100, "data-size": 1024 * 100,
"uploadType": 1, "uploadType": 1,
//该函数为点击放大镜的回调函数,如没有该函数,则不显示放大镜 //该函数为点击放大镜的回调函数,如没有该函数,则不显示放大镜
"function":function(_this,data){ "function": function (_this, data) {
} }
} }
$.extend(options,D); $.extend(options,D);
...@@ -27,7 +27,6 @@ layui.define(["jquery"], function(exports) { ...@@ -27,7 +27,6 @@ layui.define(["jquery"], function(exports) {
} }
}) })
var r = a(this), var r = a(this),
w = "<li class='item'></li>", w = "<li class='item'></li>",
A = a('<div class="item add"><svg class="icon" viewBox="0 0 1024 1024" version="1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><defs><style/></defs><path d="M737 436a174 174 0 0 1 172 172 172 172 0 0 1-172 172c-69 1-69 107 0 106 152-2 276-125 278-278S886 332 737 330c-69-1-69 105 0 106zM285 779a174 174 0 0 1-172-172 172 172 0 0 1 172-172c68-1 69-106 0-106A282 282 0 0 0 7 607a281 281 0 0 0 278 278c69 1 68-105 0-106z" fill="#4A5699"/><path d="M340 384a174 174 0 0 1 172-172 172 172 0 0 1 172 172c1 68 106 68 106 0a282 282 0 0 0-278-278 281 281 0 0 0-278 278c-1 68 105 68 106 0z" fill="#C45FA0"/><path d="M545 473c17 17 17 43 0 60L422 656a42 42 0 0 1-60-60l123-123c17-16 43-16 60 0z" fill="#F39A2B"/><path d="M485 473c17-16 44-16 60 0l123 123a42 42 0 0 1-60 60L485 533a42 42 0 0 1 0-60z" fill="#F39A2B"/><path d="M514 634c24 0 43 20 43 43v179a43 43 0 0 1-86 0V677c0-23 19-43 43-43z" fill="#E5594F"/></svg></div>'), A = a('<div class="item add"><svg class="icon" viewBox="0 0 1024 1024" version="1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><defs><style/></defs><path d="M737 436a174 174 0 0 1 172 172 172 172 0 0 1-172 172c-69 1-69 107 0 106 152-2 276-125 278-278S886 332 737 330c-69-1-69 105 0 106zM285 779a174 174 0 0 1-172-172 172 172 0 0 1 172-172c68-1 69-106 0-106A282 282 0 0 0 7 607a281 281 0 0 0 278 278c69 1 68-105 0-106z" fill="#4A5699"/><path d="M340 384a174 174 0 0 1 172-172 172 172 0 0 1 172 172c1 68 106 68 106 0a282 282 0 0 0-278-278 281 281 0 0 0-278 278c-1 68 105 68 106 0z" fill="#C45FA0"/><path d="M545 473c17 17 17 43 0 60L422 656a42 42 0 0 1-60-60l123-123c17-16 43-16 60 0z" fill="#F39A2B"/><path d="M485 473c17-16 44-16 60 0l123 123a42 42 0 0 1-60 60L485 533a42 42 0 0 1 0-60z" fill="#F39A2B"/><path d="M514 634c24 0 43 20 43 43v179a43 43 0 0 1-86 0V677c0-23 19-43 43-43z" fill="#E5594F"/></svg></div>'),
......
...@@ -33,8 +33,6 @@ layui.config({ ...@@ -33,8 +33,6 @@ layui.config({
} }
}); });
var carryPeople = "";//指定人员id
if(!isNull(parent.timeSolt)){ if(!isNull(parent.timeSolt)){
// 如果父页面传递时间段 // 如果父页面传递时间段
timeSolt = parent.timeSolt; timeSolt = parent.timeSolt;
...@@ -203,8 +201,7 @@ layui.config({ ...@@ -203,8 +201,7 @@ layui.config({
winui.window.msg('请选择指定人员', {icon: 2,time: 2000}); winui.window.msg('请选择指定人员', {icon: 2,time: 2000});
return false; return false;
}else{ }else{
carryPeople = userList[0].id; params.carryPeople = userList[0].id;
params.carryPeople = carryPeople;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册