修改附加费操作
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
:query="queryList"
|
||||
row-key="scId"
|
||||
>
|
||||
<template #toolbar="{ selection, ids }">
|
||||
<template #toolbar>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
@@ -19,30 +19,16 @@
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="selection.length !== 1"
|
||||
@click="handleUpdate(selection[0])"
|
||||
v-hasPermi="['price:surcharge:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="!selection.length"
|
||||
@click="handleDelete(ids)"
|
||||
v-hasPermi="['price:surcharge:remove']"
|
||||
>删除</el-button>
|
||||
icon="View"
|
||||
@click="voidDrawerRef.open()"
|
||||
v-hasPermi="['price:surcharge:list']"
|
||||
>作废记录</el-button>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<template #col-ssCode="{ row }">
|
||||
<el-tag :type="(row.ssCode || '').toLowerCase() === 'on' ? 'success' : 'warning'" size="small">
|
||||
{{ (row.ssCode || '').toLowerCase() === 'on' ? '有效' : '停用' }}
|
||||
</el-tag>
|
||||
<el-tag :type="ssInfo(row.ssCode).type" size="small">{{ ssInfo(row.ssCode).label }}</el-tag>
|
||||
</template>
|
||||
|
||||
<template #col-chargeType="{ row }">
|
||||
@@ -59,17 +45,34 @@
|
||||
|
||||
<template #col-action="{ row }">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(row)" v-hasPermi="['price:surcharge:edit']">编辑</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(row.scId)" v-hasPermi="['price:surcharge:remove']">删除</el-button>
|
||||
<el-button
|
||||
v-if="String(row.ssCode || '').toLowerCase() === 'on'"
|
||||
link
|
||||
type="danger"
|
||||
icon="CircleClose"
|
||||
@click="handleDisable(row.scId)"
|
||||
v-hasPermi="['price:surcharge:remove']"
|
||||
>停用</el-button>
|
||||
<el-button
|
||||
v-if="String(row.ssCode || '').toLowerCase() === 'of'"
|
||||
link
|
||||
type="success"
|
||||
icon="CircleCheck"
|
||||
@click="handleEnable(row.scId)"
|
||||
v-hasPermi="['price:surcharge:remove']"
|
||||
>启用</el-button>
|
||||
</template>
|
||||
</basic-table>
|
||||
|
||||
<surcharge-form-dialog ref="formDialogRef" @success="() => tableRef.refresh()" />
|
||||
<surcharge-void-drawer ref="voidDrawerRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="PriceSurcharge">
|
||||
import { listSurcharge, delSurcharge } from '@/api/price/surcharge'
|
||||
import { listSurcharge, disableSurcharge, enableSurcharge } from '@/api/price/surcharge'
|
||||
import SurchargeFormDialog from './components/SurchargeFormDialog.vue'
|
||||
import SurchargeVoidDrawer from './components/SurchargeVoidDrawer.vue'
|
||||
import { listRegionOptions } from '@/api/data/region'
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
@@ -78,6 +81,7 @@ const { bms_charge_type } = useDict('bms_charge_type')
|
||||
|
||||
const tableRef = ref()
|
||||
const formDialogRef = ref()
|
||||
const voidDrawerRef = ref()
|
||||
const regionOptions = ref([])
|
||||
|
||||
const columns = [
|
||||
@@ -110,7 +114,8 @@ const searchColumns = [
|
||||
component: 'select',
|
||||
options: [
|
||||
{ label: '有效', value: 'on' },
|
||||
{ label: '停用', value: 'of' }
|
||||
{ label: '停用', value: 'of' },
|
||||
{ label: '作废', value: 'vd' }
|
||||
],
|
||||
placeholder: '状态',
|
||||
width: '120px'
|
||||
@@ -159,15 +164,35 @@ function handleUpdate(row) {
|
||||
formDialogRef.value.open(row)
|
||||
}
|
||||
|
||||
function handleDelete(ids) {
|
||||
function handleDisable(ids) {
|
||||
const idText = Array.isArray(ids) ? ids.join(',') : ids
|
||||
proxy.$modal.confirm('是否确认删除所选附加费配置?').then(() => {
|
||||
return delSurcharge(idText)
|
||||
proxy.$modal.confirm('是否确认停用所选附加费?停用后不再参与计费,可再启用恢复').then(() => {
|
||||
return disableSurcharge(idText)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
proxy.$modal.msgSuccess('停用成功')
|
||||
tableRef.value.refresh()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
function handleEnable(ids) {
|
||||
const idText = Array.isArray(ids) ? ids.join(',') : ids
|
||||
proxy.$modal.confirm('是否确认启用所选附加费?启用后重新参与计费').then(() => {
|
||||
return enableSurcharge(idText)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('启用成功')
|
||||
tableRef.value.refresh()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
// 状态三态:on 有效 / of 停用 / vd 作废
|
||||
function ssInfo(code) {
|
||||
const map = {
|
||||
on: { label: '有效', type: 'success' },
|
||||
of: { label: '停用', type: 'warning' },
|
||||
vd: { label: '作废', type: 'danger' }
|
||||
}
|
||||
return map[String(code || '').toLowerCase()] || { label: code || '-', type: 'info' }
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user