Commit 098f79b2 by wusiyi

feat: 新增操作费管理

parent e3b6b5af
<script>
<script lang="jsx">
export default {
name: 'CustomForm',
components: {},
......@@ -109,63 +109,82 @@ export default {
inline
onSubmit={this.handleSubmit}
onKeyupenterCapture={this.search}>
{this.formConfig?.map((item, index) => (
<el-form-item
style={{
width: item.type === 'textarea' ? '100%' : this.formItemWidth
}}
class={item.type === 'textarea' ? 'textClass' : ''}
prop={item.prop}
rules={(item.renderRules && item.renderRules(this.formData)) || []}
label-width={item.labelWidth || this.formLabelWidth}
key={index}
label={item.name}>
{item.type === 'input' && (
<el-input
v-model={this.formData[item.prop]}
placeholder={item.placeholder || `请输入${item.name}`}
clearable></el-input>
)}
{item.type === 'textarea' && (
<el-input
type="textarea"
v-model={this.formData[item.prop]}
placeholder={item.placeholder || `请输入${item.name}`}
clearable></el-input>
)}
{item.type === 'select' && (
<el-select
v-model={this.formData[item.prop]}
placeholder={item.placeholder || `请选择${item.name}`}
clearable>
{item.options?.map((el, idx) => (
<el-option
label={el.label}
value={el.value}
key={idx}></el-option>
))}
</el-select>
)}
{item.type === 'datePicker' && (
<el-date-picker
value-format="yyyy-MM-dd"
type={item.dateType || 'date'}
placeholder="选择日期"
v-model={this.formData[item.prop]}
clearable
style="width: 100%;"></el-date-picker>
)}
{item.type === 'radio' &&
item.radioOptions?.map((el, idx) => (
<el-radio
{this.formConfig?.map((item, index) => {
if (
typeof item.isShow === 'function' &&
!item.isShow(this.formData)
) {
return null
}
return (
<el-form-item
style={{
width: item.type === 'textarea' ? '100%' : this.formItemWidth
}}
class={item.type === 'textarea' ? 'textClass' : ''}
prop={item.prop}
rules={
(item.renderRules && item.renderRules(this.formData)) || []
}
label-width={item.labelWidth || this.formLabelWidth}
key={index}
label={item.name}>
{item.type === 'input' && (
<el-input
v-model={this.formData[item.prop]}
label={el.value}
key={idx}>
{el.label}
</el-radio>
))}
</el-form-item>
))}
placeholder={item.placeholder || `请输入${item.name}`}
clearable></el-input>
)}
{item.type === 'inputNumber' && (
<el-input-number
v-model={this.formData[item.prop]}
placeholder={item.placeholder || `请输入${item.name}`}
clearable
step={item.step || 1}
controls-position={item.position || 'right'}
style="width: 100%;"></el-input-number>
)}
{item.type === 'textarea' && (
<el-input
type="textarea"
v-model={this.formData[item.prop]}
placeholder={item.placeholder || `请输入${item.name}`}
clearable></el-input>
)}
{item.type === 'select' && (
<el-select
v-model={this.formData[item.prop]}
placeholder={item.placeholder || `请选择${item.name}`}
clearable>
{item.options?.map((el, idx) => (
<el-option
label={el.label}
value={el.value}
key={idx}></el-option>
))}
</el-select>
)}
{item.type === 'datePicker' && (
<el-date-picker
value-format="yyyy-MM-dd"
type={item.dateType || 'date'}
placeholder="选择日期"
v-model={this.formData[item.prop]}
clearable
style="width: 100%;"></el-date-picker>
)}
{item.type === 'radio' &&
item.radioOptions?.map((el, idx) => (
<el-radio
v-model={this.formData[item.prop]}
label={el.value}
key={idx}>
{el.label}
</el-radio>
))}
</el-form-item>
)
})}
{this.isCustomButton && (
<el-form-item>
<el-button
......
<script>
<script lang="jsx">
import { mapState } from 'vuex'
const globalIndex = Math.random()
function getKey() {
return Math.random()
.toString()
.substr(3, 10)
return Math.random().toString().substr(3, 10)
}
export default {
name: 'my-table',
......@@ -13,101 +11,101 @@ export default {
props: {
rowKey: {
type: String,
default: '_id',
default: '_id'
},
tableColumns: {
type: Array,
default: () => [],
default: () => []
},
sourceData: {
type: Array,
default: () => [],
default: () => []
},
selectMore: {
type: Boolean,
default: false,
default: false
},
// 排序
serverSort: {
type: Boolean,
default: false,
default: false
},
treeConfig: {
type: Object,
default: () => { },
default: () => {}
},
expandConfig: {
type: Object,
default: () => { },
default: () => {}
},
stripe: {
type: Boolean,
default: false,
default: false
},
showHeader: {
type: Boolean,
default: true,
default: true
},
isFooter: {
type: Boolean,
default: false,
default: false
},
more: {
type: Boolean,
default: false,
default: false
},
pageSize: {
type: Number,
default: 100,
default: 100
},
serialNumber: {
type: Boolean,
default: true,
default: true
},
selection: {
type: Boolean,
default: false,
default: false
},
radio: {
type: Boolean,
default: false,
default: false
},
footerMethod: {
type: Function,
default: () => { },
default: () => {}
},
cellClick: {
type: Function,
default: () => { },
default: () => {}
},
footerSpanMethod: {
type: Function,
default: () => { },
default: () => {}
},
rowClassName: {
type: Function,
default: () => { },
default: () => {}
},
cellStyle: {
type: Function,
default: () => { },
default: () => {}
},
highIds: {
// 高亮显示行
type: Array,
default: () => [],
default: () => []
},
highFirst: {
type: Boolean,
default: false,
default: false
},
spanMethod: {
type: Function,
default: () => { },
default: () => {}
},
checkboxConfig: {
type: Object,
default: () => { },
default: () => {}
},
customRightMenu: {
type: Object,
......@@ -115,20 +113,20 @@ export default {
code: '',
name: '',
prefixIcon: '',
disabled: false,
}),
disabled: false
})
},
virtualScroll: {
type: Boolean,
default: true,
default: true
},
cellClassName: {
type: Function,
},
type: Function
}
},
computed: {
...mapState({
keyCode: 'keyCode',
keyCode: 'keyCode'
// oldSelection: (state) => state.Order.oldSelection,
}),
tableMenu() {
......@@ -139,15 +137,15 @@ export default {
{
code: 'hideColumn',
name: '隐藏列',
disabled: false,
disabled: false
},
{
code: 'showAllColumn',
name: '取消所有隐藏列',
disabled: false,
},
],
],
disabled: false
}
]
]
},
body: {
options: [
......@@ -155,40 +153,35 @@ export default {
{
code: 'checkAll',
name: '全部选择',
disabled: false,
disabled: false
},
{
code: 'cancelSelection',
name: '取消选择',
disabled: true,
disabled: true
},
{
code: 'copy',
name: '复制',
prefixIcon: 'fa fa-copy',
disabled: false,
},
],
],
},
disabled: false
}
]
]
}
// visibleMethod: this.visibleMethod
}
if (this.$props.customRightMenu?.name) {
const {
code,
name,
prefixIcon,
disabled,
} = this.$props.customRightMenu
const { code, name, prefixIcon, disabled } = this.$props.customRightMenu
obj.body.options[0].push({
code,
name,
prefixIcon,
disabled,
disabled
})
}
return obj
},
}
},
watch: {
sourceData(data) {
......@@ -196,14 +189,9 @@ export default {
setTimeout(() => {
if (data.length > 0 && this.highFirst) {
if (this.selection) {
this.$refs.vxetable.setCheckboxRow(
[data[0]],
true,
)
this.$refs.vxetable.setCheckboxRow([data[0]], true)
} else if (this.radio) {
this.$refs.vxetable.setRadioRow(
this.sourceData[0],
)
this.$refs.vxetable.setRadioRow(this.sourceData[0])
this.$refs.vxetable.setCurrentRow(data[0])
} else {
this.$refs.vxetable.setCurrentRow(data[0])
......@@ -218,38 +206,19 @@ export default {
},
tableColumns(newdata, olddata) {
console.log('tableColumns')
if (
newdata &&
olddata &&
olddata.length > 0 &&
newdata !== olddata
) {
if (newdata && olddata && olddata.length > 0 && newdata !== olddata) {
this.tableKey = getKey()
setTimeout(() => {
if (
this.sourceData.length > 0 &&
this.highFirst
) {
if (this.sourceData.length > 0 && this.highFirst) {
if (this.selection) {
this.$refs.vxetable.setCheckboxRow(
[this.sourceData[0]],
true,
)
this.$refs.vxetable.setCheckboxRow([this.sourceData[0]], true)
} else if (this.radio) {
this.$refs.vxetable.setRadioRow(
this.sourceData[0],
)
this.$refs.vxetable.setCurrentRow(
this.sourceData[0],
)
this.$refs.vxetable.setRadioRow(this.sourceData[0])
this.$refs.vxetable.setCurrentRow(this.sourceData[0])
} else {
this.$refs.vxetable.setCurrentRow(
this.sourceData[0],
)
this.$refs.vxetable.setCurrentRow(this.sourceData[0])
}
this.$emit('selectionChange', [
this.sourceData[0],
])
this.$emit('selectionChange', [this.sourceData[0]])
// this.$emit('currentChange', { row: this.sourceData[0] })
}
}, 200)
......@@ -265,7 +234,7 @@ export default {
// },
selection() {
this.tableKey = getKey()
},
}
},
data() {
return {
......@@ -274,7 +243,7 @@ export default {
tableData: [],
selections: [],
startIndex: null,
tableKey: getKey(),
tableKey: getKey()
}
},
methods: {
......@@ -282,7 +251,7 @@ export default {
this.$refs.vxetable.reloadData(this.sourceData)
},
clearSelectionBox() {
this.$refs.vxetable.clearCheckboxRow()// 清空表格左侧的选择框数据
this.$refs.vxetable.clearCheckboxRow() // 清空表格左侧的选择框数据
},
toggleRowExpand(obj) {
this.$emit('toggleRowExpand', obj)
......@@ -331,10 +300,7 @@ export default {
try {
if (this.selection) {
this.$refs.vxetable.clearCheckboxRow()
this.$refs.vxetable.setCheckboxRow(
[row],
true,
)
this.$refs.vxetable.setCheckboxRow([row], true)
this.$emit('selectionChange', [options.row])
}
if (this.radio) {
......@@ -437,14 +403,12 @@ export default {
break
case 'hideColumn': // 隐藏列
if (!column.property) {
return this.$message.warning(
'当前列不支持此操作',
)
return this.$message.warning('当前列不支持此操作')
}
this.$emit('columnChange', {
column: column.property,
key: 'show',
value: false,
value: false
})
// this.$set(this.tableMenu.body.options[0][0],'disabled',true)
break
......@@ -452,20 +416,14 @@ export default {
this.$emit('columnChange', {
column: 'all',
key: 'show',
value: true,
value: true
})
// this.$set(this.tableMenu.body.options[0][0],'disabled',true)
break
}
if (this.$props.customRightMenu?.func) {
if (
this.$props.customRightMenu.code === menu.code
) {
this.$props.customRightMenu.func(
row,
column,
$event,
)
if (this.$props.customRightMenu.code === menu.code) {
this.$props.customRightMenu.func(row, column, $event)
}
}
},
......@@ -489,7 +447,7 @@ export default {
this.$emit('columnChange', {
column: column.property,
key: 'width',
value: column.resizeWidth,
value: column.resizeWidth
})
},
renderColumn(item, index, classname) {
......@@ -500,15 +458,14 @@ export default {
return item.render(row, item.key, $rowIndex)
}
return row[item.key]
},
}
}
if (item.content) {
slots.content = ({ row }) =>
item.content ? item.content(row, item.key) : null
}
if (item.title) {
slots.header = () =>
item.title ? item.title(item.label) : item.label
slots.header = () => (item.title ? item.title(item.label) : item.label)
}
return (
<vxe-table-column
......@@ -524,17 +481,16 @@ export default {
header-align="center"
sortable={item.sortable}
align={item.align || 'center'}
scopedSlots={slots}
></vxe-table-column>
scopedSlots={slots}></vxe-table-column>
)
},
}
},
render() {
const isShow = this.tableColumns.length > 0
const checkboxconfig = {
reserve: true,
highlight: true,
highlight: true
}
if (this.checkboxConfig) {
for (const key in this.checkboxConfig) {
......@@ -551,7 +507,7 @@ export default {
sort-config={{
trigger: 'cell',
remote: this.serverSort,
orders: ['desc', 'asc', 'null'],
orders: ['desc', 'asc', 'null']
}}
menu-config={this.tableMenu}
checkbox-config={checkboxconfig}
......@@ -589,17 +545,14 @@ export default {
tree-config={this.treeConfig}
stripe={this.stripe}
{...{ props: this.$attrs, on: this.$listeners }}
key={this.tableKey}
>
key={this.tableKey}>
{isShow && this.selection && (
<vxe-table-column
fixed="left"
field="selection"
type="checkbox"
align="center"
width={
this.selectMore && this.notSelected ? 120 : 40
}
width={this.selectMore && this.notSelected ? 120 : 40}
// width="120"
scopedSlots={{
title: ({ checked }) =>
......@@ -610,16 +563,14 @@ export default {
size="default"
onClick={this.selectAll}
style={{
color: this.more ? 'red' : '#4168FF',
}}
>
color: this.more ? 'red' : '#4168FF'
}}>
{this.more
? `${this.pageSize}+ selected`
: `select ${this.pageSize}+`}
</el-button>
) : null,
}}
></vxe-table-column>
) : null
}}></vxe-table-column>
)}
{isShow && this.radio && (
<vxe-table-column
......@@ -628,8 +579,7 @@ export default {
title=""
field="radio"
align="center"
width="40"
></vxe-table-column>
width="40"></vxe-table-column>
)}
{isShow && this.serialNumber && (
<vxe-table-column
......@@ -637,11 +587,10 @@ export default {
title="序号"
field="num"
scopedSlots={{
default: this.$scopedSlots.serialNumberRender,
default: this.$scopedSlots.serialNumberRender
}}
align="center"
width="60"
></vxe-table-column>
width="60"></vxe-table-column>
)}
{this.tableColumns.map((item, index) => {
......@@ -653,14 +602,9 @@ export default {
<vxe-table-colgroup
header-align="center"
header-class-name="tablecolgroup"
title={item.label}
>
title={item.label}>
{item.subTitle.map((subitem, index1) => {
return this.renderColumn(
subitem,
index1,
'tablecolgroup',
)
return this.renderColumn(subitem, index1, 'tablecolgroup')
})}
</vxe-table-colgroup>
)
......@@ -670,7 +614,7 @@ export default {
})}
</vxe-table>
)
},
}
}
</script>
<style scoped>
......@@ -688,22 +632,22 @@ export default {
.my-table >>> .vxe-footer--column.col--ellipsis {
height: 30px;
} */
.my-table>>>.vxe-checkbox--label {
.my-table >>> .vxe-checkbox--label {
padding-left: 0;
}
.my-table>>>.vxe-header--column.tablecolgroup,
.my-table>>>.vxe-header--column.col--ellipsis.tablecolgroup {
.my-table >>> .vxe-header--column.tablecolgroup,
.my-table >>> .vxe-header--column.col--ellipsis.tablecolgroup {
height: 22px !important;
}
.my-table>>>.vxe-cell {
.my-table >>> .vxe-cell {
/* max-height: 30px !important; */
padding-left: 5px;
padding-right: 5px;
}
.my-table>>>.green {
.my-table >>> .green {
background: green;
color: #fff;
}
......
......@@ -8,6 +8,7 @@ import {
Form,
FormItem,
Input,
InputNumber,
Message,
MessageBox,
Pagination,
......@@ -21,6 +22,7 @@ import {
Cascader,
Radio,
RadioGroup,
RadioButton,
Menu,
Submenu,
MenuItem,
......@@ -36,6 +38,7 @@ import {
Tooltip,
ColorPicker,
CheckboxGroup,
CheckboxButton,
Divider,
Popover,
Upload
......@@ -49,6 +52,7 @@ const components = [
Form,
FormItem,
Input,
InputNumber,
DatePicker,
Pagination,
Switch,
......@@ -57,6 +61,7 @@ const components = [
Cascader,
Radio,
RadioGroup,
RadioButton,
Menu,
MenuItem,
Submenu,
......@@ -75,6 +80,7 @@ const components = [
Tooltip,
ColorPicker,
CheckboxGroup,
CheckboxButton,
Popover,
Upload
]
......@@ -88,13 +94,13 @@ export default {
Vue.prototype.$message = (message) =>
typeof message === 'string'
? Message({
duration: 2500,
message,
})
duration: 2500,
message
})
: Message({
duration: 2500,
...message,
})
duration: 2500,
...message
})
Vue.prototype.$message.success = (message) =>
typeof message === 'string'
? Message.success({ duration: 2500, message })
......@@ -115,5 +121,5 @@ export default {
Vue.prototype.$alert = MessageBox.alert
Vue.prototype.$confirm = MessageBox.confirm
Vue.prototype.$prompt = MessageBox.prompt
},
}
}
......@@ -79,6 +79,12 @@ const routes = [
meta: { title: '服务管理' }
},
{
path: '/saas/operationFee',
component: () => import('@/views/system/operationFee.vue'),
name: 'system_operationFee',
meta: { title: '操作费管理' }
},
{
path: '/saas/countryCode',
component: () => import('@/views/system/countryCode.vue'),
name: 'system_countryCode',
......
......@@ -275,6 +275,14 @@ export default {
icon: 'el-icon-s-order',
index: '/saas/services',
children: []
},
{
id: 6,
path: '',
label: '操作费管理',
icon: 'el-icon-s-order',
index: '/saas/operationFee',
children: []
}
]
},
......
<template>
<div class="wraper">
<CustomForm
:formConfig="queryformConfig"
v-model="queryFormData"
@addDialog="addDialog"
@searchFn="search"
:isFlex="false"></CustomForm>
<div class="table_wrap" v-loading="loading">
<table-vue
:sourceData="sourceData"
ref="multipleTable"
:tableColumns="usersTableColumns"
@currentChange="currentTabFn"
@selectionChange="selectionChange"></table-vue>
</div>
<div class="pagination">
<el-pagination
layout="sizes, total, prev, pager, next, jumper"
background
:total="paginationOptions.total"
:page-size="paginationOptions.pageSize"
:current-page="paginationOptions.currentPage"
@size-change="sizeChange"
@current-change="onCurrentChange"></el-pagination>
</div>
<!-- 弹出层 -->
<el-dialog
:close-on-click-modal="false"
:title="is_title == 1 ? '新增' : '编辑'"
:visible.sync="dialogVisible"
@closed="closedFn"
width="590px">
<CustomForm
formItemWidth="50%"
ref="formRefs"
v-model="formData"
:formConfig="editformConfig"
:isCustomButton="false"
formLabelWidth="100px"></CustomForm>
<span slot="footer" class="dialog-footer">
<el-button
@click="dialogVisible = false"
size="mini"
style="width: 100px">
取消
</el-button>
<el-button
type="primary"
@click="addServiceManagement"
size="mini"
style="width: 100px">
确认
</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import axios from '../../common/api/axios'
import CustomForm from '@/common/components/base/CustomForm.vue'
import { mapState } from 'vuex'
import tableVue from '@/common/components/base/tableView.vue'
export default {
name: 'system_users',
components: {
tableVue,
CustomForm
},
data() {
return {
is_title: 1,
ishowForm: false,
select: '',
sourceData: [],
serviceNameList: [],
formData: {},
queryFormData: {},
queryformConfig: [
{
prop: 'name',
type: 'input',
name: '名称',
options: []
},
{
prop: 'type',
name: '费用类型',
type: 'select',
labelWidth: '20',
options: [
{ label: '固定', value: 1 },
{ label: '浮动', value: 2 }
]
}
],
editformConfig: [
{
prop: 'name',
type: 'input',
name: '名称',
options: [],
renderRules: (item) => [
{
required: true,
message: '请输入名称',
trigger: 'blur'
}
]
},
{
prop: 'type',
name: '费用类型',
type: 'select',
options: [
{ label: '固定', value: 1 },
{ label: '浮动', value: 2 }
],
max: 1,
renderRules: (item) => [
{
required: true,
message: '请选择服务类型',
trigger: 'blur'
}
]
},
{
prop: 'fixedFee',
type: 'inputNumber',
name: '固定费用',
step: 0.01,
renderRules: (item) => [
{
required: true,
message: '请输入固定费用',
trigger: 'blur'
}
],
isShow: (formData) => formData.type === 1
},
{
prop: 'startFee',
type: 'inputNumber',
name: '起收费用',
step: 0.01,
renderRules: (item) => [
{
required: true,
message: '请输入起收费用',
trigger: 'blur'
}
],
isShow: (formData) => formData.type === 2
},
{
prop: 'incrementalFee',
type: 'inputNumber',
name: '每件加收',
step: 0.01,
renderRules: (item) => [
{
required: true,
message: '请输入每件加收',
trigger: 'blur'
}
],
isShow: (formData) => formData.type === 2
},
{
prop: 'endFee',
type: 'inputNumber',
name: '上限费用 ',
step: 0.01,
renderRules: (item) => [
{
required: true,
message: '请输入上限费用',
trigger: 'blur'
}
],
isShow: (formData) => formData.type === 2
}
],
dialogVisible: false,
formId: null,
paginationOptions: {
pageSize: 100,
currentPage: 1,
total: 0
},
details: [],
loading: false
}
},
created() {
this.getList()
},
computed: {
...mapState(['reqMenu', 'employee']),
usersTableColumns() {
return [
{
label: '名称',
key: 'name',
width: ''
},
{
label: ' 费用类型 ',
key: 'type',
width: '',
render: (item) => (
<span>
{item.type === 1 ? (
<el-tag type="success">固定类型</el-tag>
) : (
<el-tag type="warning">浮动类型</el-tag>
)}
</span>
)
},
{
label: '固定费用',
key: 'fixedFee',
width: '150'
},
{
label: '起收费用',
key: 'startFee',
width: '150'
},
{
label: '每件加收',
key: 'incrementalFee',
width: '150'
},
{
label: '上限费用',
key: 'endFee',
width: '150'
},
{
label: '创建时间',
key: 'createTime',
width: ''
},
{
label: '更新时间',
key: 'updateTime',
width: ''
},
{
label: '相关操作',
key: '',
fixed: 'right',
width: '130',
render: (item) => (
<div>
<span title="编辑" class="icon-view ">
<i
class="el-icon-edit-outline"
style="color:#E6A23C"
onClick={(e) => this.addDialog(item.id, e)}></i>
</span>
<span title="删除" class="icon-view ">
<i
style="color:#F56C6C"
class="el-icon-delete"
onClick={(e) => this.deleteSection(item, e)}></i>
</span>
</div>
)
}
]
},
funcRoleList() {
if (this.roleList.length > 0) {
return this.roleList.filter((item) => item.type === 'FUNCTION_ROLE')
}
return []
},
dataRoleList() {
if (this.roleList.length > 0) {
return this.roleList.filter((item) => item.type === 'DATA_ROLE')
}
return []
}
},
watch: {
formData: {
handler(newValue) {
// console.log(368, newValue)
},
immediate: true,
deep: true
}
},
methods: {
sizeChange(value) {
this.paginationOptions.pageSize = value
this.getList()
},
onCurrentChange(value) {
this.paginationOptions.currentPage = value
this.getList()
},
selectionChange(selection) {
if (selection.length > 0) {
this.select = selection
}
},
setempNo(id) {
for (const iterator of this.employee) {
if (iterator.id === id) {
this.addcurrencyform.empNumber = iterator.empNumber
break
}
}
},
search() {
this.getList()
},
currentTabFn(val) {
if (val.row) {
this.formId = val.row.id
}
},
// 修改新增
async addDialog(id, e) {
e && e.stopPropagation()
this.ishowForm = true
try {
if (id) {
this.is_title = 2
const url = '/serviceManagement/get'
const res = await axios.get(url, { params: { id } })
this.formData = { ...res.data }
} else {
this.is_title = 1
}
this.dialogVisible = true
} catch (error) {}
},
async checkData() {
const [isValid, postData] = await Promise.all([
new Promise((resolve) => {
this.$refs.formRefs
.validateForm()
.then((res) => resolve(true))
.catch((err) => {
resolve(false)
console.log(err)
})
}),
new Promise((resolve) => {
const params = {
name: '',
id: '',
type: '',
fixedFee: '',
startFee: '',
incrementalFee: '',
endFee: ''
}
for (const key in params) {
params[key] = this.formData[key]
}
resolve(params)
})
])
console.log(isValid, postData)
return { isValid, postData }
},
// 新增
async addServiceManagement() {
const isAdd = this.is_title === 1
const url = isAdd
? '/operationFeeManagement/add'
: '/operationFeeManagement/update'
try {
const { isValid, postData } = await this.checkData()
if (isValid) {
console.log('add', this.formData)
const finalData = isAdd ? { ...postData, id: undefined } : postData
const res = await axios.post(url, finalData)
if (res.code !== 200) {
return
}
this.dialogVisible = false
this.getList()
this.$message.success(isAdd ? '新增成功' : '更新成功')
} else {
console.log()
}
} catch (error) {
console.log(error)
}
},
// 查询
getList() {
this.loading = true
const { pageSize, currentPage } = this.paginationOptions
axios
.post('operationFeeManagement/list_page', {
pageSize,
currentPage,
...this.queryFormData
})
.then((res) => {
this.loading = false
if (res.code === 200) {
this.sourceData = res.data.records
this.paginationOptions.total = res.data.total
} else {
this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true
})
}
})
},
// 删除
deleteSection(data, e) {
e && e.stopPropagation()
const ids = [data.id].join()
this.$confirm('确定删除选中的信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
axios
.get('operationFeeManagement/delete', {
params: {
ids
}
})
.then((res) => {
if (res.code === 200) {
this.$message({
type: 'success',
message: '删除成功!'
})
this.getList()
}
})
})
.catch(() => {})
},
async closedFn() {
this.dialogVisible = false
this.formData = { enable: true, discount: true }
await this.$refs.formRefs?.resetFields()
}
}
}
</script>
<style scoped>
.wraper {
display: flex;
flex-direction: column;
height: 100%;
}
.table_wrap {
flex: 1;
}
.circle {
display: inline-block;
height: 10px;
width: 10px;
border-radius: 5px;
margin-right: 5px;
}
.my-table >>> .first {
background-color: red !important;
color: #fff !important;
}
/* 选中按钮的背景色和边框色 */
::v-deep .el-radio-button.is-checked .el-radio-button__inner {
background-color: #1565c0 !important;
border-color: #1565c0 !important;
color: #fff !important;
}
::v-deep .el-radio-button__orig-radio:checked + .el-radio-button__inner {
background-color: #1565c0 !important;
border-color: #1565c0 !important;
color: #fff !important;
}
/* 鼠标悬浮时的颜色 */
::v-deep .el-radio-button__inner:hover {
border-color: #1565c0 !important;
color: #1565c0 !important;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment