v1.0.12: 企业/人员/媒体去删除入口;企业/人员加产品入口;企业详情去产品品类/关联联系人;编辑企业改Tab卡(工商信息/财务信息/资质认证)

This commit is contained in:
nanguaboss
2026-08-03 23:22:33 +08:00
parent 71c6e8d9c1
commit 96cba121a8
14 changed files with 644 additions and 83 deletions
+60 -23
View File
@@ -28,7 +28,6 @@ $(function () {
' <button class="btn btn-success" id="btn-add">+ 新增</button>' +
' <button class="btn btn-warning" id="btn-import">导入CSV</button>' +
' <button class="btn" id="btn-export">导出</button>' +
' <button class="btn btn-danger" id="btn-del-batch">批量删除</button>' +
' </div>' +
' <div class="table-wrap"><table class="grid">' +
' <thead><tr><th><input type="checkbox" id="check-all"></th><th>ID</th><th>姓名</th><th>性别</th><th>国籍</th><th>工作所在地</th><th>家乡</th><th>学历</th><th>联系方式</th><th>创建时间</th><th>操作</th></tr></thead>' +
@@ -64,8 +63,8 @@ $(function () {
'<td class="ops">' +
' <a onclick="viewPerson(' + r.id + ')">详情</a>' +
' <a onclick="viewCompanies(' + r.id + ')">公司</a>' +
' <a onclick="viewPersonProducts(' + r.id + ')">产品</a>' +
' <a onclick="editPerson(' + r.id + ')">编辑</a>' +
' <a class="danger" onclick="delPerson(' + r.id + ')">删除</a>' +
'</td></tr>';
});
if (!rows.length) {
@@ -197,25 +196,7 @@ $(function () {
});
}
window.delPerson = function (id) {
Dialog.confirm('确定删除该人员吗?(软删除,可恢复)', function () {
httpPost('person/delete.php', { id: id }).then(function () {
Dialog.success('删除成功', function () { loadList(currentPage); });
});
});
};
$('#btn-del-batch').on('click', function () {
var ids = [];
$('.row-check:checked').each(function () { ids.push($(this).val()); });
if (!ids.length) { Dialog.error('请先勾选记录'); return; }
Dialog.confirm('确定删除选中的 ' + ids.length + ' 条记录吗?', function () {
httpPost('person/delete.php', { ids: ids.join(',') }).then(function () {
Dialog.success('删除成功', function () { loadList(currentPage); });
});
});
});
/* ---------- 导入 ---------- */
$('#btn-import').on('click', function () {
triggerFileInput('.csv', function (file) {
var fd = new FormData();
@@ -281,8 +262,15 @@ $(function () {
window.viewCompanies = function (personId) {
compPersonId = personId;
var content =
'<div style="padding:16px 18px 6px;">' +
' <div class="table-wrap"><table class="grid">' +
'<div style="padding:14px 18px 6px;overflow:hidden;height:330px;">' +
' <div class="toolbar" style="margin-bottom:10px;">' +
' <span style="font-size:13px;color:#5a6472;">状态:</span>' +
' <label style="font-size:13px;color:#5a6472;"><input type="checkbox" id="comp-cur" checked> 在岗</label>' +
' <label style="font-size:13px;color:#5a6472;"><input type="checkbox" id="comp-off" checked> 离职</label>' +
' <button class="btn btn-primary btn-sm" id="comp-search">筛选</button>' +
' <button class="btn btn-sm" id="comp-reset">重置</button>' +
' </div>' +
' <div class="table-wrap"><table class="grid" style="font-size:13px;">' +
' <thead><tr><th>公司名称</th><th>部门</th><th>岗位</th><th>职级</th><th>入职日期</th><th>是否在岗</th></tr></thead>' +
' <tbody id="comp-tbody"></tbody>' +
' </table></div>' +
@@ -290,10 +278,22 @@ $(function () {
'</div>';
Dialog.open({ title: '任职公司', area: ['720px', 'auto'], content: content, btn: ['关闭'] });
loadCompanies(1);
$('#comp-search').on('click', function () { loadCompanies(1); });
$('#comp-reset').on('click', function () {
$('#comp-cur').prop('checked', true);
$('#comp-off').prop('checked', true);
loadCompanies(1);
});
};
function loadCompanies(page) {
var params = { person_id: compPersonId, page: page, limit: 5 };
var cur = $('#comp-cur').prop('checked');
var off = $('#comp-off').prop('checked');
// 状态筛选:只勾一项则按该项过滤;都不勾视为全部
if (cur && !off) params.is_current = 1;
else if (!cur && off) params.is_current = 0;
httpGet('person/companies.php', params).then(function (data) {
var rows = data.list || [];
var html = '';
@@ -314,4 +314,41 @@ $(function () {
renderPagination($('#comp-pagination'), data, loadCompanies);
});
}
/* ---------- 产品品类弹窗(按人员任职公司查看产品,分页) ---------- */
var ppPersonId = 0;
window.viewPersonProducts = function (personId) {
ppPersonId = personId;
var content =
'<div style="padding:14px 18px 6px;overflow:hidden;height:330px;">' +
' <div class="table-wrap"><table class="grid" style="font-size:13px;">' +
' <thead><tr><th>公司</th><th>品类名称</th><th>品类描述</th><th>是否核心</th></tr></thead>' +
' <tbody id="pp-tbody"></tbody>' +
' </table></div>' +
' <div class="pagination" id="pp-pagination"></div>' +
'</div>';
Dialog.open({ title: '产品品类', area: ['760px', 'auto'], content: content, btn: ['关闭'] });
loadPersonProducts(1);
};
function loadPersonProducts(page) {
httpGet('person/products.php', { person_id: ppPersonId, page: page, limit: 5 }).then(function (data) {
var rows = data.list || [];
var html = '';
rows.forEach(function (r) {
html += '<tr>' +
'<td>' + escHtml(r.company_name) + '</td>' +
'<td>' + escHtml(r.category_name) + '</td>' +
'<td>' + escHtml(r.category_description || '-') + '</td>' +
'<td>' + (r.is_core ? '<span class="tag">核心</span>' : '-') + '</td>' +
'</tr>';
});
if (!rows.length) {
html = '<tr><td colspan="4" class="empty-tip" style="padding:30px 0;">暂无产品品类</td></tr>';
}
$('#pp-tbody').html(html);
renderPagination($('#pp-pagination'), data, loadPersonProducts);
});
}
});