diff --git a/ruoyi-admin/src/main/resources/templates/financial/compantFixedAssets/add.html b/ruoyi-admin/src/main/resources/templates/financial/compantFixedAssets/add.html index a7695515..b8332235 100644 --- a/ruoyi-admin/src/main/resources/templates/financial/compantFixedAssets/add.html +++ b/ruoyi-admin/src/main/resources/templates/financial/compantFixedAssets/add.html @@ -9,18 +9,16 @@
- +
-
- +
- - +
@@ -50,25 +48,19 @@
- +
- +
-
-
- -
- -
-
@@ -99,19 +91,19 @@
-
- +
- +
@@ -120,16 +112,16 @@
- +
- +
- + %
@@ -152,6 +144,12 @@
+
+ +
+ +
+
@@ -167,46 +165,73 @@ var prefix = ctx + "financial/compantFixedAssets" $("#form-compantFixedAssets-add").validate({focusCleanup: true}); //获取物料料号,物料名称 - $(function(){ + $(function() { + getSelections(); $("#compant_materialCode").select2({ theme: "bootstrap", allowClear: true, - placeholder: "请选择物料", - ajax:{ - type: "post", - url:ctx + "erp/material/getMaterialSelList", - dataType:"json", - delay:250, - cache:true, + placeholder: "请选择一个料号", + ajax: { + type: "get", + url: ctx + "erp/material/getMaterialAllList", + dataType: "json", + delay: 250, + timeout: 10000, // 设置超时时间为10秒 + cache: true, processResults: function (res, params) { - var resultList = res.data; var options = []; - for(let i in resultList){ - var option = resultList[i]; - option.id = resultList[i]["materialNo"]; - option.text = resultList[i]["materialNo"]; - option.title = resultList[i]["materialName"]; - options.push(option); + if (res.code == 0) { + var resultList = res.data; + console.log(resultList); + for (var i = 0, len = resultList.length; i < len; i++) { + var option = resultList[i]; + option.id = resultList[i]["materialNo"]; + option.text = resultList[i]["materialNo"]; + options.push(option); + } + return { + results: options + } } - return {results: options,pagination: {}}; + ; + return { + results: [] + }; + }, + escapeMarkup: function (markup) { + return markup; }, - escapeMarkup: function (markup) { return markup; }, - // minimumInputLength: 1 + minimumInputLength: 1, } }); - }); - - $("#compant_materialCode").on('select2:select', function (e){ - var dataObj = e.params.data; - console.log(dataObj); - $("input[name='materialName']").val(dataObj.materialName).trigger('change'); + $('#compant_materialCode').on('select2:select', function (e) { + var data = e.params.data; + $("input[name='materialName']").val(data.materialName); + }); }); function submitHandler() { if ($.validate.form()) { $.operate.save(prefix + "/add", $('#form-compantFixedAssets-add').serialize()); } } + function getSelections(){ + $.ajax({ + url: ctx + "system/dept/selectDeptList", + type: "get", + dataType: "json", + success: function (result) { + var deptDatas = result.data; + console.log(deptDatas); + deptDatas.forEach(function (dept){ + $('#department').append($('