|
@@ -3,8 +3,8 @@
|
|
|
<HcCard>
|
|
|
<template #header>
|
|
|
<div class="w-36 ml-2">
|
|
|
- <el-select v-model="searchForm.peoplename" block clearable placeholder="项目名称" size="large">
|
|
|
- <el-option v-for="item in peopleoption" :label="item.name" :value="item.key"/>
|
|
|
+ <el-select v-model="searchForm.projectId" block clearable placeholder="项目名称" size="large">
|
|
|
+ <el-option v-for="item in projectType" :label="item.projectName" :value="item.projectId"/>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
|
|
@@ -24,7 +24,7 @@
|
|
|
<template #extra>
|
|
|
<el-button type="warning" @click="toImportTempClick" size="large">
|
|
|
<HcIcon name="delete-bin-2"/>
|
|
|
- <span>草稿箱</span>
|
|
|
+ <span>草稿箱{{draftNum > 0 ? `(${draftNum})` : ''}}</span>
|
|
|
</el-button>
|
|
|
<el-button type="primary" size="large" class="ml-2" @click="addinfoClick">
|
|
|
<HcIcon name="add"/>
|
|
@@ -33,11 +33,21 @@
|
|
|
</template>
|
|
|
<HcTable :column="tableColumn" :datas="tableData" :loading="tableLoading">
|
|
|
<template #tripDesc="{row}">
|
|
|
- <span class="text-blue text-hover" @click="rowClick(row)">{{row.tripDesc}}</span>
|
|
|
+ <span class="text-blue text-hover">{{row.tripDesc}}</span>
|
|
|
</template>
|
|
|
- <template #action="{row, index}">
|
|
|
+ <!-- <template #action="{row, index}">
|
|
|
<el-button hc-btn type="primary" size="small">撤销</el-button>
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
+ <template #action="{row,index}">
|
|
|
+ <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>
|
|
|
<template #action>
|
|
|
<HcPages :pages="searchForm" @change="pageChange"></HcPages>
|
|
@@ -49,7 +59,7 @@
|
|
|
<HcTable :column="drafttableColumn" :datas="drafttableData" ui="hc-test-drop-table" isRowDrop isSort @row-drop="rowDropTap" @row-sort="rowSortTap" :loading="draftLoad">
|
|
|
<template #action="{row, index}">
|
|
|
<el-button hc-btn type="primary" size="small" @click="editinfoClick(row)">继续编辑</el-button>
|
|
|
- <el-button hc-btn type="primary" size="small">删除</el-button>
|
|
|
+ <el-button hc-btn type="primary" size="small" @click="delRowClick(row)">删除</el-button>
|
|
|
</template>
|
|
|
</HcTable>
|
|
|
</div>
|
|
@@ -63,13 +73,16 @@ import {ref, watch,onMounted} from 'vue'
|
|
|
import dayjs from "dayjs"
|
|
|
import 'dayjs/locale/zh-cn'
|
|
|
import {useRouter} from 'vue-router'
|
|
|
-import {getTokenHeader} from "~src/api/request/header";
|
|
|
+
|
|
|
import businessApi from '~api/attendance/business-trip.js';
|
|
|
import {getArrValue} from "js-fast-way"
|
|
|
import {getProjectList, getDictInfo} from "~api/other";
|
|
|
+import {delMessage} from "~uti/tools";
|
|
|
const router = useRouter()
|
|
|
onMounted(()=>{
|
|
|
+ getProjectData()
|
|
|
getTableData()
|
|
|
+ getdraftTableData()
|
|
|
})
|
|
|
|
|
|
const tableColumn = [
|
|
@@ -79,7 +92,7 @@ const tableColumn = [
|
|
|
{key: 'durationAll', name: '出差天数'},
|
|
|
{key: 'fellowTravelerUserNames', name: '同行人'},
|
|
|
{key: 'approvalResultName', name: '审批结果'},
|
|
|
- {key: 'approvalStatusName ', name: '审批状态'},
|
|
|
+ {key: 'approvalStatusName', name: '审批状态'},
|
|
|
{key: 'createName', name: '创建人'},
|
|
|
{key: 'createTime', name: '创建时间'},
|
|
|
{key: 'action', name: '操作' }
|
|
@@ -95,11 +108,23 @@ const searchForm = ref({
|
|
|
|
|
|
current: 1, size: 20, total: 0
|
|
|
})
|
|
|
-const peopleoption=ref([
|
|
|
- {name: '张三', key: '1'},
|
|
|
- {name: '李四', key: '2'},
|
|
|
+//项目类型
|
|
|
+const projectType = ref([
|
|
|
+
|
|
|
])
|
|
|
|
|
|
+//获取项目数据
|
|
|
+
|
|
|
+const getProjectData = async () => {
|
|
|
+ const {error, code, data} = await getProjectList()
|
|
|
+ //判断状态
|
|
|
+ if (!error && code === 200) {
|
|
|
+ projectType.value = getArrValue(data)
|
|
|
+ } else {
|
|
|
+ projectType.value = []
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//分页被点击
|
|
|
const pageChange = ({current, size}) => {
|
|
|
searchForm.value.current = current
|
|
@@ -112,7 +137,7 @@ const getTableData = async() => {
|
|
|
const {error, code, data} = await businessApi.getPage(searchForm.value)
|
|
|
tableLoading.value = false
|
|
|
if (!error && code === 200) {
|
|
|
- tableData.value = getArrValue(data)
|
|
|
+ tableData.value = getArrValue(data['records'])
|
|
|
searchForm.value.total = data['total'] || 0
|
|
|
} else {
|
|
|
tableData.value = []
|
|
@@ -133,7 +158,9 @@ const defaultTime = ref([
|
|
|
new Date(2000, 1, 1, 0, 0, 0),
|
|
|
new Date(2000, 2, 1, 23, 59, 59),
|
|
|
])
|
|
|
-//导入数据弹窗
|
|
|
+//草稿箱
|
|
|
+//草稿箱数据
|
|
|
+const draftNum = ref(0)
|
|
|
const importModal=ref(false)
|
|
|
const importModalClose=()=>{
|
|
|
importModal.value=false
|
|
@@ -156,6 +183,7 @@ const getdraftTableData = async() => {
|
|
|
draftLoad.value = false
|
|
|
if (!error && code === 200) {
|
|
|
drafttableData.value = getArrValue(data)
|
|
|
+ draftNum.value=getArrValue(data).length
|
|
|
|
|
|
} else {
|
|
|
drafttableData.value = []
|
|
@@ -191,8 +219,8 @@ const editinfoClick=(row)=>{
|
|
|
router.push({
|
|
|
name: 'attendance-business-trip-info',
|
|
|
query: {
|
|
|
- id: row.id,
|
|
|
- type: 'edit'
|
|
|
+ id: row.emdraftIds,
|
|
|
+ type: 'draft'
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -206,6 +234,34 @@ const rowClick = (row) => {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+//撤销
|
|
|
+const rowCancel = async (row) => {
|
|
|
+ row.isCancelLoading = true
|
|
|
+ const {error, code, msg} = await businessApi.cancel({
|
|
|
+ id: row.id
|
|
|
+ })
|
|
|
+ //判断状态
|
|
|
+ row.isCancelLoading = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success(msg)
|
|
|
+ getTableData().then()
|
|
|
+ } else {
|
|
|
+ window.$message?.error(msg)
|
|
|
+ }
|
|
|
+}
|
|
|
+//删除
|
|
|
+const delRowClick = async(row) => {
|
|
|
+ delMessage(async() => {
|
|
|
+ const {error, code, data,msg} = await businessApi.remove({groupId:row.groupId})
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message.success(msg)
|
|
|
+ getdraftTableData().then()
|
|
|
+ } else {
|
|
|
+ window.$message?.error(msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|
|
|
<style lang='scss' scoped>
|
|
|
</style>
|