123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418 |
- <template>
- <page-header-wrapper>
- <a-card :bordered="false">
- <!-- 条件搜索 -->
- <div class="table-page-search-wrapper">
- <a-form layout="inline">
- <a-row :gutter="48">
- <a-col :span="6">
- <a-form-item label="油卡号" prop="gasCode">
- <a-input v-model="queryParam.gasCode" placeholder="请输入油卡号" allow-clear />
- </a-form-item>
- </a-col>
- <a-col :span="6">
- <a-form-item label="机构名称" prop="deptName">
- <a-input v-model="queryParam.deptName" placeholder="请输入机构名称" allow-clear />
- </a-form-item>
- </a-col>
- <a-col :span="5">
- <a-form-item label="油品" prop="gasType">
- <a-select placeholder="请选择油品类型" v-model="queryParam.gasType" style="width: 100%" allow-clear>
- <a-select-option v-for="(d, index) in dict.type.gas_type" :key="index" :value="d.value">{{
- d.label
- }}</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :span="5">
- <a-form-item label="状态" prop="status">
- <a-select placeholder="请选择" v-model="queryParam.status" style="width: 100%" allow-clear>
- <a-select-option v-for="(d, index) in dict.type.gas_status" :key="index" :value="d.value">{{
- d.label
- }}</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :span="5">
- <a-form-item label="加油卡类型" prop="gasCardType">
- <a-select placeholder="请选择加油卡类型" v-model="queryParam.gasCardType" style="width: 100%" allow-clear>
- <a-select-option v-for="(d, index) in dict.type.gas_car_type" :key="index" :value="d.value">{{
- d.label
- }}</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :span="6">
- <span
- class="table-page-search-submitButtons"
- :style="(advanced && { float: 'right', overflow: 'hidden' }) || {}"
- >
- <a-button type="primary" @click="handleQuery"><a-icon type="search" />查询</a-button>
- <a-button style="margin-left: 8px" @click="resetQuery"><a-icon type="redo" />重置</a-button>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 操作 -->
- <div class="table-operations">
- <a-button type="primary" @click="$refs.createForm.handleAdd()" v-hasPermi="['clw:gas:add']">
- <a-icon type="plus" />新增
- </a-button>
- <a-button
- type="primary"
- :disabled="single"
- @click="$refs.createForm.handleUpdate(undefined, ids)"
- v-hasPermi="['clw:gas:edit']"
- >
- <a-icon type="edit" />修改
- </a-button>
- <a-button type="danger" :disabled="multiple" @click="handleDelete" v-hasPermi="['clw:gas:remove']">
- <a-icon type="delete" />删除
- </a-button>
- <a-button type="dashed" @click="$refs.importExcel.importExcelHandleOpen()" v-hasPermi="['system:user:import']">
- <a-icon type="import" />导入
- </a-button>
- <a-button type="primary" @click="handleExport" v-hasPermi="['clw:gas:export']">
- <a-icon type="download" />导出
- </a-button>
- <table-setting
- :style="{ float: 'right' }"
- :table-size.sync="tableSize"
- v-model="columns"
- :refresh-loading="loading"
- @refresh="getList"
- />
- </div>
- <!-- 增加修改 -->
- <create-form
- ref="createForm"
- :gasCardTypeOptions="dict.type.gas_car_type"
- :statusOptions="dict.type.gas_status"
- @ok="getList"
- />
- <!-- 注销原因 -->
- <singOut ref="singForm" @signCar="signCar" />
- <!-- 上传文件 -->
- <import-excel ref="importExcel" @ok="getList" />
- <!-- 删除弹窗 -->
- <OpenModul ref="modules" @handleDeletes="handleDeletes" />
- <!-- 数据展示 -->
- <a-table
- :loading="loading"
- :size="tableSize"
- rowKey="gasId"
- :columns="columns"
- :data-source="list"
- :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
- :pagination="false"
- :bordered="tableBordered"
- >
- <span slot="gasCardType" slot-scope="text, record">
- <dict-tag :options="dict.type['gas_car_type']" :value="record.gasCardType" />
- </span>
- <span slot="gasType" slot-scope="text, record">
- <dict-tag :options="dict.type['gas_type']" :value="record.gasType" />
- </span>
- <span slot="status" slot-scope="text, record">
- <dict-tag :options="dict.type['gas_status']" :value="record.status" />
- </span>
- <span slot="operation" slot-scope="text, record">
- <a-divider type="vertical" v-hasPermi="['clw:gas:edit']" />
- <a @click="$refs.createForm.handleUpdate(record, undefined)" v-hasPermi="['clw:gas:edit']">
- <a-icon type="edit" />修改
- </a>
- <a-divider type="vertical" v-hasPermi="['clw:gas:edit']" />
- <a @click="$refs.createForm.handleInfo(record, undefined)" v-hasPermi="['clw:gas:edit']">
- <a-icon type="eye" />详情
- </a>
- <a-divider type="vertical" v-hasPermi="['clw:gas:remove']" />
- <a @click="$refs.singForm.signOut(record, undefined)" v-hasPermi="['clw:gas:edit']" v-if="record.status != 0">
- <a-icon type="close-circle" />注销
- </a>
- <a-divider type="vertical" v-hasPermi="['clw:gas:remove']" />
- <a @click="handleDelete(record)" v-hasPermi="['clw:gas:remove']"> <a-icon type="delete" />删除 </a>
- </span>
- </a-table>
- <!-- 分页 -->
- <a-pagination
- class="ant-table-pagination"
- show-size-changer
- show-quick-jumper
- :current="queryParam.pageNum"
- :total="total"
- :page-size="queryParam.pageSize"
- :showTotal="(total) => `共 ${total} 条`"
- @showSizeChange="onShowSizeChange"
- @change="changeSize"
- />
- </a-card>
- </page-header-wrapper>
- </template>
- <script>
- import { listGas, delGas, updateGas } from '@/api/clw/gas'
- import CreateForm from './modules/CreateForm'
- import { tableMixin } from '@/store/table-mixin'
- import singOut from './modules/singOut.vue'
- import OpenModul from '@/components/OpenModul.vue'
- import ImportExcel from './modules/ImportExcel.vue'
- export default {
- name: 'Gas',
- components: {
- CreateForm,
- singOut,
- OpenModul,
- ImportExcel,
- },
- mixins: [tableMixin],
- dicts: ['gas_car_type', 'gas_status', 'gas_type'],
- data() {
- return {
- list: [],
- selectedRowKeys: [],
- selectedRows: [],
- // 高级搜索 展开/关闭
- advanced: false,
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- ids: [],
- loading: false,
- total: 0,
- // 查询参数
- queryParam: {
- plateNumber: null,
- gasCode: null,
- deptName: null,
- gasType: null,
- status:null,
- gasCardType:null,
- pageNum: 1,
- pageSize: 10,
- },
- //机构
- deptIdList: [
- {
- id: 100,
- lable: '两江新区消防救援支队',
- },
- {
- id: 173,
- lable: '两江新区支队鸳鸯消防救援站',
- },
- {
- id: 141,
- lable: '两江新区支队翠云消防救援站',
- },
- {
- id: 142,
- lable: '两江新区支队龙头寺消防救援站',
- },
- {
- id: 140,
- lable: '两江新区支队大竹林特勤站',
- },
- {
- id: 139,
- lable: '两江新区支队礼嘉消防救援站',
- },
- {
- id: 129,
- lable: '两江新区支队奥园消防救援站',
- },
- ],
- columns: [
- {
- title: '加油卡类型',
- dataIndex: 'gasCardType',
- scopedSlots: { customRender: 'gasCardType' },
- ellipsis: true,
- align: 'center',
- },
- {
- title: '车辆车牌号',
- dataIndex: 'plateNumber',
- ellipsis: true,
- align: 'center',
- },
- {
- title: '机构名称',
- dataIndex: 'deptName',
- ellipsis: true,
- align: 'center',
- },
- {
- title: '车辆分类',
- dataIndex: 'carCategoryName',
- ellipsis: true,
- align: 'center',
- },
- {
- title: '油品',
- dataIndex: 'gasType',
- scopedSlots: { customRender: 'gasType' },
- ellipsis: true,
- align: 'center',
- },
- {
- title: '油卡号',
- dataIndex: 'gasCode',
- ellipsis: true,
- align: 'center',
- },
- {
- title: '初始金额',
- dataIndex: 'initialAmount',
- ellipsis: true,
- align: 'center',
- },
- {
- title: '状态',
- dataIndex: 'status',
- scopedSlots: { customRender: 'status' },
- ellipsis: true,
- align: 'center',
- },
- {
- title: '备注',
- dataIndex: 'remark',
- ellipsis: true,
- align: 'center',
- },
- {
- title: '注销原因',
- dataIndex: 'logoutReason',
- ellipsis: true,
- align: 'center',
- },
- {
- title: '操作',
- dataIndex: 'operation',
- width: '20%',
- scopedSlots: { customRender: 'operation' },
- align: 'center',
- },
- ],
- gasIds: [],
- showOpen: '',
- }
- },
- filters: {},
- created() {
- this.getList()
- },
- computed: {},
- watch: {},
- methods: {
- /** 查询加油卡信息列表 */
- getList() {
- this.loading = true
- listGas(this.queryParam).then((response) => {
- this.list = response.rows
- this.total = response.total
- this.loading = false
- })
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParam.pageNum = 1
- this.getList()
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.queryParam = {
- plateNumber: undefined,
- gasCode: undefined,
- deptName: undefined,
- gasType: undefined,
- status:undefined,
- gasCardType:undefined,
- pageNum: 1,
- pageSize: 10,
- }
- this.handleQuery()
- },
- onShowSizeChange(current, pageSize) {
- this.queryParam.pageSize = pageSize
- this.getList()
- },
- changeSize(current, pageSize) {
- this.queryParam.pageNum = current
- this.queryParam.pageSize = pageSize
- this.getList()
- },
- onSelectChange(selectedRowKeys, selectedRows) {
- this.selectedRowKeys = selectedRowKeys
- this.selectedRows = selectedRows
- this.ids = this.selectedRows.map((item) => item.gasId)
- this.single = selectedRowKeys.length !== 1
- this.multiple = !selectedRowKeys.length
- },
- toggleAdvanced() {
- this.advanced = !this.advanced
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- this.gasIds = row.gasId || this.ids
- this.showOpen = '删除'
- this.$refs.modules.title = '是否确认删除'
- this.$refs.modules.visible = true
- // this.$confirm({
- // title: '确认删除所选中数据?',
- // content: '当前选中编号为' + gasIds + '的数据',
- // onOk() {
- // return delGas(gasIds).then(() => {
- // that.onSelectChange([], [])
- // that.getList()
- // that.$message.success('删除成功', 3)
- // })
- // },
- // onCancel() {},
- // })
- },
- handleDeletes() {
- if (this.showOpen == '删除') {
- delGas(this.gasIds)
- .then(() => {
- this.onSelectChange([], [])
- this.getList()
- this.$message.success('删除成功', 3)
- this.$refs.modules.visible = false
- })
- .catch((error) => {
- this.$refs.modules.visible = false
- })
- } else if (this.showOpen == '导出') {
- this.download(
- 'clw/gas/export',
- {
- ...this.queryParam,
- },
- `gas_${new Date().getTime()}.xlsx`
- )
- this.$refs.modules.visible = false
- }
- },
- /** 导出按钮操作 */
- handleExport() {
- this.showOpen = '导出'
- this.$refs.modules.title = '请确认是否导出'
- this.$refs.modules.visible = true
- },
- signCar(info) {
- if (info.logoutReason == '') {
- return this.$message.error('请输入注销原因')
- }
- updateGas(info).then((res) => {
- if (res.code == 200) {
- this.$message.success('注销成功')
- this.getList()
- }
- })
- },
- },
- }
- </script>
|