• jsp获取数据 jsp直接获取后端数据 获取input选中的值 单选 没 checked属性


    1. let str0='${showList}';
    2. let str1=${showList};

    然后可以通过JSON.parse() 转

    获取input选中的值

    1. //goodsType 按类别 goods按货品
    2. var oneType= $("input[ name='criteria1' ] ").val();
    3. //count按数量 totalprice按费用
    4. var twoType = $("input[ name='criteria2' ] ").val();

    获取的是 下面红框中的值 

    1. <script language="javascript">
    2. function querytr(){
    3. var startDate = document.getElementById("startDate");
    4. var endDate = document.getElementById("endDate");
    5. if(startDate.value != "" && endDate.value!= "" && (startDate.value > endDate.value)){
    6. parent.win.generalAlert("起始日期不能大于终止日期");
    7. return false;
    8. }
    9. document.all.query.click();
    10. }
    11. function exptr(){
    12. var startDate = document.getElementById("startDate");
    13. var endDate = document.getElementById("endDate");
    14. if(startDate.value != "" && endDate.value!= "" && (startDate.value > endDate.value)){
    15. parent.win.generalAlert("起始日期不能大于终止日期");
    16. return false;
    17. }
    18. document.all.exp.click();
    19. }
    20. // function fc(startDate,endDate){
    21. // Ext.Ajax.request({
    22. // method : 'POST',
    23. // url: 'servlet/wareStockOutCountAnalyseChartServlet',
    24. // params:{startDate:startDate,endDate:endDate},
    25. // success: function(request){
    26. // if(request.responseText != ""){
    27. // var data = request.responseText;
    28. // chart(data);
    29. // }
    30. // }
    31. // });
    32. // }
    33. // function chart(data){
    34. // if(document.forms[0].criteria1.value== "" || document.forms[0].criteria1.value== "goods"){
    35. // var chart = new FusionCharts('js/fc/Bar2D.swf?ChartNoDataText=无数据', "ChartId", "1000", "400");
    36. // }else if(document.forms[0].criteria2.value== ""){
    37. // var chart = new FusionCharts('js/fc/Bar2D.swf?ChartNoDataText=无数据', "ChartId", "1000", "400");
    38. // }else if(document.forms[0].criteria2.value== "count"){
    39. // var chart = new FusionCharts('js/fc/Bar2D.swf?ChartNoDataText=无数据', "ChartId", "1000", "400");
    40. // }else{
    41. // var chart = new FusionCharts('js/fc/Pie2D.swf?ChartNoDataText=无数据', "ChartId", "1000", "400");
    42. // }
    43. //
    44. // chart.addParam("wmode","Opaque");
    45. // chart.setDataXML(data);
    46. // chart.render('Chart');
    47. // }
    48. function fcPicture(){
    49. let title = "";
    50. let dataY = [];
    51. let dataX = [];
    52. let str0='${showList}';
    53. let showList = str0.replace(/[\\]/g,'/');
    54. // console.log(showList ,"出库情况统计");
    55. //goodsType 按类别 goods按货品
    56. var oneType= $("input[ name='criteria1' ] ").val();
    57. //count按数量 totalprice按费用
    58. var twoType = $("input[ name='criteria2' ] ").val();
    59. if(oneType === "goodsType"){
    60. //按类别 + 按数量;
    61. title = "货品分类出库数量统计(前十)";
    62. let arr = JSON.parse(showList)
    63. if(twoType === "count"){
    64. arr.forEach((item,index)=>{
    65. dataY.push(item[2]);
    66. dataX.push(item[3])
    67. })
    68. }else{
    69. //按类别 + 按费用 ---- 饼图
    70. bingPicture();
    71. return
    72. }
    73. }else{
    74. // 按货品 + 按数量;
    75. title = "货品出库数量统计(前十)";
    76. let arr = JSON.parse(showList)
    77. if(twoType === "count"){
    78. arr.forEach((item,index)=>{
    79. dataY.push(item[2]);
    80. dataX.push(item[7])
    81. })
    82. }else{
    83. //按货品 + 按费用
    84. title = "货品出库费用统计(前十)";
    85. arr.forEach((item,index)=>{
    86. dataY.push(item[2]);
    87. dataX.push(item[9])
    88. })
    89. }
    90. }
    91. // console.log(oneType,twoType,"111111111111111111")
    92. let chartDom = document.getElementById('Chart');
    93. let myChart = echarts.init(chartDom);
    94. let option = {
    95. backgroundColor: 'white',
    96. title: {
    97. text: title,
    98. left: 'center',
    99. top: "20",
    100. // padding: [10, 0, 0, 50],
    101. textStyle: {
    102. color: "#000",
    103. fontFamily: "Alibaba PuHuiTi",
    104. fontSize: 14,
    105. fontWeight: 600,
    106. // padding: [0, 0, 0, 35]
    107. },
    108. },
    109. tooltip: { show: false },
    110. grid: { left: 10, top: 50, bottom: 20, right: 80, containLabel: true },
    111. xAxis: {
    112. type: 'value',
    113. boundaryGap: false,
    114. // max: 20, // Math.ceil(max / 4) * 5 || 10
    115. axisLine: { show: true, lineStyle: { color: '#ccc' } },
    116. axisTick: { show: false },
    117. axisLabel: { color: '#999' },
    118. splitLine: { lineStyle: { color: ['#CEEDFF'], type: [5, 8], dashOffset: 3 } },
    119. min:0,
    120. max:dataX.length === 0 ? 1000 :null
    121. },
    122. yAxis: {
    123. type: 'category',
    124. data: dataY,
    125. axisLine: { show: true, lineStyle: { color: '#ccc' } },
    126. axisTick: { length: 3 },
    127. axisLabel: { fontSize: 14, color: '#666', margin: 16, padding: 0 },
    128. inverse: true,
    129. },
    130. series: [
    131. {
    132. name: '数量',
    133. type: 'bar',
    134. itemStyle: {
    135. color: '#52A8FF',
    136. color: function (params) {
    137. // 定义一个颜色集合
    138. let colorList = [
    139. '#52A8FF',
    140. '#00B389',
    141. '#FFA940',
    142. '#FF5A57',
    143. '#29EFC4',
    144. '#F8AEA4',
    145. '#FFC53D',
    146. '#009982',
    147. '#C099FC',
    148. '#F5855F',
    149. '#52A8FF',
    150. '#00B389',
    151. '#FFA940',
    152. '#FF5A57',
    153. '#29EFC4',
    154. '#F8AEA4',
    155. '#FFC53D',
    156. '#009982',
    157. '#C099FC',
    158. '#F5855F',
    159. ];
    160. // 对每个bar显示一种颜色
    161. return colorList[params.dataIndex];
    162. },
    163. },
    164. barMaxWidth: 20,
    165. label: { show: true, position: 'right', offset: [0, 2], fontSize: 16 },
    166. data: dataX,
    167. },
    168. ],
    169. };
    170. option && myChart.setOption(option);
    171. }
    172. function bingPicture(){
    173. let str0='${showList}';
    174. let showList = str0.replace(/[\\]/g,'/');;
    175. // console.log(showList ,"按类别 + 按费用");
    176. let arr0 = JSON.parse(showList);
    177. let arr=[];
    178. let total =0;
    179. arr0.forEach((item,index)=>{
    180. let obj={};
    181. // console.log(item,"888888888888")
    182. obj.name= item[2];
    183. obj.value = item[4];
    184. arr.push(obj);
    185. total+=item[4]
    186. })
    187. // console.log(arr,"777777777777777777777")
    188. let title="货品分类出库费用统计(合计:" + total.toFixed(2) + "元)";
    189. // let title="货品分类出库费用统计";
    190. // let color = ['#ffc140', '#d151d8', 'red'];
    191. let option = {
    192. backgroundColor: 'white',
    193. // color: color,
    194. grid: {
    195. left: '5%',
    196. right: '5%',
    197. top: '20%',
    198. containLabel: true,
    199. },
    200. title: {
    201. text: title,
    202. show: true, // 是否显示标题,默认 true
    203. padding: [10, 0, 15, 0],
    204. textStyle: {
    205. color: "#23527c",
    206. fontSize: 14,
    207. fontFamily: "Alibaba PuHuiTi",
    208. fontWeight: 600,
    209. },
    210. left: 'center',
    211. },
    212. tooltip: {
    213. show: true,
    214. trigger: 'item',
    215. //{a}(系列名),{b}(数据项名),{c}(数值),{d}(百分比)
    216. formatter: "{b} : {c} ({d}%)",
    217. backgroundColor: "rgba(1, 13, 19, 0.5)",
    218. borderWidth: 0,
    219. textStyle: {
    220. color: "rgba(212, 232, 254, 1)",
    221. // fontSize: fontChart(0.24),
    222. },
    223. // extraCssText: "z-index:2"
    224. },
    225. series: [
    226. {
    227. // name: 'Access From',
    228. type: 'pie',
    229. radius: '50%',
    230. center: ['50%', '60%'],
    231. data: arr,
    232. label: {
    233. padding: [
    234. 15,
    235. 0,
    236. 0,
    237. 0
    238. ],
    239. color: "#4E5969",
    240. fontSize: 14,
    241. formatter: "{b|{b}}: {d|{c}} 元\n",
    242. rich: {
    243. b: {
    244. fontSize: 14,
    245. color: "#4E5969"
    246. },
    247. d: {
    248. fontSize: 14,
    249. fontWeight: 500,
    250. // fontFamily: "DINAlternate-Bold, DINAlternate",
    251. color: "#4E5969"
    252. }
    253. }
    254. },
    255. emphasis: {
    256. itemStyle: {
    257. shadowBlur: 10,
    258. shadowOffsetX: 0,
    259. shadowColor: 'rgba(0, 0, 0, 0.5)'
    260. },
    261. }
    262. }
    263. ]
    264. };
    265. let chartDom = document.getElementById('Chart');
    266. let myChart = echarts.init(chartDom);
    267. option && myChart.setOption(option);
    268. }
    269. function setCriteria(criteria,radioObj){
    270. if("goodsType" == criteria || "goods" == criteria){
    271. document.forms[0].criteria1.value = criteria;
    272. }else{
    273. document.forms[0].criteria2.value = criteria;
    274. }
    275. var arr = document.getElementsByName(radioObj.name);
    276. for(var i = 0;i<arr.length;i++){
    277. arr[i].value = "0";
    278. }
    279. radioObj.value = "1";
    280. }
    281. function initRadio(){
    282. if(document.forms[0].criteria1.value == 'goodsType'){
    283. document.getElementById('radio1').checked = "checked";
    284. }
    285. if(document.forms[0].criteria1.value == 'goods'){
    286. document.getElementById('radio2').checked = "checked";
    287. }
    288. if(document.forms[0].criteria2.value == 'count'){
    289. document.getElementById('radio3').checked = "checked";
    290. }
    291. if(document.forms[0].criteria2.value == 'totalprice'){
    292. document.getElementById('radio4').checked = "checked";
    293. }
    294. // fc()
    295. fcPicture()
    296. }
    297. </script>
    298. <style>
    299. #Chart{
    300. width: 100%;
    301. height: 500px;
    302. }
    303. </style>
    304. </head>
    305. <body
    306. onload="initRadio();">
    307. <div class="container-fluid">
    308. <span class="container-title"><span id="title">您现在所在的位置:查询统计 &gt
    309. 出库情况分析</span> </span>
    310. <div class="continer-box">
    311. <div class="innerpage">
    312. <html:form action="wareStockOutCountAnalyse.do"
    313. enctype="multipart/form-data">
    314. <html:submit property="query" value="query" style="display:none" />
    315. <html:submit property="exp" value="exp" style="display:none" />
    316. <html:hidden property="criteria1" />
    317. <html:hidden property="criteria2" />
    318. <html:hidden property="pageType" />
    319. <div class="search-box">
    320. <span class="search-title">查询条件
    321. <a href="javascript:void(0);" class="close-up"></a>
    322. </span>
    323. <div class="seach-text clearfix">
    324. <div class="box clearfix">
    325. <span>条件:</span>
    326. <div class="form-r">
    327. <input type="radio" id="radio1" name="groupName1" value="0"
    328. onclick="setCriteria('goodsType',this)" />
    329. 按类别
    330. <input type="radio" id="radio2" name="groupName1" value="1"
    331. onclick="setCriteria('goods',this)" />
    332. 按货品
    333. </div>
    334. </div>
    335. <div class="box clearfix">
    336. <span>条件:</span>
    337. <div class="form-r">
    338. <input type="radio" id="radio3" name="groupName2" value="1"
    339. onclick="setCriteria('count',this)" />
    340. 按数量
    341. <input type="radio" id="radio4" name="groupName2" value="0"
    342. onclick="setCriteria('totalprice',this)" />
    343. 按费用
    344. </div>
    345. </div>
    346. <div class="box box-time clearfix">
    347. <span>出库日期:</span>
    348. <div class="form-r">
    349. <div class="time-q">
    350. <div class="form-group">
    351. <div class="input-group date form_date" data-date=""
    352. data-date-format="" data-link-field="dtp_input2"
    353. data-link-format="yyyy-mm-dd">
    354. <html:text property="startDate" styleId="startDate" styleClass="form-control"
    355. readonly="true" />
    356. <span class="input-group-addon"> <span
    357. class="glyphicon glyphicon-calendar"> <img
    358. src="img_new/3-12_03.png"> </span> </span>
    359. </div>
    360. </div>
    361. </div>
    362. <span>~</span>
    363. <div class="time-h">
    364. <div class="form-group">
    365. <div class="input-group date form_date" data-date=""
    366. data-date-format="" data-link-field="dtp_input2"
    367. data-link-format="yyyy-mm-dd">
    368. <html:text property="endDate" styleId="endDate" styleClass="form-control"
    369. readonly="true" />
    370. <span class="input-group-addon"> <span
    371. class="glyphicon glyphicon-calendar"> <img
    372. src="img_new/3-12_03.png"> </span> </span>
    373. </div>
    374. </div>
    375. </div>
    376. </div>
    377. </div>
    378. <div class="box clearfix">
    379. <span>部门:</span>
    380. <div class="form-r">
    381. <html:select property="depId" styleClass="selectpicker">
    382. <logic:notEmpty name="depms">
    383. <html:options collection="depms" property="id"
    384. labelProperty="name" />
    385. </logic:notEmpty>
    386. </html:select>
    387. </div>
    388. </div>
    389. <div class="btn-right">
    390. <a class="btn btn-seach" href="#n" onClick="querytr();">查询</a>
    391. </div>
    392. </div>
    393. </div>
    394. <div id='Chart' align="center">
    395. </div>
    396. <div class="result-table">
    397. <span class="table-title"><i>出库情况分析</i>
    398. <div class="btn-right">
    399. <a class="btn btn-grey" href="#n" onClick="exptr();">导出</a>
    400. </div>
    401. </span>
    402. <div class="table-box">
    403. <table width="100%" class="dg" border="0">
    404. <col class="dgl"></col>
    405. <c:choose>
    406. <c:when test="${fn:length(wareStockInList[0]) == 10}">
    407. <tr class="dgh">
    408. <th>
    409. 货品编码
    410. </th>
    411. <th>
    412. 货品名称
    413. </th>
    414. <th>
    415. 规格型号
    416. </th>
    417. <th>
    418. 颜色
    419. </th>
    420. <th>
    421. 容量
    422. </th>
    423. <th>
    424. 品牌
    425. </th>
    426. <th>
    427. 出库总数量
    428. </th>
    429. <th>
    430. 单位
    431. </th>
    432. <th>
    433. 出库总价(元)
    434. </th>
    435. </tr>
    436. <logic:notEmpty name="wareStockInList">
    437. <logic:iterate id="wareStockIn" name="wareStockInList"
    438. indexId="rowID">
    439. <tr>
    440. <td class="companyname">
    441. ${wareStockIn[1]}
    442. </td>
    443. <td class="companyname">
    444. ${wareStockIn[2]}
    445. </td>
    446. <td class="companyname">
    447. ${wareStockIn[3]}
    448. </td>
    449. <td class="companyname">
    450. ${wareStockIn[4]}
    451. </td>
    452. <td class="companyname">
    453. ${wareStockIn[5]}
    454. </td>
    455. <td class="companyname">
    456. ${wareStockIn[6]}
    457. </td>
    458. <td class=jine>
    459. ${wareStockIn[7]}
    460. </td>
    461. <td class="companyname">
    462. ${wareStockIn[8]}
    463. </td>
    464. <td class="jine">
    465. <fmt:formatNumber pattern="#,##0.00">${wareStockIn[9]}</fmt:formatNumber>
    466. </td>
    467. </tr>
    468. </logic:iterate>
    469. </logic:notEmpty>
    470. </c:when>
    471. <c:otherwise>
    472. <tr class="dgh">
    473. <th>
    474. 分类编号
    475. </th>
    476. <th>
    477. 分类名称
    478. </th>
    479. <th>
    480. 出库总数量
    481. </th>
    482. <th>
    483. 出库总价(元)
    484. </th>
    485. </tr>
    486. <logic:notEmpty name="wareStockInList">
    487. <logic:iterate id="wareStockIn" name="wareStockInList"
    488. indexId="rowID">
    489. <tr>
    490. <td class="companyname">
    491. ${wareStockIn[1]}
    492. </td>
    493. <td class="companyname">
    494. ${wareStockIn[2]}
    495. </td>
    496. <td class="jine"">
    497. ${wareStockIn[3]}
    498. ">
    499. 0.00">${wareStockIn[4]}
    500. ">
    501. 0 5 0 5;" colspan="11" align="center">
    502. 无记录!
  • ">
  • size!=0 && !(wareStockOutCountAnalyseForm.criteria1 eq 'goodsType')}">
  • ">wareStockOutCountAnalyseForm
  • <%@ include file="/common/page.jsp"%>
  • 相关阅读:
    C语言 变量的存储和引用,内部和外部函数
    npm安装错误大全
    C++ STL(十) --------- 位图模拟实现
    【ES6 03】变量解构赋值
    Windows-Oracle19c 安装详解-含Navicate远程连接配置 - 同时连接Oracle11g和Oracle19c
    日语基础复习 Day 16
    基于java电子存证系统计算机毕业设计源码+系统+lw文档+mysql数据库+调试部署
    Spring5应用之AOP概念详解
    元数据的前世今生
    cube-studio 部署过程
  • 原文地址:https://blog.csdn.net/weixin_50885665/article/details/134074148