项目信息完善

master
wangjiuyun 2025-06-06 15:35:41 +08:00
parent 7d23b0ade8
commit b7f4711697
7 changed files with 452 additions and 287 deletions

View File

@ -298,16 +298,38 @@
<tbody></tbody>
<!-- 可动态添加行 -->
</table>
</form>
</form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: layui"/>
<script th:inline="javascript">
var prefix = ctx + "sip/project"
$("#form-product-add").validate({
focusCleanup: true
});
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
})
$.operate.post(ctx + 'system/product/list', {...data, type: '2'}, function (res) {
hardwareProjectProductInfoList = res.rows
})
$.operate.post(ctx + 'system/product/list', {...data, type: '11,22'}, function (res) {
maintenanceProjectProductInfoList = res.rows
})
}
function submitHandler() {
if ($.validate.form()) {
@ -316,6 +338,7 @@
}
$(function () {
initProductList()
var layerIndex = parent.layer.index
parent.layer.full(layerIndex)
@ -433,8 +456,18 @@
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 class="layui-form"><select 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 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>
<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>
@ -451,13 +484,26 @@
initSearchProduct('1')
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 class="layui-form"><select name="hardwareProjectProductInfoList[${length}].productBomCode" required class="form-control productBomCode" lay-search="" lay-filter="productCode3">
${hardwareProjectProductInfoList.map((ele) => {
return `<option value="${ele.productCode}">${ele.productCode}</option>`
}).join('')
}
</select></td>
<td class="layui-form"><select name="hardwareProjectProductInfoList[${length}].productBomCode" required class="form-control model" lay-search="" lay-filter="productModel1">
${hardwareProjectProductInfoList.map((ele) => {
return `<option value="${ele.model}">${ele.model}</option>`
}).join('')
}
</select></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>
@ -474,13 +520,26 @@
initSearchProduct('2')
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 class="layui-form"><select name="hardwareProjectProductInfoList[${length}].productBomCode" required class="form-control productBomCode" lay-search="" lay-filter="productCode2">
${hardwareProjectProductInfoList.map((ele) => {
return `<option value="${ele.productCode}">${ele.productCode}</option>`
}).join('')
}
</select></td>
<td class="layui-form"><select name="hardwareProjectProductInfoList[${length}].model" required class="form-control model" lay-search="" lay-filter="productModel2">
${hardwareProjectProductInfoList.map((ele) => {
return `<option value="${ele.model}">${ele.model}</option>`
}).join('')
}
</select></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>
@ -512,13 +571,27 @@
}
function initSearchProduct(type) {
$('.productTable .productBomCode').on('input', function () {
let val = $(this).val()
searchProduct(val, 'code', this,type)
})
$('.productTable .model').on('input', function () {
let val = $(this).val()
searchProduct(val, 'model', this,type)
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)
})
})
$('.productTable .delRow').on('click', function () {
let ele = $(this)
@ -538,42 +611,31 @@
})
}
function searchProduct(val, type, ele,typeId) {
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,
type:typeId
}
function searchProduct(val, type, ele, typeId) {
let selectObj = {}
let listName = $(ele).attr('name')
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('')
}
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)
}
)
$(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)
}
function initPrice() {

View File

@ -167,11 +167,11 @@
required></td>
<td>预计下单时间</td>
<td><input name="estimatedOrderTime" class="form-control" placeholder="yyyy-MM-dd"
th:field="*{estimatedOrderTime}">
th:value="${#dates.format(projectInfo.estimatedOrderTime, 'yyyy-MM-dd')}">
</td>
<td>预计发货时间</td>
<td><input name="estimatedDeliverTime" class="form-control" placeholder="yyyy-MM-dd"
th:field="*{estimatedDeliverTime}"></td>
th:value="${#dates.format(projectInfo.estimatedDeliverTime, 'yyyy-MM-dd')}"></td>
</tr>
<tr>
@ -325,12 +325,48 @@
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: layui"/>
<script th:inline="javascript">
var prefix = ctx + "sip/project"
$("#form-product-add").validate({
focusCleanup: true
});
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)
})
})
}
function submitHandler() {
if ($.validate.form()) {
@ -339,6 +375,7 @@
}
$(function () {
initProductList()
var layerIndex = parent.layer.index
parent.layer.full(layerIndex)
@ -354,7 +391,6 @@
});
initData()
})
function selectCustomer() {
@ -454,18 +490,6 @@
// 添加软件
function initData() {
let softwareProjectProductInfoList = [[${projectInfo.softwareProjectProductInfoList}]]
softwareProjectProductInfoList.forEach((ele) => {
addProduct(ele)
})
let hardwareProjectProductInfoList = [[${projectInfo.hardwareProjectProductInfoList}]]
hardwareProjectProductInfoList.forEach((ele) => {
addProduct2(ele)
})
let maintenanceProjectProductInfoList = [[${projectInfo.maintenanceProjectProductInfoList}]]
maintenanceProjectProductInfoList.forEach((ele) => {
addProduct3(ele)
})
let arr2 = [[${projectInfo.projectWorkProgressList}]]
arr2.forEach((ele) => {
@ -487,8 +511,19 @@
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</td>
<td><input type="hidden" name="softwareProjectProductInfoList[${length}].id" value="${data.id || ''}"><input name="projectProductInfoList[${length}].productBomCode" type="text" class="form-control productBomCode" value="${data.productBomCode || ''}" required></td>
<td><input name="softwareProjectProductInfoList[${length}].model" type="text" class="form-control model" required value="${data.model || ''}"></td>
<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>
<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>
@ -505,13 +540,25 @@
initSearchProduct('1')
initPrice()
}
function addProduct2(data) {
let length = $('#productTable2 tbody').find('tr').length
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</td>
<td><input type="hidden" name="hardwareProjectProductInfoList[${length}].id" value="${data.id || ''}"><input name="projectProductInfoList[${length}].productBomCode" type="text" class="form-control productBomCode" value="${data.productBomCode || ''}" required></td>
<td><input name="hardwareProjectProductInfoList[${length}].model" type="text" class="form-control model" required value="${data.model || ''}"></td>
<td class="layui-form"><input type="hidden" name="hardwareProjectProductInfoList[${length}].id" value="${data.id || ''}">
<select value="${data.productBomCode || ''}" name="hardwareProjectProductInfoList[${length}].productBomCode" required class="form-control productBomCode" lay-search="" lay-filter="productCode1">
${hardwareProjectProductInfoList.map((ele) => {
return `<option value="${ele.productCode}">${ele.productCode}</option>`
}).join('')
}
</select></td>
<td class="layui-form"><select value="${data.model || ''}" name="hardwareProjectProductInfoList[${length}].model" required class="form-control model" lay-search="" lay-filter="productModel1">
${hardwareProjectProductInfoList.map((ele) => {
return `<option value="${ele.model}">${ele.model}</option>`
}).join('')
}
</select></td>
<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>
@ -528,13 +575,25 @@
initSearchProduct('2')
initPrice()
}
function addProduct3(data) {
let length = $('#productTable3 tbody').find('tr').length
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</td>
<td><input type="hidden" name="maintenanceProjectProductInfoList[${length}].id" value="${data.id || ''}"><input name="projectProductInfoList[${length}].productBomCode" type="text" class="form-control productBomCode" value="${data.productBomCode || ''}" required></td>
<td><input name="maintenanceProjectProductInfoList[${length}].model" type="text" class="form-control model" required value="${data.model || ''}"></td>
<td class="layui-form"><input type="hidden" name="maintenanceProjectProductInfoList[${length}].id" value="${data.id || ''}">
<select value="${data.productBomCode || ''}" name="maintenanceProjectProductInfoList[${length}].productBomCode" required class="form-control productBomCode" lay-search="" lay-filter="productCode1">
${maintenanceProjectProductInfoList.map((ele) => {
return `<option value="${ele.productCode}">${ele.productCode}</option>`
}).join('')
}
</select></td>
<td class="layui-form"><select value="${data.model || ''}" name="maintenanceProjectProductInfoList[${length}].model" required class="form-control model" lay-search="" lay-filter="productModel1">
${maintenanceProjectProductInfoList.map((ele) => {
return `<option value="${ele.model}">${ele.model}</option>`
}).join('')
}
</select></td>
<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>
@ -551,6 +610,7 @@
initSearchProduct('11,22')
initPrice()
}
function addLog(data) {
let length = $('#workLog tbody').find('tr').length
let tr = $(`
@ -565,13 +625,27 @@
}
function initSearchProduct(type) {
$('.productTable .productBomCode').on('input', function () {
let val = $(this).val()
searchProduct(val, 'code', this,type)
})
$('.productTable .model').on('input', function () {
let val = $(this).val()
searchProduct(val, 'model', this,type)
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)
})
})
$('.productTable .delRow').on('click', function () {
let ele = $(this)
@ -592,42 +666,31 @@
}
function searchProduct(val, type, ele,typeId) {
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,
type:typeId
}
function searchProduct(val, type, ele, typeId) {
let selectObj = {}
let listName = $(ele).attr('name')
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('')
}
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)
}
)
$(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)
}
function initPrice() {

View File

@ -210,7 +210,6 @@
formatter: function (value, row, index) {
if(row.bgProperty=='YYS'){
return $.table.selectDictLabel([[${@dict.getType('bg_yys')}]], value);
}else{
return $.table.selectDictLabel([[${@dict.getType('bg_hsys')}]], value);

View File

@ -66,56 +66,58 @@
input, textarea, .productTable td {
position: relative;
}
[name="bgProperty"], #industryTypeBox select {
pointer-events: none;
}
#projectNameBox {
margin-left: 20px;
display: inline-block;
}
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form id="form-product-add">
<div class="section-title">新建订单</div>
<div class="section-title">新建订单<span id="projectNameBox"></span></div>
<table>
<tr>
<td class="shortTd">项目编号<span class="is-required">*</span></td>
<td><input type="text" name="projectCode" class="form-control" oninput="searchProject()">
<td>
<input name="projectId" class="form-control" type="hidden">
<input type="text" name="projectCode" placeholder="请选择" class="form-control"
onclick="searchProject()">
</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><input type="text" name="projectName"
class="form-control" placeholder="选择项目后带入" readonly></td>
<td class="shortTd">最终客户<span class="is-required">*</span></td>
<td><input name="customerName" class="form-control" type="text" required onclick="selectCustomer()">
<td><input name="customerName" class="form-control" type="text" readonly placeholder="选择项目后带入"
required>
<input name="customerCode" class="form-control" type="hidden"></td>
</tr>
<tr>
<td>BG<span class="is-required">*</span></td>
<td colspan="2">
<td>
<select name="bgProperty" class="form-control" th:with="type=${@dict.getType('bg_type')}"
onchange="changeBg()" required>
readonly required>
<option value="">请选择BG</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 colspan="2" id="industryTypeBox">
<td id="industryTypeBox">
<select name="industryType" class="form-control"
required>
required readonly>
<option value="">请先选择BG</option>
</select>
</td>
</tr>
<tr id="element1">
<td>属地<span class="is-required">*</span></td>
<td colspan="2">
<select name="province" class="province form-control m-b" data-first-title="选择省">
<option value="">请选择</option>
</select>
<td>代表处<span class="is-required">*</span></td>
<td colspan="3">
<input name="agentName" class="form-control" type="text" readonly required>
<input name="agentCode" class="form-control" type="hidden">
</td>
<td class="地市">属地<span class="is-required">*</span></td>
<td colspan="2">
<select name="city" class="city form-control m-b" data-first-title="选择省">
<option value="">请选择</option>
</select>
</td>
</tr>
<tr>
<td>进货商商务接口人姓名<span class="is-required">*</span></td>
@ -144,10 +146,10 @@
</tr>
<tr>
<td>实际进货金额<span class="is-required">*</span></td>
<td colspan="2"><input type="number" name="actualPurchaseAmount" class="form-control" required>
<td><input type="number" name="actualPurchaseAmount" class="form-control" required>
</td>
<td>执行单有效截止时间<span class="is-required">*</span></td>
<td colspan="2">
<td colspan="3">
<input name="orderEndTime" class="form-control" placeholder="yyyy-MM-dd"
required>
</td>
@ -155,11 +157,11 @@
<tr>
<td>要求到货时间<span class="is-required">*</span></td>
<td colspan="2">
<td>
<input name="deliveryTime" class="form-control" placeholder="yyyy-MM-dd" required>
</td>
<td>公司直发</td>
<td colspan="2">
<td colspan="3">
<select name="companyDelivery" class="form-control"
th:with="type=${@dict.getType('company_delivery')}"
required>
@ -208,7 +210,13 @@
<td><input type="text" name="partnerCode"
class="form-control" readonly placeholder="选择后带入" required></td>
<td>进货商类型<span class="is-required">*</span></td>
<td><input name="level" class="form-control" placeholder="选择后带入" type="text" required></td>
<td>
<select name="level" class="form-control" readonly :placeholder="选择后带入"
th:with="type=${@dict.getType('identify_level')}" style="pointer-events: none">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</td>
</tr>
<tr>
<td>供货商<span class="is-required">*</span></td>
@ -310,7 +318,7 @@
<div class="layui-tab-item">内容-4</div>
<div class="layui-tab-item">
<div class="row">
<input id="uploadInput" type="file" accept=".xls,.xlsx" style="display: none">
<input id="uploadInput" type="file" accept=".pdf" style="display: none">
<div class="col-xs-12">
<button type="button" class="btn btn-white btn-sm" onclick="downloadTem()"><i
class="fa fa-download">
@ -340,6 +348,27 @@
$("#form-product-add").validate({
focusCleanup: true
});
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
})
$.operate.post(ctx + 'system/product/list', {...data, type: '2'}, function (res) {
hardwareProjectProductInfoList = res.rows
})
$.operate.post(ctx + 'system/product/list', {...data, type: '11,22'}, function (res) {
maintenanceProjectProductInfoList = res.rows
})
}
function submitHandler() {
if ($.validate.form()) {
@ -348,6 +377,7 @@
}
$(function () {
initProductList()
var layerIndex = parent.layer.index
parent.layer.full(layerIndex)
@ -383,14 +413,14 @@
});
})
function selectCustomer() {
var url = prefix + "/selectCustomer";
function searchProject() {
var url = prefix + "/selectProject";
var options = {
title: '选择客户',
width: "680",
url: url,
height: '600',
callBack: doSubmitCustomer
callBack: doSubmitProject
};
$.modal.openOptions(options);
}
@ -407,18 +437,6 @@
$.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 = {
@ -431,14 +449,25 @@
$.modal.openOptions(options);
}
function doSubmitCustomer(index, layero) {
function doSubmitProject(index, layero) {
var rows = layero.find("iframe")[0].contentWindow.getSelections();
if (rows.length == 0) {
$.modal.alertWarning("请选择一个用户");
return;
}
$('#projectNameBox').text(rows[0].projectName)
$('[name="customerCode"]').val(rows[0].customerCode);
$(' [name="customerName"]').val(rows[0].customerName);
$('[name="customerName"]').val(rows[0].customerName);
$('[name="projectCode"]').val(rows[0].projectCode);
$('[name="projectId"]').val(rows[0].id);
$('[name="projectName"]').val(rows[0].projectName);
$('[name="bgProperty"]').val(rows[0].bgProperty);
$('[name="agentName"]').val(rows[0].agentName);
$('[name="agentCode"]').val(rows[0].agentCode);
changeBg()
$('[name="industryType"]').val(rows[0].industryType);
$.modal.close(index);
}
@ -470,17 +499,6 @@
$.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() {
@ -488,8 +506,18 @@
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 class="layui-form"><select 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 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>
<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>
@ -512,8 +540,20 @@
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 class="layui-form"><select name="hardwareProjectProductInfoList[${length}].productBomCode" required class="form-control productBomCode" lay-search="" lay-filter="productCode2">
${hardwareProjectProductInfoList.map((ele) => {
return `<option value="${ele.productCode}">${ele.productCode}</option>`
}).join('')
}
</select></td>
<td class="layui-form"><select name="hardwareProjectProductInfoList[${length}].model" required class="form-control model" lay-search="" lay-filter="productModel2">
${hardwareProjectProductInfoList.map((ele) => {
return `<option value="${ele.model}">${ele.model}</option>`
}).join('')
}
</select></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>
@ -536,8 +576,20 @@
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 class="layui-form"><select name="maintenanceProjectProductInfoList[${length}].productBomCode" required class="form-control productBomCode" lay-search="" lay-filter="productCode3">
${maintenanceProjectProductInfoList.map((ele) => {
return `<option value="${ele.productCode}">${ele.productCode}</option>`
}).join('')
}
</select></td>
<td class="layui-form"><select name="maintenanceProjectProductInfoList[${length}].productBomCode" required class="form-control model" lay-search="" lay-filter="productModel1">
${maintenanceProjectProductInfoList.map((ele) => {
return `<option value="${ele.model}">${ele.model}</option>`
}).join('')
}
</select></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>
@ -568,14 +620,28 @@
}
function initSearchProduct(type) {
$('.productTable .productBomCode').on('input', function () {
let val = $(this).val()
searchProduct(val, 'code', this,type)
})
$('.productTable .model').on('input', function () {
let val = $(this).val()
searchProduct(val, 'model', this,type)
function initSearchProduct() {
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)
})
})
$('.productTable .delRow').on('click', function () {
let ele = $(this)
@ -595,42 +661,31 @@
})
}
function searchProduct(val, type, ele,typeId) {
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,
type:typeId
}
function searchProduct(val, type, ele) {
let selectObj = {}
let listName = $(ele).attr('name')
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('')
}
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)
}
)
$(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)
}
function initPrice() {
@ -690,7 +745,7 @@
str += `<option value="${ele.dictValue}">${ele.dictLabel}</option> `
})
$('#industryTypeBox').html(`
<select name="industryType" class="form-control" required>
<select name="industryType" class="form-control" readonly required>
<option value="">请选择行业</option>
${str}
</select>
@ -702,7 +757,7 @@
str += `<option value="${ele.dictValue}">${ele.dictLabel}</option> `
})
$('#industryTypeBox').html(`
<select name="industryType" class="form-control" required>
<select name="industryType" class="form-control" required readonly>
<option value="">请选择行业</option>
${str}
</select>
@ -712,22 +767,25 @@
function downloadTem() {
var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象
if(!$('[name="orderChannel"]').val()){
if (!$('[name="orderChannel"]').val()) {
$.modal.alertWarning("请先选择下单通路");
return
}
if($('[name="orderChannel"]').val()==1){
if ($('[name="orderChannel"]').val() == 1) {
window.location.href = prefix + "/contract/export?fileName=文件111.xlsx"
}else{
} else {
window.location.href = prefix + "/contract/export?fileName=文件222.xlsx"
}
$.modal.closeLoading()
}
document.getElementById('uploadInput').addEventListener('change', function (event) {
const file = event.target.files[0];
let data = new FormData()
data.append('file', file)
data.append('projectId', $('[name="projectId"]').val())
var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象
xhr.open('POST', prefix + '/importContractData', true); // 设置请求类型和URL
// 当请求完成时执行的回调函数
@ -820,6 +878,14 @@
};
$.table.init(options);
}
function importList() {
if (!$('[name="projectId"]').val()) {
$.modal.alertWarning("请先选择项目");
return
}
$('#uploadInput').click()
}
</script>
</body>
</html>

View File

@ -19,15 +19,9 @@
<input type="text" name="projectName" placeholder="项目名称" />
</li>
<li>
<label>项目负责人:</label>
<label>汇智负责人:</label>
<input type="text" name="dutyName" placeholder="项目负责人" />
</li>
<li id="element1">
<label>属地:</label>
<select name="province" class="province form-control m-b" data-first-title="选择省">
<option value="">请选择</option>
</select>
</li>
<li>
<label>供货商:</label>
<select name="bgProperty" class="form-control">

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('选择客户')"/>
<th:block th:include="include :: header('选择项目')"/>
</head>
<style>
.select-list li {
@ -20,30 +20,17 @@
<div class="select-list">
<ul>
<li>
<label>客户编码:</label>
<input type="text" name="customerCode"/>
<label>项目编码:</label>
<input type="text" name="projectCode"/>
</li>
<li>
<label>客户名称:</label>
<label>项目名称:</label>
<input type="text" name="projectName"/>
</li>
<li>
<label>最终客户:</label>
<input type="text" name="customerName"/>
</li>
<li>
<label>联系人:</label>
<input type="text" name="contactPerson"/>
</li>
<li>
<label>联系电话:</label>
<input type="text" name="contactPhone"/>
</li>
<li>
<label>所属行业:</label>
<select name="industryType" class="form-control"
th:with="type=${@dict.getType('industry_code')}" required>
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</li>
<li style="width: 46%;text-align: right;">
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
@ -61,9 +48,14 @@
</div>
<th:block th:include="include :: footer"/>
<script>
var prefix = ctx + "system/customer";
<script th:inline="javascript">
var prefix = ctx + "sip/project";
let bgArr=[[${@dict.getType('bg_type')}]]
let hyArr1=[[${@dict.getType('bg_yys')}]]
let hyArr2=[[${@dict.getType('bg_hsys')}]]
$(function () {
var options = {
url: prefix + "/list",
showSearch: true,
@ -77,50 +69,39 @@
radio: true
},
{
field: 'customerCode',
title: '客户编码'
field: 'projectCode',
title: '项目编码'
},
{
field: 'projectName',
title: '项目名称'
},
{
field: 'customerName',
title: '客户名称'
title: '最终客户'
},
{
field: 'customerPostcode',
title: '客户邮编'
},
{
field: 'address',
title: '详细地址'
},
{
field: 'contactPerson',
title: '联系人'
},
{
field: 'contactPhone',
title: '联系电话'
},
{
field: 'contactEmail',
title: '联系邮件'
field: 'bgProperty',
title: 'BG',
formatter:(value,row)=>{
return $.table.selectDictLabel(bgArr, value);
}
},
{
field: 'industryType',
title: '所属行业',
formatter:(value,row)=>{
const arr=[]
$('[name="industryType"] option').each((index,item)=>{
arr.push({
text:$(item).text(),
value:$(item).val()
})
})
return arr.find((ele)=>ele.value==value)?.text
formatter: function (value, row, index) {
if(row.bgProperty=='YYS'){
return $.table.selectDictLabel(hyArr1, value);
}else{
return $.table.selectDictLabel(hyArr2, value);
}
}
},
{
field: 'remark',
title: '备注'
field: 'agentName',
title: '办事处'
},
]
};

View File

@ -214,10 +214,10 @@ public class ProjectOrderInfoController extends BaseController
log.error("下载文件失败", e);
}
}
@GetMapping("/selectCustomer")
@GetMapping("/selectProject")
public String selectCustomer()
{
return prefix + "/selectCustomer";
return prefix + "/selectProject";
}
@GetMapping("/selectPartner")
public String selectPartner()