From d07c1877d3b1ae5157d28a979fa5c083fc96017c Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Fri, 31 May 2024 14:16:55 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E4=BF=AE=E6=94=B9=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E8=AE=A1=E5=88=92=EF=BC=8C=E9=87=87=E8=B4=AD=E6=8A=A5=E4=BB=B7?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BF=AE=E6=94=B9table=E7=9A=84js=E5=BC=95?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/purchase/purchasePlan/add.html | 37 +++++- .../purchase/purchasePlan/detail.html | 67 ++++++++-- .../templates/purchase/purchasePlan/edit.html | 16 --- .../templates/purchase/purchaseQuote/add.html | 2 +- .../purchase/purchaseQuote/edit.html | 125 +++++++++++++----- 5 files changed, 183 insertions(+), 64 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/add.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/add.html index de0e4ead..c881d3b3 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/add.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/add.html @@ -58,12 +58,47 @@ + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/edit.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/edit.html index 17259da3..5964af05 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/edit.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/edit.html @@ -78,22 +78,6 @@ -
- -
- -
-
-
- -
- -
-
diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/add.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/add.html index 1470e76e..af93512f 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/add.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/add.html @@ -270,7 +270,7 @@ /* 删除指定表格行 */ function removeRow(id){ $("#bootstrap-sub-table-requisitionChild").bootstrapTable('RemoveByUniqueId', { - field: 'id', + field: 'index', values: id }) } diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/edit.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/edit.html index 08ef3cab..feb1d514 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/edit.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/edit.html @@ -12,9 +12,9 @@
@@ -67,7 +67,10 @@
- +
+ + % +
@@ -163,9 +166,19 @@ $("#form-purchaseQuote-edit").validate({focusCleanup: true}); $(function() { var options = { - id:'bootstrap-sub-table-requisitionChild', - // url: ctx + "system/quoteChild/list", + id:'bootstrap-sub-table-purchaseQuoteChild', + url: ctx + "purchase/purchaseQuoteChild/list", pagination: false, + queryParams: function(params) { + var temp = { + pageSize: params.limit, + pageNum: params.offset / params.limit + 1, + sortName: params.sort, + sortOrder: params.order, + purchaseQuoteCode: $("#purchaseQuoteCode_edit").val(), + } + return temp; + }, sidePagination: "client", model: "物料报价信息", columns: [ @@ -203,8 +216,8 @@ }, {title:'最新报价',field: 'materialSole',align: 'center',}, {title: '物料的数量', field: 'materialNum',align: 'center',editable: true,}, - {title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',}, - {title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',}, + {title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',editable: true,}, + {title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',editable: true,}, {title: '录入人',field: 'createBy',align: 'center',visible: false}, {title: '录入时间',field: 'createTime',align: 'center',visible: false }, {title: '更新人',field: 'updateBy',align: 'center',visible: false}, @@ -213,13 +226,16 @@ {title: '操作', align: 'center', formatter: function (value, row, index) { var actions = []; - actions.push('删除 '); + actions.push('删除 '); return actions.join(''); } } ], }; $.table.init(options); + selectSupplier(); + $("#form-purchaseQuote-edit select[name='supplierQuoteCode']").val(purchaseQuote.supplierQuoteCode).trigger("change"); + $("#form-purchaseQuote-edit select[name='supplierName']").val(purchaseQuote.supplierName).trigger("change"); }); function doSubmit(index, layero,uniqueId){ console.log(uniqueId); @@ -259,10 +275,10 @@ $.modal.openOptions(options); } /* 删除指定表格行 */ - function removeRow(id){ - $("#bootstrap-sub-table-requisitionChild").bootstrapTable('remove', { - field: 'id', - values: id + function removeRow(index){ + $("#bootstrap-sub-table-purchaseQuoteChild").bootstrapTable('removeByUniqueId', { + field: 'index', + values: index }) } function submitHandler() { @@ -280,30 +296,75 @@ } } } - function selectSupplierName(){ - $.ajax({ - url: ctx + 'system/supplier/getSupplier', - type: "post", - dataType: "json", - success: function (res) { - if (res.rows.length > 0) { - var usertData = res.rows; - //alert(JSON.stringify(data)); - for (let i in usertData) { - // console.log(finishProductData[i].finishProductCode) - $("#form-purchaseQuote-add select[name='supplierQuoteCode']").append( - ""); - $("#form-purchaseQuote-add select[name='supplierName']").append( - ""); + function selectSupplier(){ + $("select[name='supplierQuoteCode']").select2({ + theme: "bootstrap", + allowClear: true, + placeholder: "请选择供应商", + ajax: { + url: ctx + "system/supplier/getSupplier", + type: "post", + dataType: "json", + delay: 250, + processResults: function (res, params) { + var resultList = res.rows; + var options = []; + for (let i in resultList) { + var option = resultList[i]; + option.id = resultList[i]["supplierCode"]; + option.text = resultList[i]["supplierCode"]; + option.title = resultList[i]["supplierName"]; + options.push(option); } - $("#form-purchaseQuote-add select[name='supplierQuoteCode']").val(purchaseQuote.supplierQuoteCode); - $("#form-purchaseQuote-add select[name='supplierName']").val(purchaseQuote.supplierName); - } else { - $.modal.msgError(res.msg); - } + return {results: options,} + }, + escapeMarkup: function (markup) {return markup;}, + } + }); + $("select[name='supplierName']").select2({ + theme: "bootstrap", + allowClear: true, + placeholder: "请选择供应商", + ajax: { + url: ctx + "system/supplier/getSupplier", + type: "post", + dataType: "json", + delay: 250, + processResults: function (res, params) { + var resultList = res.rows; + var options = []; + for (let i in resultList) { + var option = resultList[i]; + option.id = resultList[i]["supplierName"]; + option.text = resultList[i]["supplierName"]; + options.push(option); + } + return {results: options,} + }, + escapeMarkup: function (markup) {return markup;}, } }); } + $("#form-purchaseQuote-edit select[name='supplierQuoteCode']").on("select2:select",function (e) { + var dataObj = e.params.data; + console.log("codeData",dataObj); + $("#form-purchaseQuote-edit select[name='supplierName']").val(dataObj.supplierName).trigger("change"); + }); + $("#form-purchaseQuote-edit select[name='supplierName']").on("select2:select",function (e) { + var dataObj = e.params.data; + console.log("nameData",dataObj); + $("#form-purchaseQuote-edit select[name='supplierQuoteCode']").val(dataObj.supplierCode).trigger("change"); + }); + $("#form-purchaseQuote-edit select[name='supplierQuoteCode']").on("select2:select",function (e) { + var dataObj = e.params.data; + console.log("codeData",dataObj); + $("#form-purchaseQuote-edit select[name='supplierName']").val(dataObj.supplierName).trigger("change"); + }); + $("#form-purchaseQuote-edit select[name='supplierName']").on("select2:select",function (e) { + var dataObj = e.params.data; + console.log("nameData",dataObj); + $("#form-purchaseQuote-edit select[name='supplierQuoteCode']").val(dataObj.supplierCode).trigger("change"); + }); $("input[name='pricingDate']").datetimepicker({ format: "yyyy-mm-dd", minView: "month",