156 lines
5.7 KiB
JavaScript
156 lines
5.7 KiB
JavaScript
layui.config({
|
|
base: '../../js/layuiModules/', // 第三方模块所在目录
|
|
version: 'v1.6.4' // 插件版本号
|
|
}).extend({
|
|
soulTable: 'notice,layNotify', // 模块
|
|
});
|
|
let form;
|
|
var tree;
|
|
var table ;
|
|
var notice;
|
|
var layNotify;
|
|
var resourceSetId = localStorage.getItem("subResourceSetId");
|
|
var teamType = localStorage.getItem("subTeamType");
|
|
var resourceName = localStorage.getItem("subResourceName");
|
|
var resourceNotes = localStorage.getItem("subResourceNotes");
|
|
|
|
layui.use(['table', 'form','notice', 'layNotify'], function () {
|
|
//getData();
|
|
table = layui.table;
|
|
form = layui.form;
|
|
tree = layui.tree;
|
|
layNotify = layui.layNotify;
|
|
notice = layui.notice;
|
|
getTowerType(form, teamType);
|
|
$("#resourceName").val(resourceName);
|
|
$("#notes").val(resourceNotes);
|
|
createTable();
|
|
|
|
form.on('submit(formDemo)', function (data) {
|
|
var tableData = table.cache.demo; //
|
|
var tf = true;
|
|
tableData.forEach(item => {
|
|
if(tf){
|
|
let id = item.id;
|
|
let choseNum = $("#"+id+"_choseId").val()
|
|
let dictKey = item.dictKey;
|
|
console.log("choseNum="+choseNum);
|
|
item.choseNum = choseNum;
|
|
}
|
|
});
|
|
let resourceName = $("#resourceName").val();
|
|
let teamType = $("#teamType").find("option:selected").val();//获取选中文本
|
|
let notes = $("#notes").val();
|
|
if(resourceName == ""){
|
|
layer.msg("请填写班组名称!", {icon: 2});
|
|
return;
|
|
}
|
|
if(teamType == ""){
|
|
layer.msg("请选择团队类型!", {icon: 2});
|
|
return;
|
|
}
|
|
|
|
// console.log("tableData="+JSON.stringify(tableData));
|
|
// console.log("resourceName="+resourceName);
|
|
// console.log("volLevelIds="+volLevelIds);
|
|
$.ajax({
|
|
type: 'POST',
|
|
async: false, // 默认异步true,false表示同步
|
|
url: ctxPath + "/teamSet/addBranchOfficeTeamSet",// 请求地址
|
|
dataType: 'json', // 服务器返回数据类型
|
|
data: {"stringKey":JSON.stringify(tableData),
|
|
"resourceName":resourceName,
|
|
"groupType":teamType,
|
|
"resourceType":"1",
|
|
"notes":notes,
|
|
"resourceSetId":resourceSetId,
|
|
'type':'2'}, //获取提交的表单字段
|
|
success: function (data) {
|
|
var status = data.data;
|
|
if("添加成功"==status){
|
|
//layer.msg("数据添加成功!", {icon: 1});
|
|
reloadTip("修改","修改成功",'success',layNotify);
|
|
setTimeout(function(){
|
|
parent.layer.closeAll();
|
|
}, 2000);
|
|
|
|
}else{
|
|
// layer.msg("数据添加失败!", {icon: 2});
|
|
reloadTip("修改","修改失败",'error',layNotify);
|
|
setTimeout(function(){
|
|
parent.layer.closeAll();
|
|
}, 2000);
|
|
parent.layer.closeAll();
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
$("#typeManage").click(function () {
|
|
var index = layer.open({
|
|
type: 2,
|
|
title: '分类管理',
|
|
content: 'subTeamAdd.html',
|
|
area: ['62%', '90%'],
|
|
maxmin: false,
|
|
closeBtn: true,
|
|
btn: ['确定', '取消'],
|
|
yes: function(index, layero){
|
|
var formSubmit = layer.getChildFrame('form', index);
|
|
//var submited = formSubmit.find('button')[0];
|
|
let submited = formSubmit.find('button.subBtn');
|
|
submited.click();
|
|
var myIframe = window[layero.find('iframe')[0]['name']];
|
|
myIframe.addSubTableMessage();
|
|
return false;
|
|
},
|
|
end: function(){
|
|
createTable();
|
|
}
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
function createTable() {
|
|
$.ajax({
|
|
type: 'POST',
|
|
async: false, // 默认异步true,false表示同步
|
|
url: ctxPath + "/teamSet/getDataDictByDickValModify",// 请求地址
|
|
dataType: 'json', // 服务器返回数据类型
|
|
data: {"dictKey":"sub_type","id":resourceSetId}, //获取提交的表单字段
|
|
success: function (data) {
|
|
let objData= data
|
|
//渲染表格
|
|
table.render({
|
|
elem: '#demo',
|
|
cols: [[ //表头
|
|
{field: 'dictKey', title: '岗位',width:'200',align: 'center'},
|
|
{field: 'nums', title: '数量', width:'200',templet:function (d) {
|
|
var choseNum = d.choseNum;
|
|
var choseId = d.id+"_choseId";
|
|
var opt = '<input id="'+choseId+'" type="number" value="'+choseNum+'" name="price_min" placeholder="" autocomplete="off" class="layui-input " min="0" step="1" lay-affix="number">';
|
|
return opt;
|
|
}
|
|
}
|
|
// {field: 'nums', title: '数量', width:'200',edit: 'number',align: 'center'}
|
|
|
|
]],
|
|
data: objData,
|
|
done: function (res, curr, count) {
|
|
//merge(res);
|
|
},
|
|
});
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
|