190 lines
7.5 KiB
HTML
190 lines
7.5 KiB
HTML
{extend name="../../base/view/common/base" /}
|
|
<!-- 主体 -->
|
|
{block name="breadcrumb"}
|
|
<span class="layui-breadcrumb">
|
|
<a href="http://www.meteteme.com/" target="_blank">江苏美天科技</a>
|
|
<a href="/application/nav/index">
|
|
<cite>应用</cite>
|
|
</a>
|
|
<a><cite>客户管理</cite></a>
|
|
</span>
|
|
{/block}
|
|
{block name="body"}
|
|
<div class="table-content p-3">
|
|
<div class="layui-form-bar border-t border-x">
|
|
<button class="layui-btn layui-btn-sm add-new">+ 新建客户</button>
|
|
<button class="layui-btn layui-btn-sm" id="refresh-btn">刷新</button>
|
|
</div>
|
|
<div class="layui-form-bar border-t border-x">
|
|
<form id="taskForm" class="layui-form">
|
|
<div class="layui-col-md4" style="width: 200px;margin-right: 10px;">
|
|
<div class="layui-input-wrap">
|
|
<div class="layui-input-prefix">
|
|
<!-- <i class="layui-icon layui-icon-username"></i>-->
|
|
</div>
|
|
<input id="fzr" type="text" name="contact" value="" placeholder="请输入负责人" class="layui-input" lay-affix="clear">
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-md4" style="width: 200px;margin-right: 10px;">
|
|
<div class="layui-input-wrap">
|
|
<input id="gs" type="text" name="name" value="" placeholder="请输入客户单位名称" class="layui-input" lay-affix="clear">
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-md4" style="width: 200px;margin-right: 10px;">
|
|
<div class="layui-input-wrap">
|
|
<input id="gsjc" type="text" name="name_short" value="" placeholder="请输入客户简称" class="layui-input" lay-affix="clear">
|
|
</div>
|
|
</div>
|
|
<button class="layui-btn" lay-submit lay-filter="webform">搜索</button>
|
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
<button type="reset" class="layui-btn" lay-filter="onlyme">只看我</button>
|
|
<input id="loginusers" type="hidden" value="{$user_info.id}"/>
|
|
</form>
|
|
</div>
|
|
<table class="layui-hide" id="business" lay-filter="tableOne"></table>
|
|
</div>
|
|
{/block}
|
|
<!-- /主体 -->
|
|
|
|
<!-- 脚本 -->
|
|
{block name="script"}
|
|
<script>
|
|
const moduleInit = ['tool', 'gouguEdit', 'gouguComment'];
|
|
|
|
function gouguInit() {
|
|
var table = layui.table,
|
|
form = layui.form,
|
|
tool = layui.tool;
|
|
|
|
//添加按钮
|
|
$('.add-new').on('click', function () {
|
|
tool.open('/business/index/add');
|
|
});
|
|
|
|
// 刷新按钮
|
|
$("#refresh-btn").on("click", function () {
|
|
location.reload();
|
|
});
|
|
|
|
//搜索按钮
|
|
form.on('submit(webform)', function (data) {
|
|
var field = data.field; // 获取表单字段
|
|
|
|
// 执行搜索重载并过滤表格数据
|
|
table.reload('business', {
|
|
page: {
|
|
curr: 1 // 重新从第 1 页开始
|
|
},
|
|
where: field, // 搜索的字段
|
|
});
|
|
|
|
return false; // 阻止默认 form 提交
|
|
});
|
|
|
|
|
|
//搜索重置按钮
|
|
$("#taskForm").on("click", '[lay-filter="clear"]', function () {
|
|
// window.reload();
|
|
tableReload();
|
|
// setTimeout(function () {
|
|
// tableReload();
|
|
// }, 10);
|
|
});
|
|
|
|
//只看我按钮
|
|
$("#taskForm").on("click", '[lay-filter="onlyme"]', function () {
|
|
let loginuser = $("#loginusers").val(); // 从隐藏的输入字段中获取loginuser的值
|
|
$("#taskForm").find('[name="contact"]').val(loginuser); // 将contact的值设置为loginuser
|
|
let postData = {
|
|
name: $("#taskForm").find('[name="name"]').val(),
|
|
company_address: $("#taskForm").find('[name="company_address"]').val(),
|
|
contact: loginuser,
|
|
post: $("#taskForm").find('[name="post"]').val(),
|
|
admin_name: $("#taskForm").find('[name="admin_name"]').val(),
|
|
content: $("#taskForm").find('[name="content"]').val(),
|
|
};
|
|
layui.taskTable.reload({where: postData});
|
|
});
|
|
|
|
//搜索列表重置
|
|
function tableReload() {
|
|
let postData = {
|
|
name: $("#taskForm").find('[name="name"]').val(),
|
|
company_address: $("#taskForm").find('[name="company_address"]').val(),
|
|
contact: $("#taskForm").find('[name="contact"]').val(),
|
|
post: $("#taskForm").find('[name="post"]').val(),
|
|
admin_name: $("#taskForm").find('[name="admin_name"]').val(),
|
|
content: $("#taskForm").find('[name="content"]').val(),
|
|
};
|
|
layui.pageTable.reload({where: postData});
|
|
}
|
|
|
|
//渲染表格
|
|
layui.pageTable = table.render({
|
|
elem: '#business',
|
|
title: '客户列表',
|
|
cellMinWidth: 80,
|
|
url: ["/business/index/index"], //数据接口
|
|
page: true, //开启分页
|
|
limit: 50,
|
|
height: 'full-130',
|
|
cols: [[
|
|
{
|
|
field: 'id', title: '商务编号', width: 100, align: 'center', rowspan: 2, templet: function (d) {
|
|
return 'B' + d.id;
|
|
}
|
|
}
|
|
, {
|
|
field: 'name', title: '客户单位', align: 'center', width: 300, rowspan: 2, templet: function (d) {
|
|
var html = '<a class="open-a" data-href="/business/index/view/id/' + d.id + '">' + d.name + '</a>';
|
|
return html;
|
|
}
|
|
}
|
|
, {
|
|
field: 'name_short',
|
|
title: '客户简称',
|
|
align: 'center',
|
|
width: 160,
|
|
rowspan: 2,
|
|
templet: function (d) {
|
|
var nameShort = d.name_short;
|
|
var displayValue = nameShort !== null ? '<span>' + nameShort + '</span>' : '<span>暂无</span>';
|
|
return displayValue;
|
|
}
|
|
}
|
|
, {
|
|
field: 'company_address',
|
|
title: '单位地址',
|
|
align: 'center',
|
|
width: 240,
|
|
rowspan: 2,
|
|
templet: function (d) {
|
|
var html = '<span>' + d.company_address + '</span>';
|
|
return html;
|
|
}
|
|
}
|
|
, {
|
|
field: 'contact', title: '负责人', width: 120, rowspan: 2, templet: function (d) {
|
|
var html = '<span>' + d.contact + '</span>';
|
|
return html;
|
|
}
|
|
}
|
|
, {
|
|
field: 'post', title: '负责人职务', width: 120, rowspan: 2, templet: function (d) {
|
|
var html = '<span>' + d.post + '</span>';
|
|
return html;
|
|
}
|
|
}
|
|
, {field: 'admin_name', title: '创建人', align: 'center', width: 120, rowspan: 2}
|
|
, {
|
|
field: 'content', title: '备注', align: 'left', rowspan: 2, templet: function (d) {
|
|
var html = '<span>' + d.content + '</span>';
|
|
return html;
|
|
}
|
|
}
|
|
]]
|
|
});
|
|
}
|
|
</script>
|
|
{/block}
|
|
<!-- /脚本 --> |