You've already forked guangan
OA审核
This commit is contained in:
133
plugs/think-plugs-ticket/src/view/approval/form.html
Normal file
133
plugs/think-plugs-ticket/src/view/approval/form.html
Normal file
@ -0,0 +1,133 @@
|
||||
<form class="layui-form layui-card" action="{:sysuri()}" data-auto="true" method="post" autocomplete="off" data-table-id="ticketTable">
|
||||
<div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">流程名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="name" lay-verify="required" value="{$vo.name|default=''}" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">流程类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select class="layui-select" name="type" required>
|
||||
<option value="GDSH" {if isset($vo.type) && $vo.type == 'GDSH'}selected{/if}>工单审核</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">审批步骤</label>
|
||||
<div class="layui-input-block" id="approval-steps">
|
||||
<table class="layui-hide" id="processStepTable" lay-filter="processStepTable"></table>
|
||||
<button type="button" class="layui-btn layui-btn-normal add-step">添加步骤</button>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="steps" value='{$vo.steps|default=[]|raw|json_encode}'>
|
||||
{notempty name='vo.id'}<input type="hidden" name="id" value="{$vo.id}">{/notempty}
|
||||
</div>
|
||||
<div class="layui-form-item text-center">
|
||||
<button class="layui-btn layui-btn-normal" type='submit'>保存数据</button>
|
||||
<button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/html" id="editToolbar">
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs remove-step">删除</a>
|
||||
</script>
|
||||
<script type="text/html" id="approverType">
|
||||
<select class="layui-select" lay-filter="approverType" required>
|
||||
<option value="0" {{# if (d.approver_type == 0) {}} selected {{# } }}>固定审批人</option>
|
||||
<option value="3" {{# if (d.approver_type == 3) {}} selected {{# } }}>自由指定审批人</option>
|
||||
</select>
|
||||
</script>
|
||||
<script type="text/html" id="approverId">
|
||||
{{# if (d.approver_type == 0) { }}
|
||||
<select class="layui-select" lay-filter="approverId" required lay-search>
|
||||
<option value="">请选择审批人</option>
|
||||
{foreach $users as $user}
|
||||
<option value="{$user.id}" {{# if (d.approver_id == {$user.id}) {}} selected {{# } }}>{$user.username}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{{# } else { }}
|
||||
用户自行选择
|
||||
{{# } }}
|
||||
</script>
|
||||
<style>
|
||||
.layui-table-cell {
|
||||
overflow: visible !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(function () {
|
||||
layui.use(['table', 'form'], function () {
|
||||
var table = layui.table,
|
||||
form = layui.form;
|
||||
// 回显步骤数据
|
||||
var stepsData = JSON.parse($('input[name="steps"]').val());
|
||||
table.render({
|
||||
height: '400',
|
||||
title: '步骤列表',
|
||||
cols: [[
|
||||
{field:'title', title:'步骤名称', width:160, edit: true},
|
||||
{field:'approver_type', title:'审批人类型', width:160, templet: '#approverType'},
|
||||
{field:'approver_id', title:'审批人类型', width:160, templet: '#approverId'},
|
||||
{align: 'center', toolbar: '#editToolbar', title: '操作', width: 200}
|
||||
]],
|
||||
data: stepsData,
|
||||
page: false,
|
||||
id: 'processStepTable',
|
||||
elem: '#processStepTable',
|
||||
})
|
||||
form.on('select(approverType)', function (data, item) {
|
||||
var index = $(this).closest('tr').data('index');
|
||||
const currData = table.cache['processStepTable'] || [];
|
||||
currData[index].approver_type = data.value;
|
||||
$('input[name="steps"]').val(JSON.stringify(currData))
|
||||
table.reload('processStepTable', {
|
||||
data: currData
|
||||
});
|
||||
});
|
||||
form.on('select(approverId)', function (data, item) {
|
||||
var index = $(this).closest('tr').data('index');
|
||||
const currData = table.cache['processStepTable'] || [];
|
||||
currData[index].approver_id = data.value;
|
||||
$('input[name="steps"]').val(JSON.stringify(currData))
|
||||
table.reload('processStepTable', {
|
||||
data: currData
|
||||
});
|
||||
});
|
||||
table.on('tool(processStepTable)', function (obj) {
|
||||
if (obj.event === 'remove') {
|
||||
obj.del();
|
||||
}
|
||||
});
|
||||
table.on('edit(processStepTable)', function (obj) {
|
||||
const currData = table.cache['processStepTable'] || [];
|
||||
$('input[name="steps"]').val(JSON.stringify(currData))
|
||||
|
||||
})
|
||||
// 添加步骤
|
||||
$('.add-step').on('click', function () {
|
||||
const currData = table.cache['processStepTable'] || [];
|
||||
currData.push({
|
||||
title: '',
|
||||
approver_type: 0,
|
||||
})
|
||||
table.reload('processStepTable', {
|
||||
data: currData
|
||||
});
|
||||
});
|
||||
|
||||
// 删除步骤
|
||||
$('#approval-steps').on('click', '.remove-step', function () {
|
||||
var index = $(this).closest('tr').data('index');
|
||||
const currData = table.cache['processStepTable'] || [];
|
||||
currData.splice(index, 1);
|
||||
table.reload('processStepTable', {
|
||||
data: currData
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
51
plugs/think-plugs-ticket/src/view/approval/index.html
Normal file
51
plugs/think-plugs-ticket/src/view/approval/index.html
Normal file
@ -0,0 +1,51 @@
|
||||
{extend name="table"}
|
||||
|
||||
{block name="button"}
|
||||
<!--{if auth("add")}-->
|
||||
<a data-modal="{:url('add')}" data-height="80%" data-width="80%" class="layui-btn layui-btn-xs">添加流程</a>
|
||||
<!--{/if}-->
|
||||
{/block}
|
||||
|
||||
{block name="content"}
|
||||
<div class="layui-row">
|
||||
<div class="layui-col">
|
||||
<div class="article_list think-bg-white">
|
||||
{include file='approval/index_search'}
|
||||
<table class="layui-hide" data-url="{$request->url()}" data-target-search="form.form-search" id="processTable" lay-filter="processTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="toolbar">
|
||||
<!--{if auth("edit")}-->
|
||||
<a data-modal="{:url('edit')}?id={{ d.id }}" data-width="50%" class="layui-btn layui-btn-xs">编辑</a>
|
||||
<!--{/if}-->
|
||||
<!--{if auth("remove")}-->
|
||||
<a data-confirm="确定删除该流程?" data-action="{:url('remove')}" data-value="id#{{d.id}}" class="layui-btn layui-btn-danger layui-btn-xs">删除</a>
|
||||
<!--{/if}-->
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
|
||||
{block name='style'}
|
||||
<style>
|
||||
</style>
|
||||
{/block}
|
||||
|
||||
{block name='script'}
|
||||
<script>
|
||||
$(function () {
|
||||
$('#processTable').layTable({
|
||||
height: 'full-250',
|
||||
toolbar: true,
|
||||
sort: {field: 'create_time', type: 'desc'},
|
||||
title: '流程列表',
|
||||
cols: [[
|
||||
{field:'create_time', title: '创建时间', width: 160, sort: true},
|
||||
{field:'name', title:'流程名称', width:160},
|
||||
{align: 'center', toolbar: '#toolbar', title: '操作', width: 200}
|
||||
]]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
16
plugs/think-plugs-ticket/src/view/approval/index_search.html
Normal file
16
plugs/think-plugs-ticket/src/view/approval/index_search.html
Normal file
@ -0,0 +1,16 @@
|
||||
<fieldset>
|
||||
<legend>条件搜索</legend>
|
||||
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">流程名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input name="name" value="{:input('get.name')}" placeholder="请输入流程名称" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="searchData"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</fieldset>
|
Reference in New Issue
Block a user