ListTabPage.cshtml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. 
  2. <div id="SearchOnlineMonitorDiv" class="tank_table_div">
  3. <form action="" method="post">
  4. <div v-if="currentTab == 'searchListTab'" class="chart_form_div" ref="canvasdiv">
  5. <div v-if="currentlang.indexOf('zh-tw') >= 0" class="tank_form_head">
  6. <label style="width: 3%" class="tank_form_label">槍號</label>
  7. <label style="width: 11%" class="tank_form_label">時間</label>
  8. <label style="width: 11%" class="tank_form_label">加油時間(s)</label>
  9. <label style="width: 8%" class="tank_form_label">A/L(%)</label>
  10. <label style="width: 10%" class="tank_form_label">油氣流量(L)</label>
  11. <label style="width: 10%" class="tank_form_label">燃油流量(L)</label>
  12. <label style="width: 12%" class="tank_form_label">最大氣體流速(L/s)</label>
  13. <label style="width: 12%" class="tank_form_label">最大燃油流速(L/s)</label>
  14. <label style="width: 10%" class="tank_form_label" :style="showFilter">油罐壓力(inHg)</label>
  15. </div>
  16. <div v-else class="tank_form_head">
  17. <label style="width: 3%" class="tank_form_label">枪号</label>
  18. <label style="width: 11%" class="tank_form_label">时间</label>
  19. <label style="width: 11%" class="tank_form_label">加油时间(s)</label>
  20. <label style="width: 8%" class="tank_form_label">A/L(%)</label>
  21. <label style="width: 10%" class="tank_form_label">油气流量(L)</label>
  22. <label style="width: 10%" class="tank_form_label">燃油流量(L)</label>
  23. <label style="width: 12%" class="tank_form_label">最大气体流速(L/s)</label>
  24. <label style="width: 12%" class="tank_form_label">最大燃油流速(L/s)</label>
  25. <label style="width: 10%" class="tank_form_label" :style="showFilter">油罐压力(Pa)</label>
  26. </div>
  27. <div v-for="(r, index) in airLiquidList" :key="index" class="tank_form_body">
  28. <label style="width: 3%" class="tank_form_label">{{r.SiteLevelNozzleId}}</label>
  29. <label style="width: 11%" class="tank_form_label">{{r.FuellingStartTime | formatDate}}</label>
  30. <label style="width: 11%" class="tank_form_label">{{r.FuellingTime}}</label>
  31. <label style="width: 8%" class="tank_form_label">{{r.VaporLiquidRatio}}</label>
  32. <label style="width: 10%" class="tank_form_label">{{r.VaporVolumeWithDecimal}}</label>
  33. <label style="width: 10%" class="tank_form_label">{{r.LiquidVolumeWithDecimal}}</label>
  34. <label style="width: 12%" class="tank_form_label">{{r.MaxAirFlowRateWithDecimal}}</label>
  35. <label style="width: 12%" class="tank_form_label">{{r.MaxLiquidFlowRateWithDecimal}}</label>
  36. <label style="width: 10%" class="tank_form_label" :style="showFilter">{{r.TankPressure | numFilter}}</label>
  37. </div>
  38. </div>
  39. </form>
  40. <div v-if="currentTab == 'searchListTab'" class="config-search-navigation" :style="panelStyle">
  41. <div v-if="currentlang.indexOf('zh-tw') >= 0" class="config-search-tab">篩選查詢</div>
  42. <div v-else class="config-search-tab">筛选查询</div>
  43. <div v-if="currentlang.indexOf('zh-tw') >= 0" class="config-search-lable">起始日期:</div>
  44. <div v-else class="config-search-lable">起始日期:</div>
  45. <input class="config-search-input" type="text" v-model="startDate" />
  46. <input class="config-search-date" type="datetime-local" v-model="stdatetime" @@change="change('startDate')" />
  47. <div v-if="currentlang.indexOf('zh-tw') >= 0" class="config-search-lable">結束日期:</div>
  48. <div v-else class="config-search-lable">结束日期:</div>
  49. <input class="config-search-input" type="text" v-model="endDate" />
  50. <input class="config-search-date" type="datetime-local" v-model="stdatetime" @@change="change('endDate')" />
  51. <div v-if="currentlang.indexOf('zh-tw') >= 0" class="config-search-lable">油槍選擇:</div>
  52. <div v-else class="config-search-lable">油枪选择:</div>
  53. <input class="config-search-input input" type="text" v-model="nozzleNumber" @@click="show" />
  54. @*<select class="config-form-select" v-model="nozzleNumber">
  55. <option v-for="(item, i) in nozzleArray" :key="i" :value="item.SiteLevelNozzleId">{{item.SiteLevelNozzleId}}号枪 {{item.Product.ProductLabel}}</option>
  56. </select>*@
  57. <div v-if="currentlang.indexOf('zh-tw') >= 0" class="config-search-lable">油罐壓力(inHg):</div>
  58. <div v-else class="config-search-lable">油罐压力(Pa):</div>
  59. <input class="config-search-input input" type="text" v-model="tankPressure" @@click="show" />
  60. @*<div class="config-search-lable">液阻压力(Pa):</div>
  61. <input class="config-search-input input" type="text" v-model="liquidPressure" @@focus="show" />
  62. <div class="config-search-lable">油气浓度(%):</div>
  63. <input class="config-search-input input" type="text" v-model="gasConcentrations" @@click="show" />*@
  64. <div>
  65. <download-excel class="download_excel_div" :header="excel_header" :fields="json_fields" :data="excelAirLiquidList" :name="filename" worksheet="Worksheet">
  66. <button class="btn-default">Exc</button>
  67. </download-excel>
  68. <div class="search_list_div" @@click="search('searchListTab')"></div>
  69. </div>
  70. </div>
  71. <div class="tank_filter_div" :style="showFilter" @@click="clickFilter()">
  72. </div>
  73. </div>
  74. <script type="text/javascript">
  75. Vue.component("downloadExcel", JsonExcel);
  76. var vm = new Vue({
  77. el: '#SearchOnlineMonitorDiv',
  78. data: {
  79. currentlang: "",
  80. filename: ".xls",
  81. excel_header: "",
  82. json_fields: {
  83. '枪号': 'SiteLevelNozzleId',
  84. '时间': 'FuellingStartTime',
  85. '加油时间(s)': 'FuellingTime',
  86. 'A/L(%)': 'VaporLiquidRatio',
  87. '油气流量(L)': 'VaporVolumeWithDecimal',
  88. '燃油流量(L)': 'LiquidVolumeWithDecimal',
  89. '最大气体流速(L/s)': 'MaxAirFlowRateWithDecimal',
  90. '最大燃油流速(L/s)': 'MaxLiquidFlowRateWithDecimal',
  91. '油罐压力(Pa)': 'TankPressure'
  92. },
  93. currentTab: 'searchListTab',
  94. warningValueMin: 0.58,
  95. warningValueMax: 1.98,
  96. warningPointColor: 'rgba(255, 0, 0,1)',
  97. normalPointColor: 'rgba(0, 0, 255, 1)',
  98. nozzleArray: [],
  99. nozzleNumber: '',
  100. stdatetime: null,
  101. startDate: null,
  102. endDate: null,
  103. alChart: null,
  104. boardDatas: [],
  105. chartWidth: 0,
  106. startIndex: 0,
  107. rowCount: 10,
  108. tankPressure: '-10000.01 ~ 20000.01',
  109. liquidPressure: '-10000.01 ~ 20000.01',
  110. gasConcentrations: '-10.01 ~ 20000.01',
  111. airLiquidList: [],
  112. //{
  113. //SiteLevelNozzleId: 3, FuellingStartTime: '2021-08-28T23:59:59', FuellingTime: 28, VaporLiquidRatio: 118, VaporVolumeWithDecimal: 18.19, LiquidVolumeWithDecimal: 28.31,
  114. //TankPressure: 12.33, MaxAirFlowRateWithDecimal: 12.33, MaxLiquidFlowRateWithDecimal: 12.33
  115. //}
  116. excelAirLiquidList: [],
  117. inventoryFilter: [],
  118. deliveryFilter: [],
  119. panelStyle: 'visibility: hidden;',
  120. showFilter: 'visibility: visible;'
  121. },
  122. mounted() {
  123. let today = new Date()
  124. this.startDate = this.toDateString(today) + ' 00:00:00'
  125. this.endDate = this.toDateString(today) + ' 23:59:59'
  126. let path = '/sys/Vapor_Recovery_App/Application.VaporRecoveryApp.App/thing/service/'
  127. let args = '["' + this.startDate.replace(/ /g, "T") + '","' + this.endDate.replace(/ /g, "T") + '",0,0,10,"","",""]'
  128. let argsex = '["' + this.startDate.replace(/ /g, "T") + '","' + this.endDate.replace(/ /g, "T") + '",0,0,1000000,"","",""]'
  129. this.filename = 'result_' + this.startDate.replace(/-/g, "").substr(2, 6) + '-' + this.endDate.replace(/-/g, "").substr(2, 6) + this.filename
  130. this.excel_header = '起始日期:' + this.startDate + '结束日期:' + this.endDate
  131. Publish2(args, path, 'GetVRBoardNozzleTrxFlowDatas')
  132. Publish2(argsex, path, 'GetVRBoardNozzleTrxFlowDatas')
  133. this.nozzleArray = [{ SiteLevelNozzleId: 8, Product: { ProductLabel: "92#" } }]
  134. this.currentlang = (navigator.language || navigator.userLanguage || navigator.browserLanguage).toLowerCase();
  135. if (this.currentlang.indexOf('zh-tw') >= 0) {
  136. this.excel_header = '起始日期:' + this.startDate + '結束日期:' + this.endDate
  137. this.json_fields = {
  138. '槍號': 'SiteLevelNozzleId',
  139. '時間': 'FuellingStartTime',
  140. '加油時間(s)': 'FuellingTime',
  141. 'A/L(%)': 'VaporLiquidRatio',
  142. '油氣流量(L)': 'VaporVolumeWithDecimal',
  143. '燃油流量(L)': 'LiquidVolumeWithDecimal',
  144. '最大氣體流速(L/s)': 'MaxAirFlowRateWithDecimal',
  145. '最大燃油流速(L/s)': 'MaxLiquidFlowRateWithDecimal',
  146. '油罐壓力(inHg)': 'TankPressure'
  147. }
  148. }
  149. },
  150. methods: {
  151. show(e) {
  152. showKeyboard("default", e.currentTarget)
  153. },
  154. search(tab) {
  155. this.currentTab = tab
  156. this.panelStyle = 'visibility: hidden;'
  157. this.showFilter = 'visibility: visible;'
  158. this.startIndex = 0
  159. this.getdatas()
  160. },
  161. getdatas() {
  162. let path = '/sys/Vapor_Recovery_App/Application.VaporRecoveryApp.App/thing/service/'
  163. this.filename = 'result_' + this.startDate.replace(/-/g, "").substr(2, 6) + '-' + this.endDate.replace(/-/g, "").substr(2, 6) + ".xls"
  164. this.excel_header = '起始日期:' + this.startDate + '结束日期:' + this.endDate
  165. if (this.currentlang.indexOf('zh-tw') >= 0) {
  166. this.excel_header = '起始日期:' + this.startDate + '結束日期:' + this.endDate
  167. }
  168. let args = '["' + this.startDate.replace(/ /g, "T") + '","' + this.endDate.replace(/ /g, "T") + '",' + (this.nozzleNumber === '' ? '0' : this.nozzleNumber)
  169. if (this.currentTab == 'searchChartTab') {
  170. args += ',0,2000080000,"","",""]'
  171. Publish1(path, 'GetVaporRecoveryConfig')
  172. Publish2(args, path, 'GetVRBoardNozzleTrxFlowDatas')
  173. } else if (this.currentTab == 'searchListTab') {
  174. this.alChart = null
  175. let argsex = args + ',0,1000000' + ',"' + this.tankPressure + '","' + this.liquidPressure + '","' + this.gasConcentrations + '"]'
  176. args += ',' + this.startIndex + ',' + this.rowCount + ',"' + this.tankPressure + '","' + this.liquidPressure + '","' + this.gasConcentrations + '"]'
  177. Publish2(args, path, 'GetVRBoardNozzleTrxFlowDatas')
  178. Publish2(argsex, path, 'GetVRBoardNozzleTrxFlowDatas')
  179. }
  180. this.$forceUpdate()
  181. },
  182. UpdateFooterPage() {
  183. if (document.getElementById("PumpsPage_Bottom_pages") != null) {
  184. var footerPage = document.getElementById("PumpsPage_Bottom_pages");
  185. if (this.currentTab == 'searchListTab') {
  186. footerPage.style.visibility = "visible";
  187. footerPage.style.display = "";
  188. } else { footerPage.style.visibility = "hidden"; footerPage.style.display = "none"; }
  189. }
  190. },
  191. clickFilter() {
  192. if (this.currentTab == 'searchChartTab') {
  193. this.resizeChart(0.88)
  194. }
  195. this.panelStyle = 'visibility: visible;'
  196. this.showFilter = 'visibility: hidden;'
  197. },
  198. resizeChart(ratio) {
  199. this.chartWidth = this.alChart.chart.width
  200. this.alChart.chart.width = this.$refs.canvasdiv.clientWidth * ratio
  201. this.$refs.canvasRef.getContext("2d").clearRect(0, 0, this.$refs.canvasRef.width, this.$refs.canvasRef.height)
  202. this.alChart.update()
  203. },
  204. PrefixInteger(num, length) {
  205. return ('000' + num).substr(-length)
  206. },
  207. change(target) {
  208. let val = this.stdatetime.replace(/T/g, " ") + ':00'
  209. if (target === 'startDate') {
  210. this.startDate = val
  211. } else {
  212. this.endDate = val
  213. }
  214. },
  215. formatDate(value) {
  216. let realVal = ''
  217. if (value !== null && typeof (value) !== 'undefined') {
  218. realVal = value.substring(0, 16).replace('T', ' ')
  219. } else {
  220. realVal = 'N/A'
  221. }
  222. return realVal
  223. },
  224. toDateString(date) {
  225. return date.getFullYear() + '-' + this.PrefixInteger(date.getMonth() + 1, 2) + '-' + this.PrefixInteger(date.getDate(), 2)
  226. }
  227. },
  228. watch: {
  229. boardDatas: {
  230. handler(newValue, oldValue) {
  231. this.UpdateALScatterChart(newValue)
  232. this.UpdateFooterPage()
  233. },
  234. deep: true
  235. },
  236. airLiquidList: {
  237. handler(newValue, oldValue) {
  238. for (let index in newValue) {
  239. let dt = newValue[index]
  240. dt.FuellingTime = (new Date(dt.FuellingEndTime) - new Date(dt.FuellingStartTime)) / 1000
  241. }
  242. this.UpdateFooterPage()
  243. this.$forceUpdate()
  244. },
  245. deep: true
  246. }
  247. },
  248. filters: {
  249. formatDate(value) {
  250. let realVal = ''
  251. if (value !== null && typeof (value) !== 'undefined') {
  252. realVal = value.substring(0, 16).replace('T', ' ')
  253. } else {
  254. realVal = 'N/A'
  255. }
  256. return realVal
  257. },
  258. numFilter(value) {
  259. let realVal = ''
  260. if (!isNaN(value) && value !== '') {
  261. realVal = parseFloat(value).toFixed(3)
  262. } else {
  263. realVal = 'N/A'
  264. }
  265. return realVal
  266. }
  267. }
  268. })
  269. function OnReply(apis, topic, jsonObj) {
  270. let boardpath = apis.has("GetVRBoardNozzleTrxFlowDatas_Reply") ? apis.get("GetVRBoardNozzleTrxFlowDatas_Reply") : '/sys/Vapor_Recovery_App/Application.VaporRecoveryApp.App/thing/service/GetVRBoardNozzleTrxFlowDatas_Reply'
  271. let vrconfigpath = apis.has("GetVaporRecoveryConfig_Reply") ? apis.get("GetVaporRecoveryConfig_Reply") : '/sys/Vapor_Recovery_App/Application.VaporRecoveryApp.App/thing/service/GetVaporRecoveryConfig_Reply'
  272. if (topic === boardpath) {
  273. if (vm.currentTab == 'searchChartTab') {
  274. vm.boardDatas = jsonObj
  275. } else if (vm.currentTab == 'searchListTab') {
  276. if (jsonObj.length > vm.rowCount) {
  277. vm.excelAirLiquidList = jsonObj
  278. } else {
  279. vm.airLiquidList = jsonObj
  280. vm.excelAirLiquidList = jsonObj
  281. }
  282. console.log('searchListTab', jsonObj.length)
  283. }
  284. } else if (topic === vrconfigpath) {
  285. vm.warningValueMin = jsonObj.QualifiedAirLiquidRatioMin
  286. vm.warningValueMax = jsonObj.QualifiedAirLiquidRatioMax
  287. }
  288. }
  289. function ShowPreviousPage() {
  290. if (vm.startIndex <= 0) {
  291. dialogBox("提示信息", "已經是第一頁", null, null);
  292. return
  293. }
  294. vm.startIndex -= vm.rowCount
  295. vm.getdatas()
  296. }
  297. function ShowNextPage() {
  298. if (vm.rowCount > vm.airLiquidList.length) {
  299. dialogBox("提示信息", "已經是最後一頁", null, null)
  300. return
  301. }
  302. vm.startIndex += vm.rowCount
  303. vm.getdatas()
  304. }
  305. function UpdateFooterPage() {
  306. if (document.getElementById("PumpsPage_Bottom_pages") != null) {
  307. for (var p = 1; p < 6; p++) {
  308. var imgCurrentPageIdStr = "PumpsPage_Bottom_pages_img_" + p;
  309. var imgCurrentPageNotShowedIdStr = "PumpsPage_Bottom_pages_notshowed_img_" + p;
  310. if (document.getElementById(imgCurrentPageIdStr) != null)
  311. document.getElementById(imgCurrentPageIdStr).style.visibility = "hidden";
  312. if (document.getElementById(imgCurrentPageNotShowedIdStr) != null)
  313. document.getElementById(imgCurrentPageNotShowedIdStr).style.visibility = "hidden";
  314. }
  315. //update next page img position
  316. var nextPageImg = document.getElementById("PumpsPage_Bottom_pages_img_next_page");
  317. var previousPageImg = document.getElementById("PumpsPage_Bottom_pages_img_previous_page");
  318. previousPageImg.style.visibility = "visible";
  319. if (nextPageImg != null) {
  320. //if (totalPage < 5)
  321. nextPageImg.style.left = (16.5 * 1 + 5).toString() + "%";
  322. nextPageImg.style.visibility = "visible";
  323. }
  324. }
  325. }
  326. UpdateFooterPage();
  327. </script>