unis_sip/ruoyi-admin/src/main/resources/templates/project/info/edit.html

787 lines
35 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
2025-06-05 07:52:23 +00:00
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
2025-06-05 07:52:23 +00:00
<th:block th:include="include :: header('新增项目管理')"/>
<th:block th:include="include :: datetimepicker-css"/>
</head>
2025-06-05 07:52:23 +00:00
<style>
body {
font-family: "微软雅黑", Arial, sans-serif;
}
table {
border-collapse: collapse;
width: 100%;
margin-bottom: 20px;
}
th, td {
border: 1px solid #ccc;
padding: 8px;
}
.is-required {
color: red;
}
th {
background: #f5f5f5;
}
.section-title {
font-weight: bold;
font-size: 18px;
padding: 10px 0;
}
.checkbox-group label {
margin-right: 20px;
}
.add-btn {
background: #409eff;
color: #fff;
border: none;
padding: 5px 10px;
cursor: pointer;
}
.checkbox-box {
display: flex;
flex-direction: row;
gap: 10px;
}
.checkbox-box label {
display: flex;
flex-direction: row;
gap: 5px;
align-items: center;
}
.shortTd {
width: 100px;
}
2025-06-05 12:07:28 +00:00
input, textarea, .productTable td {
2025-06-05 07:52:23 +00:00
position: relative;
}
</style>
<body class="white-bg">
2025-06-05 07:52:23 +00:00
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form id="form-product-add" th:object="${projectInfo}">
<input type="hidden" name="id" th:field="*{id}">
<div class="section-title">项目信息</div>
<table>
<tr>
<td class="shortTd">项目编码<span class="is-required">*</span></td>
2025-06-05 12:07:28 +00:00
<td><input type="text" th:field="*{projectCode}" name="projectCode" class="form-control"
placeholder="保存后自动生成" readonly>
2025-06-05 07:52:23 +00:00
</td>
<td class="shortTd">项目名称<span class="is-required">*</span></td>
2025-06-05 12:07:28 +00:00
<td><input type="text" th:field="*{projectName}" name="projectName" maxlength="40"
placeholder="限制40个字符"
2025-06-05 07:52:23 +00:00
class="form-control"></td>
<td class="shortTd">最终客户<span class="is-required">*</span></td>
2025-06-05 12:07:28 +00:00
<td><input name="customerName" th:field="*{customerName}" class="form-control" type="text" required
onclick="selectCustomer()">
2025-06-05 07:52:23 +00:00
<input name="customerCode" th:field="*{customerCode}" class="form-control" type="hidden"></td>
</tr>
<tr>
<td class="shortTd">BG<span class="is-required">*</span></td>
<td>
2025-06-05 12:07:28 +00:00
<select name="bgProperty" th:field="*{bgProperty}" class="form-control"
th:with="type=${@dict.getType('bg_type')}"
2025-06-05 07:52:23 +00:00
onchange="changeBg()" required>
<option value="">请选择BG</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</td>
<td class="shortTd">行业<span class="is-required">*</span></td>
<td id="industryTypeBox">
<select name="industryType" th:field="*{industryType}" class="form-control"
required>
<option value="">请先选择BG</option>
</select>
</td>
<td class="shortTd"> 代表处 <span class="is-required">*</span></td>
<td id="element1">
2025-06-05 12:07:28 +00:00
<input name="agentName" th:field="*{agentName}" class="form-control" type="text"
2025-06-05 07:52:23 +00:00
onclick="selectAgent()" required>
<input name="agentCode" th:field="*{agentCode}" class="form-control" type="hidden" required>
</td>
</tr>
<tr>
<td>项目阶段<span class="is-required">*</span></td>
<td>
<select name="projectStage" th:field="*{projectStage}" class="form-control"
th:with="type=${@dict.getType('project_stage')}"
required>
<option value="">请选择合项目阶段</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</td>
<td>项目把握度<span class="is-required">*</span></td>
<td>
<select name="projectGraspDegree" class="form-control" th:field="*{projectGraspDegree}" required>
<option value="">请选择</option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="D">D</option>
</select>
</td>
<td>汇智责任人</td>
<td>
<input name="hzSupportUserName" class="form-control" type="text"
onclick="selectPeople()" th:field="*{hzSupportUserName}">
<input name="hzSupportUser" class="form-control" type="hidden" th:field="*{hzSupportUser}"></td>
</tr>
<tr>
<td>合作渠道</td>
<td>
<select name="operateInstitution" class="form-control"
th:with="type=${@dict.getType('operate_institution')}"
onchange="changeInstitution()" th:field="*{operateInstitution}">
<option value="">请选择合作渠道</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</td>
<td>代理商<span class="is-required">*</span></td>
<td>
<input name="partnerName" class="form-control" type="text" required
onclick="selectPartner()" th:field="*{partnerName}">
<input name="partnerCode" class="form-control" type="hidden" th:field="*{partnerCode}">
</td>
<td>联系方式</td>
2025-06-05 12:07:28 +00:00
<td><input type="text" name="contactWay" class="form-control" placeholder="姓名+电话"
th:field="*{contactWay}"></td>
2025-06-05 07:52:23 +00:00
</tr>
<tr>
<td>预计金额RMB<span class="is-required">*</span></td>
2025-06-05 12:07:28 +00:00
<td><input type="number" name="estimatedAmount" class="form-control" th:field="*{estimatedAmount}"
required></td>
2025-06-05 07:52:23 +00:00
<td>预计下单时间</td>
2025-06-05 12:07:28 +00:00
<td><input name="estimatedOrderTime" class="form-control" placeholder="yyyy-MM-dd"
2025-06-06 07:35:41 +00:00
th:value="${#dates.format(projectInfo.estimatedOrderTime, 'yyyy-MM-dd')}">
2025-06-05 07:52:23 +00:00
</td>
<td>预计发货时间</td>
<td><input name="estimatedDeliverTime" class="form-control" placeholder="yyyy-MM-dd"
2025-06-06 07:35:41 +00:00
th:value="${#dates.format(projectInfo.estimatedDeliverTime, 'yyyy-MM-dd')}"></td>
2025-06-05 07:52:23 +00:00
</tr>
<tr>
<td>竞争对手</td>
<td colspan="5" class="checkbox-group">
<div class="checkbox-box">
<label><input type="checkbox" name="competitorList[0]" value="华为">华为</label>
<label><input type="checkbox" name="competitorList[1]" value="锐捷">锐捷</label>
<label><input type="checkbox" name="competitorList[2]" value="深信服">深信服</label>
<label><input type="checkbox" name="competitorList[3]" value="中兴">中兴</label>
<label><input type="checkbox" name="competitorList[4]" value="曙云">曙云</label>
</div>
2025-06-05 07:52:23 +00:00
<div>
2025-06-06 08:41:11 +00:00
其它:<input type="text" name="competitorList[5]"
2025-06-05 12:07:28 +00:00
class="form-control" style="width: 400px">
</div>
2025-06-05 07:52:23 +00:00
</td>
</tr>
<tr>
<td>关键技术问题</td>
<td colspan="5"><input type="text" name="keyProblem" style="width:98%;"
2025-06-05 12:07:28 +00:00
class="form-control" maxlength="200" th:field="*{keyProblem}"
placeholder="限制200个字符"></td>
2025-06-05 07:52:23 +00:00
</tr>
<tr>
<td>项目简述<span class="is-required">*</span></td>
<td colspan="5"><textarea name="projectDesc" style="width:98%;" rows="2"
class="form-control" required maxlength="200"
placeholder="限制200个字符" th:field="*{projectDesc}"></textarea>
</td>
</tr>
</table>
2025-06-05 07:52:23 +00:00
<div class="section-title">配置信息</div>
2025-06-05 12:07:28 +00:00
<h3>软件</h3>
2025-06-05 07:52:23 +00:00
<button type="button" class="add-btn" onclick="addProduct({})">添加</button>
2025-06-05 12:07:28 +00:00
<table id="productTable" class="productTable">
<thead>
<tr>
<th>序号</th>
<th>产品编号</th>
<th>产品型号</th>
<th>描述</th>
<th>数量</th>
<th style="width: 90px">目录单价(RMB)</th>
<th style="width: 90px">指导折扣</th>
<th style="width: 90px">折扣</th>
<th style="width: 90px">单价(RMB)</th>
<th style="width: 120px">总价(RMB)</th>
<th style="width: 120px">目录总价(RMB)</th>
<th>备注</th>
<th style="width: 60px">操作</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<h3>硬件</h3>
<button type="button" class="add-btn" onclick="addProduct2({})">添加</button>
<table id="productTable2" class="productTable">
<thead>
<tr>
<th>序号</th>
<th>产品编号</th>
<th>产品型号</th>
<th>描述</th>
<th>数量</th>
<th style="width: 90px">目录单价(RMB)</th>
<th style="width: 90px">指导折扣</th>
<th style="width: 90px">折扣</th>
<th style="width: 90px">单价(RMB)</th>
<th style="width: 120px">总价(RMB)</th>
<th style="width: 120px">目录总价(RMB)</th>
<th>备注</th>
<th style="width: 60px">操作</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<h3>维保</h3>
<button type="button" class="add-btn" onclick="addProduct3({})">添加</button>
<table id="productTable3" class="productTable">
2025-06-05 07:52:23 +00:00
<thead>
<tr>
<th>序号</th>
<th>产品编号</th>
<th>产品型号</th>
<th>描述</th>
<th>数量</th>
<th style="width: 90px">目录单价(RMB)</th>
<th style="width: 90px">指导折扣</th>
<th style="width: 90px">折扣</th>
<th style="width: 90px">单价(RMB)</th>
<th style="width: 120px">总价(RMB)</th>
<th style="width: 120px">目录总价(RMB)</th>
<th>备注</th>
<th style="width: 60px">操作</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div>
<table>
<tr>
<td>服务器配置</td>
<td><textarea name="serverConfiguration" class="form-control" maxlength="200"
placeholder="限制200个字符" th:field="*{serverConfiguration}"></textarea></td>
<td>是否国产</td>
<td>
<select name="countryProduct" class="form-control" th:field="*{countryProduct}">
<option value="">请选择</option>
<option value="1"></option>
<option value="0"></option>
</select>
</td>
</tr>
</table>
</div>
<div class="section-title">工作进度</div>
<button type="button" class="add-btn" onclick="addLog({})">添加</button>
<table id="workLog">
<thead>
<tr>
<th>序号</th>
<th>更新内容</th>
<th>更新人员</th>
<th>更新时间</th>
</tr>
</thead>
<tbody></tbody>
<!-- 可动态添加行 -->
</table>
<div class="section-title">操作日志</div>
<table id="sysLog">
<thead>
<tr>
<th>序号</th>
<th>操作人员</th>
<th>操作内容</th>
<th>操作时间</th>
</tr>
</thead>
<tbody></tbody>
</table>
</form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
2025-06-06 07:35:41 +00:00
<th:block th:include="include :: layui"/>
2025-06-05 07:52:23 +00:00
<script th:inline="javascript">
var prefix = ctx + "sip/project"
$("#form-product-add").validate({
focusCleanup: true
});
2025-06-06 07:35:41 +00:00
var softwareProjectProductInfoList = []
var hardwareProjectProductInfoList = []
var maintenanceProjectProductInfoList = []
function initProductList() {
let data = {
pageSize: 100000,
pageNum: 1,
isTable: 0,
}
$.operate.post(ctx + 'system/product/list', {...data, type: '1'}, function (res) {
softwareProjectProductInfoList = res.rows
let softwareProjectProductInfoListAll = [[${projectInfo.softwareProjectProductInfoList}]] || []
softwareProjectProductInfoListAll.forEach((ele) => {
addProduct(ele)
})
})
$.operate.post(ctx + 'system/product/list', {...data, type: '2'}, function (res) {
hardwareProjectProductInfoList = res.rows
let hardwareProjectProductInfoListAll = [[${projectInfo.hardwareProjectProductInfoList}]] || []
hardwareProjectProductInfoListAll.forEach((ele) => {
addProduct2(ele)
})
})
$.operate.post(ctx + 'system/product/list', {...data, type: '11,22'}, function (res) {
maintenanceProjectProductInfoList = res.rows
let maintenanceProjectProductInfoListAll = [[${projectInfo.maintenanceProjectProductInfoList}]] || []
maintenanceProjectProductInfoListAll.forEach((ele) => {
addProduct3(ele)
})
})
}
2025-06-05 07:52:23 +00:00
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-product-add').serialize());
2025-06-06 11:59:13 +00:00
}else{
$.modal.alertWarning("请完善表单");
}
2025-06-05 07:52:23 +00:00
}
$(function () {
2025-06-06 07:35:41 +00:00
initProductList()
2025-06-05 07:52:23 +00:00
var layerIndex = parent.layer.index
$("input[name='estimatedOrderTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='estimatedDeliverTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
2025-06-05 07:52:23 +00:00
initData()
})
function selectCustomer() {
var url = prefix + "/selectCustomer";
var options = {
title: '选择客户',
width: "680",
url: url,
height: '600',
callBack: doSubmitCustomer
};
$.modal.openOptions(options);
}
function selectPartner() {
var url = prefix + "/selectPartner";
var options = {
title: '选择代理商',
width: "680",
height: '600',
url: url,
callBack: doSubmitPartner
};
$.modal.openOptions(options);
}
function selectAgent() {
var url = prefix + "/selectAgent";
var options = {
title: '选择代理商',
width: "680",
height: '600',
url: url,
callBack: doSubmitAgent
};
$.modal.openOptions(options);
}
function selectPeople() {
var url = prefix + "/selectPeople";
var options = {
title: '选择代理商',
width: "680",
height: '600',
url: url,
callBack: doSubmitPeople
};
$.modal.openOptions(options);
}
function doSubmitCustomer(index, layero) {
var rows = layero.find("iframe")[0].contentWindow.getSelections();
if (rows.length == 0) {
$.modal.alertWarning("请选择一个用户");
return;
}
$('[name="customerCode"]').val(rows[0].customerCode);
$(' [name="customerName"]').val(rows[0].customerName);
$.modal.close(index);
}
function doSubmitPartner(index, layero) {
var rows = layero.find("iframe")[0].contentWindow.getSelections();
if (rows.length == 0) {
$.modal.alertWarning("请选择一个代理商");
return;
}
$('[name="partnerCode"]').val(rows[0].partnerCode);
$('[name="partnerName"]').val(rows[0].partnerName);
$.modal.close(index);
}
function doSubmitPeople(index, layero) {
var rows = layero.find("iframe")[0].contentWindow.getSelections();
if (rows.length == 0) {
$.modal.alertWarning("请选择一个代理商");
return;
}
$('[name="hzSupportUser"]').val(rows[0].userId);
$('[name="hzSupportUserName"]').val(rows[0].userName);
$.modal.close(index);
}
function doSubmitAgent(index, layero) {
var rows = layero.find("iframe")[0].contentWindow.getSelections();
if (rows.length == 0) {
$.modal.alertWarning("请选择一个代理商");
return;
}
$('[name="agentCode"]').val(rows[0].agentCode);
$('[name="agentName"]').val(rows[0].agentName);
$.modal.close(index);
}
// 添加软件
function initData() {
2025-06-06 08:41:11 +00:00
console.log(123, [[${projectInfo.competitorList}]])
let competitorList=[[${projectInfo.competitorList}]]
competitorList.forEach((ele,index)=>{
if(ele){
$(`input[type="checkbox"][value="${ele}"]`).attr('checked',true)
}
if((!$(`input[type="checkbox"][value="${ele}"]`).length)&&ele){
$(`[name="competitorList[5]"]`).val(ele)
}
})
2025-06-05 12:07:28 +00:00
let arr2 = [[${projectInfo.projectWorkProgressList}]]
arr2.forEach((ele) => {
addLog(ele)
})
let arr3 = [[${projectInfo.projectOperateLogList}]]
arr3.forEach((ele, index) => {
let tr = $(`
<tr><td>${index + 1}</td><td>${ele.operateUserName}</td><td>${ele.operateLog}</td><td>${ele.operateTime}</td></tr>
2025-06-05 07:52:23 +00:00
`)
$('#sysLog tbody').append(tr)
})
changeBg()
$('[name="industryType"]').val([[${projectInfo.industryType}]])
}
function addProduct(data) {
let length = $('#productTable tbody').find('tr').length
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</td>
2025-06-06 07:35:41 +00:00
<td class="layui-form"><input type="hidden" name="softwareProjectProductInfoList[${length}].id" value="${data.id || ''}">
<select value="${data.productBomCode || ''}" name="softwareProjectProductInfoList[${length}].productBomCode" required class="form-control productBomCode" lay-search="" lay-filter="productCode1">
${softwareProjectProductInfoList.map((ele) => {
return `<option value="${ele.productCode}">${ele.productCode}</option>`
}).join('')
}
</select></td>
<td class="layui-form"><select value="${data.model || ''}" name="softwareProjectProductInfoList[${length}].model" required class="form-control model" lay-search="" lay-filter="productModel1">
${softwareProjectProductInfoList.map((ele) => {
return `<option value="${ele.model}">${ele.model}</option>`
}).join('')
}
</select></td>
2025-06-05 12:07:28 +00:00
<td><textarea name="softwareProjectProductInfoList[${length}].productDesc" required class="form-control productDesc" placeholder="自动带入" readonly>${data.productDesc || ''}</textarea></td>
<td><input value="${data.quantity || ''}" name="softwareProjectProductInfoList[${length}].quantity" type="number" class="form-control quantity" step="1" required></td>
<td><input value="${data.cataloguePrice || ''}" name="softwareProjectProductInfoList[${length}].cataloguePrice" type="text" class="form-control cataloguePrice" required></td>
<td><input value="${data.guidanceDiscount || ''}" name="softwareProjectProductInfoList[${length}].guidanceDiscount" type="number" class="form-control guidanceDiscount" min="0" max="1" step="0.1" required></td>
<td><input value="${data.discount || ''}" name="softwareProjectProductInfoList[${length}].discount" type="number" class="form-control discount" min="0" max="1" step="0.1" required></td>
<td><input value="${data.price || ''}" name="softwareProjectProductInfoList[${length}].price" type="number" class="form-control price" placeholder="自动计算" required readonly></td>
<td><input value="${data.allPrice || ''}" name="softwareProjectProductInfoList[${length}].allPrice" type="number" class="form-control allPrice" placeholder="自动计算" required readonly></td>
<td><input value="${data.catalogueAllPrice || ''}" name="softwareProjectProductInfoList[${length}].catalogueAllPrice" type="number" class="form-control catalogueAllPrice" placeholder="自动计算" required readonly></td>
<td><input value="${data.remark || ''}" name="softwareProjectProductInfoList[${length}].remark" type="text" class="form-control" ></td>
2025-06-05 07:52:23 +00:00
<td><span style="cursor:pointer;color: ff5722" class="delRow">删除</span></td>
</tr>`)
$('#productTable tbody').append(tr)
initSearchProduct('1')
2025-06-05 07:52:23 +00:00
initPrice()
}
2025-06-06 07:35:41 +00:00
2025-06-05 12:07:28 +00:00
function addProduct2(data) {
let length = $('#productTable2 tbody').find('tr').length
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</td>
2025-06-06 07:35:41 +00:00
<td class="layui-form"><input type="hidden" name="hardwareProjectProductInfoList[${length}].id" value="${data.id || ''}">
2025-06-06 09:34:50 +00:00
<select value="${data.productBomCode || ''}" name="hardwareProjectProductInfoList[${length}].productBomCode" required class="form-control productBomCode" lay-search="" lay-filter="productCode2">
2025-06-06 07:35:41 +00:00
${hardwareProjectProductInfoList.map((ele) => {
return `<option value="${ele.productCode}">${ele.productCode}</option>`
}).join('')
}
</select></td>
2025-06-06 09:34:50 +00:00
<td class="layui-form"><select value="${data.model || ''}" name="hardwareProjectProductInfoList[${length}].model" required class="form-control model" lay-search="" lay-filter="productModel2">
2025-06-06 07:35:41 +00:00
${hardwareProjectProductInfoList.map((ele) => {
return `<option value="${ele.model}">${ele.model}</option>`
}).join('')
}
</select></td>
2025-06-05 12:07:28 +00:00
<td><textarea name="hardwareProjectProductInfoList[${length}].productDesc" required class="form-control productDesc" placeholder="自动带入" readonly>${data.productDesc || ''}</textarea></td>
<td><input value="${data.quantity || ''}" name="hardwareProjectProductInfoList[${length}].quantity" type="number" class="form-control quantity" step="1" required></td>
<td><input value="${data.cataloguePrice || ''}" name="hardwareProjectProductInfoList[${length}].cataloguePrice" type="text" class="form-control cataloguePrice" required></td>
<td><input value="${data.guidanceDiscount || ''}" name="hardwareProjectProductInfoList[${length}].guidanceDiscount" type="number" class="form-control guidanceDiscount" min="0" max="1" step="0.1" required></td>
<td><input value="${data.discount || ''}" name="hardwareProjectProductInfoList[${length}].discount" type="number" class="form-control discount" min="0" max="1" step="0.1" required></td>
<td><input value="${data.price || ''}" name="hardwareProjectProductInfoList[${length}].price" type="number" class="form-control price" placeholder="自动计算" required readonly></td>
<td><input value="${data.allPrice || ''}" name="hardwareProjectProductInfoList[${length}].allPrice" type="number" class="form-control allPrice" placeholder="自动计算" required readonly></td>
<td><input value="${data.catalogueAllPrice || ''}" name="hardwareProjectProductInfoList[${length}].catalogueAllPrice" type="number" class="form-control catalogueAllPrice" placeholder="自动计算" required readonly></td>
<td><input value="${data.remark || ''}" name="hardwareProjectProductInfoList[${length}].remark" type="text" class="form-control" ></td>
<td><span style="cursor:pointer;color: ff5722" class="delRow">删除</span></td>
2025-06-05 07:52:23 +00:00
2025-06-05 12:07:28 +00:00
</tr>`)
$('#productTable2 tbody').append(tr)
initSearchProduct('2')
2025-06-05 12:07:28 +00:00
initPrice()
}
2025-06-06 07:35:41 +00:00
2025-06-05 12:07:28 +00:00
function addProduct3(data) {
let length = $('#productTable3 tbody').find('tr').length
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</td>
2025-06-06 07:35:41 +00:00
<td class="layui-form"><input type="hidden" name="maintenanceProjectProductInfoList[${length}].id" value="${data.id || ''}">
2025-06-06 09:34:50 +00:00
<select value="${data.productBomCode || ''}" name="maintenanceProjectProductInfoList[${length}].productBomCode" required class="form-control productBomCode" lay-search="" lay-filter="productCode3">
2025-06-06 07:35:41 +00:00
${maintenanceProjectProductInfoList.map((ele) => {
return `<option value="${ele.productCode}">${ele.productCode}</option>`
}).join('')
}
</select></td>
2025-06-06 09:34:50 +00:00
<td class="layui-form"><select value="${data.model || ''}" name="maintenanceProjectProductInfoList[${length}].model" required class="form-control model" lay-search="" lay-filter="productModel3">
2025-06-06 07:35:41 +00:00
${maintenanceProjectProductInfoList.map((ele) => {
return `<option value="${ele.model}">${ele.model}</option>`
}).join('')
}
</select></td>
2025-06-05 12:07:28 +00:00
<td><textarea name="maintenanceProjectProductInfoList[${length}].productDesc" required class="form-control productDesc" placeholder="自动带入" readonly>${data.productDesc || ''}</textarea></td>
<td><input value="${data.quantity || ''}" name="maintenanceProjectProductInfoList[${length}].quantity" type="number" class="form-control quantity" step="1" required></td>
<td><input value="${data.cataloguePrice || ''}" name="maintenanceProjectProductInfoList[${length}].cataloguePrice" type="text" class="form-control cataloguePrice" required></td>
<td><input value="${data.guidanceDiscount || ''}" name="maintenanceProjectProductInfoList[${length}].guidanceDiscount" type="number" class="form-control guidanceDiscount" min="0" max="1" step="0.1" required></td>
<td><input value="${data.discount || ''}" name="maintenanceProjectProductInfoList[${length}].discount" type="number" class="form-control discount" min="0" max="1" step="0.1" required></td>
<td><input value="${data.price || ''}" name="maintenanceProjectProductInfoList[${length}].price" type="number" class="form-control price" placeholder="自动计算" required readonly></td>
<td><input value="${data.allPrice || ''}" name="maintenanceProjectProductInfoList[${length}].allPrice" type="number" class="form-control allPrice" placeholder="自动计算" required readonly></td>
<td><input value="${data.catalogueAllPrice || ''}" name="maintenanceProjectProductInfoList[${length}].catalogueAllPrice" type="number" class="form-control catalogueAllPrice" placeholder="自动计算" required readonly></td>
<td><input value="${data.remark || ''}" name="maintenanceProjectProductInfoList[${length}].remark" type="text" class="form-control" ></td>
<td><span style="cursor:pointer;color: ff5722" class="delRow">删除</span></td>
</tr>`)
$('#productTable3 tbody').append(tr)
initSearchProduct('11,22')
2025-06-05 12:07:28 +00:00
initPrice()
}
2025-06-06 07:35:41 +00:00
2025-06-05 07:52:23 +00:00
function addLog(data) {
let length = $('#workLog tbody').find('tr').length
let tr = $(`
<tr>
<td>${length + 1}</td>
2025-06-06 08:41:11 +00:00
<td><input type="hidden" value="${data.id || ''}" name="projectWorkProgressList[${length}].id"><textarea type="text" name="projectWorkProgressList[${length}].workContent" class="form-control" required>${data.workContent || ''}</textarea></td>
2025-06-05 12:07:28 +00:00
<td><input type="text" class="form-control" placeholder="保存后自动填入" value="${data.userName || ''}" readonly></td>
<td><input type="text" class="form-control" placeholder="保存后自动填入" value="${data.workTime || ''}" readonly></td>
2025-06-05 07:52:23 +00:00
</tr>`)
$('#workLog tbody').append(tr)
}
function initSearchProduct(type) {
2025-06-06 07:35:41 +00:00
layui.use(function () {
var form = layui.form
form.render()
form.on('select(productCode1)', function (data) {
searchProduct(data.value, 'code', data.elem)
})
form.on('select(productCode2)', function (data) {
searchProduct(data.value, 'code', data.elem)
})
form.on('select(productCode3)', function (data) {
searchProduct(data.value, 'code', data.elem)
})
form.on('select(productModel1)', function (data) {
searchProduct(data.value, 'model', data.elem)
})
form.on('select(productModel2)', function (data) {
searchProduct(data.value, 'model', data.elem)
})
form.on('select(productModel3)', function (data) {
searchProduct(data.value, 'model', data.elem)
})
2025-06-06 08:41:11 +00:00
$('.layui-input').on('mouseout',function (){
$(this).blur()
})
2025-06-05 07:52:23 +00:00
})
2025-06-05 12:07:28 +00:00
$('.productTable .delRow').on('click', function () {
2025-06-05 07:52:23 +00:00
let ele = $(this)
$.modal.confirm('是否确认删除', function () {
$(ele).parent().parent().remove()
$('#productTable tbody tr').each((index, item) => {
$(item).find('.indexBox').text(index + 1)
})
2025-06-05 12:07:28 +00:00
$('#productTable2 tbody tr').each((index, item) => {
$(item).find('.indexBox').text(index + 1)
})
$('#productTable3 tbody tr').each((index, item) => {
$(item).find('.indexBox').text(index + 1)
})
2025-06-05 07:52:23 +00:00
});
})
}
2025-06-06 07:35:41 +00:00
function searchProduct(val, type, ele, typeId) {
let selectObj = {}
let listName = $(ele).attr('name')
2025-06-05 07:52:23 +00:00
if (type == 'code') {
2025-06-06 07:35:41 +00:00
if (listName.indexOf('softwareProjectProductInfoList') > -1) {
selectObj = softwareProjectProductInfoList.find((ele) => ele.productCode == val)
} else if (listName.indexOf('hardwareProjectProductInfoList') > -1) {
selectObj = hardwareProjectProductInfoList.find((ele) => ele.productCode == val)
} else if (listName.indexOf('maintenanceProjectProductInfoList') > -1) {
selectObj = maintenanceProjectProductInfoList.find((ele) => ele.productCode == val)
2025-06-05 07:52:23 +00:00
}
2025-06-06 07:35:41 +00:00
$(ele).parent().parent().find('.model+div').find('.layui-input').val(selectObj.model)
$(ele).parent().parent().find('.model').val(selectObj.model)
} else {
if (listName.indexOf('softwareProjectProductInfoList') > -1) {
selectObj = softwareProjectProductInfoList.find((ele) => ele.model == val)
} else if (listName.indexOf('hardwareProjectProductInfoList') > -1) {
selectObj = hardwareProjectProductInfoList.find((ele) => ele.model == val)
} else if (listName.indexOf('maintenanceProjectProductInfoList') > -1) {
selectObj = maintenanceProjectProductInfoList.find((ele) => ele.model == val)
}
$(ele).parent().parent().find('.productBomCode+div').find('.layui-input').val(selectObj.model)
$(ele).parent().parent().find('.productBomCode').val(selectObj.productCode)
}
$(ele).parent().parent().find('.productDesc').val(selectObj.description)
2025-06-05 07:52:23 +00:00
}
function initPrice() {
$('#productTable .quantity').on('input', function () {
let num = $(this).val()
let priceVal = $(this).parent().parent().find('.price').val()
let cateVal = $(this).parent().parent().find('.cataloguePrice').val()
if (priceVal && num) {
$(this).parent().parent().find('.allPrice').val((num * priceVal).toFixed(2))
}
if (cateVal && num) {
$(this).parent().parent().find('.catalogueAllPrice').val((num * cateVal).toFixed(2))
}
})
$('#productTable .cataloguePrice').on('input', function () {
let val = $(this).val()
$(this).parent().parent().find('.price').val(val)
let quantity = $(this).parent().parent().find('.quantity').val()
if (quantity && val)
$(this).parent().parent().find('.catalogueAllPrice').val((val * quantity).toFixed(2))
})
$('#productTable .guidanceDiscount').on('input', function () {
let val = $(this).val()
let cataloguePrice = $(this).parent().parent().find('.cataloguePrice').val()
$(this).parent().parent().find('.discount').val(val)
$(this).parent().parent().find('.price').val((cataloguePrice * val).toFixed(2))
let price = $(this).parent().parent().find('.price').val()
let quantity = $(this).parent().parent().find('.quantity').val()
if (price && quantity) {
$(this).parent().parent().find('.allPrice').val((price * quantity).toFixed(2))
}
})
$('#productTable .discount').on('input', function () {
let discount = $(this).val()
let val = $(this).parent().parent().find('.cataloguePrice').val()
$(this).parent().parent().find('.price').val((val * discount).toFixed(2))
})
$('#productTable .price').change('input', function () {
let val = $(this).val()
let num = $(this).parent().parent().find('.quantity').val()
$(this).parent().parent().find('.allPrice').val((val * num).toFixed(2))
})
}
function changeInstitution() {
if ($('[name="operateInstitution"]').val() == 'h3c') {
$('[name="partnerName"]').val('新华三')
$('[name="partnerCode"]').val('')
}
}
function changeBg() {
if ($('[name="bgProperty"]').val() != 'YYS') {
let datas = [[${@dict.getType('bg_hysy')}]]
let str = ``
datas.forEach((ele) => {
str += `<option value="${ele.dictValue}">${ele.dictLabel}</option> `
})
$('#industryTypeBox').html(`
<select name="industryType" class="form-control" required>
<option value="">请选择行业</option>
${str}
</select>
`)
} else {
let datas = [[${@dict.getType('bg_yys')}]]
let str = ``
datas.forEach((ele) => {
str += `<option value="${ele.dictValue}">${ele.dictLabel}</option> `
})
$('#industryTypeBox').html(`
<select name="industryType" class="form-control" required>
<option value="">请选择行业</option>
${str}
</select>
`)
}
}
</script>
</body>
</html>