lihai-oa/app/project/view/index/edit.html

222 lines
9.4 KiB
HTML
Raw Normal View History

2023-10-24 15:17:16 +08:00
{extend name="../../base/view/common/base" /}
{block name="style"}
<style>
.layui-form-pane .layui-form-label {width:60px; padding:8px;}
.layui-form-pane .layui-form-label.label-index,.layui-form-pane .layui-form-label.label-first {width:80px;}
.layui-form-item .layui-input-inline {margin-right:4px;}
.layui-form-item .layui-inline {margin-right:0; margin-bottom:0;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-3">
<h3 class="pb-3">编辑项目阶段</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">项目名称<font>*</font></td>
<td>{$detail.name}</td>
<td class="layui-td-gray-2">计划完成周期</td>
<td>{$detail.start_time_str} - {$detail.end_time_str}</td>
</tr>
<tr>
<td class="layui-td-gray">负责人</td>
<td>{$detail.director_name}</td>
<td class="layui-td-gray">项目成员</td>
<td colspan="3">{$detail.team_admin_names}</td>
</tr>
{gt name="$detail.contract_id" value="0"}
<tr>
<td class="layui-td-gray">关联合同</td>
<td colspan="3">{$detail.contract}</td>
</tr>
{/gt}
<tr>
<td class="layui-td-gray">项目简介</td>
<td colspan="3">{$detail.content}</td>
</tr>
<tr>
<td colspan="8" class="layui-td-gray" style="text-align:left; font-weight:600">项目阶段<font>*</font></td>
</tr>
<tr>
<td colspan="8">
<div id="flowList">
{volist name="$step_array" id="vo"}
<div class="layui-form-item layui-form-pane">
<div class="layui-inline">
<label class="layui-form-label {$key==0?'label-first':'label-index'}">第{$key+1}阶段</label>
<div class="layui-input-inline" style="width:120px;">
<input type="text" name="flowName[]" autocomplete="off" value="{$vo.flow_name}" placeholder="输入阶段名称" class="layui-input" lay-verify="required" lay-reqText="请输入阶段名称">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">负责人</label>
<div class="layui-input-inline" style="width:120px;">
<input type="text" name="chargeNames[]" autocomplete="off" readonly placeholder="选择阶段负责人" class="layui-input picker-one" lay-verify="required" lay-reqText="请选择阶段负责人" value="{$vo.check_name}">
<input type="hidden" name="chargeIds[]" value="{$vo.flow_uid}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">成员</label>
<div class="layui-input-inline" style="width:168px;">
<input type="text" name="membeNames[]" value="{$vo.flow_names}" autocomplete="off" readonly placeholder="选择阶段成员,可多选" class="layui-input picker-more" lay-verify="required" lay-reqText="请选择阶段成员">
<input type="hidden" name="membeIds[]" value="{$vo.flow_ids}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">周期</label>
<div class="layui-input-inline" style="width:186px;">
<input type="text" name="cycleDate[]" class="layui-input select-time-range" readonly value="{$vo.start_time} 到 {$vo.end_time}" placeholder="开始时间 到 结束时间" lay-verify="required" lay-reqText="请选择阶段周期">
</div>
</div>
</div>
{/volist}
</div>
<span class="layui-btn layui-btn-xs add-flow" data-type="1">+ 添加自定义阶段</span>
<div style="padding:10px; margin-top:10px; font-size:12px; background-color:#fffcf0">
<p><strong>温馨提示</strong></p>
<p>1、项目开始流转前请确保已完善好各项目信息。</p>
<p>2、项目开始流转后只有项目负责人可修改项目信息。</p>
<p>3、项目负责人可以修改项目阶段的信息但是修改完成后已流转的项目阶段需要重新走一遍流程。</p>
</div>
</td>
</tr>
</table>
<div style="padding: 10px 0">
<input type="hidden" name="id" value="{$detail.id}" />
<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,laydate = layui.laydate,employeepicker = layui.employeepicker;
//日期
lay('.select-time-range').each(function () {
laydate.render({
elem: this,
range: '到',
trigger: 'click'
});
});
$('.add-flow').on('click',function(){
let len = $('#flowList').find('.layui-form-item').length;
let index = len+1;
let type = $(this).data('type');;
let tem=['<div class="layui-form-item layui-form-pane">\
<div class="layui-inline">\
<label class="layui-form-label label-index">第'+index+'阶段</label>\
<div class="layui-input-inline" style="width:120px;">\
<select name="flowName[]" lay-filter="flowName" lay-verify="required" lay-reqText="请选择阶段名称">\
<option value="">请选择</option>\
<option value="立项阶段">立项阶段</option>\
<option value="产品阶段">产品阶段</option>\
<option value="UI阶段">UI阶段</option>\
<option value="测试阶段">测试阶段</option>\
<option value="交付阶段">交付阶段</option>\
<option value="售后阶段">售后阶段</option>\
<option value="项目完结">项目完结</option>\
</select>\
</div>\
</div>\
<div class="layui-inline">\
<label class="layui-form-label">负责人</label>\
<div class="layui-input-inline" style="width:120px;">\
<input type="text" name="chargeName[]" autocomplete="off" readonly placeholder="选择阶段负责人" class="layui-input picker-one" lay-verify="required" lay-reqText="请选择阶段负责人">\
<input type="hidden" name="chargeIds[]">\
</div>\
</div>\
<div class="layui-inline">\
<label class="layui-form-label">成员</label>\
<div class="layui-input-inline" style="width:168px;">\
<input type="text" name="membeNames[]" autocomplete="off" readonly placeholder="选择阶段成员,可多选" class="layui-input picker-more" lay-verify="required" lay-reqText="请选择阶段成员">\
<input type="hidden" name="membeIds[]">\
</div>\
</div>\
<div class="layui-inline">\
<label class="layui-form-label">周期</label>\
<div class="layui-input-inline" style="width:186px;">\
<input type="text" name="cycleDate[]" class="layui-input select-time-range" readonly placeholder="开始时间 到 结束时间" lay-verify="required" lay-reqText="请选择阶段周期">\
</div>\
</div>\
<span class="layui-btn layui-btn-danger layui-btn-sm">删除</span>\
</div>',
'<div class="layui-form-item layui-form-pane">\
<div class="layui-inline">\
<label class="layui-form-label label-index">第'+index+'阶段</label>\
<div class="layui-input-inline" style="width:120px;">\
<input type="text" name="flowName[]" autocomplete="off" placeholder="输入阶段名称" class="layui-input" lay-verify="required" lay-reqText="请输入阶段名称">\
</div>\
</div>\
<div class="layui-inline">\
<label class="layui-form-label">负责人</label>\
<div class="layui-input-inline" style="width:120px;">\
<input type="text" name="chargeNames[]" autocomplete="off" readonly placeholder="选择阶段负责人" class="layui-input picker-one" lay-verify="required" lay-reqText="请选择阶段负责人">\
<input type="hidden" name="chargeIds[]">\
</div>\
</div>\
<div class="layui-inline">\
<label class="layui-form-label">成员</label>\
<div class="layui-input-inline" style="width:168px;">\
<input type="text" name="membeNames[]" autocomplete="off" readonly placeholder="选择阶段成员,可多选" class="layui-input picker-more" lay-verify="required" lay-reqText="请选择阶段成员">\
<input type="hidden" name="membeIds[]">\
</div>\
</div>\
<div class="layui-inline">\
<label class="layui-form-label">周期</label>\
<div class="layui-input-inline" style="width:186px;">\
<input type="text" name="cycleDate[]" class="layui-input select-time-range" readonly placeholder="开始时间 到 结束时间" lay-verify="required" lay-reqText="请选择阶段周期">\
</div>\
</div>\
<span class="layui-btn layui-btn-danger layui-btn-sm">删除</span>\
</div>'
];
$('#flowList').append(tem[type]);
form.render();
//日期
lay('.select-time-range').each(function () {
laydate.render({
elem: this,
range: '到',
rangeLinked:true,
trigger: 'click'
});
});
});
$('#flowList').on('click','.layui-btn-danger',function(){
$(this).parents('.layui-form-item').remove();
var items = $('.label-index').length;
if(items>0){
$('.label-index').each(function(index,item){
$(this).html('第'+(index+2)+'阶段');
})
}
});
//监听提交
form.on('submit(webform)', function (data) {
layer.confirm('重置项目阶段信息,已审核的阶段需要重新走一遍流转,确认重置?', {
icon: 3,
title: '温馨提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/project/api/reset_check",data.field,callback);
layer.close(index);
});
return false;
});
}
</script>
{/block}