|
@@ -28,7 +28,7 @@
|
|
|
<template #extra>
|
|
|
<el-button size="large" type="warning" hc-btn @click="draftsClick">
|
|
|
<HcIcon name="draft"/>
|
|
|
- <span>草稿箱(1)</span>
|
|
|
+ <span>草稿箱{{draftNum > 0 ? `(${draftNum})` : ''}}</span>
|
|
|
</el-button>
|
|
|
<el-button size="large" type="primary" hc-btn @click="addRowClick">
|
|
|
<HcIcon name="add"/>
|
|
@@ -37,11 +37,18 @@
|
|
|
</template>
|
|
|
|
|
|
<HcTable :isIndex="false" :column="tableColumn" :datas="tableData" :loading="tableLoading">
|
|
|
- <template #key="{row}">
|
|
|
- <span class="text-blue" @click="rowNameTap(row)">{{row.key}}</span>
|
|
|
+ <template #frNumber="{row}">
|
|
|
+ <span class="text-blue text-hover" @click="rowNameTap(row)">{{row.frNumber}}</span>
|
|
|
</template>
|
|
|
<template #action="{row,index}">
|
|
|
- <el-button size="small" type="primary">撤销</el-button>
|
|
|
+ <el-popconfirm title="是否确认撤销?" hide-icon @confirm="rowCancel(row)">
|
|
|
+ <template #reference>
|
|
|
+ <el-button size="small" type="primary"
|
|
|
+ :disabled="row.status !== 1"
|
|
|
+ :loading="row.isCancelLoading"
|
|
|
+ >撤销</el-button>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
</template>
|
|
|
</HcTable>
|
|
|
|
|
@@ -50,13 +57,15 @@
|
|
|
</template>
|
|
|
|
|
|
<!--草稿箱-->
|
|
|
- <HcDialog bgColor="#ffffff" isToBody isTable :footer="false" :show="draftsModal" title="草稿箱(1)" widths="62rem" @close="draftsCloseClick">
|
|
|
+ <HcDialog isToBody isTable bgColor="#ffffff" widths="62rem" :footer="false" :show="draftsModal"
|
|
|
+ :title="draftNum > 0 ? `草稿箱(${draftNum})` : '草稿箱'" @close="draftsCloseClick"
|
|
|
+ >
|
|
|
<el-alert title="3个月内未更新的草稿将被自动删除" type="warning" show-icon />
|
|
|
<div style="position: relative;height: calc(100% - 44px);">
|
|
|
<HcTable :isIndex="false" :column="tableDraftsColumn" :datas="tableDraftsData">
|
|
|
<template #action="{row,index}">
|
|
|
- <el-button size="small" type="primary">继续编辑</el-button>
|
|
|
- <el-button size="small" type="danger">删除</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="editDraftClick(row)">继续编辑</el-button>
|
|
|
+ <el-button size="small" type="danger" @click="delDraftClick(row)">删除</el-button>
|
|
|
</template>
|
|
|
</HcTable>
|
|
|
</div>
|
|
@@ -71,16 +80,21 @@ import mainApi from "~api/expense/finReimburse";
|
|
|
import projectApi from "~api/project/project-list";
|
|
|
import {getArrValue} from "js-fast-way";
|
|
|
import {getChildList} from "~api/system/parameter";
|
|
|
+import {delMessage} from "~uti/tools";
|
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
onActivated(() => {
|
|
|
+ getApi()
|
|
|
+})
|
|
|
+
|
|
|
+const getApi = () => {
|
|
|
getProjectData()
|
|
|
getTableData()
|
|
|
-
|
|
|
+ getDraftNum()
|
|
|
//测试查字典
|
|
|
getChildListApi()
|
|
|
-})
|
|
|
+}
|
|
|
|
|
|
//测试查字典
|
|
|
const getChildListApi = () => {
|
|
@@ -104,7 +118,6 @@ const getProjectData = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//搜索表单
|
|
|
const searchForm = ref({userIdVesting: null, projectId: null, current: 1, size: 20, total: 0})
|
|
|
|
|
@@ -138,7 +151,7 @@ const tableColumn = [
|
|
|
{key: 'approvalStatusName', name: '审批状态', width: '140', align: 'center'},
|
|
|
{key: 'frDate', name: '报销时间', width: '160', align: 'center'},
|
|
|
{key: 'createName', name: '创建人', width: '140', align: 'center'},
|
|
|
- {key: 'createTime', name: '创建时间', width: '160', align: 'center'},
|
|
|
+ {key: 'createTime', name: '创建时间', width: '180', align: 'center'},
|
|
|
{key: 'action', name: '操作', width: '90', align: 'center', fixed: 'right'},
|
|
|
]
|
|
|
const tableData = ref([])
|
|
@@ -156,11 +169,28 @@ const getTableData = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//预览
|
|
|
-const rowNameTap = (row) => {
|
|
|
+const rowNameTap = ({id}) => {
|
|
|
+ router.push({
|
|
|
+ name: 'expense-finReimburse-record',
|
|
|
+ query: {id: id}
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
+//撤销
|
|
|
+const rowCancel = async (row) => {
|
|
|
+ row.isCancelLoading = true
|
|
|
+ const {error, code, msg} = await mainApi.page({
|
|
|
+ id: row.id
|
|
|
+ })
|
|
|
+ //判断状态
|
|
|
+ row.isCancelLoading = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success(msg)
|
|
|
+ getTableData().then()
|
|
|
+ } else {
|
|
|
+ window.$message?.error(msg)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//新增预算
|
|
@@ -173,18 +203,58 @@ const addRowClick = () => {
|
|
|
//草稿箱
|
|
|
const draftsModal = ref(false)
|
|
|
const draftsClick = () => {
|
|
|
+ tableDraftsData.value = []
|
|
|
draftsModal.value = true
|
|
|
+ getDraftNum()
|
|
|
}
|
|
|
const draftsCloseClick = () => {
|
|
|
draftsModal.value = false
|
|
|
}
|
|
|
|
|
|
//草稿箱数据
|
|
|
+const draftNum = ref(0)
|
|
|
const tableDraftsColumn = [
|
|
|
- {key: 'key1', name: '标题'},
|
|
|
- {key: 'key2', name: '更新时间', width: '200'},
|
|
|
+ {key: 'title', name: '标题'},
|
|
|
+ {key: 'updateTime', name: '更新时间', width: '200'},
|
|
|
{key: 'action', name: '操作', width: '170', align: 'center'},
|
|
|
]
|
|
|
-const tableDraftsData = ref([{id: 1, key1: 'xxxx', key2: 'xxxx'}, {id: 2, key1: 'xxxx', key2: 'xxxx'}, {id: 3, key1: 'xxxx', key2: 'xxxx'}])
|
|
|
+const tableDraftsData = ref([])
|
|
|
+
|
|
|
+//获取草稿数量
|
|
|
+const getDraftNum = async () => {
|
|
|
+ const {error, code, data} = await mainApi.draft()
|
|
|
+ //判断状态
|
|
|
+ if (!error && code === 200) {
|
|
|
+ const res = getArrValue(data)
|
|
|
+ tableDraftsData.value = res
|
|
|
+ draftNum.value = res.length
|
|
|
+ } else {
|
|
|
+ tableDraftsData.value = []
|
|
|
+ draftNum.value = 0
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
+//继续编辑
|
|
|
+const editDraftClick = ({id}) => {
|
|
|
+ router.push({
|
|
|
+ name: 'expense-finReimburse-record',
|
|
|
+ query: {id: id}
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+//删除草稿
|
|
|
+const delDraftClick = (row) => {
|
|
|
+ delMessage(async () => {
|
|
|
+ const {error, code, msg} = await mainApi.remove({
|
|
|
+ id: row.id
|
|
|
+ })
|
|
|
+ //判断状态
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success(msg)
|
|
|
+ getDraftNum().then()
|
|
|
+ } else {
|
|
|
+ window.$message?.error(msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|