2022-02-11 13:23:31 +08:00
|
|
|
|
{extend name="../../base/view/common/base" /}
|
2021-11-15 23:51:08 +08:00
|
|
|
|
<!-- 主体 -->
|
|
|
|
|
{block name="body"}
|
2022-06-08 15:13:48 +08:00
|
|
|
|
<form class="layui-form p-4">
|
2021-11-27 17:42:29 +08:00
|
|
|
|
{if condition="$type eq 1"}
|
2022-06-08 15:13:48 +08:00
|
|
|
|
<h3 class="pb-3">回复消息</h3>
|
2021-11-27 17:42:29 +08:00
|
|
|
|
{else/}
|
2022-06-08 15:13:48 +08:00
|
|
|
|
<h3 class="pb-3">转发消息</h3>
|
2021-11-27 17:42:29 +08:00
|
|
|
|
{/if}
|
2021-11-15 23:51:08 +08:00
|
|
|
|
<table class="layui-table">
|
|
|
|
|
<tr>
|
2022-06-08 15:13:48 +08:00
|
|
|
|
<td class="layui-td-gray-2">接收人类型</td>
|
2021-11-15 23:51:08 +08:00
|
|
|
|
<td>
|
2021-12-14 00:35:34 +08:00
|
|
|
|
<input type="radio" name="type" lay-filter="type" value="1" title="同事" checked>
|
|
|
|
|
<input type="radio" name="type" lay-filter="type" value="2" title="部门">
|
|
|
|
|
<input type="radio" name="type" lay-filter="type" value="3" title="岗位">
|
|
|
|
|
<input type="radio" name="type" lay-filter="type" value="4" title="全部">
|
2021-11-15 23:51:08 +08:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
{if condition="$type eq 1"}
|
|
|
|
|
<tr id ="person" {eq name="$detail.type" value="3"}style="display:none;"{/eq}>
|
2022-06-10 17:00:24 +08:00
|
|
|
|
<td class="layui-td-gray">收件人<font>*</font></td>
|
2021-11-15 23:51:08 +08:00
|
|
|
|
<td>
|
|
|
|
|
<input type="text" name="person_name" value="{$detail.person_name}" lay-verify="required" lay-reqText="请选择收件人" placeholder="请选择收件人" readonly class="layui-input">
|
|
|
|
|
<input type="hidden" name="uids" value="{$detail.from_uid}">
|
|
|
|
|
<input type="hidden" name="dids" value="{$detail.from_uid}">
|
|
|
|
|
<input type="hidden" name="pids" value="{$detail.from_uid}">
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
2022-06-10 17:00:24 +08:00
|
|
|
|
<td class="layui-td-gray">主题<font>*</font></td>
|
2021-11-15 23:51:08 +08:00
|
|
|
|
<td>
|
2021-12-14 00:35:34 +08:00
|
|
|
|
<input type="text" name="title" value="回复:{$detail.title}" lay-verify="required" lay-reqText="请输入消息主题" placeholder="请输入消息主题" class="layui-input" lay-verify="required">
|
2021-11-15 23:51:08 +08:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
{else/}
|
|
|
|
|
<tr id ="person" {eq name="$detail.type" value="3"}style="display:none;"{/eq}>
|
2022-06-10 17:00:24 +08:00
|
|
|
|
<td class="layui-td-gray">收件人<font>*</font></td>
|
2021-11-15 23:51:08 +08:00
|
|
|
|
<td>
|
|
|
|
|
<input type="text" name="person_name" value="" lay-verify="required" lay-reqText="请选择收件人" placeholder="请选择收件人" readonly class="layui-input">
|
|
|
|
|
<input type="hidden" name="uids" value="">
|
|
|
|
|
<input type="hidden" name="dids" value="">
|
|
|
|
|
<input type="hidden" name="pids" value="">
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
2022-06-10 17:00:24 +08:00
|
|
|
|
<td class="layui-td-gray">主题<font>*</font></td>
|
2021-11-15 23:51:08 +08:00
|
|
|
|
<td>
|
2021-12-14 00:35:34 +08:00
|
|
|
|
<input type="text" name="title" value="转发:{$detail.title}" lay-verify="required" lay-reqText="请输入消息主题" placeholder="请输入消息主题" class="layui-input" lay-verify="required">
|
2021-11-15 23:51:08 +08:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
{/if}
|
|
|
|
|
<tr>
|
2022-06-10 17:00:24 +08:00
|
|
|
|
<td class="layui-td-gray" style="vertical-align:top;">内容<font>*</font></td>
|
2021-11-15 23:51:08 +08:00
|
|
|
|
<td>
|
|
|
|
|
<textarea name="content" placeholder="请输入消息内容" class="layui-textarea" style="height: 200px;" lay-verify="required" lay-reqText="请输入消息内容"></textarea>
|
|
|
|
|
|
2022-02-11 13:23:31 +08:00
|
|
|
|
<table class="layui-table" style="margin-top:10px;">
|
2021-11-15 23:51:08 +08:00
|
|
|
|
<tr>
|
2022-06-08 15:13:48 +08:00
|
|
|
|
<td class="layui-td-gray-2">原消息内容</td>
|
2022-08-01 09:53:02 +08:00
|
|
|
|
<td>{$detail.content}</td>
|
2021-11-15 23:51:08 +08:00
|
|
|
|
</tr>
|
|
|
|
|
{notempty name="$file_array"}
|
|
|
|
|
<tr>
|
2022-06-08 15:13:48 +08:00
|
|
|
|
<td class="layui-td-gray-2" style="vertical-align:top">原消息附件</td>
|
2021-11-15 23:51:08 +08:00
|
|
|
|
<td>
|
2022-08-01 09:53:02 +08:00
|
|
|
|
{volist name="$detail.from_file_array" id="vo"}
|
|
|
|
|
<div class="layui-col-md3" id="uploadImg{$vo.id}">
|
|
|
|
|
<div class="file-card">
|
|
|
|
|
<i class="file-icon iconfont icon-renwuguanli"></i>
|
|
|
|
|
<div class="file-title">{$vo.name}</div>
|
|
|
|
|
<div class="file-tool">
|
|
|
|
|
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/volist}
|
2021-11-15 23:51:08 +08:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
{/notempty}
|
|
|
|
|
</table>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
2022-08-01 09:53:02 +08:00
|
|
|
|
<td class="layui-td-gray"><div class="layui-input-inline">附件</div> <div class="layui-input-inline"><button type="button" class="layui-btn layui-btn-xs" id="upFile"><i class="layui-icon"></i></button></div></td>
|
|
|
|
|
<td colspan="5">
|
|
|
|
|
<div class="layui-row" id="fileList">
|
|
|
|
|
<input type="hidden" name="file_ids" value="{$detail.file_ids}">
|
|
|
|
|
{notempty name="$detail.file_ids"}
|
|
|
|
|
{volist name="$detail.file_array" id="vo"}
|
|
|
|
|
<div class="layui-col-md3" id="uploadImg{$vo.id}">
|
|
|
|
|
<div class="file-card">
|
|
|
|
|
<i class="file-icon iconfont icon-renwuguanli"></i>
|
|
|
|
|
<div class="file-title">{$vo.name}</div>
|
|
|
|
|
<div class="file-tool">
|
|
|
|
|
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
|
|
|
|
|
<i class="btn-delete layui-icon layui-icon-delete" data-id="{$vo.id}" style="color: #FF5722;" title="删除"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-11-15 23:51:08 +08:00
|
|
|
|
</div>
|
2022-08-01 09:53:02 +08:00
|
|
|
|
{/volist}
|
|
|
|
|
{/notempty}
|
2021-11-15 23:51:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
2022-06-08 15:13:48 +08:00
|
|
|
|
<div class="py-3">
|
2021-11-15 23:51:08 +08:00
|
|
|
|
<input type="hidden" value="0" name="id">
|
|
|
|
|
<input type="hidden" value="{$fid}" name="fid">
|
|
|
|
|
<button class="layui-btn" lay-submit="" lay-filter="draftform">存为草稿</button>
|
|
|
|
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即发送</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
{/block}
|
|
|
|
|
<!-- /主体 -->
|
|
|
|
|
|
|
|
|
|
<!-- 脚本 -->
|
|
|
|
|
{block name="script"}
|
|
|
|
|
<script>
|
2022-08-01 09:53:02 +08:00
|
|
|
|
// 查找指定的元素在数组中的位置
|
|
|
|
|
Array.prototype.indexOf = function (val) {
|
|
|
|
|
for (var i = 0; i < this.length; i++) {
|
|
|
|
|
if (this[i] == val) {
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
};
|
|
|
|
|
// 通过索引删除数组元素
|
|
|
|
|
Array.prototype.remove = function (val) {
|
|
|
|
|
var index = this.indexOf(val);
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
this.splice(index, 1);
|
|
|
|
|
}
|
|
|
|
|
};
|
2022-06-08 15:13:48 +08:00
|
|
|
|
const moduleInit = ['tool','employeepicker','dtree'];
|
|
|
|
|
function gouguInit() {
|
|
|
|
|
var form = layui.form,tool=layui.tool,table=layui.table,laydate = layui.laydate,employeepicker = layui.employeepicker,dtree = layui.dtree,upload = layui.upload;
|
2021-11-15 23:51:08 +08:00
|
|
|
|
//监听保存到草稿并发送
|
|
|
|
|
form.on('submit(webform)', function(data){
|
|
|
|
|
$.ajax({
|
2022-02-11 13:23:31 +08:00
|
|
|
|
url: "/message/index/save",
|
2021-11-15 23:51:08 +08:00
|
|
|
|
type:'post',
|
|
|
|
|
data:data.field,
|
|
|
|
|
success:function(e){
|
|
|
|
|
if(e.code==0){
|
|
|
|
|
layer.msg('消息保存成功,正在发送中...');
|
|
|
|
|
$.ajax({
|
2022-02-11 13:23:31 +08:00
|
|
|
|
url: "/message/index/send",
|
2021-11-15 23:51:08 +08:00
|
|
|
|
type:'post',
|
|
|
|
|
data:{'id':e.data},
|
2022-02-11 13:23:31 +08:00
|
|
|
|
success: function (e) {
|
|
|
|
|
layer.msg(e.msg);
|
|
|
|
|
if (e.code == 0) {
|
2022-08-01 09:53:02 +08:00
|
|
|
|
tool.sideClose(1000);
|
2021-11-15 23:51:08 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
layer.msg(e.msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//监听保存到草稿
|
|
|
|
|
form.on('submit(draftform)', function(data){
|
|
|
|
|
$.ajax({
|
2022-02-11 13:23:31 +08:00
|
|
|
|
url: "/message/index/save",
|
2021-11-15 23:51:08 +08:00
|
|
|
|
type:'post',
|
|
|
|
|
data:data.field,
|
2022-02-11 13:23:31 +08:00
|
|
|
|
success: function (e) {
|
|
|
|
|
layer.msg(e.msg);
|
|
|
|
|
if (e.code == 0) {
|
2022-08-01 09:53:02 +08:00
|
|
|
|
tool.sideClose(1000);
|
2021-11-15 23:51:08 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//选择收件人类型
|
|
|
|
|
form.on('radio(type)', function (data) {
|
|
|
|
|
$('[name="person_name"]').val('');
|
|
|
|
|
$('[name="dids"]').val('');
|
|
|
|
|
$('[name="uids"]').val('');
|
2022-06-08 15:13:48 +08:00
|
|
|
|
$('[name="pids"]').val('');
|
2022-02-11 13:23:31 +08:00
|
|
|
|
if(data.value==4){
|
2021-11-15 23:51:08 +08:00
|
|
|
|
$('#person').val('0').hide();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$('#person').val('').show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//选择对应人
|
|
|
|
|
$('[name="person_name"]').on('click',function(){
|
|
|
|
|
type = $("input[name='type']:checked").val();
|
2021-12-14 00:35:34 +08:00
|
|
|
|
if(type == 1){
|
2021-11-15 23:51:08 +08:00
|
|
|
|
addEmployee();
|
|
|
|
|
}else if(type == 2){
|
2021-12-14 00:35:34 +08:00
|
|
|
|
selectDepartment();
|
|
|
|
|
}else if(type == 3){
|
2021-11-15 23:51:08 +08:00
|
|
|
|
selectAuditor();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//添加人员
|
|
|
|
|
function addEmployee(){
|
|
|
|
|
var ids=$('[name="uids"]').val(),names=$('[name="person_name"]').val(),idsArray=[],namesArray=[];
|
|
|
|
|
if(ids!=''){
|
|
|
|
|
idsArray=ids.split(',');
|
|
|
|
|
namesArray=names.split(',');
|
|
|
|
|
}
|
|
|
|
|
employeepicker.init({
|
2022-02-11 13:23:31 +08:00
|
|
|
|
department_url: "/api/index/get_department_tree",
|
|
|
|
|
employee_url: "/api/index/get_employee",
|
2021-11-15 23:51:08 +08:00
|
|
|
|
ids:idsArray,
|
|
|
|
|
names:namesArray,
|
|
|
|
|
callback:function(ids,names){
|
|
|
|
|
$('[name="uids"]').val(ids.join(',')),
|
|
|
|
|
$('[name="person_name"]').val(names.join(','));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//选择部门
|
|
|
|
|
function selectDepartment(){
|
|
|
|
|
var tpl='<div style="width:382px; height:338px;overflow-y: auto;">\
|
|
|
|
|
<div id="checkemployeetree" style="padding:10px 0;"></div>\
|
|
|
|
|
</div>';
|
|
|
|
|
layer.open({
|
|
|
|
|
type:1,
|
|
|
|
|
title:'选择部门',
|
|
|
|
|
area:['400px','450px'],
|
|
|
|
|
content:tpl,
|
|
|
|
|
success:function(){
|
|
|
|
|
$.ajax({
|
2022-02-11 13:23:31 +08:00
|
|
|
|
url: "/api/index/get_department_tree",
|
2022-06-08 15:13:48 +08:00
|
|
|
|
type:'get',
|
2021-11-15 23:51:08 +08:00
|
|
|
|
success:function(res){
|
|
|
|
|
dtree.render({
|
|
|
|
|
elem: "#checkemployeetree",
|
|
|
|
|
data: res.trees,
|
|
|
|
|
icon: "2", //修改二级图标样式
|
|
|
|
|
checkbarType: "no-all", // 默认就是all,其他的值为: no-all p-casc self only
|
|
|
|
|
checkbar: true //开启复选框
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
btn: ['确定'],
|
|
|
|
|
btnAlign:'c',
|
|
|
|
|
yes: function(){
|
|
|
|
|
var ids=[],names=[];
|
|
|
|
|
var check=dtree.getCheckbarNodesParam("checkemployeetree");
|
|
|
|
|
if(check.length==0){
|
|
|
|
|
layer.msg('请选择部门');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for(var m=0; m<check.length; m++){
|
|
|
|
|
ids.push(check[m].nodeId);
|
|
|
|
|
names.push(check[m].context);
|
|
|
|
|
}
|
|
|
|
|
$('[name="person_name"]').val(names.join(','));
|
|
|
|
|
$('[name="dids"]').val(ids.join(','));
|
|
|
|
|
layer.closeAll();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-08 15:13:48 +08:00
|
|
|
|
//选择岗位
|
2021-11-15 23:51:08 +08:00
|
|
|
|
function selectAuditor(){
|
|
|
|
|
layer.open({
|
|
|
|
|
title:'选择岗位',
|
|
|
|
|
type:1,
|
|
|
|
|
area:['360px','480px'],
|
|
|
|
|
content:'<div style="padding:5px 12px"><div id="vaeservice"></div></div>',
|
|
|
|
|
success:function(){
|
|
|
|
|
tableid=table.render({
|
|
|
|
|
elem: '#vaeservice'
|
2022-02-11 13:23:31 +08:00
|
|
|
|
,url: "/api/index/get_position"
|
2021-11-15 23:51:08 +08:00
|
|
|
|
,page: false //开启分页
|
|
|
|
|
,cols: [[
|
|
|
|
|
{type:'checkbox',title: '选择'}
|
|
|
|
|
,{field:'id', width:80, title: '编号', align:'center'}
|
|
|
|
|
,{field:'name',title: '岗位名称'}
|
|
|
|
|
]]
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
btn: ['确定'],
|
|
|
|
|
btnAlign:'c',
|
|
|
|
|
yes: function(){
|
|
|
|
|
var checkStatus = table.checkStatus(tableid.config.id);
|
|
|
|
|
var data = checkStatus.data,val = [],title=[];
|
|
|
|
|
if(data.length>0){
|
|
|
|
|
for ( var i = 0; i <data.length; i++){
|
|
|
|
|
val.push(data[i].id);
|
|
|
|
|
title.push(data[i].name);
|
|
|
|
|
}
|
|
|
|
|
$('[name="person_name"]').val(title.join(','));
|
2022-06-08 15:13:48 +08:00
|
|
|
|
$('[name="pids"]').val(val.join(','));
|
2021-11-15 23:51:08 +08:00
|
|
|
|
layer.closeAll();
|
|
|
|
|
}else{
|
2022-06-08 15:13:48 +08:00
|
|
|
|
layer.msg('请选择岗位');
|
2021-11-15 23:51:08 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-08-01 09:53:02 +08:00
|
|
|
|
//多附件上传
|
|
|
|
|
upload.render({
|
|
|
|
|
elem: '#upFile'
|
|
|
|
|
,url: "/api/index/upload"
|
|
|
|
|
,multiple: true
|
|
|
|
|
,accept: 'file' //普通文件
|
|
|
|
|
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z' //只允许上传文件格式
|
|
|
|
|
,done: function(res){
|
|
|
|
|
layer.msg(res.msg);
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
//上传成功
|
|
|
|
|
var idsStr = $('#fileList input').val(),idsArray = [];
|
|
|
|
|
if (idsStr != '') {
|
|
|
|
|
idsArray = idsStr.split(",");
|
|
|
|
|
}
|
|
|
|
|
idsArray.push(res.data.id);
|
|
|
|
|
$('#fileList input').attr('value', idsArray.join(','));
|
|
|
|
|
let temp = `<div class="layui-col-md3" id="uploadImg${res.data.id}">
|
|
|
|
|
<div class="file-card">
|
|
|
|
|
<i class="file-icon layui-icon layui-icon-file"></i>
|
|
|
|
|
<div class="file-title">${res.data.name}</div>
|
|
|
|
|
<div class="file-tool">
|
|
|
|
|
<a href="${res.data.filepath}" download="${res.data.name}" title="下载查看" target="_blank"><i class="layui-icon layui-icon-download-circle" style="color: #12bb37;"></i></a>
|
|
|
|
|
<i class="btn-delete layui-icon layui-icon-delete" data-id="${res.data.id}" style="color: #FF5722;" title="删除"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>`;
|
|
|
|
|
$('#fileList').append(temp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2022-06-08 15:13:48 +08:00
|
|
|
|
}
|
2021-11-15 23:51:08 +08:00
|
|
|
|
</script>
|
|
|
|
|
{/block}
|
|
|
|
|
<!-- /脚本 -->
|