Compare commits

..

No commits in common. "6a62d079d50ee8e4de4cc0b56c83ce6f950ab869" and "2be0ced2ce793e10b98a7ffbb252cca5dbf73c37" have entirely different histories.

7 changed files with 290 additions and 455 deletions

View File

@ -298,38 +298,16 @@
<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()) {
@ -338,7 +316,6 @@
}
$(function () {
initProductList()
var layerIndex = parent.layer.index
parent.layer.full(layerIndex)
@ -456,18 +433,8 @@
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</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><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>
@ -484,26 +451,13 @@ ${softwareProjectProductInfoList.map((ele) => {
initSearchProduct('1')
initPrice()
}
function addProduct2() {
let length = $('#productTable2 tbody').find('tr').length
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</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><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>
@ -520,26 +474,13 @@ ${hardwareProjectProductInfoList.map((ele) => {
initSearchProduct('2')
initPrice()
}
function addProduct3() {
let length = $('#productTable3 tbody').find('tr').length
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</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><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>
@ -571,27 +512,13 @@ ${hardwareProjectProductInfoList.map((ele) => {
}
function initSearchProduct(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 .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)
})
$('.productTable .delRow').on('click', function () {
let ele = $(this)
@ -611,31 +538,42 @@ ${hardwareProjectProductInfoList.map((ele) => {
})
}
function searchProduct(val, type, ele, typeId) {
let selectObj = {}
let listName = $(ele).attr('name')
if (type == 'code') {
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)
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
}
$(ele).parent().parent().find('.productDesc').val(selectObj.description)
let data = {
pageSize: 10,
pageNum: 1,
isTable: 0,
type:typeId
}
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() {

View File

@ -167,11 +167,11 @@
required></td>
<td>预计下单时间</td>
<td><input name="estimatedOrderTime" class="form-control" placeholder="yyyy-MM-dd"
th:value="${#dates.format(projectInfo.estimatedOrderTime, 'yyyy-MM-dd')}">
th:field="*{estimatedOrderTime}">
</td>
<td>预计发货时间</td>
<td><input name="estimatedDeliverTime" class="form-control" placeholder="yyyy-MM-dd"
th:value="${#dates.format(projectInfo.estimatedDeliverTime, 'yyyy-MM-dd')}"></td>
th:field="*{estimatedDeliverTime}"></td>
</tr>
<tr>
@ -325,48 +325,12 @@
</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()) {
@ -375,7 +339,6 @@
}
$(function () {
initProductList()
var layerIndex = parent.layer.index
parent.layer.full(layerIndex)
@ -391,6 +354,7 @@
});
initData()
})
function selectCustomer() {
@ -490,6 +454,18 @@
// 添加软件
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) => {
@ -511,19 +487,8 @@
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</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><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><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>
@ -540,25 +505,13 @@ ${softwareProjectProductInfoList.map((ele) => {
initSearchProduct('1')
initPrice()
}
function addProduct2(data) {
let length = $('#productTable2 tbody').find('tr').length
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</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><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><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>
@ -575,25 +528,13 @@ ${hardwareProjectProductInfoList.map((ele) => {
initSearchProduct('2')
initPrice()
}
function addProduct3(data) {
let length = $('#productTable3 tbody').find('tr').length
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</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><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><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>
@ -610,7 +551,6 @@ ${maintenanceProjectProductInfoList.map((ele) => {
initSearchProduct('11,22')
initPrice()
}
function addLog(data) {
let length = $('#workLog tbody').find('tr').length
let tr = $(`
@ -625,27 +565,13 @@ ${maintenanceProjectProductInfoList.map((ele) => {
}
function initSearchProduct(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 .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)
})
$('.productTable .delRow').on('click', function () {
let ele = $(this)
@ -666,31 +592,42 @@ ${maintenanceProjectProductInfoList.map((ele) => {
}
function searchProduct(val, type, ele, typeId) {
let selectObj = {}
let listName = $(ele).attr('name')
if (type == 'code') {
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)
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
}
$(ele).parent().parent().find('.productDesc').val(selectObj.description)
let data = {
pageSize: 10,
pageNum: 1,
isTable: 0,
type:typeId
}
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() {

View File

@ -210,6 +210,7 @@
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,58 +66,56 @@
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">新建订单<span id="projectNameBox"></span></div>
<div class="section-title">新建订单</div>
<table>
<tr>
<td class="shortTd">项目编号<span class="is-required">*</span></td>
<td>
<input name="projectId" class="form-control" type="hidden">
<input type="text" name="projectCode" placeholder="请选择" class="form-control"
onclick="searchProject()">
<td><input type="text" name="projectCode" class="form-control" oninput="searchProject()">
</td>
<td class="shortTd">项目名称<span class="is-required">*</span></td>
<td><input type="text" name="projectName"
class="form-control" placeholder="选择项目后带入" readonly></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" readonly placeholder="选择项目后带入"
required>
<td><input name="customerName" class="form-control" type="text" required onclick="selectCustomer()">
<input name="customerCode" class="form-control" type="hidden"></td>
</tr>
<tr>
<td>BG<span class="is-required">*</span></td>
<td>
<td colspan="2">
<select name="bgProperty" class="form-control" th:with="type=${@dict.getType('bg_type')}"
readonly required>
onchange="changeBg()" 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 id="industryTypeBox">
<td colspan="2" id="industryTypeBox">
<select name="industryType" class="form-control"
required readonly>
required>
<option value="">请先选择BG</option>
</select>
</td>
<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">
</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>
<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>
@ -146,10 +144,10 @@
</tr>
<tr>
<td>实际进货金额<span class="is-required">*</span></td>
<td><input type="number" name="actualPurchaseAmount" class="form-control" required>
<td colspan="2"><input type="number" name="actualPurchaseAmount" class="form-control" required>
</td>
<td>执行单有效截止时间<span class="is-required">*</span></td>
<td colspan="3">
<td colspan="2">
<input name="orderEndTime" class="form-control" placeholder="yyyy-MM-dd"
required>
</td>
@ -157,11 +155,11 @@
<tr>
<td>要求到货时间<span class="is-required">*</span></td>
<td>
<td colspan="2">
<input name="deliveryTime" class="form-control" placeholder="yyyy-MM-dd" required>
</td>
<td>公司直发</td>
<td colspan="3">
<td colspan="2">
<select name="companyDelivery" class="form-control"
th:with="type=${@dict.getType('company_delivery')}"
required>
@ -210,13 +208,7 @@
<td><input type="text" name="partnerCode"
class="form-control" readonly placeholder="选择后带入" required></td>
<td>进货商类型<span class="is-required">*</span></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>
<td><input name="level" class="form-control" placeholder="选择后带入" type="text" required></td>
</tr>
<tr>
<td>供货商<span class="is-required">*</span></td>
@ -318,7 +310,7 @@
<div class="layui-tab-item">内容-4</div>
<div class="layui-tab-item">
<div class="row">
<input id="uploadInput" type="file" accept=".pdf" style="display: none">
<input id="uploadInput" type="file" accept=".xls,.xlsx" style="display: none">
<div class="col-xs-12">
<button type="button" class="btn btn-white btn-sm" onclick="downloadTem()"><i
class="fa fa-download">
@ -348,27 +340,6 @@
$("#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()) {
@ -377,7 +348,6 @@
}
$(function () {
initProductList()
var layerIndex = parent.layer.index
parent.layer.full(layerIndex)
@ -413,14 +383,14 @@
});
})
function searchProject() {
var url = prefix + "/selectProject";
function selectCustomer() {
var url = prefix + "/selectCustomer";
var options = {
title: '选择客户',
width: "680",
url: url,
height: '600',
callBack: doSubmitProject
callBack: doSubmitCustomer
};
$.modal.openOptions(options);
}
@ -437,6 +407,18 @@
$.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 = {
@ -449,25 +431,14 @@
$.modal.openOptions(options);
}
function doSubmitProject(index, layero) {
function doSubmitCustomer(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="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);
$(' [name="customerName"]').val(rows[0].customerName);
$.modal.close(index);
}
@ -499,6 +470,17 @@
$.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() {
@ -506,18 +488,8 @@
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</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><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>
@ -540,20 +512,8 @@ ${softwareProjectProductInfoList.map((ele) => {
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</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><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>
@ -576,20 +536,8 @@ ${hardwareProjectProductInfoList.map((ele) => {
let tr = $(`
<tr>
<td class="indexBox">${length + 1}</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><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>
@ -620,28 +568,14 @@ ${maintenanceProjectProductInfoList.map((ele) => {
}
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)
})
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)
})
$('.productTable .delRow').on('click', function () {
let ele = $(this)
@ -661,31 +595,42 @@ ${maintenanceProjectProductInfoList.map((ele) => {
})
}
function searchProduct(val, type, ele) {
let selectObj = {}
let listName = $(ele).attr('name')
if (type == 'code') {
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)
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
}
$(ele).parent().parent().find('.productDesc').val(selectObj.description)
let data = {
pageSize: 10,
pageNum: 1,
isTable: 0,
type:typeId
}
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() {
@ -745,7 +690,7 @@ ${maintenanceProjectProductInfoList.map((ele) => {
str += `<option value="${ele.dictValue}">${ele.dictLabel}</option> `
})
$('#industryTypeBox').html(`
<select name="industryType" class="form-control" readonly required>
<select name="industryType" class="form-control" required>
<option value="">请选择行业</option>
${str}
</select>
@ -757,7 +702,7 @@ ${maintenanceProjectProductInfoList.map((ele) => {
str += `<option value="${ele.dictValue}">${ele.dictLabel}</option> `
})
$('#industryTypeBox').html(`
<select name="industryType" class="form-control" required readonly>
<select name="industryType" class="form-control" required>
<option value="">请选择行业</option>
${str}
</select>
@ -767,25 +712,22 @@ ${maintenanceProjectProductInfoList.map((ele) => {
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
// 当请求完成时执行的回调函数
@ -878,14 +820,6 @@ ${maintenanceProjectProductInfoList.map((ele) => {
};
$.table.init(options);
}
function importList() {
if (!$('[name="projectId"]').val()) {
$.modal.alertWarning("请先选择项目");
return
}
$('#uploadInput').click()
}
</script>
</body>
</html>

View File

@ -19,9 +19,15 @@
<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,17 +20,30 @@
<div class="select-list">
<ul>
<li>
<label>项目编码:</label>
<input type="text" name="projectCode"/>
<label>客户编码:</label>
<input type="text" name="customerCode"/>
</li>
<li>
<label>项目名称:</label>
<input type="text" name="projectName"/>
</li>
<li>
<label>最终客户:</label>
<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>
@ -48,14 +61,9 @@
</div>
<th:block th:include="include :: footer"/>
<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')}]]
<script>
var prefix = ctx + "system/customer";
$(function () {
var options = {
url: prefix + "/list",
showSearch: true,
@ -69,39 +77,50 @@
radio: true
},
{
field: 'projectCode',
title: '项目编码'
},
{
field: 'projectName',
title: '项目名称'
field: 'customerCode',
title: '客户编码'
},
{
field: 'customerName',
title: '最终客户'
title: '客户名称'
},
{
field: 'bgProperty',
title: 'BG',
formatter:(value,row)=>{
return $.table.selectDictLabel(bgArr, value);
}
field: 'customerPostcode',
title: '客户邮编'
},
{
field: 'address',
title: '详细地址'
},
{
field: 'contactPerson',
title: '联系人'
},
{
field: 'contactPhone',
title: '联系电话'
},
{
field: 'contactEmail',
title: '联系邮件'
},
{
field: 'industryType',
title: '所属行业',
formatter: function (value, row, index) {
if(row.bgProperty=='YYS'){
return $.table.selectDictLabel(hyArr1, value);
}else{
return $.table.selectDictLabel(hyArr2, value);
}
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
}
},
{
field: 'agentName',
title: '办事处'
field: 'remark',
title: '备注'
},
]
};

View File

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