index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <template>
  2. <page-header-wrapper>
  3. <a-card :bordered="false">
  4. <!-- 条件搜索 -->
  5. <div class="table-page-search-wrapper">
  6. <a-form layout="inline">
  7. <a-row :gutter="48">
  8. <a-col :span="6">
  9. <a-form-item label="油卡号" prop="gasCode">
  10. <a-input v-model="queryParam.gasCode" placeholder="请输入油卡号" allow-clear />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :span="6">
  14. <a-form-item label="机构名称" prop="deptName">
  15. <a-input v-model="queryParam.deptName" placeholder="请输入机构名称" allow-clear />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :span="5">
  19. <a-form-item label="油品" prop="gasType">
  20. <a-select placeholder="请选择油品类型" v-model="queryParam.gasType" style="width: 100%" allow-clear>
  21. <a-select-option v-for="(d, index) in dict.type.gas_type" :key="index" :value="d.value">{{
  22. d.label
  23. }}</a-select-option>
  24. </a-select>
  25. </a-form-item>
  26. </a-col>
  27. <a-col :span="5">
  28. <a-form-item label="状态" prop="status">
  29. <a-select placeholder="请选择" v-model="queryParam.status" style="width: 100%" allow-clear>
  30. <a-select-option v-for="(d, index) in dict.type.gas_status" :key="index" :value="d.value">{{
  31. d.label
  32. }}</a-select-option>
  33. </a-select>
  34. </a-form-item>
  35. </a-col>
  36. <a-col :span="5">
  37. <a-form-item label="加油卡类型" prop="gasCardType">
  38. <a-select placeholder="请选择加油卡类型" v-model="queryParam.gasCardType" style="width: 100%" allow-clear>
  39. <a-select-option v-for="(d, index) in dict.type.gas_car_type" :key="index" :value="d.value">{{
  40. d.label
  41. }}</a-select-option>
  42. </a-select>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :span="6">
  46. <span
  47. class="table-page-search-submitButtons"
  48. :style="(advanced && { float: 'right', overflow: 'hidden' }) || {}"
  49. >
  50. <a-button type="primary" @click="handleQuery"><a-icon type="search" />查询</a-button>
  51. <a-button style="margin-left: 8px" @click="resetQuery"><a-icon type="redo" />重置</a-button>
  52. </span>
  53. </a-col>
  54. </a-row>
  55. </a-form>
  56. </div>
  57. <!-- 操作 -->
  58. <div class="table-operations">
  59. <a-button type="primary" @click="$refs.createForm.handleAdd()" v-hasPermi="['clw:gas:add']">
  60. <a-icon type="plus" />新增
  61. </a-button>
  62. <a-button
  63. type="primary"
  64. :disabled="single"
  65. @click="$refs.createForm.handleUpdate(undefined, ids)"
  66. v-hasPermi="['clw:gas:edit']"
  67. >
  68. <a-icon type="edit" />修改
  69. </a-button>
  70. <a-button type="danger" :disabled="multiple" @click="handleDelete" v-hasPermi="['clw:gas:remove']">
  71. <a-icon type="delete" />删除
  72. </a-button>
  73. <a-button type="dashed" @click="$refs.importExcel.importExcelHandleOpen()" v-hasPermi="['system:user:import']">
  74. <a-icon type="import" />导入
  75. </a-button>
  76. <a-button type="primary" @click="handleExport" v-hasPermi="['clw:gas:export']">
  77. <a-icon type="download" />导出
  78. </a-button>
  79. <table-setting
  80. :style="{ float: 'right' }"
  81. :table-size.sync="tableSize"
  82. v-model="columns"
  83. :refresh-loading="loading"
  84. @refresh="getList"
  85. />
  86. </div>
  87. <!-- 增加修改 -->
  88. <create-form
  89. ref="createForm"
  90. :gasCardTypeOptions="dict.type.gas_car_type"
  91. :statusOptions="dict.type.gas_status"
  92. @ok="getList"
  93. />
  94. <!-- 注销原因 -->
  95. <singOut ref="singForm" @signCar="signCar" />
  96. <!-- 上传文件 -->
  97. <import-excel ref="importExcel" @ok="getList" />
  98. <!-- 删除弹窗 -->
  99. <OpenModul ref="modules" @handleDeletes="handleDeletes" />
  100. <!-- 数据展示 -->
  101. <a-table
  102. :loading="loading"
  103. :size="tableSize"
  104. rowKey="gasId"
  105. :columns="columns"
  106. :data-source="list"
  107. :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  108. :pagination="false"
  109. :bordered="tableBordered"
  110. >
  111. <span slot="gasCardType" slot-scope="text, record">
  112. <dict-tag :options="dict.type['gas_car_type']" :value="record.gasCardType" />
  113. </span>
  114. <span slot="gasType" slot-scope="text, record">
  115. <dict-tag :options="dict.type['gas_type']" :value="record.gasType" />
  116. </span>
  117. <span slot="status" slot-scope="text, record">
  118. <dict-tag :options="dict.type['gas_status']" :value="record.status" />
  119. </span>
  120. <span slot="operation" slot-scope="text, record">
  121. <a-divider type="vertical" v-hasPermi="['clw:gas:edit']" />
  122. <a @click="$refs.createForm.handleUpdate(record, undefined)" v-hasPermi="['clw:gas:edit']">
  123. <a-icon type="edit" />修改
  124. </a>
  125. <a-divider type="vertical" v-hasPermi="['clw:gas:edit']" />
  126. <a @click="$refs.createForm.handleInfo(record, undefined)" v-hasPermi="['clw:gas:edit']">
  127. <a-icon type="eye" />详情
  128. </a>
  129. <a-divider type="vertical" v-hasPermi="['clw:gas:remove']" />
  130. <a @click="$refs.singForm.signOut(record, undefined)" v-hasPermi="['clw:gas:edit']" v-if="record.status != 0">
  131. <a-icon type="close-circle" />注销
  132. </a>
  133. <a-divider type="vertical" v-hasPermi="['clw:gas:remove']" />
  134. <a @click="handleDelete(record)" v-hasPermi="['clw:gas:remove']"> <a-icon type="delete" />删除 </a>
  135. </span>
  136. </a-table>
  137. <!-- 分页 -->
  138. <a-pagination
  139. class="ant-table-pagination"
  140. show-size-changer
  141. show-quick-jumper
  142. :current="queryParam.pageNum"
  143. :total="total"
  144. :page-size="queryParam.pageSize"
  145. :showTotal="(total) => `共 ${total} 条`"
  146. @showSizeChange="onShowSizeChange"
  147. @change="changeSize"
  148. />
  149. </a-card>
  150. </page-header-wrapper>
  151. </template>
  152. <script>
  153. import { listGas, delGas, updateGas } from '@/api/clw/gas'
  154. import CreateForm from './modules/CreateForm'
  155. import { tableMixin } from '@/store/table-mixin'
  156. import singOut from './modules/singOut.vue'
  157. import OpenModul from '@/components/OpenModul.vue'
  158. import ImportExcel from './modules/ImportExcel.vue'
  159. export default {
  160. name: 'Gas',
  161. components: {
  162. CreateForm,
  163. singOut,
  164. OpenModul,
  165. ImportExcel,
  166. },
  167. mixins: [tableMixin],
  168. dicts: ['gas_car_type', 'gas_status', 'gas_type'],
  169. data() {
  170. return {
  171. list: [],
  172. selectedRowKeys: [],
  173. selectedRows: [],
  174. // 高级搜索 展开/关闭
  175. advanced: false,
  176. // 非单个禁用
  177. single: true,
  178. // 非多个禁用
  179. multiple: true,
  180. ids: [],
  181. loading: false,
  182. total: 0,
  183. // 查询参数
  184. queryParam: {
  185. plateNumber: null,
  186. gasCode: null,
  187. deptName: null,
  188. gasType: null,
  189. status:null,
  190. gasCardType:null,
  191. pageNum: 1,
  192. pageSize: 10,
  193. },
  194. //机构
  195. deptIdList: [
  196. {
  197. id: 100,
  198. lable: '两江新区消防救援支队',
  199. },
  200. {
  201. id: 173,
  202. lable: '两江新区支队鸳鸯消防救援站',
  203. },
  204. {
  205. id: 141,
  206. lable: '两江新区支队翠云消防救援站',
  207. },
  208. {
  209. id: 142,
  210. lable: '两江新区支队龙头寺消防救援站',
  211. },
  212. {
  213. id: 140,
  214. lable: '两江新区支队大竹林特勤站',
  215. },
  216. {
  217. id: 139,
  218. lable: '两江新区支队礼嘉消防救援站',
  219. },
  220. {
  221. id: 129,
  222. lable: '两江新区支队奥园消防救援站',
  223. },
  224. ],
  225. columns: [
  226. {
  227. title: '加油卡类型',
  228. dataIndex: 'gasCardType',
  229. scopedSlots: { customRender: 'gasCardType' },
  230. ellipsis: true,
  231. align: 'center',
  232. },
  233. {
  234. title: '车辆车牌号',
  235. dataIndex: 'plateNumber',
  236. ellipsis: true,
  237. align: 'center',
  238. },
  239. {
  240. title: '机构名称',
  241. dataIndex: 'deptName',
  242. ellipsis: true,
  243. align: 'center',
  244. },
  245. {
  246. title: '车辆分类',
  247. dataIndex: 'carCategoryName',
  248. ellipsis: true,
  249. align: 'center',
  250. },
  251. {
  252. title: '油品',
  253. dataIndex: 'gasType',
  254. scopedSlots: { customRender: 'gasType' },
  255. ellipsis: true,
  256. align: 'center',
  257. },
  258. {
  259. title: '油卡号',
  260. dataIndex: 'gasCode',
  261. ellipsis: true,
  262. align: 'center',
  263. },
  264. {
  265. title: '初始金额',
  266. dataIndex: 'initialAmount',
  267. ellipsis: true,
  268. align: 'center',
  269. },
  270. {
  271. title: '状态',
  272. dataIndex: 'status',
  273. scopedSlots: { customRender: 'status' },
  274. ellipsis: true,
  275. align: 'center',
  276. },
  277. {
  278. title: '备注',
  279. dataIndex: 'remark',
  280. ellipsis: true,
  281. align: 'center',
  282. },
  283. {
  284. title: '注销原因',
  285. dataIndex: 'logoutReason',
  286. ellipsis: true,
  287. align: 'center',
  288. },
  289. {
  290. title: '操作',
  291. dataIndex: 'operation',
  292. width: '20%',
  293. scopedSlots: { customRender: 'operation' },
  294. align: 'center',
  295. },
  296. ],
  297. gasIds: [],
  298. showOpen: '',
  299. }
  300. },
  301. filters: {},
  302. created() {
  303. this.getList()
  304. },
  305. computed: {},
  306. watch: {},
  307. methods: {
  308. /** 查询加油卡信息列表 */
  309. getList() {
  310. this.loading = true
  311. listGas(this.queryParam).then((response) => {
  312. this.list = response.rows
  313. this.total = response.total
  314. this.loading = false
  315. })
  316. },
  317. /** 搜索按钮操作 */
  318. handleQuery() {
  319. this.queryParam.pageNum = 1
  320. this.getList()
  321. },
  322. /** 重置按钮操作 */
  323. resetQuery() {
  324. this.queryParam = {
  325. plateNumber: undefined,
  326. gasCode: undefined,
  327. deptName: undefined,
  328. gasType: undefined,
  329. status:undefined,
  330. gasCardType:undefined,
  331. pageNum: 1,
  332. pageSize: 10,
  333. }
  334. this.handleQuery()
  335. },
  336. onShowSizeChange(current, pageSize) {
  337. this.queryParam.pageSize = pageSize
  338. this.getList()
  339. },
  340. changeSize(current, pageSize) {
  341. this.queryParam.pageNum = current
  342. this.queryParam.pageSize = pageSize
  343. this.getList()
  344. },
  345. onSelectChange(selectedRowKeys, selectedRows) {
  346. this.selectedRowKeys = selectedRowKeys
  347. this.selectedRows = selectedRows
  348. this.ids = this.selectedRows.map((item) => item.gasId)
  349. this.single = selectedRowKeys.length !== 1
  350. this.multiple = !selectedRowKeys.length
  351. },
  352. toggleAdvanced() {
  353. this.advanced = !this.advanced
  354. },
  355. /** 删除按钮操作 */
  356. handleDelete(row) {
  357. this.gasIds = row.gasId || this.ids
  358. this.showOpen = '删除'
  359. this.$refs.modules.title = '是否确认删除'
  360. this.$refs.modules.visible = true
  361. // this.$confirm({
  362. // title: '确认删除所选中数据?',
  363. // content: '当前选中编号为' + gasIds + '的数据',
  364. // onOk() {
  365. // return delGas(gasIds).then(() => {
  366. // that.onSelectChange([], [])
  367. // that.getList()
  368. // that.$message.success('删除成功', 3)
  369. // })
  370. // },
  371. // onCancel() {},
  372. // })
  373. },
  374. handleDeletes() {
  375. if (this.showOpen == '删除') {
  376. delGas(this.gasIds)
  377. .then(() => {
  378. this.onSelectChange([], [])
  379. this.getList()
  380. this.$message.success('删除成功', 3)
  381. this.$refs.modules.visible = false
  382. })
  383. .catch((error) => {
  384. this.$refs.modules.visible = false
  385. })
  386. } else if (this.showOpen == '导出') {
  387. this.download(
  388. 'clw/gas/export',
  389. {
  390. ...this.queryParam,
  391. },
  392. `gas_${new Date().getTime()}.xlsx`
  393. )
  394. this.$refs.modules.visible = false
  395. }
  396. },
  397. /** 导出按钮操作 */
  398. handleExport() {
  399. this.showOpen = '导出'
  400. this.$refs.modules.title = '请确认是否导出'
  401. this.$refs.modules.visible = true
  402. },
  403. signCar(info) {
  404. if (info.logoutReason == '') {
  405. return this.$message.error('请输入注销原因')
  406. }
  407. updateGas(info).then((res) => {
  408. if (res.code == 200) {
  409. this.$message.success('注销成功')
  410. this.getList()
  411. }
  412. })
  413. },
  414. },
  415. }
  416. </script>