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

599 lines
24 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;
}
input, textarea, #productTable td {
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>
<td><input type="text" th:field="*{projectCode}" name="projectCode" class="form-control" placeholder="保存后自动生成" readonly>
</td>
<td class="shortTd">项目名称<span class="is-required">*</span></td>
<td><input type="text" th:field="*{projectName}" name="projectName" maxlength="40" placeholder="限制40个字符"
class="form-control"></td>
<td class="shortTd">最终客户<span class="is-required">*</span></td>
<td><input name="customerName" th:field="*{customerName}" class="form-control" type="text" required onclick="selectCustomer()">
<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>
<select name="bgProperty" th:field="*{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" 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">
<input name="agentName" th:field="*{agentName}" class="form-control" type="text"
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>
<td><input type="text" name="contactWay" class="form-control" placeholder="姓名+电话" th:field="*{contactWay}"></td>
</tr>
<tr>
<td>预计金额RMB<span class="is-required">*</span></td>
<td><input type="number" name="estimatedAmount" class="form-control" th:field="*{estimatedAmount}" required></td>
<td>预计下单时间</td>
<td><input name="estimatedOrderTime" class="form-control" placeholder="yyyy-MM-dd" th:field="*{estimatedOrderTime}">
</td>
<td>预计发货时间</td>
<td><input name="estimatedDeliverTime" class="form-control" placeholder="yyyy-MM-dd"
th:field="*{estimatedDeliverTime}"></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>
2025-06-05 07:52:23 +00:00
<div>
其它:<input type="text" name="competitorList[5]" th:field="*{competitorList[5]}" 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%;"
class="form-control" maxlength="200" th:field="*{keyProblem}" 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个字符" th:field="*{projectDesc}"></textarea>
</td>
</tr>
</table>
2025-06-05 07:52:23 +00:00
<div class="section-title">配置信息</div>
<button type="button" class="add-btn" onclick="addProduct({})">添加</button>
<table id="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个字符" 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"/>
<script th:inline="javascript">
var prefix = ctx + "sip/project"
$("#form-product-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-product-add').serialize());
}
2025-06-05 07:52:23 +00:00
}
$(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
});
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() {
let arr=[[${projectInfo.projectProductInfoList}]]
arr.forEach((ele)=>{
addProduct(ele)
})
let arr2=[[${projectInfo.projectWorkProgressList }]]
arr2.forEach((ele)=>{
addLog(ele)
})
console.log(123,arr)
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>
`)
$('#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>
<td><input type="hidden" name="projectProductInfoList[${length}].id" value="${data.id||''}"><input name="projectProductInfoList[${length}].productBomCode" type="text" class="form-control productBomCode" value="${data.productBomCode||''}" required></td>
<td><input name="projectProductInfoList[${length}].model" type="text" class="form-control model" required value="${data.model||''}"></td>
<td><textarea name="projectProductInfoList[${length}].productDesc" required class="form-control productDesc" placeholder="自动带入" readonly>${data.productDesc||''}</textarea></td>
<td><input value="${data.quantity||''}" name="projectProductInfoList[${length}].quantity" type="number" class="form-control quantity" step="1" required></td>
<td><input value="${data.cataloguePrice||''}" name="projectProductInfoList[${length}].cataloguePrice" type="text" class="form-control cataloguePrice" required></td>
<td><input value="${data.guidanceDiscount||''}" name="projectProductInfoList[${length}].guidanceDiscount" type="number" class="form-control guidanceDiscount" min="0" max="1" step="0.1" required></td>
<td><input value="${data.discount||''}" name="projectProductInfoList[${length}].discount" type="number" class="form-control discount" min="0" max="1" step="0.1" required></td>
<td><input value="${data.price||''}" name="projectProductInfoList[${length}].price" type="number" class="form-control price" placeholder="自动计算" required readonly></td>
<td><input value="${data.allPrice||''}" name="projectProductInfoList[${length}].allPrice" type="number" class="form-control allPrice" placeholder="自动计算" required readonly></td>
<td><input value="${data.catalogueAllPrice||''}" name="projectProductInfoList[${length}].catalogueAllPrice" type="number" class="form-control catalogueAllPrice" placeholder="自动计算" required readonly></td>
<td><input value="${data.remark||''}" name="projectProductInfoList[${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 addLog(data) {
let length = $('#workLog tbody').find('tr').length
let tr = $(`
<tr>
<td>${length + 1}</td>
<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>
<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>
</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)
})
});
})
}
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>