see.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. {extend name='main'}
  2. {block name="button"}
  3. {if auth("add")}
  4. <button class="layui-btn layui-bg-red" style="height: 30px;line-height:28px;color: #333;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="change7()">可售单方成本(含税)</li>
  28. <li onclick="change8()">可售单方成本(不含税)</li>
  29. <li onclick="change4()">工程量</li>
  30. <li onclick="change5()">建面单方含量</li>
  31. <li onclick="change6()">可售单方含量</li>
  32. <li onclick="change9()">预留指标1</li>
  33. <li onclick="change10()">预留指标2</li>
  34. </ul>
  35. <div class="layui-tab-content" style="height: 100px;">
  36. <div class="layui-tab-item layui-show" style="width:100%;">
  37. <div id="main" class="tu"></div>
  38. </div>
  39. <div class="layui-tab-item" style="width:100%;">
  40. <div id="main1" class="tu" ></div>
  41. </div>
  42. <div class="layui-tab-item" style="width:100%;">
  43. <div id="main2" class="tu" ></div>
  44. </div>
  45. <div class="layui-tab-item" style="width:100%;">
  46. <div id="main3" class="tu"></div>
  47. </div>
  48. <div class="layui-tab-item" style="width:100%;">
  49. <div id="main7" class="tu"></div>
  50. </div>
  51. <div class="layui-tab-item" style="width:100%;">
  52. <div id="main8" class="tu"></div>
  53. </div>
  54. <div class="layui-tab-item" style="width:100%;">
  55. <div id="main4" class="tu"></div>
  56. </div>
  57. <div class="layui-tab-item" style="width:100%;">
  58. <div id="main5" class="tu"></div>
  59. </div>
  60. <div class="layui-tab-item" style="width:100%;">
  61. <div id="main6" class="tu"></div>
  62. </div>
  63. <div class="layui-tab-item" style="width:100%;">
  64. <div id="main9" class="tu"></div>
  65. </div>
  66. <div class="layui-tab-item" style="width:100%;">
  67. <div id="main10" class="tu"></div>
  68. </div>
  69. <div style="width: 25%;float: right">
  70. <table class="layui-table margin-top-10">
  71. <tr >
  72. <th style="font-weight:bold">样本名称</th>
  73. <th style="font-weight:bold">数值</th>
  74. <th style="font-weight:bold">备注</th>
  75. </tr>
  76. <tbody id="right">
  77. </tbody>
  78. </table>
  79. </div>
  80. </div>
  81. </div>
  82. <script type="text/javascript">
  83. setinfo('main','single_party_cost')
  84. function change () {
  85. setinfo('main','single_party_cost')
  86. }
  87. function change1 () {
  88. setinfo('main1','total_price_included')
  89. }
  90. function change2 () {
  91. setinfo('main2','single_party_cost_excluding')
  92. }
  93. function change3 () {
  94. setinfo('main3','total_price_included_excluding')
  95. }
  96. function change4 () {
  97. setinfo('main4','quantities')
  98. }
  99. function change5 () {
  100. setinfo('main5','unilateral_content')
  101. }
  102. function change6 () {
  103. setinfo('main6','unilateral_content_excluding')
  104. }
  105. function change7 () {
  106. setinfo('main7','single_party_cost_tax')
  107. }
  108. function change8 () {
  109. setinfo('main8','single_party_cost_no_tax')
  110. }
  111. function change9 () {
  112. setinfo('main9','saleable_single_party_tax')
  113. }
  114. function change10 () {
  115. setinfo('main10','saleable_single_party_no_tax')
  116. }
  117. //ajax获取数据
  118. function setinfo(where,field) {
  119. var subjects = $("#subjects").val()
  120. var ids = $("#ids").val()
  121. var value = {subjects:subjects,ids:ids,field:field}
  122. $.ajax({
  123. url:"/admin/child_project/get_see_info",
  124. type:'get',
  125. data:value
  126. ,success:function(result){
  127. setchart(where,result,field)
  128. var arr = result.data.right;
  129. htmlright(arr)
  130. }
  131. });
  132. }
  133. //画图
  134. function setchart(where,result,field) {
  135. // console.log(result)
  136. // console.log(result.data.field.title.length)
  137. var len = result.data.field.title.length
  138. var xname = ''
  139. if (field=='single_party_cost'){
  140. xname = '建面单方成本(元/m2)(含税)'
  141. }else if (field=='total_price_included'){
  142. xname = '总价(万元)(含税)';
  143. }else if (field=='single_party_cost_excluding'){
  144. xname = '建面单方成本(元/m2)(不含税)';
  145. }else if (field=='total_price_included_excluding'){
  146. xname = '总价(万元)(不含税)';
  147. }else if (field=='quantities'){
  148. xname = '工程量(含税)';
  149. }else if (field=='unilateral_content'){
  150. xname = '建面单方含量';
  151. }else if (field=='unilateral_content_excluding'){
  152. xname = '可售单方含量';
  153. }else if (field=='single_party_cost_tax'){
  154. xname = '可售单方成本(元/m2)(含税)';
  155. }else if (field=='single_party_cost_no_tax'){
  156. xname = '可售单方成本(元/m2)(不含税)';
  157. }else if (field=='saleable_single_party_tax'){
  158. xname = '预留指标1';
  159. }else if (field=='saleable_single_party_no_tax'){
  160. xname = '预留指标2';
  161. }
  162. var cid = document.getElementById(where)
  163. //echarts重新渲染
  164. if (cid.hasAttribute("_echarts_instance_"))
  165. cid.removeAttribute("_echarts_instance_")
  166. // 基于准备好的dom,初始化echarts实例
  167. var myChart = echarts.init(cid);
  168. // 指定图表的配置项和数据
  169. var option = {
  170. title: {
  171. text: ''
  172. },
  173. tooltip: {},
  174. legend: {
  175. // data: ['销量']
  176. },
  177. xAxis: {
  178. show:true,
  179. name:xname,
  180. nameTextStyle:{ //---坐标轴名称样式
  181. padding:[40,100,-65,-125], //---坐标轴名称相对位置
  182. },
  183. axisLabel:{
  184. interval:0,
  185. // rotate:20
  186. formatter: function (value) {
  187. value = value.replace(/[^\x00-\xff]/g, "$&\x01").replace(/.{12}\x01?/g, "$&\n").replace(/\x01/g, "");
  188. return value;
  189. }
  190. },
  191. data:result.data.field.title
  192. },
  193. yAxis: {
  194. show:true,
  195. name:'工程数量',
  196. nameTextStyle:{ //---坐标轴名称样式
  197. padding:[5,100,-20,15], //---坐标轴名称相对位置
  198. },
  199. },
  200. series: [
  201. {
  202. name: result.data.subjects,
  203. type: 'bar',
  204. barMaxWidth:'10%',
  205. // barMaxWidth:function (len) {
  206. // if (len>1){
  207. // return '0'
  208. // }else {
  209. // return '10%'
  210. // }
  211. // },
  212. label:{
  213. show:true,
  214. position:'top',
  215. color:'#000000'
  216. },
  217. data:result.data.field.value
  218. }
  219. ]
  220. };
  221. myChart.setOption(option);
  222. }
  223. //填充右边栏
  224. function htmlright(arr) {
  225. if (arr.length>0) {
  226. var html = '';
  227. for (var i = 0; i < arr.length; i++) {
  228. var tag = arr[i];
  229. html += '<tr>' +
  230. '<th style="color:red;">' + tag.project_name + '</th>' +
  231. '<th>' + tag.value + '</th>' +
  232. '<th>' + tag.note + '</th>' +
  233. '</tr>';
  234. }
  235. $('#right').html(html);
  236. }
  237. }
  238. </script>
  239. {/block}