EnergyRateList.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <a-card class="j-inner-table-wrapper" :bordered="false">
  3. <!-- 查询区域 begin -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline">
  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.name" placeholder="请输入名称"/>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13. <span class="table-page-search-submitButtons table-operator">
  14. <a-button type="primary" icon="search" @click="searchQuery">查询</a-button>
  15. <a-button type="primary" icon="reload" @click="searchReset">重置</a-button>
  16. <!-- <a @click="handleToggleSearch" style="margin-left: 8px">
  17. <span>{{ toggleSearchStatus ? '收起' : '展开' }}</span>
  18. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  19. </a> -->
  20. </span>
  21. </a-col>
  22. </a-row>
  23. </a-form>
  24. </div>
  25. <!-- 查询区域 end -->
  26. <!-- 操作按钮区域 begin -->
  27. <div class="table-operator">
  28. <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
  29. <!-- <a-button type="primary" icon="download" @click="handleExportXls('base_energy_rate')">导出</a-button>
  30. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  31. <a-button type="primary" icon="import">导入</a-button>
  32. </a-upload> -->
  33. <!-- 高级查询区域 -->
  34. <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> -->
  35. <a-dropdown v-if="selectedRowKeys.length > 0">
  36. <a-menu slot="overlay">
  37. <a-menu-item key="1" @click="batchDel">
  38. <a-icon type="delete"/>
  39. <span>删除</span>
  40. </a-menu-item>
  41. </a-menu>
  42. <a-button>
  43. <span>批量操作</span>
  44. <a-icon type="down"/>
  45. </a-button>
  46. </a-dropdown>
  47. </div>
  48. <!-- 操作按钮区域 end -->
  49. <!-- table区域 begin -->
  50. <div>
  51. <a-alert type="info" showIcon style="margin-bottom: 16px;">
  52. <template slot="message">
  53. <span>已选择</span>
  54. <a style="font-weight: 600;padding: 0 4px;">{{ selectedRowKeys.length }}</a>
  55. <span>项</span>
  56. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  57. </template>
  58. </a-alert>
  59. <a-table
  60. ref="table"
  61. size="middle"
  62. bordered
  63. rowKey="id"
  64. class="j-table-force-nowrap"
  65. :scroll="{x:true}"
  66. :loading="loading"
  67. :columns="columns"
  68. :dataSource="dataSource"
  69. :pagination="ipagination"
  70. :expandedRowKeys="expandedRowKeys"
  71. :rowSelection="{selectedRowKeys, onChange: onSelectChange}"
  72. @expand="handleExpand"
  73. @change="handleTableChange"
  74. >
  75. <!-- 内嵌table区域 begin -->
  76. <!-- <template slot="expandedRowRender" slot-scope="record">
  77. <a-tabs tabPosition="top">
  78. <a-tab-pane tab="详情" key="baseEnergyRateDetail" forceRender>
  79. <energy-rate-detail-sub-table :record="record"/>
  80. </a-tab-pane>
  81. </a-tabs>
  82. </template> -->
  83. <!-- 内嵌table区域 end -->
  84. <!-- <template slot="htmlSlot" slot-scope="text">
  85. <div v-html="text"></div>
  86. </template> -->
  87. <template slot="imgSlot" slot-scope="text,record">
  88. <div style="font-size: 12px;font-style: italic;">
  89. <span v-if="!text">无图片</span>
  90. <img v-else :src="getImgView(text)" :preview="record.id" alt="" style="max-width:80px;height:25px;"/>
  91. </div>
  92. </template>
  93. <template slot="fileSlot" slot-scope="text">
  94. <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  95. <a-button
  96. v-else
  97. ghost
  98. type="primary"
  99. icon="download"
  100. size="small"
  101. @click="downloadFile(text)"
  102. >
  103. <span>下载</span>
  104. </a-button>
  105. </template>
  106. <template slot="action" slot-scope="text, record">
  107. <a @click="handleEdit(record)">编辑</a>
  108. <a-divider type="vertical"/>
  109. <a-dropdown>
  110. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  111. <a-menu slot="overlay">
  112. <a-menu-item>
  113. <a-popconfirm title="确定删除吗?" @confirm="handleDelete(record.id)">
  114. <a>删除</a>
  115. </a-popconfirm>
  116. </a-menu-item>
  117. </a-menu>
  118. </a-dropdown>
  119. </template>
  120. </a-table>
  121. </div>
  122. <!-- table区域 end -->
  123. <!-- 表单区域 -->
  124. <energy-rate-modal ref="modalForm" @ok="modalFormOk"/>
  125. <!-- 详情 -->
  126. <energy-rate-detail ref="equipmentDetail"></energy-rate-detail>
  127. </a-card>
  128. </template>
  129. <script>
  130. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  131. import EnergyRateModal from './modules/EnergyRateModal'
  132. import EnergyRateDetailSubTable from './subTables/EnergyRateDetailSubTable'
  133. import '@/assets/less/TableExpand.less'
  134. import EnergyRateDetail from './modules/EnergyRateDetail.vue'
  135. export default {
  136. name: 'EnergyRateList',
  137. mixins: [JeecgListMixin],
  138. components: {
  139. EnergyRateModal,
  140. EnergyRateDetailSubTable,
  141. EnergyRateDetail,
  142. },
  143. data() {
  144. return {
  145. description: 'base_energy_rate列表管理页面',
  146. // 表头
  147. columns: [
  148. {
  149. title: '序号',
  150. key: 'rowIndex',
  151. width: 60,
  152. align: 'center',
  153. customRender: (t, r, index) => parseInt(index) + 1
  154. },
  155. {
  156. title: '名称',
  157. align: 'center',
  158. dataIndex: 'name',
  159. customCell: this.customCellDetail
  160. },
  161. {
  162. title: '能源分类',
  163. align: 'center',
  164. dataIndex: 'energytypeid_dictText',
  165. },
  166. {
  167. title: '费率类型',
  168. align: 'center',
  169. dataIndex: 'ratetype_dictText',
  170. },
  171. {
  172. title: '单位',
  173. align: 'center',
  174. dataIndex: 'rateunit',
  175. },
  176. {
  177. title: '费率有效期开始',
  178. align: 'center',
  179. dataIndex: 'begintime',
  180. },
  181. {
  182. title: '费率有效期结束',
  183. align: 'center',
  184. dataIndex: 'endtime',
  185. },
  186. {
  187. title: '备注',
  188. align: 'center',
  189. dataIndex: 'remark',
  190. },
  191. {
  192. title: '操作',
  193. dataIndex: 'action',
  194. align: 'center',
  195. width:147,
  196. scopedSlots: { customRender: 'action' },
  197. },
  198. ],
  199. // 字典选项
  200. dictOptions: {},
  201. // 展开的行test
  202. expandedRowKeys: [],
  203. url: {
  204. list: '/energyRate/energyRate/list',
  205. delete: '/energyRate/energyRate/delete',
  206. deleteBatch: '/energyRate/energyRate/deleteBatch',
  207. exportXlsUrl: '/energyRate/energyRate/exportXls',
  208. importExcelUrl: '/energyRate/energyRate/importExcel',
  209. },
  210. superFieldList:[],
  211. }
  212. },
  213. created() {
  214. this.getSuperFieldList();
  215. },
  216. computed: {
  217. importExcelUrl() {
  218. return window._CONFIG['domianURL'] + this.url.importExcelUrl
  219. }
  220. },
  221. methods: {
  222. initDictConfig() {
  223. },
  224. handleExpand(expanded, record) {
  225. this.expandedRowKeys = []
  226. if (expanded === true) {
  227. this.expandedRowKeys.push(record.id)
  228. }
  229. },
  230. customCellDetail(record){
  231. return {
  232. style: {
  233. 'color': "#1890ff",
  234. 'cursor': "pointer",
  235. },
  236. on: {
  237. // 点击事件
  238. click: (event) => {
  239. this.$refs.equipmentDetail.detail(record);
  240. },
  241. },
  242. };
  243. },
  244. getSuperFieldList(){
  245. let fieldList=[];
  246. fieldList.push({type:'int',value:'energyrateid',text:'能源费率ID',dictCode:''})
  247. fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''})
  248. fieldList.push({type:'string',value:'name',text:'名称',dictCode:''})
  249. fieldList.push({type:'int',value:'energytypeid',text:'能源分类ID',dictCode:''})
  250. fieldList.push({type:'string',value:'ratetype',text:'费率类型',dictCode:''})
  251. fieldList.push({type:'string',value:'rateunit',text:'单位',dictCode:''})
  252. fieldList.push({type:'date',value:'begintime',text:'费率有效期开始'})
  253. fieldList.push({type:'date',value:'endtime',text:'费率有效期结束'})
  254. this.superFieldList = fieldList
  255. }
  256. }
  257. }
  258. </script>
  259. <style lang="less" scoped>
  260. @import '~@assets/less/common.less';
  261. </style>