|
@@ -73,7 +73,7 @@
|
|
|
/>
|
|
/>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
label="报销金额(元)"
|
|
label="报销金额(元)"
|
|
|
- prop="price"
|
|
|
|
|
|
|
+ prop="reimbursementPrice"
|
|
|
align="center"
|
|
align="center"
|
|
|
width="250px"
|
|
width="250px"
|
|
|
/>
|
|
/>
|
|
@@ -82,13 +82,6 @@
|
|
|
align="center"
|
|
align="center"
|
|
|
>
|
|
>
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <el-button
|
|
|
|
|
- text
|
|
|
|
|
- type="primary"
|
|
|
|
|
- :icon="Notebook"
|
|
|
|
|
- >
|
|
|
|
|
- 详情
|
|
|
|
|
- </el-button>
|
|
|
|
|
<el-button
|
|
<el-button
|
|
|
text
|
|
text
|
|
|
type="primary"
|
|
type="primary"
|
|
@@ -186,8 +179,11 @@
|
|
|
/>
|
|
/>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item label="报销总金额:">
|
|
|
|
|
+ <el-text size="large">{{ totality }}</el-text>
|
|
|
|
|
+ </el-form-item>
|
|
|
<el-row
|
|
<el-row
|
|
|
- v-for="(item,index) in reimburseItem"
|
|
|
|
|
|
|
+ v-for="(item,index) in createData.feeDetails"
|
|
|
:key="index"
|
|
:key="index"
|
|
|
>
|
|
>
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
@@ -195,7 +191,7 @@
|
|
|
label="报销金额:"
|
|
label="报销金额:"
|
|
|
>
|
|
>
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
- v-model="item.price"
|
|
|
|
|
|
|
+ v-model="item.feePrice"
|
|
|
placeholder="请输入报销金额"
|
|
placeholder="请输入报销金额"
|
|
|
clearable
|
|
clearable
|
|
|
size="large"
|
|
size="large"
|
|
@@ -223,9 +219,9 @@
|
|
|
<template #footer>
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
<div class="dialog-footer">
|
|
|
<el-button
|
|
<el-button
|
|
|
- v-show="reimburseItem.length > 1"
|
|
|
|
|
|
|
+ v-show="createData.feeDetails.length > 1"
|
|
|
size="large"
|
|
size="large"
|
|
|
- @click="reimburseItem.splice(reimburseItem.length - 1,1)"
|
|
|
|
|
|
|
+ @click="createData.feeDetails.splice(createData.feeDetails.length - 1,1)"
|
|
|
>
|
|
>
|
|
|
删除报销详情
|
|
删除报销详情
|
|
|
</el-button>
|
|
</el-button>
|
|
@@ -311,6 +307,13 @@
|
|
|
/>
|
|
/>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col :span="10">
|
|
|
|
|
+ <el-form-item label="报销总金额:">
|
|
|
|
|
+ <el-text size="large">{{editTotality}}</el-text>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
<el-row
|
|
<el-row
|
|
|
v-for="(item,index) in editData.feeDetails"
|
|
v-for="(item,index) in editData.feeDetails"
|
|
|
:key="index"
|
|
:key="index"
|
|
@@ -320,7 +323,7 @@
|
|
|
label="报销金额:"
|
|
label="报销金额:"
|
|
|
>
|
|
>
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
- v-model="item.price"
|
|
|
|
|
|
|
+ v-model="item.feePrice"
|
|
|
placeholder="请输入报销金额"
|
|
placeholder="请输入报销金额"
|
|
|
clearable
|
|
clearable
|
|
|
size="large"
|
|
size="large"
|
|
@@ -363,7 +366,7 @@
|
|
|
<el-button
|
|
<el-button
|
|
|
type="primary"
|
|
type="primary"
|
|
|
size="large"
|
|
size="large"
|
|
|
- @click="addReimburse"
|
|
|
|
|
|
|
+ @click="editReimburse"
|
|
|
>
|
|
>
|
|
|
确定
|
|
确定
|
|
|
</el-button>
|
|
</el-button>
|
|
@@ -374,29 +377,20 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { Search, Delete, Edit, Notebook, Plus } from '@element-plus/icons-vue'
|
|
|
|
|
|
|
+import { Search, Delete, Edit, Plus } from '@element-plus/icons-vue'
|
|
|
import { reactive, ref, onMounted, computed } from 'vue'
|
|
import { reactive, ref, onMounted, computed } from 'vue'
|
|
|
import { reimburseOperate } from '@/pinia/reimbursement/Reimbursement'
|
|
import { reimburseOperate } from '@/pinia/reimbursement/Reimbursement'
|
|
|
import { codeOperate } from '@/pinia/code/code'
|
|
import { codeOperate } from '@/pinia/code/code'
|
|
|
import { queryExpensesGenre } from '@/api/finance'
|
|
import { queryExpensesGenre } from '@/api/finance'
|
|
|
import { getAllUsers } from '@/api/user'
|
|
import { getAllUsers } from '@/api/user'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
-import { createReimburse, deleteReimburse } from '@/api/reimbursement'
|
|
|
|
|
|
|
+import { createReimburse, deleteReimburse, updateReimburse } from '@/api/reimbursement'
|
|
|
defineOptions({
|
|
defineOptions({
|
|
|
name: 'Reimburse'
|
|
name: 'Reimburse'
|
|
|
})
|
|
})
|
|
|
// pinia
|
|
// pinia
|
|
|
const submit = reimburseOperate()
|
|
const submit = reimburseOperate()
|
|
|
const serial = codeOperate()
|
|
const serial = codeOperate()
|
|
|
-// 计算属性
|
|
|
|
|
-const deleteDetailShow = computed(() => {
|
|
|
|
|
- for (const i in editData) {
|
|
|
|
|
- if (i === 'feeDetails' && editData[i].length > 1) {
|
|
|
|
|
- return true
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return false
|
|
|
|
|
-})
|
|
|
|
|
// 数据
|
|
// 数据
|
|
|
const reimburseAddShow = ref(false)
|
|
const reimburseAddShow = ref(false)
|
|
|
const condition = reactive({
|
|
const condition = reactive({
|
|
@@ -410,21 +404,44 @@ const condition = reactive({
|
|
|
})
|
|
})
|
|
|
const createData = reactive({
|
|
const createData = reactive({
|
|
|
projectCode: '',
|
|
projectCode: '',
|
|
|
- applicant: '张三',
|
|
|
|
|
|
|
+ applicant: '',
|
|
|
applicationTime: '',
|
|
applicationTime: '',
|
|
|
approval: '',
|
|
approval: '',
|
|
|
- price: 0,
|
|
|
|
|
|
|
+ reimbursementPrice: 0,
|
|
|
genre: '',
|
|
genre: '',
|
|
|
- feeDetails: []
|
|
|
|
|
|
|
+ feeDetails: [{
|
|
|
|
|
+ remarks: '',
|
|
|
|
|
+ feePrice: 0
|
|
|
|
|
+ }]
|
|
|
})
|
|
})
|
|
|
const editData = reactive({})
|
|
const editData = reactive({})
|
|
|
const reimburseEditShow = ref(false)
|
|
const reimburseEditShow = ref(false)
|
|
|
const costList = reactive([])
|
|
const costList = reactive([])
|
|
|
const userList = reactive([])
|
|
const userList = reactive([])
|
|
|
-const reimburseItem = reactive([{
|
|
|
|
|
- remarks: '',
|
|
|
|
|
- price: 0
|
|
|
|
|
-}])
|
|
|
|
|
|
|
+
|
|
|
|
|
+// 计算属性
|
|
|
|
|
+const deleteDetailShow = computed(() => {
|
|
|
|
|
+ for (const i in editData) {
|
|
|
|
|
+ if (i === 'feeDetails' && editData[i].length > 1) {
|
|
|
|
|
+ return true
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return false
|
|
|
|
|
+})
|
|
|
|
|
+const totality = computed(() => {
|
|
|
|
|
+ let middle = 0
|
|
|
|
|
+ createData.feeDetails.forEach(item => {
|
|
|
|
|
+ middle += item.feePrice
|
|
|
|
|
+ })
|
|
|
|
|
+ return middle
|
|
|
|
|
+})
|
|
|
|
|
+const editTotality = computed(() => {
|
|
|
|
|
+ let middle = 0
|
|
|
|
|
+ editData.feeDetails.forEach(item => {
|
|
|
|
|
+ middle += item.feePrice
|
|
|
|
|
+ })
|
|
|
|
|
+ return middle
|
|
|
|
|
+})
|
|
|
// const overall = ref(0)
|
|
// const overall = ref(0)
|
|
|
// 方法
|
|
// 方法
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
@@ -479,19 +496,12 @@ const changeReimbursePage = (value) => {
|
|
|
submit.getReimburseList(condition)
|
|
submit.getReimburseList(condition)
|
|
|
}
|
|
}
|
|
|
const addReimburse = () => {
|
|
const addReimburse = () => {
|
|
|
- const data = createData
|
|
|
|
|
- const sum = ref(0)
|
|
|
|
|
- // 报销详情
|
|
|
|
|
- data.feeDetails = reimburseItem
|
|
|
|
|
// // 报销总金额
|
|
// // 报销总金额
|
|
|
- reimburseItem.forEach(item => {
|
|
|
|
|
- sum.value += item.price
|
|
|
|
|
- })
|
|
|
|
|
- data.price = sum.value
|
|
|
|
|
- data.projectCode = serial.currentCode
|
|
|
|
|
- console.log(data)
|
|
|
|
|
- for (const i in data) {
|
|
|
|
|
- if (data[i] === '' || data[i] === 0) {
|
|
|
|
|
|
|
+ createData.reimbursementPrice = totality.value
|
|
|
|
|
+ createData.projectCode = serial.currentCode
|
|
|
|
|
+ console.log(createData)
|
|
|
|
|
+ for (const i in createData) {
|
|
|
|
|
+ if (createData[i] === '' || createData[i] === 0) {
|
|
|
ElMessage({
|
|
ElMessage({
|
|
|
message: '请将信息填写完整',
|
|
message: '请将信息填写完整',
|
|
|
type: 'error',
|
|
type: 'error',
|
|
@@ -501,7 +511,7 @@ const addReimburse = () => {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- createReimburse(data).then(res => {
|
|
|
|
|
|
|
+ createReimburse(createData).then(res => {
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
ElMessage({
|
|
ElMessage({
|
|
|
message: '添加成功',
|
|
message: '添加成功',
|
|
@@ -509,33 +519,72 @@ const addReimburse = () => {
|
|
|
showClose: true,
|
|
showClose: true,
|
|
|
duration: 2000
|
|
duration: 2000
|
|
|
})
|
|
})
|
|
|
|
|
+ const reset = {
|
|
|
|
|
+ projectCode: '',
|
|
|
|
|
+ applicant: '',
|
|
|
|
|
+ applicationTime: '',
|
|
|
|
|
+ approval: '',
|
|
|
|
|
+ genre: '',
|
|
|
|
|
+ feeDetails: [{
|
|
|
|
|
+ remarks: '',
|
|
|
|
|
+ feePrice: 0
|
|
|
|
|
+ }]
|
|
|
|
|
+ }
|
|
|
|
|
+ Object.assign(createData, reset)
|
|
|
|
|
+ createData.reimbursementPrice = totality.value
|
|
|
reimburseAddShow.value = false
|
|
reimburseAddShow.value = false
|
|
|
refreshList()
|
|
refreshList()
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const editReimburse = () => {
|
|
|
|
|
+ const editCondition = {
|
|
|
|
|
+ projectCode: serial.currentCode,
|
|
|
|
|
+ id: editData.ID,
|
|
|
|
|
+ applicant: editData.applicant,
|
|
|
|
|
+ applicationTime: editData.applicationTime,
|
|
|
|
|
+ approval: editData.approval,
|
|
|
|
|
+ reimbursementPrice: editTotality.value,
|
|
|
|
|
+ genre: editData.genre,
|
|
|
|
|
+ feeDetails: editData.feeDetails
|
|
|
|
|
+ }
|
|
|
|
|
+ updateReimburse(editCondition).then(res => {
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: '编辑成功',
|
|
|
|
|
+ type: 'success',
|
|
|
|
|
+ showClose: true,
|
|
|
|
|
+ duration: 2000
|
|
|
|
|
+ })
|
|
|
|
|
+ reimburseEditShow.value = false
|
|
|
|
|
+ refreshList()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const refreshList = () => {
|
|
const refreshList = () => {
|
|
|
const refresh = condition
|
|
const refresh = condition
|
|
|
refresh.code = serial.currentCode
|
|
refresh.code = serial.currentCode
|
|
|
submit.getReimburseList(refresh)
|
|
submit.getReimburseList(refresh)
|
|
|
}
|
|
}
|
|
|
const addFeeDetails = () => {
|
|
const addFeeDetails = () => {
|
|
|
- reimburseItem.push({
|
|
|
|
|
|
|
+ createData.feeDetails.push({
|
|
|
remarks: '',
|
|
remarks: '',
|
|
|
- price: 0
|
|
|
|
|
|
|
+ feePrice: 0
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const addEditFeeDetails = () => {
|
|
const addEditFeeDetails = () => {
|
|
|
editData.feeDetails.push({
|
|
editData.feeDetails.push({
|
|
|
remarks: '',
|
|
remarks: '',
|
|
|
- price: 0
|
|
|
|
|
|
|
+ feePrice: 0
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
const delFeeDetails = () => {
|
|
const delFeeDetails = () => {
|
|
|
editData.feeDetails.splice(editData.feeDetails.length - 1, 1)
|
|
editData.feeDetails.splice(editData.feeDetails.length - 1, 1)
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|