From 36862b93ec048ef1514fb37413ca12cb050cfa34 Mon Sep 17 00:00:00 2001 From: wangjiuyun <1595161655@qq.com> Date: Fri, 6 Jun 2025 19:59:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=96=B0=E5=BB=BA=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/templates/project/info/add.html | 2 + .../templates/project/info/edit.html | 2 + .../templates/project/info/project.html | 44 +- .../templates/project/order/add.html | 93 +- .../templates/project/order/edit.html | 1100 ++++++++++++++--- 5 files changed, 1023 insertions(+), 218 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/project/info/add.html b/ruoyi-admin/src/main/resources/templates/project/info/add.html index 8d7d0aa7..c2733382 100644 --- a/ruoyi-admin/src/main/resources/templates/project/info/add.html +++ b/ruoyi-admin/src/main/resources/templates/project/info/add.html @@ -334,6 +334,8 @@ function submitHandler() { if ($.validate.form()) { $.operate.save(prefix + "/add", $('#form-product-add').serialize()); + }else{ + $.modal.alertWarning("请完善表单"); } } diff --git a/ruoyi-admin/src/main/resources/templates/project/info/edit.html b/ruoyi-admin/src/main/resources/templates/project/info/edit.html index f9266a17..4c6e8ac4 100644 --- a/ruoyi-admin/src/main/resources/templates/project/info/edit.html +++ b/ruoyi-admin/src/main/resources/templates/project/info/edit.html @@ -371,6 +371,8 @@ function submitHandler() { if ($.validate.form()) { $.operate.save(prefix + "/edit", $('#form-product-add').serialize()); + }else{ + $.modal.alertWarning("请完善表单"); } } diff --git a/ruoyi-admin/src/main/resources/templates/project/info/project.html b/ruoyi-admin/src/main/resources/templates/project/info/project.html index 45833749..74529426 100644 --- a/ruoyi-admin/src/main/resources/templates/project/info/project.html +++ b/ruoyi-admin/src/main/resources/templates/project/info/project.html @@ -34,6 +34,10 @@ .highlightRow { color: red; } + + .disableBtnfalse { + color: #ccc; + }
@@ -57,7 +61,7 @@
  • @@ -186,7 +190,7 @@ formatter: (value, row, index) => { if (row.highlight) { return `${value}` - }else{ + } else { return `${value}` } } @@ -210,9 +214,9 @@ field: 'industryType', title: '行业', formatter: function (value, row, index) { - if(row.bgProperty=='YYS'){ + if (row.bgProperty == 'YYS') { return $.table.selectDictLabel([[${@dict.getType('bg_yys')}]], value); - }else{ + } else { return $.table.selectDictLabel([[${@dict.getType('bg_hsys')}]], value); } @@ -225,7 +229,7 @@ { field: 'projectGraspDegree', title: '项目把握度', - width:30 + width: 30 }, { field: 'projectStage', @@ -266,7 +270,7 @@ formatter: function (value, row, index) { var actions = []; actions.push('项目详情 '); - actions.push('生成订单 '); + actions.push('生成订单 '); actions.push('删除'); return actions.join(''); } @@ -368,6 +372,7 @@ $('#laydate-endTime').attr('name', 'updateTimeEnd') } } + function changeBg() { if ($('[name="bgProperty"]').val() != 'YYS') { let datas = [[${@dict.getType('bg_hysy')}]] @@ -397,6 +402,31 @@ } + function openOrder(id, canAdd) { + if (!canAdd) { + $.modal.alertWarning("该项目已存在订单"); + return + } + var options = { + title: "新建订单", + url: ctx + `project/order/add`, + maxmin: false, + full: true, + index: 1000, + width: 1050, + yes: function (index, layero) { + let body = parent.layer.getChildFrame('body', index) + if ($(body.find('#form-product-add').get(0)).validate().form()) { + $.operate.save(prefix + "/add", body.find('#form-product-add').serialize(), function () { + parent.layer.close(index) + }); + } + }, + }; + window.localStorage.setItem('projcetDataId', id) + $.modal.openOptions(options) + } + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/project/order/add.html b/ruoyi-admin/src/main/resources/templates/project/order/add.html index 20a62260..5ebb4927 100644 --- a/ruoyi-admin/src/main/resources/templates/project/order/add.html +++ b/ruoyi-admin/src/main/resources/templates/project/order/add.html @@ -85,6 +85,7 @@ 项目编号* + @@ -129,6 +130,7 @@ 联系方式* + 合同编号* @@ -218,6 +220,15 @@ + + 进货商联系人 + + Email + + 联系方式* + + 供货商* @@ -383,11 +394,39 @@ function submitHandler() { if ($.validate.form()) { $.operate.save(prefix + "/add", $('#form-product-add').serialize()); + }else{ + $.modal.alertWarning("请完善表单"); } } + function initProjcet() { + let id = window.localStorage.getItem('projcetDataId') + if (!id) { + return + } + window.localStorage.removeItem('projcetDataId') + $.operate.get(ctx + `sip/project/query/${id}`, function (res) { + let data = res.data + $('#projectNameBox').text(data.projectName) + $('[name="customerCode"]').val(data.customerCode); + $('[name="customerName"]').val(data.customerName); + $('[name="projectCode"]').val(data.projectCode); + $('[name="projectId"]').val(data.id); + $('[name="projectName"]').val(data.projectName); + $('[name="bgProperty"]').val(data.bgProperty); + $('[name="agentName"]').val(data.agentName); + $('[name="agentCode"]').val(data.agentCode); + changeBg() + $('[name="industryType"]').val(data.industryType); + initProjectList() + }) + + + } + $(function () { initProductList() + initProjcet() $("input[name='estimatedOrderTime']").datetimepicker({ format: "yyyy-mm-dd", minView: "month", @@ -459,7 +498,7 @@ function doSubmitProject(index, layero) { var rows = layero.find("iframe")[0].contentWindow.getSelections(); if (rows.length == 0) { - $.modal.alertWarning("请选择一个用户"); + $.modal.alertWarning("请选择一个项目"); return; } $('#projectNameBox').text(rows[0].projectName) @@ -486,6 +525,9 @@ $('[name="partnerCode"]').val(rows[0].partnerCode); $('[name="partnerName"]').val(rows[0].partnerName); $('[name="level"]').val(rows[0].level); + $('[name="partnerPeople"]').val(rows[0].contactPerson); + $('[name="partnerPhone"]').val(rows[0].contactPhone); + $.modal.close(index); } @@ -534,7 +576,7 @@ ${softwareProjectProductInfoList.map((ele) => { -删除 +删除 `) $('#productTable tbody').append(tr) @@ -571,7 +613,7 @@ ${hardwareProjectProductInfoList.map((ele) => { -删除 +删除 `) $('#productTable2 tbody').append(tr) @@ -608,7 +650,7 @@ ${maintenanceProjectProductInfoList.map((ele) => { -删除 +删除 `) $('#productTable3 tbody').append(tr) @@ -790,7 +832,7 @@ ${maintenanceProjectProductInfoList.map((ele) => { const file = event.target.files[0]; let data = new FormData() data.append('file', file) - data.append('projectId', $('[name="projectId"]').val()) + data.append('orderId', $('[name="orderId"]').val()) var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象 xhr.open('POST', prefix + '/importContractData', true); // 设置请求类型和URL @@ -799,9 +841,7 @@ ${maintenanceProjectProductInfoList.map((ele) => { let data = JSON.parse(res.currentTarget.response) if (data.code === 0) { $.modal.msgSuccess('导入成功'); - data.data.forEach((row) => { - addFile(row) - }) + addFile(data.data) } else { $.modal.msgError(data.msg || '导入失败'); } @@ -818,21 +858,30 @@ ${maintenanceProjectProductInfoList.map((ele) => { }); function importList() { - if (!$('[name="projectId"]').val()) { - $.modal.alertWarning("请先选择项目"); - return - } $('#uploadInput').click() } - function addFile() { + function addFile(data) { + let length = $('#fileBox tbody').find('tr').length + let filterArr = ['fileName', 'createBy', 'uploadTime'] + let keys = Object.keys(data).filter((ele) => filterArr.indexOf(ele) < 0) let tr = $(` - - - + +${ + keys.map((ele) => { + return `` + }).join('') + } + + + +预览下载删除 `) $('#fileBox tbody').append(tr) + $('.delfile').on('click', function () { + $(this).parent().parent().remove() + }) } @@ -853,6 +902,18 @@ ${maintenanceProjectProductInfoList.map((ele) => { }) : '' }) } + + function downFile(filePath) { + $.operate.get(prefix + `/file/download?filePath=${filePath}`, function (res) { + window.location.href = res.data + }) + } + + function preview(filePath) { + $.operate.get(prefix + `/file/download?filePath=${filePath}`, function (res) { + window.open(res.data) + }) + } \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/project/order/edit.html b/ruoyi-admin/src/main/resources/templates/project/order/edit.html index 60d0f2ef..21fb1800 100644 --- a/ruoyi-admin/src/main/resources/templates/project/order/edit.html +++ b/ruoyi-admin/src/main/resources/templates/project/order/edit.html @@ -1,214 +1,924 @@ - + - - + + + -
    -
    - -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - - - + initData() + }) + + function searchProject() { + var url = prefix + "/selectProject"; + var options = { + title: '选择客户', + width: "680", + url: url, + height: '600', + callBack: doSubmitProject + }; + $.modal.openOptions(options); + } + + function selectPartner() { + var url = prefix + "/selectPartner"; + var options = { + title: '选择代理商', + width: "680", + height: '600', + url: url, + callBack: doSubmitPartner + }; + $.modal.openOptions(options); + } + + function selectPeople() { + var url = prefix + "/selectPeople"; + var options = { + title: '选择代理商', + width: "680", + height: '600', + url: url, + callBack: doSubmitPeople + }; + $.modal.openOptions(options); + } + + 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="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); + initProjectList() + $.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); + $('[name="level"]').val(rows[0].level); + $('[name="partnerPeople"]').val(rows[0].contactPerson); + $('[name="partnerPhone"]').val(rows[0].contactPhone); + + + $.modal.close(index); + } + + function initData() { + changeBg() + } + + function doSubmitPeople(index, layero) { + var rows = layero.find("iframe")[0].contentWindow.getSelections(); + if (rows.length == 0) { + $.modal.alertWarning("请选择一个代理商"); + return; + } + $('[name="duty"]').val(rows[0].userId); + $('[name="dutyName"]').val(rows[0].userName); + $('[name="dutyPhone"]').val(rows[0].phonenumber); + $('[name="dutyEmail"]').val(rows[0].email); + + + $.modal.close(index); + } + + + // 添加软件 + function addProduct(data) { + let length = $('#productTable tbody').find('tr').length + let tr = $(` + +${length + 1} + + + + + + + + + + + + +删除 + +`) + $('#productTable tbody').append(tr) + initSearchProduct('1') + initPrice() + } + + function addProduct2(data) { + let length = $('#productTable2 tbody').find('tr').length + let tr = $(` + +${length + 1} + + + + + + + + + + + + +删除 + +`) + $('#productTable2 tbody').append(tr) + initSearchProduct('2') + initPrice() + } + + function addProduct3(data) { + let length = $('#productTable3 tbody').find('tr').length + let tr = $(` + +${length + 1} + + + + + + + + + + + + +删除 + +`) + $('#productTable3 tbody').append(tr) + initSearchProduct('11,22') + initPrice() + } + + function addLog() { + let length = $('#workLog tbody').find('tr').length + let tr = $(` + +${length + 1} + + + +`) + $('#workLog tbody').append(tr) + + } + + 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) + }) + $('.layui-input').on('mouseout', function () { + $(this).blur() + }) + }) + $('.productTable .delRow').on('click', function () { + let ele = $(this) + $.modal.confirm('是否确认删除', function () { + $(ele).parent().parent().remove() + $('#productTable tbody tr').each((index, item) => { + $(item).find('.indexBox').text(index + 1) + }) + $('#productTable2 tbody tr').each((index, item) => { + $(item).find('.indexBox').text(index + 1) + }) + $('#productTable3 tbody tr').each((index, item) => { + $(item).find('.indexBox').text(index + 1) + }) + + }); + }) + } + + function searchProduct(val, type, ele) { + 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) + } + $(ele).parent().parent().find('.productDesc').val(selectObj.description) + } + + 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 changeBg() { + if ($('[name="bgProperty"]').val() != 'YYS') { + let datas = [[${@dict.getType('bg_hysy')}]] + let str = `` + datas.forEach((ele) => { + str += ` ` + }) + $('#industryTypeBox').html(` + + `) + } else { + let datas = [[${@dict.getType('bg_yys')}]] + let str = `` + datas.forEach((ele) => { + str += ` ` + }) + $('#industryTypeBox').html(` + + `) + } + } + + function downloadTem() { + var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象 + if (!$('[name="orderChannel"]').val()) { + $.modal.alertWarning("请先选择下单通路"); + return + } + if ($('[name="orderChannel"]').val() == 1) { + window.location.href = prefix + "/contract/export?fileName=文件111.xlsx" + } 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('orderId', $('[name="id"]').val()) + + var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象 + xhr.open('POST', prefix + '/importContractData', true); // 设置请求类型和URL + // 当请求完成时执行的回调函数 + xhr.onload = function (res) { + let data = JSON.parse(res.currentTarget.response) + if (data.code === 0) { + $.modal.msgSuccess('导入成功'); + addFile(data.data) + } else { + $.modal.msgError(data.msg || '导入失败'); + } + $('#uploadInput').val('') + + }; + + // 当请求发生错误时执行的回调函数 + xhr.onerror = function () { + console.log('上传过程中发生错误'); + }; + // // 发送数据到服务器 + xhr.send(data); + }); + + function importList() { + $('#uploadInput').click() + } + + function addFile(data) { + let length = $('#fileBox tbody').find('tr').length + let filterArr = ['fileName', 'createBy', 'uploadTime'] + let keys = Object.keys(data).filter((ele) => filterArr.indexOf(ele) < 0) + let tr = $(` + + +${ + keys.map((ele) => { + return `` + }).join('') + } + + + +预览下载删除 +`) + $('#fileBox tbody').append(tr) + $('.delfile').on('click', function () { + $(this).parent().parent().remove() + }) + + } + + function initProjectList() { + let id = $('[name="projectId"]').val() + $.operate.get(ctx + `sip/project/query/${id}`, function (res) { + $('#productTable tbody').html('') + $('#productTable2 tbody').html('') + $('#productTable3 tbody').html('') + res.data.softwareProjectProductInfoList ? res.data.softwareProjectProductInfoList.forEach((ele) => { + addProduct(ele) + }) : '' + res.data.hardwareProjectProductInfoList ? res.data.hardwareProjectProductInfoList.forEach((ele) => { + addProduct2(ele) + }) : '' + res.data.maintenanceProjectProductInfoList ? res.data.maintenanceProjectProductInfoList.forEach((ele) => { + addProduct3(ele) + }) : '' + }) + } + + function downFile(filePath) { + $.operate.get(prefix + `/file/download?filePath=${filePath}`, function (res) { + window.location.href = res.data + }) + } + + function preview(filePath) { + $.operate.get(prefix + `/file/download?filePath=${filePath}`, function (res) { + window.open(res.data) + }) + } + \ No newline at end of file