上传
This commit is contained in:
@@ -5,10 +5,16 @@
|
||||
v-loading="formLoading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="80px"
|
||||
label-width="auto"
|
||||
>
|
||||
<el-form-item label="支出项" prop="label">
|
||||
<el-input v-model="formData.label" placeholder="请输入支出项" />
|
||||
<el-form-item label="支出项" prop="extraPayName">
|
||||
<el-input v-model="formData.extraPayName" placeholder="请输入支出项" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否扣除提成" prop="isPercentage">
|
||||
<el-radio-group v-model="formData.isPercentage">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="formData.sort" placeholder="请输入排序" type="number" :min="0" />
|
||||
@@ -29,7 +35,8 @@
|
||||
</Dialog>
|
||||
</template>
|
||||
<script name="DialogExtraFee" setup>
|
||||
import * as dictApi from '@/api/system/dict/dict.data'
|
||||
import * as ExtraFeeApi from '@/api/clue/extraFee'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
@@ -38,12 +45,13 @@ const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
label: '',
|
||||
extraPayName: '',
|
||||
isPercentage: false,
|
||||
sort: 1,
|
||||
remark: ''
|
||||
})
|
||||
const formRules = reactive({
|
||||
label: [{ required: true, message: '支出项不能为空', trigger: 'blur' }]
|
||||
extraPayName: [{ required: true, message: '支出项不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
@@ -57,7 +65,7 @@ const open = async (type, id) => {
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await dictApi.getDictData(id)
|
||||
formData.value = await ExtraFeeApi.getExtraFee(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
@@ -75,14 +83,11 @@ const submitForm = async () => {
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
if (!formData.value.value) {
|
||||
formData.value.value = formData.value.label
|
||||
}
|
||||
if (formType.value === 'create') {
|
||||
await dictApi.createDictData(formData.value)
|
||||
await ExtraFeeApi.createExtraFee(formData.value)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await dictApi.updateDictData(formData.value)
|
||||
await ExtraFeeApi.updateExtraFee(formData.value)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
@@ -96,10 +101,10 @@ const submitForm = async () => {
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
label: '',
|
||||
extraPayName: '',
|
||||
isPercentage: false,
|
||||
sort: 1,
|
||||
status: 0,
|
||||
dictType: 'extra_pay_type',
|
||||
remark: ''
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<el-form ref="queryForm" :model="searchForm" label-width="0" inline>
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="searchForm.name"
|
||||
v-model="searchForm.extraPayName"
|
||||
placeholder="请输入名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
@@ -16,7 +16,12 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table v-loading="loading" :data="tableList">
|
||||
<el-table-column prop="label" label="支出项" />
|
||||
<el-table-column prop="extraPayName" label="支出项" />
|
||||
<el-table-column prop="isPercentage" label="是否扣除提成">
|
||||
<template #default="{ row }">
|
||||
{{ row.isPercentage ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sort" label="排序" width="100px" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column
|
||||
@@ -27,22 +32,10 @@
|
||||
/>
|
||||
<el-table-column label="操作">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="!scope.row.editable"
|
||||
text
|
||||
@click="openForm('update', scope.row.id)"
|
||||
>
|
||||
<el-button type="primary" text @click="openForm('update', scope.row.id)">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
:disabled="!scope.row.editable"
|
||||
text
|
||||
@click="handleDelete(scope.row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button type="danger" text @click="handleDelete(scope.row.id)"> 删除 </el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -60,16 +53,16 @@
|
||||
<script setup name="ExtraFeeType">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import DialogExtraFee from './DialogExtraFee.vue'
|
||||
import * as dictApi from '@/api/system/dict/dict.data'
|
||||
import * as ExtraFeeApi from '@/api/clue/extraFee'
|
||||
import { removeNullField } from '@/utils'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const searchForm = ref({
|
||||
label: '',
|
||||
extraPayName: '',
|
||||
pageSize: 20,
|
||||
pageNo: 1,
|
||||
dictType: 'extra_pay_type'
|
||||
pageNo: 1
|
||||
})
|
||||
|
||||
const total = ref(0)
|
||||
@@ -83,10 +76,9 @@ function handleQuery() {
|
||||
}
|
||||
function resetQuery() {
|
||||
searchForm.value = {
|
||||
label: '',
|
||||
extraPayName: '',
|
||||
pageSize: 20,
|
||||
pageNo: 1,
|
||||
dictType: 'extra_pay_type'
|
||||
pageNo: 1
|
||||
}
|
||||
getList()
|
||||
}
|
||||
@@ -94,7 +86,7 @@ function resetQuery() {
|
||||
async function getList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await dictApi.getDictDataPage(searchForm.value)
|
||||
const data = await ExtraFeeApi.getExtraFeePage(removeNullField(searchForm.value))
|
||||
tableList.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
@@ -111,7 +103,7 @@ async function handleDelete(id) {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await dictApi.deleteDictData(id)
|
||||
await ExtraFeeApi.deleteExtraFee(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
|
||||
Reference in New Issue
Block a user