修改类型
This commit is contained in:
@@ -134,13 +134,31 @@
|
||||
</el-table>
|
||||
</el-drawer>
|
||||
|
||||
<el-drawer v-model="detailVisible" :title="detailTitle" size="78%" destroy-on-close>
|
||||
<pay-config-detail v-loading="detailLoading" :product="detail" :editable="editing" />
|
||||
<el-drawer
|
||||
v-model="detailVisible"
|
||||
:title="detailTitle"
|
||||
size="78%"
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
@closed="editing = false"
|
||||
>
|
||||
<pay-config-detail
|
||||
v-loading="detailLoading || !!savingRowKey"
|
||||
:product="detail"
|
||||
:editable="editing"
|
||||
:saving-row-key="savingRowKey"
|
||||
@save-row="saveProductRow"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button v-if="detail" @click="downloadSource(detail)" v-hasPermi="['price:pay:query']">下载源文件</el-button>
|
||||
<el-button v-if="!editing" type="primary" @click="editing = true" v-hasPermi="['price:pay:import']">编辑</el-button>
|
||||
<el-button v-else type="primary" :loading="saving" @click="saveDetail">保存</el-button>
|
||||
<el-button @click="detailVisible = false">关闭</el-button>
|
||||
<el-button v-if="detail" @click="downloadSource(detail)" v-hasPermi="['price:pay:query']">下载源文件</el-button>
|
||||
<el-button
|
||||
v-if="!editing"
|
||||
type="primary"
|
||||
@click="editing = true"
|
||||
v-hasPermi="['price:pay:import']"
|
||||
>编辑</el-button>
|
||||
<el-button v-else @click="editing = false">完成</el-button>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</div>
|
||||
@@ -157,7 +175,7 @@ const importRef = ref()
|
||||
const detailVisible = ref(false)
|
||||
const detailLoading = ref(false)
|
||||
const editing = ref(false)
|
||||
const saving = ref(false)
|
||||
const savingRowKey = ref('')
|
||||
const detail = ref(null)
|
||||
const historyVisible = ref(false)
|
||||
const historyLoading = ref(false)
|
||||
@@ -275,6 +293,7 @@ function handleDelete(ids) {
|
||||
function openDetail(row) {
|
||||
detailVisible.value = true
|
||||
editing.value = false
|
||||
savingRowKey.value = ''
|
||||
detailLoading.value = true
|
||||
detail.value = null
|
||||
getPay(row.versionProductId || row.productId).then(res => {
|
||||
@@ -284,15 +303,24 @@ function openDetail(row) {
|
||||
})
|
||||
}
|
||||
|
||||
function saveDetail() {
|
||||
function saveProductRow(payload) {
|
||||
if (!detail.value || savingRowKey.value) return
|
||||
cleanMoney(detail.value)
|
||||
saving.value = true
|
||||
;(detail.value.surcharges || []).forEach(row => {
|
||||
if (row.amount === '') row.amount = null
|
||||
})
|
||||
const productId = detail.value.productId
|
||||
savingRowKey.value = payload?.rowKey || 'row'
|
||||
updatePay(detail.value).then(() => {
|
||||
proxy.$modal.msgSuccess('已保存这一版。产品编号不变,绑定该产品的渠道按有效期取价')
|
||||
editing.value = false
|
||||
tableRef.value.refresh()
|
||||
proxy.$modal.msgSuccess('该行已保存')
|
||||
if (!productId) return
|
||||
return getPay(productId).then(res => {
|
||||
if (res.data) detail.value = res.data
|
||||
})
|
||||
}).then(() => {
|
||||
tableRef.value?.refresh()
|
||||
}).finally(() => {
|
||||
saving.value = false
|
||||
savingRowKey.value = ''
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user