ItdmWenxiangHistory8List.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :xl="10" :lg="11" :md="12" :sm="24">
  8. <a-form-item label="创建时间">
  9. <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date>
  10. <span class="query-group-split-cust"></span>
  11. <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date>
  12. </a-form-item>
  13. </a-col>
  14. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  15. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  16. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  17. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  18. <!-- <a @click="handleToggleSearch" style="margin-left: 8px">-->
  19. <!-- {{ toggleSearchStatus ? '收起' : '展开' }}-->
  20. <!-- <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
  21. <!-- </a>-->
  22. </span>
  23. </a-col>
  24. </a-row>
  25. </a-form>
  26. </div>
  27. <!-- 查询区域-END -->
  28. <!-- 操作按钮区域 -->
  29. <div class="table-operator">
  30. <!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
  31. <a-button type="primary" icon="download" @click="dc('1立方温箱历史数据')">导出</a-button>
  32. <!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
  33. <!-- <a-button type="primary" icon="import">导入</a-button>-->
  34. <!-- </a-upload>-->
  35. <!-- &lt;!&ndash; 高级查询区域 &ndash;&gt;-->
  36. <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
  37. <!-- <a-dropdown v-if="selectedRowKeys.length > 0">-->
  38. <!-- <a-menu slot="overlay">-->
  39. <!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
  40. <!-- </a-menu>-->
  41. <!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
  42. <!-- </a-dropdown>-->
  43. </div>
  44. <!-- table区域-begin -->
  45. <div>
  46. <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
  47. <!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项-->
  48. <!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
  49. <!-- </div>-->
  50. <a-table
  51. ref="table"
  52. size="middle"
  53. :scroll="{x:true}"
  54. bordered
  55. rowKey="id"
  56. :columns="columns"
  57. :dataSource="dataSource"
  58. :pagination="ipagination"
  59. :loading="loading"
  60. class="j-table-force-nowrap"
  61. @change="handleTableChange">
  62. <!-- 通过判断alarm的值,动态渲染对应数据这一列单元格的样式 -->
  63. <div slot="temperature" slot-scope="text, record">
  64. <span v-if="record.temperatureAlarm ==1" class="y">{{text}}</span>
  65. <span v-else>{{text}}</span>
  66. </div>
  67. <div slot="humidity" slot-scope="text, record">
  68. <span :class="record.humidityAlarm == 1?'y':''">{{text}}</span>
  69. </div>
  70. <div slot="currentA" slot-scope="text, record">
  71. <span :class="record.currentAAlarm == 1?'y':''">{{text}}</span>
  72. </div>
  73. <div slot="currentB" slot-scope="text, record">
  74. <span :class="record.currentBAlarm == 1?'y':''">{{text}}</span>
  75. </div>
  76. <div slot="currentC" slot-scope="text, record">
  77. <span :class="record.currentCAlarm == 1?'y':''">{{text}}</span>
  78. </div>
  79. <template slot="htmlSlot" slot-scope="text">
  80. <div v-html="text"></div>
  81. </template>
  82. <template slot="imgSlot" slot-scope="text,record">
  83. <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  84. <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  85. </template>
  86. <template slot="fileSlot" slot-scope="text">
  87. <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  88. <a-button
  89. v-else
  90. :ghost="true"
  91. type="primary"
  92. icon="download"
  93. size="small"
  94. @click="downloadFile(text)">
  95. 下载
  96. </a-button>
  97. </template>
  98. <span slot="action" slot-scope="text, record">
  99. <a @click="handleEdit(record)">编辑</a>
  100. <a-divider type="vertical" />
  101. <a-dropdown>
  102. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  103. <a-menu slot="overlay">
  104. <a-menu-item>
  105. <a @click="handleDetail(record)">详情</a>
  106. </a-menu-item>
  107. <a-menu-item>
  108. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  109. <a>删除</a>
  110. </a-popconfirm>
  111. </a-menu-item>
  112. </a-menu>
  113. </a-dropdown>
  114. </span>
  115. </a-table>
  116. </div>
  117. <itdm-wenxiang-history8-modal ref="modalForm" @ok="modalFormOk"></itdm-wenxiang-history8-modal>
  118. </a-card>
  119. </template>
  120. <script>
  121. import '@/assets/less/TableExpand.less'
  122. import { mixinDevice } from '@/utils/mixin'
  123. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  124. import ItdmWenxiangHistory8Modal from './modules/ItdmWenxiangHistory8Modal'
  125. import { downFile } from '@/api/manage'
  126. export default {
  127. name: 'ItdmWenxiangHistory8List',
  128. mixins:[JeecgListMixin, mixinDevice],
  129. components: {
  130. ItdmWenxiangHistory8Modal
  131. },
  132. data () {
  133. return {
  134. description: '8立方温箱历史数据管理页面',
  135. // 表头
  136. columns: [
  137. // {
  138. // title: '#',
  139. // dataIndex: '',
  140. // key:'rowIndex',
  141. // width:60,
  142. // align:"center",
  143. // customRender:function (t,r,index) {
  144. // return parseInt(index)+1;
  145. // }
  146. // },
  147. // {
  148. // title:'设备id',
  149. // align:"center",
  150. // dataIndex: 'deviceId_dictText'
  151. // },
  152. {
  153. title:'设备名称',
  154. align:"center",
  155. dataIndex: 'deviceName'
  156. },
  157. {
  158. title:'设备编号',
  159. align:"center",
  160. dataIndex: 'deviceNo'
  161. },
  162. {
  163. title:'温度',
  164. align:"center",
  165. dataIndex: 'temperature',
  166. scopedSlots: { customRender: 'temperature' }
  167. },
  168. {
  169. title:'温度Max',
  170. align:"center",
  171. dataIndex: 'temperatureMax'
  172. },
  173. {
  174. title:'温度Min',
  175. align:"center",
  176. dataIndex: 'temperatureMin'
  177. },
  178. // {
  179. // title:'温度报警(0正常1报警)',
  180. // align:"center",
  181. // dataIndex: 'temperatureAlarm_dictText'
  182. // },
  183. {
  184. title:'湿度',
  185. align:"center",
  186. dataIndex: 'humidity',
  187. scopedSlots: { customRender: 'humidity' }
  188. },
  189. {
  190. title:'湿度Max',
  191. align:"center",
  192. dataIndex: 'humidityMax'
  193. },
  194. {
  195. title:'湿度Min',
  196. align:"center",
  197. dataIndex: 'humidityMin'
  198. },
  199. // {
  200. // title:'湿度报警(0正常1报警)',
  201. // align:"center",
  202. // dataIndex: 'humidityAlarm_dictText'
  203. // },
  204. {
  205. title:'A相电流',
  206. align:"center",
  207. dataIndex: 'currentA',
  208. scopedSlots: { customRender: 'currentA' }
  209. },
  210. {
  211. title:'A相电流Max',
  212. align:"center",
  213. dataIndex: 'currentAMax'
  214. },
  215. {
  216. title:'A相电流Min',
  217. align:"center",
  218. dataIndex: 'currentAMin'
  219. },
  220. // {
  221. // title:'A相电流报警(0正常1报警)',
  222. // align:"center",
  223. // dataIndex: 'currentAAlarm_dictText'
  224. // },
  225. {
  226. title:'B相电流',
  227. align:"center",
  228. dataIndex: 'currentB',
  229. scopedSlots: { customRender: 'currentB' }
  230. },
  231. {
  232. title:'B相电流Max',
  233. align:"center",
  234. dataIndex: 'currentBMax'
  235. },
  236. {
  237. title:'B相电流Min',
  238. align:"center",
  239. dataIndex: 'currentBMin'
  240. },
  241. // {
  242. // title:'B相电流报警(0正常1报警)',
  243. // align:"center",
  244. // dataIndex: 'currentBAlarm_dictText'
  245. // },
  246. {
  247. title:'C相电流',
  248. align:"center",
  249. dataIndex: 'currentC',
  250. scopedSlots: { customRender: 'currentC' }
  251. },
  252. {
  253. title:'C相电流Max',
  254. align:"center",
  255. dataIndex: 'currentCMax'
  256. },
  257. {
  258. title:'C相电流Min',
  259. align:"center",
  260. dataIndex: 'currentCMin'
  261. },
  262. // {
  263. // title:'C相电流报警(0正常1报警)',
  264. // align:"center",
  265. // dataIndex: 'currentCAlarm_dictText'
  266. // },
  267. {
  268. title:'创建时间',
  269. align:"center",
  270. dataIndex: 'createTime'
  271. },
  272. // {
  273. // title: '操作',
  274. // dataIndex: 'action',
  275. // align:"center",
  276. // fixed:"right",
  277. // width:147,
  278. // scopedSlots: { customRender: 'action' }
  279. // }
  280. ],
  281. url: {
  282. list: "/itdmWenxiangHistory/itdmWenxiangHistory8/list",
  283. delete: "/itdmWenxiangHistory/itdmWenxiangHistory8/delete",
  284. deleteBatch: "/itdmWenxiangHistory/itdmWenxiangHistory8/deleteBatch",
  285. exportXlsUrl: "/itdmWenxiangHistory/itdmWenxiangHistory8/exportXls",
  286. importExcelUrl: "itdmWenxiangHistory/itdmWenxiangHistory8/importExcel",
  287. },
  288. dictOptions:{},
  289. superFieldList:[],
  290. }
  291. },
  292. created() {
  293. this.getSuperFieldList();
  294. },
  295. computed: {
  296. importExcelUrl: function(){
  297. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  298. },
  299. },
  300. methods: {
  301. // 判断时间段是否在3个月内,在的话导出,超出的话提示
  302. dc(fileName){
  303. console.log(11111,this.queryParam)
  304. //判断时间段是否在3个月内
  305. let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
  306. if(flag){
  307. this.handleExportXls(fileName)
  308. }else {
  309. this.$message.error("时间跨度不得超过3个月!")
  310. }
  311. },
  312. //导出xls
  313. handleExportXls(fileName){
  314. if(!fileName || typeof fileName != "string"){
  315. fileName = "导出文件"
  316. }
  317. let param = this.getQueryParams();
  318. if(this.selectedRowKeys && this.selectedRowKeys.length>0){
  319. param['selections'] = this.selectedRowKeys.join(",")
  320. }
  321. console.log("导出参数",param)
  322. downFile(this.url.exportXlsUrl,param).then((data)=>{
  323. if (!data) {
  324. this.$message.warning("文件下载失败")
  325. return
  326. }
  327. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  328. window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
  329. }else{
  330. let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
  331. let link = document.createElement('a')
  332. link.style.display = 'none'
  333. link.href = url
  334. link.setAttribute('download', fileName+'.xls')
  335. document.body.appendChild(link)
  336. link.click()
  337. document.body.removeChild(link); //下载完成移除元素
  338. window.URL.revokeObjectURL(url); //释放掉blob对象
  339. }
  340. })
  341. },
  342. //判断时间段是否在3个月内,是的话返回true,否则返回false
  343. completeDate (time1, time2, m) {
  344. const year1 = time1.getFullYear()
  345. const year2 = time2.getFullYear()
  346. const month1 = time1.getMonth() + 1
  347. const month2 = time2.getMonth() + 1
  348. const day1 = time1.getDate()
  349. const day2 = time2.getDate()
  350. if (year2 === year1) { // 判断两个日期 是否是同年
  351. if (month2 - month1 > m) { // 相差是否 在m个月中
  352. return false
  353. } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
  354. if (day2 > day1) {
  355. return false
  356. }
  357. }
  358. } else { // 不同年
  359. if (year2 - year1 > 1) {
  360. return false
  361. }
  362. else if (year2 - year1 === 1) {
  363. if (month2 > m || month1 + m - month2 < 12) {
  364. return false
  365. }
  366. else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
  367. if (day2 > day1) {
  368. return false
  369. }
  370. }
  371. }
  372. }
  373. return true
  374. },
  375. initDictConfig(){
  376. },
  377. getSuperFieldList(){
  378. let fieldList=[];
  379. fieldList.push({type:'string',value:'deviceName',text:'设备名称',dictCode:''})
  380. fieldList.push({type:'string',value:'deviceNo',text:'设备编号',dictCode:''})
  381. fieldList.push({type:'BigDecimal',value:'temperature',text:'温度',dictCode:''})
  382. fieldList.push({type:'BigDecimal',value:'temperatureMax',text:'温度上限',dictCode:''})
  383. fieldList.push({type:'BigDecimal',value:'temperatureMin',text:'温度下限',dictCode:''})
  384. fieldList.push({type:'int',value:'temperatureAlarm',text:'温度报警(0正常1报警)',dictCode:''})
  385. fieldList.push({type:'BigDecimal',value:'humidity',text:'湿度',dictCode:''})
  386. fieldList.push({type:'BigDecimal',value:'humidityMax',text:'湿度上限',dictCode:''})
  387. fieldList.push({type:'BigDecimal',value:'humidityMin',text:'湿度下限',dictCode:''})
  388. fieldList.push({type:'int',value:'humidityAlarm',text:'湿度报警(0正常1报警)',dictCode:''})
  389. fieldList.push({type:'BigDecimal',value:'currentA',text:'A相电流',dictCode:''})
  390. fieldList.push({type:'BigDecimal',value:'currentAMax',text:'A相电流上限',dictCode:''})
  391. fieldList.push({type:'BigDecimal',value:'currentAMin',text:'A相电流下限',dictCode:''})
  392. fieldList.push({type:'int',value:'currentAAlarm',text:'A相电流报警(0正常1报警)',dictCode:''})
  393. fieldList.push({type:'BigDecimal',value:'currentB',text:'B相电流',dictCode:''})
  394. fieldList.push({type:'BigDecimal',value:'currentBMax',text:'B相电流上限',dictCode:''})
  395. fieldList.push({type:'BigDecimal',value:'currentBMin',text:'B相电流下限',dictCode:''})
  396. fieldList.push({type:'int',value:'currentBAlarm',text:'B相电流报警(0正常1报警)',dictCode:''})
  397. fieldList.push({type:'BigDecimal',value:'currentC',text:'C相电流',dictCode:''})
  398. fieldList.push({type:'BigDecimal',value:'currentCMax',text:'C相电流上限',dictCode:''})
  399. fieldList.push({type:'BigDecimal',value:'currentCMin',text:'C相电流下限',dictCode:''})
  400. fieldList.push({type:'int',value:'currentCAlarm',text:'C相电流报警(0正常1报警)',dictCode:''})
  401. fieldList.push({type:'datetime',value:'createTime',text:'创建时间'})
  402. this.superFieldList = fieldList
  403. }
  404. }
  405. }
  406. </script>
  407. <style scoped>
  408. @import '~@assets/less/common.less';
  409. ::v-deep .ant-card-body{
  410. padding-top: 0px !important;
  411. padding-left: 10px !important;
  412. padding-right: 10px !important;
  413. }
  414. .y {
  415. color: red;
  416. }
  417. </style>