<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>改良項目審批表</title>
<link href="/static/layui/css/layui.css" rel="stylesheet">
<link href="/static/layui/css/modules/tableFilter/tableFilter.css" rel="stylesheet"/>
<style>
.layui-table-cell {
/*height: auto;*/
overflow: visible !important;
}
.layui-form-item .layui-input-inline{
width:280px;
}
.layui-form-item .layui-form-label{
width:100px;
}
.layui-input-block {
margin-left: 130px;
}
/*使下拉列表框不被遮挡*/
/*.layui-table-cell {*/
/* overflow: visible !important;*/
/*}*/
/*使列表框与表格单元格重合*/
/*.layui-form-select {*/
td .xm-select-demo{
/*overflow: visible !important;*/
margin-top: -10px;
margin-bottom: -10px;
margin-left: -15px;
margin-right: -15px;
}
</style>
</head>
<body>
<div class="layui-fluid">
<form class="layui-form" lay-filter="example" id="example1Show">
<!--按鈕-->
<div class="layui-form-item" style="margin-left: 25px;">
<div class="layui-btn-container">
<button type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="saveDetail" name="saveDetail" id="saveDetail">保存</button>
<button type="button" class="layui-btn" id="programData" name="programData">打印改良項目審批表</button>
</div>
</div>
<input type="text" name="designcode"autocomplete="off" class="layui-input layui-hide">
<input type="text" name="programcode"autocomplete="off" class="layui-input layui-hide">
<div class="layui-form " id ="formsign">
<div class="layui-form-item">
<!--<div class="layui-form-item" style="display: inline-block;">-->
<label class="layui-form-label" style="color:red">跨部門小組簽署</label>
<div class="layui-input-block">
<!--<div class="layui-input-inline">-->
<div id="co_groupsign" name="co_groupsign" class="xm-select-demo"></div>
<!--<input type="text" name="co_groupsign" placeholder="请输入" autocomplete="off" class="layui-input">-->
</div>
</div>
</div>
<div class="layui-form " id ="form1">
<fieldset class="layui-elem-field layui-field-title " style="margin-top: 20px; border-color:#FF6633; " id="titleShow">
<legend>提出改良項目</legend>
</fieldset>
<div class="layui-form-item">
<!--<div class="layui-form-item" style="display: inline-block;">-->
<label class="layui-form-label">改良項目名稱</label>
<div class="layui-input-block">
<!--<div class="layui-input-inline">-->
<input type="text" name="programName" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">現時狀況</label>
<div class="layui-input-inline">
<input type="text" name="now_position" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">適用產品</label>
<div class="layui-input-inline">
<input type="text" name="product" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">訂單量</label>
<div class="layui-input-inline">
<input type="text" name="orderNum" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<!--<div class="layui-form-item" style="display: inline-block;">-->
<!-- <label class="layui-form-label">現時狀況</label>-->
<!-- <div class="layui-input-inline">-->
<!-- <input type="text" name="now_position" placeholder="请输入" autocomplete="off" class="layui-input">-->
<!-- </div>-->
<!--</div>-->
<div class="layui-form-item">
<label class="layui-form-label">現狀描述</label>
<div class="layui-input-block">
<textarea type="text" name="description" placeholder="请输入" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<!--提出人-->
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">提出人</label>
<div class="layui-input-inline">
<input type="text" name="sign1" readonly autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">日期</label>
<div class="layui-input-inline">
<input type="text" name="date1" readonly placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">改良目標</label>
<div class="layui-input-block">
<input type="text" name="aim" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form " id ="form2">
<fieldset class="layui-elem-field layui-field-title " style="margin-top: 20px; border-color:#FF6633; " id="titleShow">
<legend>提出改良方案</legend>
</fieldset>
<div class="layui-form-item">
<label class="layui-form-label">改良方案</label>
<div class="layui-input-block">
<textarea type="text" name="project" placeholder="请输入" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<!--时间计划表-->
<div class="layui-form-item">
<table lay-filter="LAY_table_plan" id="LAY_table_plan" style="overflow: visible;"></table>
</div>
<!-- <div class="layui-form-item" style="display: inline-block;">-->
<!--<input type="text" name="_id" class="layui-hide">-->
<!-- <label class="layui-form-label">審核人</label>-->
<!-- <div class="layui-input-inline">-->
<!--<div id="column" class="xm-select-demo" style="width:200px;"></div>-->
<!-- <div id="Name" name="Name" class="xm-select-demo" style="width: 200px;"></div>-->
<!-- </div>-->
<!--</div>-->
</div>
<!--预计成本表-->
<!--<div class="layui-form-item">-->
<!-- <table lay-filter="LAY_table_Estimated" id="LAY_table_Estimated" style="overflow: visible;"></table>-->
<!--</div>-->
<!-- <div class="layui-form-item" style="display: inline-block;">-->
<!-- <label class="layui-form-label">預計成本</label>-->
<!-- <div class="layui-input-inline">-->
<!-- <input type="text" name="Estimated_cost" placeholder="请输入" autocomplete="off" class="layui-input">-->
<!-- </div>-->
<!-- <label class="layui-form-label">後期維護</label>-->
<!-- <div class="layui-input-inline">-->
<!-- <input type="text" name="maintain" placeholder="请输入" autocomplete="off" class="layui-input">-->
<!-- </div>-->
<!-- <label class="layui-form-label">预计制作成功率评分</label>-->
<!-- <div class="layui-input-inline">-->
<!-- <input type="text" name="success_rate" placeholder="请输入" autocomplete="off" class="layui-input">-->
<!-- </div>-->
<!--</div>-->
<div class="layui-form " id ="form3">
<!--預計成本表-->
<div class="layui-form-item">
<!--<div class ="layui-form layui-border-box layui-table-view">-->
<table class="layui-table">
<tbody>
<tr>
<td rowspan="3"><div class="layui-table-cell laytable-cell-group" align="left"><span>預計成本:</span><div><input type="text" name="pre_rate" value="" style="border:0" autocomplete="off" class="layui-input"></div></div></td>
<td rowspan="3"><div class="layui-table-cell laytable-cell-group" align="left"><span>後期維護:</span><div><input type="text" name="maintenance" value="" style="border:0" autocomplete="off" class="layui-input"></div></div></td>
<td colspan="2"><div class="layui-table-cell laytable-cell-group" align="center" ><span>開發資源</span></div></td>
<td colspan="2"><div class="layui-table-cell laytable-cell-group" align="center"><span>新增設備</span></div></td>
</tr>
<tr>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<span>技術員</span>
</div></td>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<span>佔用工時</span>
</div></td>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<input type="text" name="pre_machine1" value="" style="border:0" autocomplete="off" >
</div></td>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<input type="text" name="pre_machine2" value="" style="border:0" autocomplete="off">
</div></td>
</tr>
<tr>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<input type="text" name="pre_workernum" value="" style="border:0" autocomplete="off" >
</div></td>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<input type="text" name="pre_worktime" value="" style="border:0" autocomplete="off" >
</div></td>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<input type="text" name="pre_machine1name" value="" style="border:0" autocomplete="off">
</div></td>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<input type="text" name="pre_machine2name" value="" style="border:0" autocomplete="off">
</div></td>
</tr>
<tr>
<td colspan="2"><div class="layui-table-cell laytable-cell-group" align="right"><span>預計製作成功率評分:</span></div></td>
<td colspan="4"><div class="layui-table-cell laytable-cell-group" align="left"><input type="number" width="50px" oninput="value=value.replace(/(^\.|[^\d\.])/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.').replace(/^\d{3,}.*/,'100')" name="success_rate" value="" style="border:0" autocomplete="off"><span >%</span></div></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="layui-form " id ="form4">
<fieldset class="layui-elem-field layui-field-title " style="margin-top: 20px; border-color:#FF6633; " id="titleShow">
<legend>項目審批意見</legend>
</fieldset>
<div class="layui-form-item">
<label class="layui-form-label">經理部意見</label>
<div class="layui-input-block">
<textarea type="text" name="mangerOpinion" placeholder="请输入" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<!--提出人-->
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">審批人</label>
<div class="layui-input-inline">
<input type="text" name="sign2" readonly autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">日期</label>
<div class="layui-input-inline">
<input type="text" name="date2" readonly placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
</div>
</div>
</div>
</div>
<div class="layui-form " id ="form5">
<fieldset class="layui-elem-field layui-field-title " style="margin-top: 20px; border-color:#FF6633; " id="titleShow">
<legend>項目驗收</legend>
</fieldset>
<!--實際成本表-->
<div class="layui-form-item">
<!--<div class ="layui-form layui-border-box layui-table-view">-->
<table class="layui-table">
<tbody>
<tr>
<td rowspan="3"><div class="layui-table-cell laytable-cell-group" align="left"><span>實際成本:</span><div><input type="text" name="post_rate" value="" style="border:0" autocomplete="off" class="layui-input"></div></div></td>
<td colspan="2"><div class="layui-table-cell laytable-cell-group" align="center"><span>開發資源</span></div></td>
<td colspan="2"><div class="layui-table-cell laytable-cell-group" align="center"><span>新增設備</span></div></td>
</tr>
<tr>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<span>技術員</span>
</div></td>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<span>佔用工時</span>
</div></td>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<input type="text" name="post_machine1" value="" style="border:0" autocomplete="off" >
</div></td>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<input type="text" name="post_machine2" value="" style="border:0" autocomplete="off">
</div></td>
</tr>
<tr>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<input type="text" name="post_workernum" value="" style="border:0" autocomplete="off" >
</div></td>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<input type="text" name="post_worktime" value="" style="border:0" autocomplete="off" >
</div></td>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<input type="text" name="post_machine1name" value="" style="border:0" autocomplete="off">
</div></td>
<td><div class="layui-table-cell laytable-cell-group" align="center">
<input type="text" name="post_machine2name" value="" style="border:0" autocomplete="off">
</div></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="layui-form " id ="form6">
<fieldset class="layui-elem-field layui-field-title " style="margin-top: 20px; border-color:#FF6633; " id="titleShow">
<legend>檢討結果</legend>
</fieldset>
<div class="layui-form-item">
<label class="layui-form-label">改良效果檢討</label>
<div class="layui-input-block">
<textarea type="text" name="review" placeholder="请输入" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">使用部門意見</label>
<div class="layui-input-block">
<input type="text" name="otherOpinion" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">實際可使用產品</label>
<div class="layui-input-block">
<input type="text" name="Applicable_product" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">檢討結果</label>
<div class="layui-input-inline">
<input type="text" name="result" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">檢討人</label>
<div class="layui-input-inline">
<input type="text" name="sign3" readonly autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">日期</label>
<div class="layui-input-inline">
<input type="text" name="date3" readonly placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
</div>
</div>
</div>
</div>
<!--</div>-->
</form>
</div>
<script src="/static/layui/layui.js"></script>
<script src="/static/kms/formPermissions.js"></script>
<script>
layui.config({
base: '/static/layui/lay/mymodules/'
}).extend({
mytable: 'mytable',
xmSelect: 'xm-select',
tableMerge: 'tableMerge'
});
layui.use(['layedit', 'jquery', 'form', 'table', "laydate", 'mytable', 'layer', 'xmSelect','tableMerge'], function () {
var $ = layui.jquery,
form = layui.form,
laydate = layui.laydate,
mytable = layui.mytable,
table = layui.table,
layer = layui.layer,
xmSelect = layui.xmSelect
tableMerge = layui.tableMerge
;
// ===================================================變量定義======================================================
var formper = "{{formper|safe}}"//符号注意,|safe 權限控制
,nameData = []
,deptnameData = []
,nameDemo = ''
,formdataObj = {
taskid: '{{taskid}}'
,formid: '改良項目審批表'
,formdataid: '{{formdataid}}'
,formdata: {{formdata|safe}}
,userdata: {{userdata|safe}}
}
,checkCols = [
{field:'checkPro', title:'時間計劃',merge:'checkPro',align:'center'}
,{field:'condition', title:'項目',align:'center'}
,{field:'checkMessage1', title:'方案確定',edit: true, event: 'checkMessageEvent1',unresize: false,templet: function(d){return getplancontent(d,checkData,field='checkMessage1')}}
,{field:'checkMessage2', title:'成本評估',edit: true, event: 'checkMessageEvent2',unresize: false,templet: function(d){return getplancontent(d,checkData,field='checkMessage2')}}
,{field:'checkMessage3', title:'項目審批',edit: true, event: 'checkMessageEvent3',unresize: false,templet: function(d){return getplancontent(d,checkData,field='checkMessage3')}}
,{field:'checkMessage4', title:'設計製作',edit: true, event: 'checkMessageEvent4',unresize: false,templet: function(d){return getplancontent(d,checkData,field='checkMessage4')}}
,{field:'checkMessage5', title:'驗收', edit: true,event: 'checkMessageEvent5',unresize: false,templet: function(d){return getplancontent(d,checkData,field='checkMessage5')}}
,{field:'checkMessage6', title:'試用', edit: true,event: 'checkMessageEvent6',unresize: false,templet: function(d){return getplancontent(d,checkData,field='checkMessage6')}}
,{field:'checkMessage7', title:'效果檢討', edit: true,event: 'checkMessageEvent7',unresize: false,templet: function(d){return getplancontent(d,checkData,field='checkMessage7')}}
]
,checkData = [
{id:1, 'checkPro':'時間計劃','condition':'負責人'
}
,{id:2, 'checkPro':'時間計劃','condition':'計劃完成時間'
}
,{id:3, 'checkPro':'時間計劃', 'condition':'實際完成時間'
}
]// 保存查核項目數據
,checkDone = function(res){
$("[class$='0-3']").css("overflow", "visible")
// // 設置下拉框不會被表格遮擋
// $(".layui-table-cell").css('overflow','visible');
$(".layui-table-body").css('overflow','visible');
$(".layui-table-box").css('overflow','visible');
$(".layui-table-view").css('overflow','visible');
form.render();
tableMerge.render(this);
layui.each($('select'), function (index, item) {
var elem = $(item);
elem.val(elem.data('value')).parents('div.layui-table-cell').css('overflow', 'visible');
});
form.render();
}
,costCols = [[{align:'center',edit:true,field:'left',title:'開發資源',colspan:2},{align:'center',edit:true,field:'right',title:'新增設備',colspan:2}],
[{align:'center',field:'workernum',title:'技術員',edit:true,templet: function(d){return getcostcontent(d,costData,field='workernum')}},//,unresize:false,templet: function(d){return getcostcontent(d,costData,field='workernum')}},
{align:'center',field:'worktime',title:'佔用工時',edit:true,templet: function(d){return getcostcontent(d,costData,field='worktime')}},
{align:'center',field:'machine1',title:'',edit:true,templet: function(d){return getcostcontent(d,costData,field='machine1')}},
{align:'center',field:'machine2',title:'',edit:true,templet: function(d){return getcostcontent(d,costData,field='machine2')}},
]]
,costData = [{'workernum':'','worktime':'','machine1':'','machine2':''}]
,coDemo = ''
,coDemolist = []
,getTimerfunFlag = true
// // ====================================================表格渲染=====================================================
// $('[name|="result"]').val('NG')
// // elem, id, url, where, limit, cols, page, height, toolbar, defaultToolbar, loading, filters, title, cellMinWidth, data, done
// // limit為必填項
// 查核項目表格
checktable()
function checktable(){
mytable.tableShow(
'#LAY_table_plan', 'LAY_table_plan', '', '', 20, checkCols, false, 'auto', false, '', false, '',
'', 15, checkData, checkDone
)
}
mytable.tableShow(
'#LAY_table_Estimated', 'LAY_table_Estimated', '', '', 20, costCols, false, 'auto', false, '', false, '',
'', 15, costData, checkDone
)
//跨部門小組簽署
coDemo = xmSelect.render({
el: '#co_groupsign',
filterable: true,
name: 'co_groupsign',
tree:{
show:true
},
prop:{
name:"Name",
value:"Name"
},
on:function(data){
var arr = data.arr
coDemolist = []
arr.forEach((item) => {coDemolist.push({Name:item.Name,WorkID:item.WorkID,Department:item.Department})})
// data.Department=='R&D'?true:false,
},
data: nameData
})
// ====================================================後端數據界面控制=============================================
// console.log(111,formdataObj.formdata.ExamineStyle,'formdata', formdataObj.formdata)
// ================================================權限控制=========================================================
console.log(524,formper)
if(formper!=''){ // 根据auth进行权限控制
setFormPermissions(eval('('+formper+')'))
form.render();
}
let setp = eval('('+formper+')')
setp.forEach((item)=>{
if (item.auth == 'r'){
$('#'+item.name+' *').attr('readonly',true)
}
if (item.name == 'form2' && item.auth=="r"){
console.log(531,'让时间计划表单失效')
getTimerfunFlag = false
checkCols = [
{field:'checkPro', title:'時間計劃',merge:'checkPro',align:'center'}
,{field:'condition', title:'項目',align:'center'}
,{field:'checkMessage1', title:'方案確定',edit: false, event: 'checkMessageEvent1',unresize: false}
,{field:'checkMessage2', title:'成本評估',edit: false, event: 'checkMessageEvent2',unresize: false}
,{field:'checkMessage3', title:'項目審批',edit: false, event: 'checkMessageEvent3',unresize: false}
,{field:'checkMessage4', title:'設計製作',edit: false, event: 'checkMessageEvent4',unresize: false}
,{field:'checkMessage5', title:'驗收', edit: false,event: 'checkMessageEvent5',unresize: false}
,{field:'checkMessage6', title:'試用', edit: false,event: 'checkMessageEvent6',unresize: false}
,{field:'checkMessage7', title:'效果檢討', edit: false,event: 'checkMessageEvent7',unresize: false}
]
checktable()
// endDemo.update({"disabled":true});
}
})
form.render()
// console.log(510,formper)
// $('form').find('input,textarea,select').not('这里代表需要改的元素的查找').attr('readonly',true) 或者使用 prop('readonly',true).
// // 界面控制
// var formdata = {{ formdata|safe }};
// console.log(2222, formdata)
// if(Object.keys(formdata).length === 0){
// $('#beginupload').addClass('layui-hide');
// $('#download').addClass('layui-hide');
// }else{
// if(formdata.hasOwnProperty('name') && formdata.name!==''){
// // $('#checkBtn').addClass('layui-hide');
// }else{
// $('#beginupload').addClass('layui-hide');
// $('#download').addClass('layui-hide');
// }
// }
// ==================================================自定義函數部分=================================================
function getplancontent(d,oridata,field=''){
if (d['id']===1){
var modifydate = '';
var id = field+d['id']
modifydate = '<div id="'+id+'" name="checkMessageName" class="xm-select-demo" ></div>';
return modifydate
// if (d[field]===undefined){d[field] = ''}
// return '<div style="float:left" id="'+id+'">'+d[field]+'</span>';
// var modifydate = '';
// var id = field+d['id']
// modifydate ='<span id="'+id+'">'+d[field]+'</span>';
// // modifydate = '<div class="xm-select-demo" name="checkMessageName" id="'+id+'">'+d[field]+'</div>';
// for(var i=0;i<oridata.length;i++){
// if(oridata[i]['id'] === d['id']){
// oridata[i][field] = d[field]
// break
// }
// }
// return modifydate;
}
else{
// d[field] = layui.util.toDateString(d[field], 'yyyy-MM-dd')
if (d[field]===undefined){d[field] = ''}
var modifydate = '';
var id = field+d['id']
modifydate = '<span id="'+id+'">'+d[field]+'</span>';
for(var i=0;i<oridata.length;i++){
if(oridata[i]['id'] === d['id']){
oridata[i][field] = d[field]
break
}
}
return modifydate;
}
}
function getcostcontent(d,oridata,field=''){
// 
// d[field] = layui.util.toDateString(d[field], 'yyyy-MM-dd')
if (d[field]===''){d[field] ='   '}
var modifydate = '';
// var id = field+d['id']
var id = field
modifydate = '<span id="'+id+'">'+d[field]+'</span>';
// for(var i=0;i<oridata.length;i++){
// if(oridata[i]['id'] === d['id']){
// oridata[i][field] = d[field]
// break
// }
// }
return modifydate;
}
// ==================================================按鈕響應事件===================================================
//獲取項目負責人(共用查找人的)
$.ajax({
type:'post',
url:'/form/programImprove/SeekWorker',
data:{},
success:function(res){
if (res.code === 0) {
//res.data = {'dept':dept,'result':resultlist}
nameData = JSON.parse(JSON.stringify(res.data.result))
//对coDemo 进行 部门限制
deptnameData =JSON.parse(JSON.stringify(nameData))
deptnameData.forEach(item => {
if (item.Name !== res.data.dept){
item.disabled = true
}
})
coDemo.update({data:deptnameData})
coDemo.setValue(coDemolist)
Getplanman(checkData[0])
form.render()
}
}
})
//給單元格渲染日期框
function getTimerfun(obj,tableid,oridata,field){
var id = '#'+field+obj.data['id']
//var id = '#checkMessage'+i+obj.data['id']//'#modifydate'+obj.data['id']
laydate.render({
elem: id
,trigger:'click'
,show:true
,done:function(value){
for(var i=0;i<oridata.length;i++){
if(oridata[i]['id'] === obj.data['id']){
oridata[i][field] = value
}
}
var namedemoobj = $("span[id='"+field+obj.data['id']+"'] ")
namedemoobj.text(value)
form.render()
// table.reload(tableid, {
// data: oridata
// })
}
});
}
// 表格事件触发事件
table.on('tool(LAY_table_plan)', function(obj){
if (!getTimerfunFlag){
return
}
var data = obj.data;
switch (obj.event){
case 'checkMessageEvent1':
getTimerfun(obj,'LAY_table_plan',checkData,'checkMessage1')
break
case 'checkMessageEvent2':
getTimerfun(obj,'LAY_table_plan',checkData,'checkMessage2')
break
case 'checkMessageEvent3':
getTimerfun(obj,'LAY_table_plan',checkData,'checkMessage3')
break
case 'checkMessageEvent4':
getTimerfun(obj,'LAY_table_plan',checkData,'checkMessage4')
break
case 'checkMessageEvent5':
getTimerfun(obj,'LAY_table_plan',checkData,'checkMessage5')
break
case 'checkMessageEvent6':
getTimerfun(obj,'LAY_table_plan',checkData,'checkMessage6')
break
case 'checkMessageEvent7':
getTimerfun(obj,'LAY_table_plan',checkData,'checkMessage7')
break
default:
break
}
});
// 改良項目 保存
form.on('submit(saveDetail)', function(data){
checkData.forEach(item => {
delete item['LAY_TABLE_INDEX']
})
var param = JSON.parse(JSON.stringify(data.field))
console.log(849,param)
// var param = {}
param['checkData'] = checkData
param['coDemolist']= coDemolist
console.log(900,coDemo)
$.ajax({
type:'post',
url:'/form/programImprove/save',
data:{
taskid:formdataObj.taskid,
formid:formdataObj.formid,
formdataid:formdataObj.formdataid,
formdata:JSON.stringify(param)
},
success:function(res){
if(res.code == 0){
formdataObj.formdataid=res.data.formdataid
layer.msg(res.msg)
}else{
this.error(res)
}
},
error:function(res){
if(res.hasOwnProperty('code')){
layer.msg(res.msg)
}else{
layer.msg('error!')
}
}
})
return false
})
// 打印改良項目審批表
$('#programData').click(function(){
if($('[name|="reporttype"]').val() === ''){
return false
}
$.ajax({
url: '/report/rendercusmrep',
type: 'post',
data:{"reportid":'改良項目審批表',"pyparams":'{"id":"'+formdataObj.formdataid+'"}'},//"pyparams":'{"product":"'+itemModelDemo.getValue("nameStr")+'","sdate":"'+formdataObj.formdata['sdate']+'","realclient":"'+formdataObj.formdata['realclient']+'","id":"'+formdataObj.formdataid+'"}'},
success: function (res) {
var printData = res // 獲得返回報表模板
var h = window.open('打印窗口', '_blank') // 新窗口打印
h.document.write(printData)
h.document.close() // 关闭文档输入流
setTimeout(() => {
h.print()
h.close()
}, 500);
}
})
})
//時間計劃的負責人下拉框
function Getplanman(namedict = {}){
if (!getTimerfunFlag){
return
}
for (var i=1;i<=7;i++){
let field = 'checkMessage'+i
var id = field+1
let valuedata = []
if (namedict[field]!== undefined){
valuedata = [{
'Name':namedict[field]
}]
// valuedata = namedict[field]
}
// console.log(966,valuedata)
// 姓名下拉-樹形下拉
xmSelect.render({
el: '#'+id,
autoRow: false,
filterable: true,
cascader: {
//是否显示级联模式
show: true,
//间距
indent: 200,
//是否严格遵守父子模式
strict: true,
},
// iconfont: {// 隱藏父子節點
// parent: 'hidden'
// },
height: '220px',
name: 'checkMessageName',
model: { label: { type: 'text' } },
radio: true,
clickClose: true,
initValue:valuedata,
prop:{
name:"Name",
value:"Name"
},
on:function(data){
var arr = data.change,
person = arr[0];
// for(var i=0;i<checkData.length;i++){
// if(checkData[i]['id'] === obj.data['id']){
// checkData[i][field] = person.Name
// }
// }
checkData[0][field]=person.Name
// table.reload('LAY_table_plan', {
// data: checkData
// })
},
data: nameData
})
}
}
init()
//初始化界面
function init(){
// //date1 date2 date3
// for (var i=1;i<=3;i++){
// // 生產日期
// laydate.render({
// elem:'[name|="date'+i+'"]',
// trigger:'click'
// })
// }
if (formdataObj.formdataid != ''){
$.ajax({
async: false,
type: 'post',
url: '/form/programImprove/show',
data: formdataObj,
success: function(res) {
formdataObj['formdata'] = res.data.formdata
projectAllFun(formdataObj.formdata)
console.log(969,'formdata',formdataObj.formdata)
// Year = formdataObj['formdata']['year']
// ExamineStyle = formdataObj['formdata']['ExamineStyle']
// RemoveRepoId = formdataObj['formdata']['RemoveRepoId']
// // ismonth = formdataObj['formdata']['ismonth']
// product = formdataObj['formdata']['product']
// var timever = 'month'
// // 271
// //禁用下拉框
// $('[name|="Year"]').val(Year)
// $('[name|="auditType"]').val(formdataObj['formdata']['ExamineStyle'])
// $("select[name=auditType]").attr("disabled",true)
// $("input[name=Year]").attr("disabled",true)
// itemModelDemo.setValue([{product:product,product:product}])
// itemModelDemo.update({"disabled":true});
// if (ExamineStyle === '層次審核'){
// console.log(1303)
// weekdata = formdataObj['formdata']['WeekContent']
// monthdata = formdataObj['formdata']['MonthContent']
// RemoveM = formdataObj['formdata']['RemoveM']
// RemoveW = formdataObj['formdata']['RemoveW']
// getWM()
// $('#positionShow').removeClass("layui-hide")
// if (ismonth){
// level = '高層管理人員'
// }
// else{
// level = '中層管理人員'
// var timever = 'weeks'
// }
// $("#position ").val(level)
// // $("select[name=position]").attr("disabled",true)
// }
// //渲染表格数据
// //行
// newData = []
// for(var item in formdataObj['formdata']['content']){
// newDatadict={}
// newDatadict[timever] = item
// for (let i = 0; i < formdataObj['formdata']['content'][item].length; i++) {
// //符合 开始时间<= i <= 结束时间 的才加)
// let cc = formdataObj['formdata']['content'][item][i]
// newDatadict[cc['col_title']]=cc
// // newData[i][col_title] = Data
// }
// newData.push(newDatadict)
// // CheckContentlist.push(newData[i][item])
// }
// //列
// a = formdataObj['formdata']['newCols']//newCols = formdataObj['formdata']['newCols']
// if (a !== undefined){
// newCols = a
// if (ismonth){newCols[0]['templet'] = function(d){var w = d['month'] + '月';return w;}}
// else{newCols[0]['templet'] = function(d){var w = d['weeks'] + '周';return w;}}
// }
// showTable()
// // $('[name|="aim"]').val(res.data.aim)
form.render();
// console.log('289====',Year,ExamineStyle,ismonth,newData)
} ,
error:function(res){
console.log(res)
if(res.hasOwnProperty('code')){
layer.msg(res.msg, {icon:5})
}else{
layer.msg('端口出錯!')
}
}
})
}
}
// 改良項目賦值函數
function projectAllFun(data){
console.log(1006,data)
form.val('example',{
"Applicable_product":data['Applicable_product']
,"aim":data['aim']
,"checkMessageName":data['checkMessageName']
,"co_groupsign":data['co_groupsign']
// ,"co_groupsign":coDemo.update({initValue:[{name:data['co_groupsign']}]})//data['co_groupsign']
,"date1":data['date1']
,"date2":data['date2']
,"date3":data['date3']
,"description":data['description']
,"maintenance":data['maintenance']
,"mangerOpinion":data['mangerOpinion']
,"now_position":data['now_position']
,"orderNum":data['orderNum']
,"otherOpinion":data['otherOpinion']
,"post_machine1":data['post_machine1']
,"post_machine1name":data['post_machine1name']
,"post_machine2":data['post_machine2']
,"post_machine2name":data['post_machine2name']
,"post_rate":data['post_rate']
,"post_workernum":data['post_workernum']
,"post_worktime":data['post_worktime']
,"pre_machine1":data['pre_machine1']
,"pre_machine1name":data['pre_machine1name']
,"pre_machine2":data['pre_machine2']
,"pre_machine2name":data['pre_machine2name']
,"pre_rate":data['pre_rate']
,"pre_workernum":data['pre_workernum']
,"pre_worktime":data['pre_worktime']
,"product":data['product']
,"programName":data['programName']
,"project":data['project']
,"result":data['result']
,"review":data['review']
,"sign1":data['sign1']
,"sign2":data['sign2']
,"sign3":data['sign3']
,"success_rate":data['success_rate']
,"designcode":data['designcode']
,"programcode":data['programcode']
// "itemModel": itemModelDemo.setValue([{product:data['itemModel'],product:data['itemModel']}])
// ,"ProType": data['ProType']//data['ProType']
// ,"client": data['client']
// ,"realclient":data.hasOwnProperty('realclient')&&data['realclient']!==''?data['realclient']:data['client']
// ,"ways": data.hasOwnProperty('ways')&&data['ways']!==''?waysDemo.setValue([{name:data['ways'],value:data['ways']}]):waysDemo.setValue([])
// ,"furtherways": data.hasOwnProperty('furtherways')&&data['furtherways']!==''?furtherwaysDemo.setValue([{name:data['furtherways'],value:data['furtherways']}]):furtherwaysDemo.setValue([])
// ,"sealed": data.hasOwnProperty('sealed')&&data['sealed']!==''?sealedDemo.setValue([{name:data['sealed'],value:data['sealed']}]):sealedDemo.setValue([])
// ,"decision": data.hasOwnProperty('decision')&&data['decision']!==''?decisionDemo.setValue([{name:data['decision'],value:data['decision']}]):decisionDemo.setValue([])
// ,"NCProcess_card": data.hasOwnProperty('NCProcess_card')&&data['NCProcess_card']!==''?NCProcessDemo.setValue([{name:data['NCProcess_card'],value:data['NCProcess_card']}]):NCProcessDemo.setValue([])
})
//1122
if (data.hasOwnProperty('coDemolist')){
coDemolist = data['coDemolist']
coDemo.setValue(coDemolist)
}
if(data.hasOwnProperty('checkData')){
checkData = JSON.parse(JSON.stringify(data['checkData']))
}
table.reload('LAY_table_plan',{
data:checkData
})
checkData.forEach((item,index) => {
if(item.id===1){
Getplanman(checkData[0])
}
})
}
});
</script>
</body>
</html>
<!--自动带入当今月份--
08-29
1559
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)