ElecfeeBaseList.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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"> </a-row>
  7. </a-form>
  8. </div>
  9. <!-- 查询区域-END -->
  10. <!-- 操作按钮区域 -->
  11. <div class="table-operator">
  12. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  13. <!-- <a-button type="primary" icon="download" @click="handleExportXls('base_elecfee_base')">导出</a-button> -->
  14. <!-- <a-upload
  15. name="file"
  16. :showUploadList="false"
  17. :multiple="false"
  18. :headers="tokenHeader"
  19. :action="importExcelUrl"
  20. @change="handleImportExcel"
  21. >
  22. <a-button type="primary" icon="import">导入</a-button>
  23. </a-upload> -->
  24. <!-- 高级查询区域 -->
  25. <!-- <j-super-query
  26. :fieldList="superFieldList"
  27. ref="superQueryModal"
  28. @handleSuperQuery="handleSuperQuery"
  29. ></j-super-query> -->
  30. <a-dropdown v-if="selectedRowKeys.length > 0">
  31. <a-menu slot="overlay">
  32. <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
  33. </a-menu>
  34. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  35. </a-dropdown>
  36. </div>
  37. <!-- table区域-begin -->
  38. <div>
  39. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
  40. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
  41. <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
  42. >项
  43. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  44. </div>
  45. <a-table
  46. ref="table"
  47. size="middle"
  48. :scroll="{ x: true }"
  49. bordered
  50. rowKey="id"
  51. :columns="columns"
  52. :dataSource="dataSource"
  53. :pagination="ipagination"
  54. :loading="loading"
  55. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  56. class="j-table-force-nowrap"
  57. @change="handleTableChange"
  58. >
  59. <template slot="htmlSlot" slot-scope="text">
  60. <div v-html="text"></div>
  61. </template>
  62. <template slot="imgSlot" slot-scope="text, record">
  63. <span v-if="!text" style="font-size: 12px; font-style: italic">无图片</span>
  64. <img
  65. v-else
  66. :src="getImgView(text)"
  67. :preview="record.id"
  68. height="25px"
  69. alt=""
  70. style="max-width: 80px; font-size: 12px; font-style: italic"
  71. />
  72. </template>
  73. <template slot="fileSlot" slot-scope="text">
  74. <span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
  75. <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
  76. 下载
  77. </a-button>
  78. </template>
  79. <span slot="action" slot-scope="text, record">
  80. <a @click="handleEdit(record)">编辑</a>
  81. <a-divider type="vertical" />
  82. <a-dropdown>
  83. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  84. <a-menu slot="overlay">
  85. <a-menu-item>
  86. <a @click="handleDetail(record)">详情</a>
  87. </a-menu-item>
  88. <a-menu-item>
  89. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  90. <a>删除</a>
  91. </a-popconfirm>
  92. </a-menu-item>
  93. </a-menu>
  94. </a-dropdown>
  95. </span>
  96. </a-table>
  97. </div>
  98. <elecfee-base-modal ref="modalForm" @ok="modalFormOk"></elecfee-base-modal>
  99. </a-card>
  100. </template>
  101. <script>
  102. import '@/assets/less/TableExpand.less'
  103. import { mixinDevice } from '@/utils/mixin'
  104. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  105. import ElecfeeBaseModal from './modules/ElecfeeBaseModal'
  106. import { loadCategoryData } from '@/api/api'
  107. import { filterMultiDictText } from '@/components/dict/JDictSelectUtil'
  108. export default {
  109. name: 'ElecfeeBaseList',
  110. mixins: [JeecgListMixin, mixinDevice],
  111. components: {
  112. ElecfeeBaseModal,
  113. filterMultiDictText,
  114. },
  115. data() {
  116. return {
  117. description: '基本电费管理页面',
  118. // 表头
  119. columns: [
  120. {
  121. title: '#',
  122. dataIndex: '',
  123. key: 'rowIndex',
  124. width: 60,
  125. align: 'center',
  126. customRender: function (t, r, index) {
  127. return parseInt(index) + 1
  128. },
  129. },
  130. {
  131. title: '部门',
  132. align: 'center',
  133. dataIndex: 'deptid_dictText',
  134. width: 200,
  135. },
  136. {
  137. title: '计费类型',
  138. align: 'center',
  139. dataIndex: 'feetype_dictText',
  140. width: 150,
  141. },
  142. {
  143. title: '变压器容量/合同最大需量(kVA)',
  144. align: 'center',
  145. dataIndex: 'kva',
  146. width: 200,
  147. },
  148. {
  149. title: '基本电价(元/kw)',
  150. align: 'center',
  151. dataIndex: 'price',
  152. width: 150,
  153. },
  154. {
  155. title: '开始时间',
  156. align: 'center',
  157. dataIndex: 'begintime',
  158. customRender: function (text) {
  159. return !text ? '' : text.length > 10 ? text.substr(0, 10) : text
  160. },
  161. width: 130,
  162. },
  163. {
  164. title: '结束时间',
  165. align: 'center',
  166. dataIndex: 'endtime',
  167. customRender: function (text) {
  168. return !text ? '' : text.length > 10 ? text.substr(0, 10) : text
  169. },
  170. width: 130,
  171. },
  172. {
  173. title: '备注',
  174. align: 'center',
  175. dataIndex: 'remark',
  176. },
  177. {
  178. title: '操作',
  179. dataIndex: 'action',
  180. align: 'center',
  181. fixed: 'right',
  182. width: 147,
  183. scopedSlots: { customRender: 'action' },
  184. },
  185. ],
  186. url: {
  187. list: '/elecfeeBase/elecfeeBase/list',
  188. delete: '/elecfeeBase/elecfeeBase/delete',
  189. deleteBatch: '/elecfeeBase/elecfeeBase/deleteBatch',
  190. exportXlsUrl: '/elecfeeBase/elecfeeBase/exportXls',
  191. importExcelUrl: 'elecfeeBase/elecfeeBase/importExcel',
  192. },
  193. dictOptions: {},
  194. superFieldList: [],
  195. }
  196. },
  197. created() {
  198. this.getSuperFieldList()
  199. },
  200. computed: {
  201. importExcelUrl: function () {
  202. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
  203. },
  204. },
  205. methods: {
  206. initDictConfig() {},
  207. getSuperFieldList() {
  208. let fieldList = []
  209. fieldList.push({ type: 'int', value: 'elecfeebaseid', text: '基本电费ID', dictCode: '' })
  210. fieldList.push({ type: 'string', value: 'remark', text: '备注', dictCode: '' })
  211. fieldList.push({ type: 'sel_depart', value: 'deptid', text: '部门' })
  212. fieldList.push({ type: 'string', value: 'feetype', text: '计费类型', dictCode: 'elecfee_base_feetype' })
  213. fieldList.push({ type: 'double', value: 'kva', text: '变压器容量/合同最大需量(kVA)', dictCode: '' })
  214. fieldList.push({ type: 'double', value: 'price', text: '基本电价(元/kw)', dictCode: '' })
  215. fieldList.push({ type: 'date', value: 'begintime', text: '开始时间' })
  216. fieldList.push({ type: 'date', value: 'endtime', text: '结束时间' })
  217. this.superFieldList = fieldList
  218. },
  219. },
  220. }
  221. </script>
  222. <style scoped>
  223. @import '~@assets/less/common.less';
  224. </style>