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

658 lines
28 KiB
HTML

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('新增项目管理')"/>
<th:block th:include="include :: datetimepicker-css"/>
</head>
<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;
}
input, textarea, .productTable td {
position: relative;
}
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form id="form-product-add">
<div class="section-title">项目信息</div>
<table>
<tr>
<td class="shortTd">项目编码<span class="is-required">*</span></td>
<td><input type="text" name="projectCode" class="form-control" placeholder="保存后自动生成" readonly>
</td>
<td class="shortTd">项目名称<span class="is-required">*</span></td>
<td><input type="text" name="projectName" maxlength="40" placeholder="限制40个字符"
class="form-control"></td>
<td class="shortTd">最终客户<span class="is-required">*</span></td>
<td><input name="customerName" class="form-control" type="text" required onclick="selectCustomer()">
<input name="customerCode" class="form-control" type="hidden"></td>
</tr>
<tr>
<td class="shortTd">BG<span class="is-required">*</span></td>
<td>
<select name="bgProperty" class="form-control" th:with="type=${@dict.getType('bg_type')}"
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" class="form-control"
required>
<option value="">请先选择BG</option>
</select>
</td>
<td class="shortTd"> 代表处 <span class="is-required">*</span></td>
<td id="element1">
<input name="agentName" class="form-control" type="text"
onclick="selectAgent()">
<input name="agentCode" class="form-control" type="hidden">
</td>
</tr>
<tr>
<td>项目阶段<span class="is-required">*</span></td>
<td>
<select name="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" 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()">
<input name="hzSupportUser" class="form-control" type="hidden"></td>
</tr>
<tr>
<td>合作渠道</td>
<td>
<select name="operateInstitution" class="form-control"
th:with="type=${@dict.getType('operate_institution')}"
onchange="changeInstitution()">
<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()">
<input name="partnerCode" class="form-control" type="hidden">
</td>
<td>联系方式</td>
<td><input type="text" name="contactWay" class="form-control" placeholder="姓名+电话"></td>
</tr>
<tr>
<td>预计金额(元)<span class="is-required">*</span></td>
<td><input type="number" name="estimatedAmount" class="form-control" required></td>
<td>预计下单时间</td>
<td><input name="estimatedOrderTime" class="form-control" placeholder="yyyy-MM-dd">
</td>
<td>预计发货时间</td>
<td><input name="estimatedDeliverTime" class="form-control" placeholder="yyyy-MM-dd"
></td>
</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>
<div>
其它:<input type="text" name="competitorList[5]" class="form-control" style="width: 400px">
</div>
</td>
</tr>
<tr>
<td>关键技术问题</td>
<td colspan="5"><input type="text" name="keyProblem" style="width:98%;"
class="form-control" maxlength="200" placeholder="限制200个字符"></td>
</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个字符"></textarea>
</td>
</tr>
</table>
<div class="section-title">配置信息</div>
<h3>软件</h3>
<button type="button" class="add-btn" onclick="addProduct()">添加</button>
<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">
<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个字符"></textarea></td>
<td>是否国产</td>
<td>
<select name="countryProduct" class="form-control">
<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>
</form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
var prefix = ctx + "sip/project"
$("#form-product-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-product-add').serialize());
}
}
$(function () {
var layerIndex = parent.layer.index
parent.layer.full(layerIndex)
$("input[name='estimatedOrderTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='estimatedDeliverTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
})
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 addProduct() {
let length = $('#productTable tbody').find('tr').length
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</td>
<td><input name="softwareProjectProductInfoList[${length}].productBomCode" type="text" class="form-control productBomCode" required></td>
<td><input name="softwareProjectProductInfoList[${length}].model" type="text" class="form-control model" required></td>
<td><textarea name="softwareProjectProductInfoList[${length}].productDesc" required class="form-control productDesc" placeholder="自动带入" readonly></textarea></td>
<td><input name="softwareProjectProductInfoList[${length}].quantity" type="number" class="form-control quantity" step="1" required></td>
<td><input name="softwareProjectProductInfoList[${length}].cataloguePrice" type="text" class="form-control cataloguePrice" required></td>
<td><input name="softwareProjectProductInfoList[${length}].guidanceDiscount" type="number" class="form-control guidanceDiscount" min="0" max="1" step="0.1" required></td>
<td><input name="softwareProjectProductInfoList[${length}].discount" type="number" class="form-control discount" min="0" max="1" step="0.1" required></td>
<td><input name="softwareProjectProductInfoList[${length}].price" type="number" class="form-control price" placeholder="自动计算" required readonly></td>
<td><input name="softwareProjectProductInfoList[${length}].allPrice" type="number" class="form-control allPrice" placeholder="自动计算" required readonly></td>
<td><input name="softwareProjectProductInfoList[${length}].catalogueAllPrice" type="number" class="form-control catalogueAllPrice" placeholder="自动计算" required readonly></td>
<td><input name="softwareProjectProductInfoList[${length}].remark" type="text" class="form-control" ></td>
<td><span style="cursor:pointer;color: ff5722" class="delRow">删除</span></td>
</tr>`)
$('#productTable tbody').append(tr)
initSearchProduct()
initPrice()
}
function addProduct2() {
let length = $('#productTable2 tbody').find('tr').length
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</td>
<td><input name="hardwareProjectProductInfoList[${length}].productBomCode" type="text" class="form-control productBomCode" required></td>
<td><input name="hardwareProjectProductInfoList[${length}].model" type="text" class="form-control model" required></td>
<td><textarea name="hardwareProjectProductInfoList[${length}].productDesc" required class="form-control productDesc" placeholder="自动带入" readonly></textarea></td>
<td><input name="hardwareProjectProductInfoList[${length}].quantity" type="number" class="form-control quantity" step="1" required></td>
<td><input name="hardwareProjectProductInfoList[${length}].cataloguePrice" type="text" class="form-control cataloguePrice" required></td>
<td><input name="hardwareProjectProductInfoList[${length}].guidanceDiscount" type="number" class="form-control guidanceDiscount" min="0" max="1" step="0.1" required></td>
<td><input name="hardwareProjectProductInfoList[${length}].discount" type="number" class="form-control discount" min="0" max="1" step="0.1" required></td>
<td><input name="hardwareProjectProductInfoList[${length}].price" type="number" class="form-control price" placeholder="自动计算" required readonly></td>
<td><input name="hardwareProjectProductInfoList[${length}].allPrice" type="number" class="form-control allPrice" placeholder="自动计算" required readonly></td>
<td><input name="hardwareProjectProductInfoList[${length}].catalogueAllPrice" type="number" class="form-control catalogueAllPrice" placeholder="自动计算" required readonly></td>
<td><input name="hardwareProjectProductInfoList[${length}].remark" type="text" class="form-control" ></td>
<td><span style="cursor:pointer;color: ff5722" class="delRow">删除</span></td>
</tr>`)
$('#productTable2 tbody').append(tr)
initSearchProduct()
initPrice()
}
function addProduct3() {
let length = $('#productTable3 tbody').find('tr').length
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</td>
<td><input name="maintenanceProjectProductInfoList[${length}].productBomCode" type="text" class="form-control productBomCode" required></td>
<td><input name="maintenanceProjectProductInfoList[${length}].model" type="text" class="form-control model" required></td>
<td><textarea name="maintenanceProjectProductInfoList[${length}].productDesc" required class="form-control productDesc" placeholder="自动带入" readonly></textarea></td>
<td><input name="maintenanceProjectProductInfoList[${length}].quantity" type="number" class="form-control quantity" step="1" required></td>
<td><input name="maintenanceProjectProductInfoList[${length}].cataloguePrice" type="text" class="form-control cataloguePrice" required></td>
<td><input name="maintenanceProjectProductInfoList[${length}].guidanceDiscount" type="number" class="form-control guidanceDiscount" min="0" max="1" step="0.1" required></td>
<td><input name="maintenanceProjectProductInfoList[${length}].discount" type="number" class="form-control discount" min="0" max="1" step="0.1" required></td>
<td><input name="maintenanceProjectProductInfoList[${length}].price" type="number" class="form-control price" placeholder="自动计算" required readonly></td>
<td><input name="maintenanceProjectProductInfoList[${length}].allPrice" type="number" class="form-control allPrice" placeholder="自动计算" required readonly></td>
<td><input name="maintenanceProjectProductInfoList[${length}].catalogueAllPrice" type="number" class="form-control catalogueAllPrice" placeholder="自动计算" required readonly></td>
<td><input 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()
initPrice()
}
function addLog() {
let length = $('#workLog tbody').find('tr').length
let tr = $(`
<tr>
<td>${length + 1}</td>
<td><textarea type="text" name="projectWorkProgressList[${length}].workContent" class="form-control" required></textarea></td>
<td><input type="text" class="form-control" placeholder="保存后自动填入" readonly></td>
<td><input type="text" class="form-control" placeholder="保存后自动填入" readonly></td>
</tr>`)
$('#workLog tbody').append(tr)
}
function initSearchProduct() {
$('.productTable .productBomCode').on('input', function () {
let val = $(this).val()
searchProduct(val, 'code', this)
})
$('.productTable .model').on('input', function () {
let val = $(this).val()
searchProduct(val, 'model', this)
})
$('.productTable .delRow').on('click', function () {
let ele = $(this)
$.modal.confirm('是否确认删除', function () {
$(ele).parent().parent().remove()
$('#productTable tbody tr').each((index, item) => {
$(item).find('.indexBox').text(index + 1)
})
$('#productTable2 tbody tr').each((index, item) => {
$(item).find('.indexBox').text(index + 1)
})
$('#productTable3 tbody tr').each((index, item) => {
$(item).find('.indexBox').text(index + 1)
})
});
})
}
function searchProduct(val, type, ele) {
if (!val) {
$(ele).parent().parent().find('.productBomCode').val('')
$(ele).parent().parent().find('.model').val('')
$(ele).parent().parent().find('.productDesc').val('')
return
}
let data = {
pageSize: 10,
pageNum: 1,
isTable: 0
}
if (type == 'code') {
data.productCode = val
} else if (type == 'model') {
data.model = val
}
$.operate.post(ctx + 'system/product/list', data, function (res) {
if (res.rows.length) {
if (type == 'code') {
$(ele).parent().parent().find('.model').val(res.rows[0].model)
} else if (type == 'model') {
$(ele).parent().parent().find('.productBomCode').val(res.rows[0].productCode)
}
$(ele).parent().parent().find('.productDesc').val(res.rows[0].description)
} else {
if (type == 'code') {
$(ele).parent().parent().find('.model').val('')
} else if (type == 'model') {
$(ele).parent().parent().find('.productBomCode').val('')
}
$(ele).parent().parent().find('.productDesc').val('')
}
}
)
}
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>