199 lines
7.4 KiB
HTML
199 lines
7.4 KiB
HTML
![]() |
{extend name="../../base/view/common/base" /}
|
||
|
{block name="style"}
|
||
|
{include file="/approve/add_style" /}
|
||
|
{/block}
|
||
|
<!-- 主体 -->
|
||
|
{block name="body"}
|
||
|
<form class="layui-form p-4">
|
||
|
<h3 class="pb-3">通用审批</h3>
|
||
|
{eq name="$id" value="0"}
|
||
|
<table class="layui-table layui-table-form">
|
||
|
<tr>
|
||
|
<td class="layui-td-gray">审批内容<font>*</font></td>
|
||
|
<td colspan="2"><input type="text" name="name" value="" autocomplete="off" placeholder="请输入审批内容" lay-verify="required" lay-reqText="请输入审批内容" class="layui-input"></td>
|
||
|
<td class="layui-td-gray">紧急程度<font>*</font></td>
|
||
|
<td colspan="2">
|
||
|
<select name="detail_type" lay-verify="required" lay-reqText="请选择">
|
||
|
<option value="">--请选择--</option>
|
||
|
<option value="1">普通</option>
|
||
|
<option value="2">紧急</option>
|
||
|
<option value="3">特急</option>
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="layui-td-gray-2">审批详细描述<font>*</font></td>
|
||
|
<td colspan="5">
|
||
|
<textarea name="content" placeholder="请输入审批详细描述" class="layui-textarea" lay-verify="required" lay-reqText="请输入审批详细描述"></textarea>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="layui-td-gray">审批流程<font>*</font></td>
|
||
|
<td colspan="5">
|
||
|
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
|
||
|
<option value="">--请选择--</option>
|
||
|
{volist name="flows" id="vo"}
|
||
|
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
|
||
|
{/volist}
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr id="flow_tr">
|
||
|
<td class="layui-td-gray">审核人<font>*</font></td>
|
||
|
<td colspan="5">
|
||
|
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
{else/}
|
||
|
<table class="layui-table layui-table-form">
|
||
|
<tr>
|
||
|
<td class="layui-td-gray-2">审批内容<font>*</font></td>
|
||
|
<td colspan="2"><input type="text" name="name" value="{$detail.name}" autocomplete="off" placeholder="请输入审批内容" lay-verify="required" lay-reqText="请输入故障设备名称" class="layui-input"></td>
|
||
|
<td class="layui-td-gray">紧急程度<font>*</font></td>
|
||
|
<td colspan="2">
|
||
|
<select name="detail_type" lay-verify="required" lay-reqText="请选择">
|
||
|
<option value="">--请选择--</option>
|
||
|
<option value="1" {eq name="$detail.detail_type" value="1"}selected=""{/eq}>普通</option>
|
||
|
<option value="2" {eq name="$detail.detail_type" value="2"}selected=""{/eq}>紧急</option>
|
||
|
<option value="3" {eq name="$detail.detail_type" value="3"}selected=""{/eq}>特急</option>
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="layui-td-gray-2">审批详细描述<font>*</font></td>
|
||
|
<td colspan="5">
|
||
|
<textarea name="content" placeholder="请输入审批详细描述" class="layui-textarea" lay-verify="required" lay-reqText="请输入审批详细描述">{$detail.content}</textarea>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="layui-td-gray">审批流程<font>*</font></td>
|
||
|
<td colspan="5">
|
||
|
<select name="flow_id" lay-verify="required" lay-filter="flowtype" lay-reqText="请选择审批流程">
|
||
|
<option value="">--请选择--</option>
|
||
|
{volist name="flows" id="vo"}
|
||
|
<option value="{$vo.id}" title="{$vo.check_type}">{$vo.name}</option>
|
||
|
{/volist}
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr id="flow_tr">
|
||
|
<td class="layui-td-gray">审核人<font>*</font></td>
|
||
|
<td colspan="5">
|
||
|
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
{/eq}
|
||
|
<div style="padding: 10px 0">
|
||
|
<input type="hidden" name="id" value="{$id}">
|
||
|
<input type="hidden" name="type" value="{$type}">
|
||
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||
|
</div>
|
||
|
</form>
|
||
|
{/block}
|
||
|
<!-- /主体 -->
|
||
|
|
||
|
<!-- 脚本 -->
|
||
|
{block name="script"}
|
||
|
<script>
|
||
|
const moduleInit = ['tool','employeepicker'];
|
||
|
function gouguInit() {
|
||
|
var form = layui.form,tool=layui.tool, employeepicker = layui.employeepicker;
|
||
|
//选择人员
|
||
|
$('.layui-form').on('click','[name="check_admin_name"]',function(){
|
||
|
if($('[name="flow_id"]').val()==''){
|
||
|
layer.msg('请先选择审批流程');
|
||
|
return false;
|
||
|
}
|
||
|
employeepicker.init({
|
||
|
department_url: "/api/index/get_department_tree",
|
||
|
employee_url: "/api/index/get_employee",
|
||
|
type:0,
|
||
|
callback:function(ids,names){
|
||
|
$('[name="check_admin_ids"]').val(ids),
|
||
|
$('[name="check_admin_name"]').val(names);
|
||
|
}
|
||
|
});
|
||
|
})
|
||
|
|
||
|
//监听提交
|
||
|
form.on('submit(webform)', function(data){
|
||
|
$.ajax({
|
||
|
url: "/oa/approve/add",
|
||
|
type:'post',
|
||
|
data:data.field,
|
||
|
success: function (e) {
|
||
|
layer.msg(e.msg);
|
||
|
if (e.code == 0) {
|
||
|
setTimeout(function(){
|
||
|
parent.layui.tool.close();
|
||
|
parent.layui.pageTable.reload();
|
||
|
},1000);
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
return false;
|
||
|
});
|
||
|
|
||
|
form.on('select(flowtype)', function(data){
|
||
|
var check_type = data.elem[data.elem.selectedIndex].title;
|
||
|
var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
|
||
|
<td colspan="5">\
|
||
|
<input type="hidden" name="check_admin_ids" value="" readonly><input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input" readonly>\
|
||
|
</td>';
|
||
|
if(check_type == 2){
|
||
|
$('#flow_tr').html(formHtml);
|
||
|
form.render();
|
||
|
}
|
||
|
else{
|
||
|
$.ajax({
|
||
|
url: "/api/index/get_flow_users",
|
||
|
type:'post',
|
||
|
data:{id:data.value},
|
||
|
success: function (e) {
|
||
|
if (e.code == 0) {
|
||
|
var flowLi='';
|
||
|
for(var a=0;a<e.data.length;a++){
|
||
|
var userList='',sign_type = '';
|
||
|
if(e.data[a].flow_type==1){
|
||
|
userList+= '<li style="padding:3px 0">当前部门负责人</li>';
|
||
|
}
|
||
|
else if(e.data[a].flow_type==2){
|
||
|
userList+= '<li style="padding:3px 0">上级部门负责人</li>';
|
||
|
}
|
||
|
else{
|
||
|
if(e.data[a].flow_type==3){
|
||
|
sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>'
|
||
|
}
|
||
|
if(e.data[a].flow_type==4){
|
||
|
sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>'
|
||
|
}
|
||
|
for(var b=0;b<e.data[a].user_id_info.length;b++){
|
||
|
userList+= '<li style="padding:3px 0"><img src="'+e.data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+e.data[a].user_id_info[b].name+'</li>';
|
||
|
}
|
||
|
}
|
||
|
flowLi+='<li class="layui-timeline-item">\
|
||
|
<i class="layui-icon layui-timeline-axis"></i>\
|
||
|
<div class="layui-timeline-content">\
|
||
|
<p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
|
||
|
<ul>'+userList+'</ul>\
|
||
|
</div>\
|
||
|
</li>';
|
||
|
}
|
||
|
|
||
|
formHtml = '<td class="layui-td-gray">审批流程</td>\
|
||
|
<td colspan="5">\
|
||
|
<ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
|
||
|
</td>';
|
||
|
$('#flow_tr').html(formHtml);
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
</script>
|
||
|
{/block}
|
||
|
<!-- /脚本 -->
|