优化合同选择归属关联客户操作,优化合同上传附件操作
This commit is contained in:
parent
9d73589893
commit
b4775245d1
@ -264,6 +264,15 @@ class Index extends BaseController
|
||||
$is_create_admin = 1;
|
||||
}
|
||||
|
||||
$file_array_other = Db::name('ContractFile')
|
||||
->field('cf.id,f.filepath,f.name,f.filesize,f.fileext')
|
||||
->alias('cf')
|
||||
->join('File f', 'f.id = cf.file_id', 'LEFT')
|
||||
->order('cf.create_time asc')
|
||||
->where(array('cf.contract_id' => $id, 'cf.delete_time' => 0))
|
||||
->select()->toArray();
|
||||
$detail['file_array_other'] = $file_array_other;
|
||||
|
||||
$check_record = Db::name('FlowRecord')->field('f.*,a.name,a.thumb')
|
||||
->alias('f')
|
||||
->join('Admin a', 'a.id = f.check_user_id', 'left')
|
||||
@ -283,6 +292,7 @@ class Index extends BaseController
|
||||
$vv['status_str'] = '撤销';
|
||||
}
|
||||
}
|
||||
|
||||
View::assign('is_check_admin', $is_check_admin);
|
||||
View::assign('is_create_admin', $is_create_admin);
|
||||
View::assign('check_record', $check_record);
|
||||
|
@ -77,15 +77,7 @@ class Contract extends Model
|
||||
public function detail($id)
|
||||
{
|
||||
$detail = self::where(['id' => $id])->find();
|
||||
if (!empty($detail)) {
|
||||
$file_array = Db::name('ContractFile')
|
||||
->field('cf.id,f.filepath,f.name,f.filesize,f.fileext')
|
||||
->alias('cf')
|
||||
->join('File f', 'f.id = cf.file_id', 'LEFT')
|
||||
->order('cf.create_time asc')
|
||||
->where(array('cf.contract_id' => $id, 'cf.delete_time' => 0))
|
||||
->select()->toArray();
|
||||
|
||||
if (!empty($detail)) {
|
||||
$detail['status_name'] = self::$Status[(int) $detail['check_status']];
|
||||
$detail['archive_status_name'] = self::$ArchiveStatus[(int) $detail['archive_status']];
|
||||
$detail['sign_time'] = date('Y-m-d', $detail['sign_time']);
|
||||
@ -125,7 +117,11 @@ class Contract extends Model
|
||||
if($detail['pid']>0){
|
||||
$detail['pname'] = self::where(['id' => $detail['pid']])->value('name');
|
||||
}
|
||||
$detail['file_array'] = $file_array;
|
||||
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
}
|
||||
return $detail;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ class ContractLog extends Model
|
||||
'check_status' => '状态',
|
||||
'status' => '状态',
|
||||
'archive_status' => '归档状态',
|
||||
'file_ids' => '合同附件',
|
||||
'file' => '合同附件',
|
||||
'remark' => '备注信息',
|
||||
'new' => '新增',
|
||||
|
@ -111,37 +111,49 @@
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">合同签订人<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="sign_name" autocomplete="off" readonly placeholder="请选择合同签订人" class="layui-input">
|
||||
<input type="hidden" name="sign_uid" lay-verify="required" lay-reqText="请选择合同签订人">
|
||||
<input type="hidden" name="sign_did">
|
||||
<div class="layui-input-inline" style="width:50%;">
|
||||
<input type="text" name="sign_name" autocomplete="off" readonly lay-verify="required" lay-reqText="请选择合同签订人" placeholder="请选择合同签订人" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-input-inline gray" style="width:42%;" id="sign_department"></div>
|
||||
<input type="hidden" name="sign_uid">
|
||||
<input type="hidden" name="sign_did">
|
||||
</td>
|
||||
<td class="layui-td-gray-2">合同签订时间<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="sign_time" readonly lay-verify="required" lay-reqText="请选择合同签订日期" placeholder="请选择合同签订日期" class="layui-input select-time">
|
||||
</td>
|
||||
<td class="layui-td-gray-2">合同签订部门</td>
|
||||
<td>
|
||||
<input type="text" name="sign_department" autocomplete="off" readonly class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">合同制定人<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="prepared_name" autocomplete="off" readonly placeholder="请选择合同制定人" class="layui-input picker-one">
|
||||
<input type="hidden" name="prepared_uid" lay-verify="required" lay-reqText="请选择合同制定人">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">合同保管人<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="keeper_name" autocomplete="off" readonly placeholder="请选择合同保管人" class="layui-input picker-one">
|
||||
<input type="hidden" name="keeper_uid" lay-verify="required" lay-reqText="请选择合同保管人">
|
||||
</td>
|
||||
<td class="layui-td-gray">合同共享人员</td>
|
||||
<td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="share_names" autocomplete="off" readonly placeholder="请选择共享人员" class="layui-input picker-more">
|
||||
<input type="hidden" name="share_ids">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6"><strong>相关附件</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn"><i class="layui-icon"></i>附件上传</button>
|
||||
</td>
|
||||
<td colspan="5" style="line-height:inherit">
|
||||
<div class="layui-row" id="fileBox">
|
||||
<input type="hidden" id="fileBoxInput" name="file_ids" value="">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6"><strong>备注信息</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -162,9 +174,9 @@
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool','employeepicker'];
|
||||
const moduleInit = ['tool','employeepicker','oaTool'];
|
||||
function gouguInit() {
|
||||
var form = layui.form,tool=layui.tool,table = layui.table,laydate = layui.laydate,employeepicker = layui.employeepicker;
|
||||
var form = layui.form,tool=layui.tool,table = layui.table,laydate = layui.laydate,oaTool = layui.oaTool, employeepicker = layui.employeepicker;
|
||||
//日期
|
||||
lay('.select-time').each(function () {
|
||||
laydate.render({
|
||||
@ -173,6 +185,22 @@
|
||||
});
|
||||
});
|
||||
|
||||
//相关附件上传
|
||||
oaTool.addFile();
|
||||
|
||||
//选择关联的客户
|
||||
$('.customer-picker').on('click', function () {
|
||||
let that = $(this);
|
||||
let callback = function(data){
|
||||
$('[name="customer_id"]').val(data.id);
|
||||
$('[name="customer"]').val(data.name);
|
||||
$('[name="customer_name"]').val(data.contact_name);
|
||||
$('[name="customer_mobile"]').val(data.contact_mobile);
|
||||
$('[name="customer_address"]').val(data.address);
|
||||
}
|
||||
oaTool.customerPicker(callback);
|
||||
});
|
||||
|
||||
//选择合同签订人弹窗
|
||||
$('body').on('click','[name="sign_name"]',function () {
|
||||
var ids=$('[name="sign_uid"]').val(),names=$('[name="sign_name"]').val();
|
||||
@ -186,7 +214,7 @@
|
||||
$('[name="sign_uid"]').val(ids);
|
||||
$('[name="sign_name"]').val(names);
|
||||
$('[name="sign_did"]').val(dids);
|
||||
$('[name="sign_department"]').val(departments);
|
||||
$('#sign_department').html('部门:'+departments);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -223,63 +251,6 @@
|
||||
tool.post("/contract/index/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
//选择关联的客户
|
||||
$('.customer-picker').on('click', function () {
|
||||
selectCustomer();
|
||||
});
|
||||
var customeTable;
|
||||
function selectCustomer() {
|
||||
layer.open({
|
||||
title: '选择客户',
|
||||
area: ['600px', '580px'],
|
||||
type: 1,
|
||||
content: '<div class="picker-table">\
|
||||
<form class="layui-form pb-2">\
|
||||
<div class="layui-input-inline" style="width:480px;">\
|
||||
<input type="text" name="keywords" placeholder="客户名称" class="layui-input" autocomplete="off" />\
|
||||
</div>\
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="search_form">提交搜索</button>\
|
||||
</form>\
|
||||
<div id="customerTable"></div></div>',
|
||||
success: function () {
|
||||
customeTable = table.render({
|
||||
elem: '#customerTable'
|
||||
, url: '/contract/api/get_customer'
|
||||
, page: true //开启分页
|
||||
, limit: 10
|
||||
, cols: [[
|
||||
{ type: 'radio', title: '选择' }
|
||||
, { field: 'id', width: 100, title: '编号', align: 'center' }
|
||||
, { field: 'name', title: '客户名称' }
|
||||
]]
|
||||
});
|
||||
},
|
||||
btn: ['确定'],
|
||||
yes: function () {
|
||||
var checkStatus = table.checkStatus(customeTable.config.id);
|
||||
var data = checkStatus.data;
|
||||
if (data.length > 0) {
|
||||
$('[name="customer_id"]').val(data[0].id);
|
||||
$('[name="customer"]').val(data[0].name);
|
||||
$('[name="customer_name"]').val(data[0].contact_name);
|
||||
$('[name="customer_mobile"]').val(data[0].contact_mobile);
|
||||
$('[name="customer_address"]').val(data[0].address);
|
||||
layer.closeAll();
|
||||
}
|
||||
else {
|
||||
layer.msg('请先选择客户');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
//客户搜索提交
|
||||
form.on('submit(search_form)', function (data) {
|
||||
customeTable.reload({ where: { keywords: data.field.keywords }, page: { curr: 1 } });
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
|
@ -102,35 +102,61 @@
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">合同签订人<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="sign_name" value="{$detail.sign_name}" autocomplete="off" readonly placeholder="请选择合同签订人" class="layui-input">
|
||||
<input type="hidden" name="sign_uid" value="{$detail.sign_uid}" lay-verify="required" lay-reqText="请选择合同签订人">
|
||||
<input type="hidden" name="sign_did" value="{$detail.sign_did}">
|
||||
<div class="layui-input-inline" style="width:50%;">
|
||||
<input type="text" name="sign_name" value="{$detail.sign_name}" autocomplete="off" readonly lay-verify="required" lay-reqText="请选择合同签订人" placeholder="请选择合同签订人" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-input-inline gray" style="width:42%;" id="sign_department">部门:{$detail.sign_department}</div>
|
||||
<input type="hidden" name="sign_uid" value="{$detail.sign_uid}">
|
||||
<input type="hidden" name="sign_did" value="{$detail.sign_did}">
|
||||
</td>
|
||||
<td class="layui-td-gray-2">合同签订时间<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="sign_time" value="{$detail.sign_time}" readonly lay-verify="required" lay-reqText="请选择合同签订日期" placeholder="请选择合同签订日期" class="layui-input select-time">
|
||||
</td>
|
||||
<td class="layui-td-gray-2">合同签订部门</td>
|
||||
<td>
|
||||
<input type="text" name="sign_department" value="{$detail.sign_department}" autocomplete="off" readonly class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">合同制定人<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="prepared_name" value="{$detail.prepared_name}" autocomplete="off" readonly placeholder="请选择合同制定人" class="layui-input picker-one">
|
||||
<input type="hidden" name="prepared_uid" value="{$detail.prepared_uid}" lay-verify="required" lay-reqText="请选择合同制定人">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">合同保管人<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="keeper_name" value="{$detail.keeper_name}" autocomplete="off" readonly placeholder="请选择合同保管人" class="layui-input picker-one">
|
||||
<input type="hidden" name="keeper_uid" value="{$detail.keeper_uid}" lay-verify="required" lay-reqText="请选择合同保管人">
|
||||
</td>
|
||||
<td class="layui-td-gray">合同共享人员</td>
|
||||
<td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="share_names" value="{$detail.share_names}" autocomplete="off" readonly placeholder="请选择共享人员" class="layui-input picker-more">
|
||||
<input type="hidden" name="share_ids" value="{$detail.share_ids}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6"><strong>相关附件</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn"><i class="layui-icon"></i>附件上传</button>
|
||||
</td>
|
||||
<td colspan="5" style="line-height:inherit">
|
||||
<div class="layui-row" id="fileBox">
|
||||
<input type="hidden" id="fileBoxInput" name="file_ids" value="{$detail.file_ids}">
|
||||
{notempty name="$detail.file_ids"}
|
||||
{volist name="$detail.fileArray" id="vo"}
|
||||
<div class="layui-col-md4" id="fileItem{$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="iconfont icon-shujudaoru blue"></i></a>
|
||||
<i class="btn-delete iconfont icon-shanchu red" data-id="{$vo.id}" title="删除"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/volist}
|
||||
{/notempty}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6"><strong>备注信息</strong></td>
|
||||
@ -154,9 +180,9 @@
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool','employeepicker'];
|
||||
const moduleInit = ['tool','employeepicker','oaTool'];
|
||||
function gouguInit() {
|
||||
var form = layui.form,tool=layui.tool,table = layui.table,laydate = layui.laydate,employeepicker = layui.employeepicker;
|
||||
var form = layui.form,tool=layui.tool,table = layui.table,laydate = layui.laydate,oaTool = layui.oaTool, employeepicker = layui.employeepicker;
|
||||
//日期
|
||||
lay('.select-time').each(function () {
|
||||
laydate.render({
|
||||
@ -165,6 +191,22 @@
|
||||
});
|
||||
});
|
||||
|
||||
//相关附件上传
|
||||
oaTool.addFile();
|
||||
|
||||
//选择关联的客户
|
||||
$('.customer-picker').on('click', function () {
|
||||
let that = $(this);
|
||||
let callback = function(data){
|
||||
$('[name="customer_id"]').val(data.id);
|
||||
$('[name="customer"]').val(data.name);
|
||||
$('[name="customer_name"]').val(data.contact_name);
|
||||
$('[name="customer_mobile"]').val(data.contact_mobile);
|
||||
$('[name="customer_address"]').val(data.address);
|
||||
}
|
||||
oaTool.customerPicker(callback);
|
||||
});
|
||||
|
||||
//选择合同签订人弹窗
|
||||
$('body').on('click','[name="sign_name"]',function () {
|
||||
var ids=$('[name="sign_uid"]').val(),names=$('[name="sign_name"]').val();
|
||||
|
@ -140,28 +140,51 @@ html{background-color:#fff;}
|
||||
<td colspan="7">{$detail.remark}</td>
|
||||
</tr>
|
||||
{/notempty}
|
||||
{notempty name="$detail.file_ids"}
|
||||
<tr>
|
||||
<td class="layui-td-gray">相关附件</td>
|
||||
<td colspan="7" style="line-height:inherit">
|
||||
<div class="layui-row">
|
||||
{volist name="$detail.fileArray" id="vo"}
|
||||
<div class="layui-col-md4">
|
||||
<div class="file-card">
|
||||
<i class="file-icon iconfont icon-renwuguanli"></i>
|
||||
<div class="file-title file-title-view">{$vo.name}</div>
|
||||
<div class="file-tool">
|
||||
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="iconfont icon-shujudaoru blue"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/volist}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/notempty}
|
||||
<tr>
|
||||
<td colspan="8"><strong>补充附件</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">
|
||||
<div class="layui-input-inline">合同附件</div>
|
||||
{eq name="$detail.check_status" value="1" }<div class="layui-input-inline"><button type="button" class="layui-btn layui-btn-xs" id="upFile"><i class="layui-icon"></i></button></div>{/eq}
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn"><i class="layui-icon"></i>附件上传</button>
|
||||
</td>
|
||||
<td colspan="7" style="line-height:inherit">
|
||||
<div id="fileList">
|
||||
{volist name="$detail.file_array" id="vo"}
|
||||
<div class="layui-col-md4" id="file_{$vo.id}">
|
||||
<div id="fileBox">
|
||||
<input type="hidden" id="fileBoxInput" name="file_ids" value="">
|
||||
{volist name="$detail.file_array_other" id="vo"}
|
||||
<div class="layui-col-md4" id="fileItem{$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}" title="下载查看" target="_blank"><i class="iconfont icon-shujudaoru blue"></i></a>
|
||||
<i class="btn-delete iconfont icon-shanchu red" data-id="{$vo.id}" title="删除"></i>
|
||||
<i class="ajax-delete iconfont icon-shanchu red" data-id="{$vo.id}" title="删除"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/volist}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8"><strong>签订信息</strong></td>
|
||||
</tr>
|
||||
@ -252,7 +275,7 @@ html{background-color:#fff;}
|
||||
{eq name="$detail.check_status" value="1" }
|
||||
{include file="/index/view_step" /}
|
||||
{/eq}
|
||||
<div class="py-4">
|
||||
<div class="pt-3">
|
||||
{gt name="$auth" value="0"}
|
||||
{eq name="$detail.check_status" value="2" }
|
||||
{eq name="$detail.archive_status" value="1" }
|
||||
@ -296,9 +319,9 @@ html{background-color:#fff;}
|
||||
<script>
|
||||
const contract_id = '{$detail.id}';
|
||||
const contract_status = '{$detail.check_status}';
|
||||
const moduleInit = ['tool','employeepicker'];
|
||||
const moduleInit = ['tool','employeepicker','oaTool'];
|
||||
function gouguInit() {
|
||||
var form = layui.form,tool=layui.tool, upload = layui.upload,element = layui.element,employeepicker = layui.employeepicker;
|
||||
var form = layui.form,tool=layui.tool, upload = layui.upload,element = layui.element,employeepicker = layui.employeepicker,oaTool = layui.oaTool;
|
||||
element.on('tab(contract)', function(data){
|
||||
let index = data.index;
|
||||
if(index == 1){
|
||||
@ -436,53 +459,23 @@ const moduleInit = ['tool','employeepicker'];
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
||||
//删除附件
|
||||
$('#fileList').on('click', '.btn-delete', function () {
|
||||
var _id = $(this).data('id');
|
||||
layer.confirm('确定要删除该附件吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
oaTool.addFile({
|
||||
type:1,
|
||||
isSave:true,
|
||||
ajaxDelete:function(file_id){
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
$('#file_' + _id).remove();
|
||||
$('#fileItem' + file_id).remove();
|
||||
}
|
||||
}
|
||||
tool.delete("/contract/api/delete_file", {id: _id}, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
})
|
||||
//多附件上传
|
||||
upload.render({
|
||||
elem: '#upFile'
|
||||
,url: "/api/index/upload"
|
||||
,multiple: true
|
||||
,accept: 'file' //普通文件
|
||||
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|txt|zip|rar|7z' //只允许上传文件格式
|
||||
,done: function(res){
|
||||
if (res.code == 0) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
let temp = `<div class="layui-col-md4" id="file_${e.data}">
|
||||
<div class="file-card">
|
||||
<i class="file-icon iconfont icon-renwuguanli"></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="iconfont icon-shujudaoru blue"></i></a>
|
||||
<i class="btn-delete iconfont icon-shanchu red" data-id="${e.data}" title="删除"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
$('#fileList').append(temp);
|
||||
}
|
||||
tool.post("/contract/api/add_file", {'contract_id':contract_id,'file_id':res.data.id,'file_name':res.data.name}, callback);
|
||||
}
|
||||
else{
|
||||
layer.msg(res.msg);
|
||||
tool.delete("/contract/api/delete_file", {id: file_id}, callback);
|
||||
},
|
||||
ajaxSave:function(res){
|
||||
let callback = function (e) {
|
||||
location.reload();
|
||||
}
|
||||
tool.post("/contract/api/add_file", {'contract_id':contract_id,'file_id':res.data.id,'file_name':res.data.name}, callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -140,28 +140,26 @@ html{background-color:#fff;}
|
||||
<td colspan="7">{$detail.remark}</td>
|
||||
</tr>
|
||||
{/notempty}
|
||||
<tr>
|
||||
<td class="layui-td-gray">
|
||||
<div class="layui-input-inline">合同附件</div>
|
||||
{eq name="$detail.check_status" value="1" }<div class="layui-input-inline"><button type="button" class="layui-btn layui-btn-xs" id="upFile"><i class="layui-icon"></i></button></div>{/eq}
|
||||
</td>
|
||||
<td colspan="7" style="line-height:inherit">
|
||||
<div id="fileList">
|
||||
{volist name="$detail.file_array" id="vo"}
|
||||
<div class="layui-col-md4" id="file_{$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}" title="下载查看" target="_blank"><i class="iconfont icon-shujudaoru blue"></i></a>
|
||||
<i class="btn-delete iconfont icon-shanchu red" data-id="{$vo.id}" title="删除"></i>
|
||||
{notempty name="$detail.file_ids"}
|
||||
<tr>
|
||||
<td class="layui-td-gray">相关附件</td>
|
||||
<td colspan="7" style="line-height:inherit">
|
||||
<div class="layui-row">
|
||||
{volist name="$detail.fileArray" id="vo"}
|
||||
<div class="layui-col-md4">
|
||||
<div class="file-card">
|
||||
<i class="file-icon iconfont icon-renwuguanli"></i>
|
||||
<div class="file-title file-title-view">{$vo.name}</div>
|
||||
<div class="file-tool">
|
||||
<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看"><i class="iconfont icon-shujudaoru blue"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
{/volist}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
{/notempty}
|
||||
<tr>
|
||||
<td colspan="8"><strong>签订信息</strong></td>
|
||||
</tr>
|
||||
@ -180,7 +178,7 @@ html{background-color:#fff;}
|
||||
<td>{$detail.keeper_name}{gt name="$auth" value="0"}<span id="keeper" data-ids="{$detail.keeper_uid}" data-names="{$detail.keeper_name}" class="layui-btn layui-btn-xs layui-btn-normal ml-1">更改</span>{/gt}</td>
|
||||
<td class="layui-td-gray">合同共享人员</td>
|
||||
<td colspan="5">{$detail.share_names}{gt name="$auth" value="0"}<span id="shares" data-ids="{$detail.share_ids}" data-names="{$detail.share_names}" class="layui-btn layui-btn-xs layui-btn-normal ml-1">更改</span>{/gt}</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8"><strong>审核信息</strong></td>
|
||||
</tr>
|
||||
@ -235,7 +233,7 @@ html{background-color:#fff;}
|
||||
</tr>
|
||||
{/eq}
|
||||
</table>
|
||||
<div class="py-4">
|
||||
<div class="pt-3">
|
||||
{eq name="$is_create_admin" value = "1"}
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交审核</button>
|
||||
<a class="layui-btn" href="/contract/index/add/id/{$detail.id}">编辑合同</a>
|
||||
@ -455,55 +453,6 @@ const moduleInit = ['tool','employeepicker'];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//删除附件
|
||||
$('#fileList').on('click', '.btn-delete', function () {
|
||||
var _id = $(this).data('id');
|
||||
layer.confirm('确定要删除该附件吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
$('#file_' + _id).remove();
|
||||
}
|
||||
}
|
||||
tool.delete("/contract/api/delete_file", {id: _id}, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
})
|
||||
//多附件上传
|
||||
upload.render({
|
||||
elem: '#upFile'
|
||||
,url: "/api/index/upload"
|
||||
,multiple: true
|
||||
,accept: 'file' //普通文件
|
||||
,exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|txt|zip|rar|7z' //只允许上传文件格式
|
||||
,done: function(res){
|
||||
if (res.code == 0) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
let temp = `<div class="layui-col-md4" id="file_${e.data}">
|
||||
<div class="file-card">
|
||||
<i class="file-icon iconfont icon-renwuguanli"></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="iconfont icon-shujudaoru blue"></i></a>
|
||||
<i class="btn-delete layui-icon layui-icon-delete" data-id="${e.data}" style="color: #FF5722;" title="删除"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
$('#fileList').append(temp);
|
||||
}
|
||||
tool.post("/contract/api/add_file", {'contract_id':contract_id,'file_id':res.data.id,'file_name':res.data.name}, callback);
|
||||
}
|
||||
else{
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -1581,6 +1581,7 @@ CREATE TABLE `oa_contract` (
|
||||
`sign_uid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '合同签订人',
|
||||
`keeper_uid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '合同保管人',
|
||||
`share_ids` varchar(500) NOT NULL DEFAULT '' COMMENT '共享人员,如:1,2,3',
|
||||
`file_ids` varchar(500) NOT NULL DEFAULT '' COMMENT '相关附件,如:1,2,3',
|
||||
`sign_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '合同签订时间',
|
||||
`sign_did` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '合同签订部门',
|
||||
`cost` decimal(15, 2) NOT NULL DEFAULT 0.00 COMMENT '合同金额',
|
||||
|
@ -21,6 +21,7 @@ layui.define(['tool'], function (exports) {
|
||||
addFile: function (options) {
|
||||
let that = this;
|
||||
let settings = {
|
||||
type:0,
|
||||
btn: 'uploadBtn',
|
||||
box: 'fileBox',
|
||||
url: "/api/index/upload",
|
||||
@ -28,40 +29,58 @@ layui.define(['tool'], function (exports) {
|
||||
exts: 'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf|zip|rar|7z', //只允许上传文件格式
|
||||
colmd:4,
|
||||
isSave:false,
|
||||
ajaxSave:function(val){}
|
||||
ajaxSave:function(val){},
|
||||
ajaxDelete:function(val){}
|
||||
};
|
||||
let opts = $.extend({}, settings, options);
|
||||
|
||||
//虚拟删除
|
||||
$('#'+opts.box).on('click', '.btn-delete', function () {
|
||||
let file_id = $(this).data('id');
|
||||
let idsStr = $('#'+opts.box+'Input').val(),idsArray = [];
|
||||
if (idsStr != '') {
|
||||
idsArray = idsStr.split(",");
|
||||
}
|
||||
idsArray.remove(file_id);
|
||||
$('#'+opts.box+'Input').val(idsArray.join(','));
|
||||
$('#fileItem' + file_id).remove();
|
||||
})
|
||||
|
||||
//ajax删除
|
||||
$('#'+opts.box).on('click', '.ajax-delete', function () {
|
||||
let file_id = $(this).data('id');
|
||||
let idsStr = $('#'+opts.box+'Input').val(),idsArray = [];
|
||||
if (idsStr != '') {
|
||||
idsArray = idsStr.split(",");
|
||||
}
|
||||
idsArray.remove(file_id);
|
||||
layer.confirm('确定删除该附件吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
if (typeof (opts.ajaxSave) == "function") {
|
||||
opts.ajaxSave(idsArray.join(','));
|
||||
if(opts.type==0){
|
||||
//虚拟删除
|
||||
$('#'+opts.box).on('click', '.btn-delete', function () {
|
||||
let file_id = $(this).data('id');
|
||||
let idsStr = $('#'+opts.box+'Input').val(),idsArray = [];
|
||||
if (idsStr != '') {
|
||||
idsArray = idsStr.split(",");
|
||||
}
|
||||
layer.close(index);
|
||||
});
|
||||
})
|
||||
idsArray.remove(file_id);
|
||||
$('#'+opts.box+'Input').val(idsArray.join(','));
|
||||
$('#fileItem' + file_id).remove();
|
||||
})
|
||||
|
||||
//ajax删除
|
||||
$('#'+opts.box).on('click', '.ajax-delete', function () {
|
||||
let file_id = $(this).data('id');
|
||||
let idsStr = $('#'+opts.box+'Input').val(),idsArray = [];
|
||||
if (idsStr != '') {
|
||||
idsArray = idsStr.split(",");
|
||||
}
|
||||
idsArray.remove(file_id);
|
||||
layer.confirm('确定删除该附件吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
if (typeof (opts.ajaxSave) == "function") {
|
||||
opts.ajaxSave(idsArray.join(','));
|
||||
}
|
||||
layer.close(index);
|
||||
});
|
||||
})
|
||||
}
|
||||
if(opts.type==1){
|
||||
//ajax删除
|
||||
$('#'+opts.box).on('click', '.ajax-delete', function () {
|
||||
let file_id = $(this).data('id');
|
||||
layer.confirm('确定删除该附件吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
if (typeof (opts.ajaxSave) == "function") {
|
||||
opts.ajaxDelete(file_id);
|
||||
}
|
||||
layer.close(index);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
//多附件上传
|
||||
upload.render({
|
||||
@ -74,31 +93,86 @@ layui.define(['tool'], function (exports) {
|
||||
layer.msg(res.msg);
|
||||
if (res.code == 0) {
|
||||
//上传成功
|
||||
let idsStr = $('#'+opts.box+'Input').val(),idsArray = [];
|
||||
if (idsStr != '') {
|
||||
idsArray = idsStr.split(",");
|
||||
}
|
||||
idsArray.push(res.data.id);
|
||||
$('#'+opts.box+'Input').val(idsArray.join(','));
|
||||
let temp = `<div class="layui-col-md${opts.colmd}" id="fileItem${res.data.id}">
|
||||
<div class="file-card">
|
||||
<i class="file-icon iconfont icon-renwuguanli"></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="iconfont icon-shujudaoru blue"></i></a>
|
||||
<span class="btn-delete iconfont icon-shanchu red" data-id="${res.data.id}" title="删除"></span>
|
||||
if(opts.type==0){
|
||||
let idsStr = $('#'+opts.box+'Input').val(),idsArray = [];
|
||||
if (idsStr != '') {
|
||||
idsArray = idsStr.split(",");
|
||||
}
|
||||
idsArray.push(res.data.id);
|
||||
$('#'+opts.box+'Input').val(idsArray.join(','));
|
||||
let temp = `<div class="layui-col-md${opts.colmd}" id="fileItem${res.data.id}">
|
||||
<div class="file-card">
|
||||
<i class="file-icon iconfont icon-renwuguanli"></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="iconfont icon-shujudaoru blue"></i></a>
|
||||
<span class="btn-delete iconfont icon-shanchu red" data-id="${res.data.id}" title="删除"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
$('#'+opts.box).append(temp);
|
||||
|
||||
if (typeof (opts.ajaxSave) == "function" && opts.isSave ==true) {
|
||||
opts.ajaxSave(idsArray.join(','));
|
||||
</div>`;
|
||||
$('#'+opts.box).append(temp);
|
||||
|
||||
if (typeof (opts.ajaxSave) == "function" && opts.isSave ==true) {
|
||||
opts.ajaxSave(idsArray.join(','));
|
||||
}
|
||||
}
|
||||
if(opts.type==1){
|
||||
if (typeof (opts.ajaxSave) == "function" && opts.isSave ==true) {
|
||||
opts.ajaxSave(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
customerPicker:function(callback){
|
||||
var customeTable;
|
||||
layer.open({
|
||||
title: '选择客户',
|
||||
area: ['600px', '580px'],
|
||||
type: 1,
|
||||
content: '<div class="picker-table">\
|
||||
<form class="layui-form pb-2">\
|
||||
<div class="layui-input-inline" style="width:480px;">\
|
||||
<input type="text" name="keywords" placeholder="客户名称" class="layui-input" autocomplete="off" />\
|
||||
</div>\
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="search_customer">提交搜索</button>\
|
||||
</form>\
|
||||
<div id="customerTable"></div></div>',
|
||||
success: function () {
|
||||
customeTable = table.render({
|
||||
elem: '#customerTable'
|
||||
, url: '/contract/api/get_customer'
|
||||
, page: true //开启分页
|
||||
, limit: 10
|
||||
, cols: [[
|
||||
{ type: 'radio', title: '选择' }
|
||||
, { field: 'id', width: 100, title: '编号', align: 'center' }
|
||||
, { field: 'name', title: '客户名称' }
|
||||
]]
|
||||
});
|
||||
//客户搜索提交
|
||||
form.on('submit(search_customer)', function (data) {
|
||||
customeTable.reload({ where: { keywords: data.field.keywords }, page: { curr: 1 } });
|
||||
return false;
|
||||
});
|
||||
},
|
||||
btn: ['确定'],
|
||||
btnAlign: 'c',
|
||||
yes: function () {
|
||||
var checkStatus = table.checkStatus(customeTable.config.id);
|
||||
var data = checkStatus.data;
|
||||
if (data.length > 0) {
|
||||
callback(data[0]);
|
||||
layer.closeAll();
|
||||
}
|
||||
else {
|
||||
layer.msg('请先选择客户');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
contractPicker:function(callback){
|
||||
var contractTable;
|
||||
layer.open({
|
||||
@ -110,7 +184,7 @@ layui.define(['tool'], function (exports) {
|
||||
<div class="layui-input-inline" style="width:480px;">\
|
||||
<input type="text" name="keywords" placeholder="合同名称" class="layui-input" autocomplete="off" />\
|
||||
</div>\
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="search_form">提交搜索</button>\
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="search_contract">提交搜索</button>\
|
||||
</form>\
|
||||
<div id="contractTable"></div></div>',
|
||||
success: function () {
|
||||
@ -126,7 +200,7 @@ layui.define(['tool'], function (exports) {
|
||||
]]
|
||||
});
|
||||
//项目搜索提交
|
||||
form.on('submit(search_form)', function (data) {
|
||||
form.on('submit(search_contract)', function (data) {
|
||||
contractTable.reload({ where: { keywords: data.field.keywords }, page: { curr: 1 } });
|
||||
return false;
|
||||
});
|
||||
@ -149,12 +223,24 @@ layui.define(['tool'], function (exports) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//选择客户
|
||||
$('body').on('click','.picker-customer',function () {
|
||||
let that = $(this);
|
||||
let callback = function(data){
|
||||
that.val(data.name);
|
||||
that.next.val(data.id);
|
||||
}
|
||||
obj.customerPicker(callback);
|
||||
});
|
||||
|
||||
|
||||
//选择合同
|
||||
$('body').on('click','.picker-contract',function () {
|
||||
let that = $(this);
|
||||
let callback = function(data){
|
||||
that.val(data[0].name);
|
||||
that.next.val(data[0].id);
|
||||
that.val(data.name);
|
||||
that.next.val(data.id);
|
||||
}
|
||||
obj.contractPicker(callback);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user