EnergyPlanList.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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="6" :lg="7" :md="8" :sm="24">
  8. <a-form-item label="设备编号">
  9. <a-input v-model="queryParam.equipmentcode" placeholder="请输入设备编号"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13. <a-form-item label="设备名称">
  14. <j-search-select-tag v-model="queryParam.equipmentid" placeholder="请选择设备" dict="tpm_equipment,equipmentname,id" />
  15. </a-form-item>
  16. </a-col>
  17. <template v-if="toggleSearchStatus">
  18. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  19. <a-form-item label="计划日期">
  20. <!-- <j-date placeholder="请选择计划日期" v-model="queryParam.plandate" style="width: 100%" /> -->
  21. <a-range-picker date-format="YYYY-MM-DD" v-model="queryParam.date" @change="onChangeDate" />
  22. </a-form-item>
  23. </a-col>
  24. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  25. <a-form-item label="能源分类">
  26. <j-search-select-tag v-model="queryParam.energytypeid" placeholder="请选择能源分类" dict="base_energy_type,name,id" />
  27. </a-form-item>
  28. </a-col>
  29. </template>
  30. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  31. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  32. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  33. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  34. <a @click="handleToggleSearch" style="margin-left: 8px">
  35. {{ toggleSearchStatus ? '收起' : '展开' }}
  36. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  37. </a>
  38. </span>
  39. </a-col>
  40. </a-row>
  41. </a-form>
  42. </div>
  43. <!-- 查询区域-END -->
  44. <!-- 操作按钮区域 -->
  45. <div class="table-operator">
  46. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  47. <!-- <a-button type="primary" icon="download" @click="handleExportXls('base_energy_plan')">导出</a-button>
  48. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  49. <a-button type="primary" icon="import">导入</a-button>
  50. </a-upload> -->
  51. <!-- 高级查询区域 -->
  52. <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> -->
  53. <a-dropdown v-if="selectedRowKeys.length > 0">
  54. <a-menu slot="overlay">
  55. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  56. </a-menu>
  57. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  58. </a-dropdown>
  59. </div>
  60. <!-- table区域-begin -->
  61. <div>
  62. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  63. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  64. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  65. </div>
  66. <a-table
  67. ref="table"
  68. size="middle"
  69. :scroll="{x:true}"
  70. bordered
  71. rowKey="id"
  72. :columns="columns"
  73. :dataSource="dataSource"
  74. :pagination="ipagination"
  75. :loading="loading"
  76. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  77. class="j-table-force-nowrap"
  78. @change="handleTableChange">
  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. <energy-plan-modal ref="modalForm" @ok="modalFormOk"></energy-plan-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 EnergyPlanModal from './modules/EnergyPlanModal'
  125. export default {
  126. name: 'EnergyPlanList',
  127. mixins:[JeecgListMixin, mixinDevice],
  128. components: {
  129. EnergyPlanModal
  130. },
  131. data () {
  132. return {
  133. description: 'base_energy_plan管理页面',
  134. // 表头
  135. columns: [
  136. {
  137. title: '序号',
  138. dataIndex: '',
  139. key:'rowIndex',
  140. width:60,
  141. align:"center",
  142. customRender:function (t,r,index) {
  143. return parseInt(index)+1;
  144. }
  145. },
  146. {
  147. title:'设备编号',
  148. align:"center",
  149. dataIndex: 'equipmentcode',
  150. width: 150,
  151. },
  152. {
  153. title:'设备名称',
  154. align:"center",
  155. dataIndex: 'equipmentid_dictText',
  156. width: 300,
  157. },
  158. {
  159. title:'计划日期',
  160. align:"center",
  161. dataIndex: 'plandate',
  162. // customRender:function (text) {
  163. // return !text?"":(text.length>10?text.substr(0,10):text)
  164. // },
  165. width: 150,
  166. },
  167. {
  168. title:'能源分类',
  169. align:"center",
  170. dataIndex: 'energytypeid_dictText',
  171. width: 150,
  172. },
  173. {
  174. title:'计划值',
  175. align:"center",
  176. dataIndex: 'planvalue',
  177. width: 150,
  178. },
  179. {
  180. title:'录入人',
  181. align:"center",
  182. dataIndex: 'createBy_dictText',
  183. },
  184. {
  185. title:'录入日期',
  186. align:"center",
  187. dataIndex: 'createTime',
  188. },
  189. {
  190. title:'备注',
  191. align:"center",
  192. dataIndex: 'remark'
  193. },
  194. {
  195. title: '操作',
  196. dataIndex: 'action',
  197. align:"center",
  198. fixed:"right",
  199. width:147,
  200. scopedSlots: { customRender: 'action' }
  201. }
  202. ],
  203. url: {
  204. list: "/energyPlan/energyPlan/list",
  205. delete: "/energyPlan/energyPlan/delete",
  206. deleteBatch: "/energyPlan/energyPlan/deleteBatch",
  207. exportXlsUrl: "/energyPlan/energyPlan/exportXls",
  208. importExcelUrl: "energyPlan/energyPlan/importExcel",
  209. },
  210. dictOptions:{},
  211. superFieldList:[],
  212. }
  213. },
  214. created() {
  215. this.getSuperFieldList();
  216. },
  217. computed: {
  218. importExcelUrl: function(){
  219. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  220. },
  221. },
  222. methods: {
  223. // 时间处理
  224. onChangeDate(date, dateString){
  225. console.log(date, dateString);
  226. this.queryParam.plandate_begin= dateString[0]
  227. this.queryParam.plandate_end= dateString[1]
  228. },
  229. initDictConfig(){
  230. },
  231. getSuperFieldList(){
  232. let fieldList=[];
  233. fieldList.push({type:'int',value:'energyplanid',text:'能源计划ID'})
  234. fieldList.push({type:'string',value:'remark',text:'备注'})
  235. fieldList.push({type:'int',value:'equipmentid',text:'设备ID'})
  236. fieldList.push({type:'string',value:'equipmentcode',text:'设备编号'})
  237. fieldList.push({type:'date',value:'plandate',text:'计划日期'})
  238. fieldList.push({type:'int',value:'energytypeid',text:'能源分类ID'})
  239. fieldList.push({type:'number',value:'planvalue',text:'计划值'})
  240. fieldList.push({type:'int',value:'year',text:'所属年'})
  241. fieldList.push({type:'int',value:'month',text:'所属月'})
  242. fieldList.push({type:'string',value:'day',text:'日期'})
  243. fieldList.push({type:'string',value:'yearmonth',text:'所属年月'})
  244. fieldList.push({type:'int',value:'week',text:'所属周'})
  245. fieldList.push({type:'int',value:'dayofweek',text:'周几'})
  246. this.superFieldList = fieldList
  247. }
  248. }
  249. }
  250. </script>
  251. <style scoped>
  252. @import '~@assets/less/common.less';
  253. </style>