see.html 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. {extend name='main'}
  2. {block name="button"}
  3. {if auth("add")}
  4. <button class="layui-btn" style="height: 30px;line-height:28px;background-color: #DC2219;color: #FFFFFF;border: 1px solid #C9C9C9 " type='button' onclick="window.history.back()">返 回</button>
  5. {/if}
  6. {/block}
  7. {block name="content"}
  8. <style>
  9. .tu{
  10. width: 75%;height:600px;float: left
  11. }
  12. .layui-table td, .layui-table th, .layui-table-col-set, .layui-table-fixed-r, .layui-table-grid-down, .layui-table-header, .layui-table-page, .layui-table-tips-main, .layui-table-tool, .layui-table-total, .layui-table-view{
  13. border: none !important;
  14. }
  15. .layui-table{
  16. background-color:initial !important;
  17. }
  18. </style>
  19. <div class="layui-tab">
  20. <input type="hidden" id="subjects" value="{$subjects}">
  21. <input type="hidden" id="ids" value="{$ids}">
  22. <ul class="layui-tab-title">
  23. <li class="layui-this" onclick="change()">不含增值税测算成本 (万元)</li>
  24. <li onclick="change1()">增值税总额</li>
  25. <li onclick="change2()">含增值税测算成本</li>
  26. <li onclick="change3()">建面单方成本指标(不含税)</li>
  27. <li onclick="change4()">建面单方成本指标(含税)</li>
  28. <li onclick="change5()">可售单方成本指标(不含税)</li>
  29. <li onclick="change6()">可售单方成本指标(含税)</li>
  30. </ul>
  31. <div class="layui-tab-content" style="height: 100px;">
  32. <div class="layui-tab-item layui-show" style="width:100%;">
  33. <div id="main" class="tu"></div>
  34. </div>
  35. <div class="layui-tab-item" style="width:100%;">
  36. <div id="main1" class="tu" ></div>
  37. </div>
  38. <div class="layui-tab-item" style="width:100%;">
  39. <div id="main2" class="tu" ></div>
  40. </div>
  41. <div class="layui-tab-item" style="width:100%;">
  42. <div id="main3" class="tu"></div>
  43. </div>
  44. <div class="layui-tab-item" style="width:100%;">
  45. <div id="main4" class="tu"></div>
  46. </div>
  47. <div class="layui-tab-item" style="width:100%;">
  48. <div id="main5" class="tu"></div>
  49. </div>
  50. <div class="layui-tab-item" style="width:100%;">
  51. <div id="main6" class="tu"></div>
  52. </div>
  53. <div style="width: 25%;float: right">
  54. <table class="layui-table margin-top-10">
  55. <tr>
  56. <th style="font-weight:bold">样本名称</th>
  57. <th style="font-weight:bold">数值</th>
  58. <th style="font-weight:bold">备注</th>
  59. </tr>
  60. <tbody id="right">
  61. </tbody>
  62. </table>
  63. </div>
  64. </div>
  65. </div>
  66. <script type="text/javascript">
  67. setinfo('main','costs_are_excluded')
  68. function change () {
  69. setinfo('main','costs_are_excluded')
  70. }
  71. function change1 () {
  72. // setTimeout(() => {
  73. // // 基于准备好的dom,初始化echarts实例
  74. // var myChart1 = echarts.init(document.getElementById('main1'));
  75. // // 指定图表的配置项和数据
  76. // var option1 = {
  77. // title: {
  78. // text: ''
  79. // },
  80. // tooltip: {},
  81. // legend: {
  82. // // data: ['销量']
  83. // },
  84. // xAxis: {
  85. // axisLabel:{
  86. // interval:0,
  87. // // rotate:20
  88. // },
  89. // data:result1.data.total_vat.title
  90. // },
  91. // yAxis: {},
  92. // series: [
  93. // {
  94. // name: result1.data.subjects,
  95. // type: 'bar',
  96. // data:result1.data.total_vat.value
  97. // }
  98. // ]
  99. // };
  100. // // 使用刚指定的配置项和数据显示图表。
  101. // myChart1.setOption(option1);
  102. // },200)
  103. setinfo('main1','total_vat')
  104. }
  105. function change2 () {
  106. setinfo('main2','measurement_cost')
  107. }
  108. function change3 () {
  109. setinfo('main3','unilateral_cost_indicator')
  110. }
  111. function change4 () {
  112. setinfo('main4','single_cost_indicator')
  113. }
  114. function change5 () {
  115. setinfo('main5','single_party_cost_tax')
  116. }
  117. function change6 () {
  118. setinfo('main6','single_party_cost_no_tax')
  119. }
  120. //ajax获取数据
  121. function setinfo(where,field) {
  122. var subjects = $("#subjects").val()
  123. var ids = $("#ids").val()
  124. var value = {subjects:subjects,ids:ids,field:field}
  125. $.ajax({
  126. url:"/admin/main_project/get_see_info",
  127. type:'get',
  128. data:value
  129. ,success:function(result){
  130. console.log(result);
  131. setchart(where,result,field);
  132. var arr = result.data.right;
  133. htmlright(arr)
  134. }
  135. });
  136. }
  137. //画图
  138. function setchart(where,result,field) {
  139. var len = result.data.field.title.length
  140. var xname = ''
  141. if (field=='costs_are_excluded'){
  142. xname = '不含增值税测算成本 (万元)'
  143. }else if (field=='total_vat'){
  144. xname = '增值税总额';
  145. }else if (field=='measurement_cost'){
  146. xname = '含增值税测算成本';
  147. }else if (field=='unilateral_cost_indicator'){
  148. xname = '单方成本指标(不含税)';
  149. }else if (field=='single_cost_indicator'){
  150. xname = '单方成本指标(含税)';
  151. }else if (field=='single_party_cost_tax'){
  152. xname = '可售单方成本指标(不含税)';
  153. }else if (field=='single_party_cost_no_tax'){
  154. xname = '可售单方成本指标(含税)';
  155. }
  156. var cid = document.getElementById(where)
  157. //echarts重新渲染
  158. if (cid.hasAttribute("_echarts_instance_"))
  159. cid.removeAttribute("_echarts_instance_")
  160. // 基于准备好的dom,初始化echarts实例
  161. var myChart = echarts.init(cid);
  162. // 指定图表的配置项和数据
  163. var option = {
  164. title: {
  165. text: ''
  166. },
  167. tooltip: {},
  168. legend: {
  169. // data: ['销量']
  170. },
  171. xAxis: {
  172. show:true,
  173. name:xname,
  174. nameTextStyle:{ //---坐标轴名称样式
  175. padding:[40,100,-50,-105], //---坐标轴名称相对位置
  176. },
  177. axisLabel:{
  178. interval:0,
  179. // rotate:20
  180. formatter: function (value) {
  181. value = value.replace(/[^\x00-\xff]/g, "$&\x01").replace(/.{12}\x01?/g, "$&\n").replace(/\x01/g, "");
  182. return value;
  183. }
  184. },
  185. //data: ['100-113.8', '113.8-127.6', '127.6-141.4', '141.4-155.2', '155.2-169', '155.2-169', '155.2-169', '155.2-169', '155.2-169', '155.2-169']
  186. data:result.data.field.title
  187. },
  188. yAxis: {
  189. show:true,
  190. name:'工程数量',
  191. nameTextStyle:{ //---坐标轴名称样式
  192. padding:[5,100,-20,15], //---坐标轴名称相对位置
  193. },
  194. },
  195. series: [
  196. {
  197. name: result.data.subjects,
  198. type: 'bar',
  199. barMaxWidth:'10%',
  200. label:{
  201. show:true,
  202. position:'top',
  203. color:'#000000'
  204. },
  205. // data: [5, 0, 36, 10, 12, 14, 13, 30, 40, 1076872]
  206. data:result.data.field.value
  207. }
  208. ]
  209. };
  210. myChart.setOption(option);
  211. }
  212. //填充右边栏
  213. function htmlright(arr) {
  214. if (arr.length>0) {
  215. var html = '';
  216. for (var i = 0; i < arr.length; i++) {
  217. var tag = arr[i];
  218. html += '<tr>' +
  219. '<th style="color:red;">' + tag.project_name + '</th>' +
  220. '<th>' + tag.value + '</th>' +
  221. '<th>' + tag.note + '</th>' +
  222. '</tr>';
  223. }
  224. $('#right').html(html);
  225. }
  226. }
  227. </script>
  228. {/block}