<template>
|
<div>
|
<!-- 列表页面 -->
|
<div class="page-container" v-if="showEdit == 0">
|
<!-- 查询条件 -->
|
<div class="search-section">
|
<el-form :inline="true" :model="queryForm" class="demo-form-inline" label-width="auto">
|
<el-form-item label="关键字">
|
<el-input v-model="queryForm.keyword" placeholder="名称/描述/备注/项目经理/联系人" clearable />
|
</el-form-item>
|
<el-form-item label="所属项目" prop="project_id">
|
<el-select v-model="queryForm.project_id" placeholder="所属项目" clearable filterable>
|
<el-option v-for="item in projectInfoArr" :key="item.id" :label="item.project_name" :value="item.id" />
|
</el-select>
|
</el-form-item>
|
<el-form-item label="日期范围" prop="daily_date" style="width: 400px">
|
<el-date-picker
|
v-model="queryForm.date_range"
|
type="datetimerange"
|
range-separator="到"
|
start-placeholder="开始时间"
|
end-placeholder="结束时间"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
format="YYYY-MM-DD HH:mm:ss"
|
/>
|
</el-form-item>
|
|
<el-form-item>
|
<el-button type="primary" @click="search">查询</el-button>
|
<el-button type="primary" @click="add">新增</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
<!-- 表格 -->
|
<div class="table-section">
|
<el-table :data="tableData" v-loading="loading" stripe style="width: 100%" fit height="450px">
|
<el-table-column prop="" label="序号" fixed="left" width="60">
|
<template #default="scope">
|
{{ pageSize * (currentPage - 1) + scope.$index + 1 }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="project_name" label="项目"></el-table-column>
|
<el-table-column prop="meeting_title" label="会议标题"></el-table-column>
|
<el-table-column prop="business_content" label="内容">
|
<template #default="scope">
|
<div v-html="scope.row.business_content"></div>
|
</template>
|
</el-table-column>
|
<el-table-column prop="business_date" label="日志日期"></el-table-column>
|
<el-table-column prop="business_start_time" label="开始时间"></el-table-column>
|
<el-table-column prop="business_end_time" label="结束时间"></el-table-column>
|
<el-table-column prop="business_user_names" label="负责人"></el-table-column>
|
<!-- <el-table-column prop="user_dolist" label="负责人">
|
<template #default="scope">
|
<el-tag v-for="user in scope.row.user_dolist" :key="user.id" type="primary">
|
{{ user.nickname }}
|
</el-tag>
|
</template>
|
</el-table-column> -->
|
<el-table-column prop="remark" label="备注"></el-table-column>
|
|
<el-table-column label="操作栏" fixed="right" width="200">
|
<template #default="scope">
|
<el-button type="text" size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
<el-button
|
type="text"
|
size="small"
|
:disabled="scope.row.meeting_id != ''"
|
@click="handleDelete(scope.row)"
|
>删除</el-button
|
>
|
<!-- <el-button type="text" size="small" @click="handleProjectStatistics(scope.row)">详情</el-button> -->
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<div class="demo-pagination-block">
|
<!-- <div class="demonstration">All combined</div> -->
|
<el-pagination
|
v-model:current-page="currentPage"
|
v-model:page-size="pageSize"
|
:page-sizes="[10, 20, 30]"
|
:small="small"
|
:disabled="disabled"
|
:background="background"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="totalSize"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
/>
|
</div>
|
</div>
|
</div>
|
<!-- 编辑页面 -->
|
<business-daily-add v-if="showEdit == 1" @editClose="editClose" :editId="editId"></business-daily-add>
|
</div>
|
</template>
|
|
<script>
|
import { ref, reactive, onMounted } from 'vue'
|
import { ElMessageBox, ElMessage } from 'element-plus'
|
import ProjectInfo from '@/model/projectInfo'
|
import BusinessDaily from '@/model/businessDaily'
|
import sysDictItemModel from '@/model/sysDictItem'
|
|
import BusinessDailyAdd from './business-daily-add'
|
|
export default {
|
components: {
|
BusinessDailyAdd,
|
},
|
|
setup() {
|
const loading = ref(false)
|
|
const currentPage = ref(1)
|
const pageSize = ref(10)
|
const totalSize = ref(100)
|
const projectTypeArr = ref([])
|
const projectStatusArr = ref([])
|
const projectStageArr = ref([])
|
|
const showEdit = ref(0)
|
const editId = ref(1)
|
|
const projectInfoArr = ref([])
|
|
const queryForm = reactive({
|
keyword: '',
|
project_id: '',
|
start_time: '',
|
end_time: '',
|
date_range: [],
|
|
page: 1,
|
count: 10,
|
})
|
|
const resultPage = ref({})
|
|
const tableData = ref([])
|
|
onMounted(() => {
|
// 列出所有项目信息
|
getBusinessDailyPage()
|
loadDictDitems()
|
})
|
|
const getBusinessDailyPage = async () => {
|
try {
|
queryForm.page = currentPage.value
|
queryForm.count = pageSize.value
|
|
loading.value = true
|
if (queryForm.date_range) {
|
queryForm.start_time = queryForm.date_range[0]
|
queryForm.end_time = queryForm.date_range[1]
|
} else {
|
queryForm.start_time = ''
|
queryForm.end_time = ''
|
}
|
resultPage.value = await BusinessDaily.getBusinessDailyPage(queryForm)
|
tableData.value = resultPage.value.items
|
totalSize.value = resultPage.value.total
|
currentPage.value = resultPage.value.page
|
pageSize.value = resultPage.value.count
|
|
loading.value = false
|
} catch (error) {
|
loading.value = false
|
if (error.code === 10020) {
|
tableData.value = []
|
}
|
}
|
}
|
|
const search = () => {
|
// 执行查询操作,更新表格数据
|
// 列出所有项目信息
|
getBusinessDailyPage()
|
}
|
|
// 根据字典类型查询字典
|
const loadDictDitems = async () => {
|
projectTypeArr.value = await sysDictItemModel.getSysDictItemListByType('project_type')
|
projectStatusArr.value = await sysDictItemModel.getSysDictItemListByType('project_status')
|
projectStageArr.value = await sysDictItemModel.getSysDictItemListByType('project_stage')
|
|
projectInfoArr.value = await ProjectInfo.getProjectInfoList({})
|
}
|
|
const handleEdit = row => {
|
// 编辑操作
|
editId.value = row.id
|
showEdit.value = 1
|
}
|
|
const handleDelete = row => {
|
// 删除操作
|
ElMessageBox.confirm('此操作将永久删除该记录, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
}).then(async () => {
|
const res = await BusinessDaily.deleteBusinessDaily(row.id)
|
if (res.code < window.MAX_SUCCESS_CODE) {
|
getBusinessDailyPage()
|
ElMessage.success(`${res.message}`)
|
}
|
}).catch(() => {
|
// 用户点击取消按钮时执行的操作
|
// 可以选择不做任何事情,也可以显示取消消息
|
// ElMessage.info('操作已取消'); // 如果需要显示取消消息,可以取消注释
|
});
|
}
|
|
/**
|
* 项目立项
|
*/
|
const handleProjectSetUp = row => {
|
// 工时确认操作
|
editId.value = row.id
|
showEdit.value = 2
|
}
|
|
/**
|
* 项目启动
|
*/
|
const handleProjectStart = row => {
|
ElMessageBox.confirm('确定启动项目, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
}).then(async () => {
|
const res = await projectInfo.editProjectInfoStart(row.id)
|
if (res.code < window.MAX_SUCCESS_CODE) {
|
getBusinessDailyPage()
|
ElMessage.success(`${res.message}`)
|
}
|
}).catch(() => {
|
// 用户点击取消按钮时执行的操作
|
// 可以选择不做任何事情,也可以显示取消消息
|
// ElMessage.info('操作已取消'); // 如果需要显示取消消息,可以取消注释
|
});
|
}
|
|
/**
|
* 项目完成
|
*/
|
const handleProjectComplete = row => {
|
ElMessageBox.confirm('确定完成项目, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
}).then(async () => {
|
const res = await projectInfo.editProjectInfoComplete(row.id)
|
if (res.code < window.MAX_SUCCESS_CODE) {
|
getBusinessDailyPage()
|
ElMessage.success(`${res.message}`)
|
}
|
}).catch(() => {
|
// 用户点击取消按钮时执行的操作
|
// 可以选择不做任何事情,也可以显示取消消息
|
// ElMessage.info('操作已取消'); // 如果需要显示取消消息,可以取消注释
|
});
|
}
|
|
/**
|
* 项目终止
|
*/
|
const handleProjectTermination = row => {
|
ElMessageBox.confirm('确定终止项目, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
}).then(async () => {
|
const res = await projectInfo.editProjectInfoTermination(row.id)
|
if (res.code < window.MAX_SUCCESS_CODE) {
|
getBusinessDailyPage()
|
ElMessage.success(`${res.message}`)
|
}
|
}).catch(() => {
|
// 用户点击取消按钮时执行的操作
|
// 可以选择不做任何事情,也可以显示取消消息
|
// ElMessage.info('操作已取消'); // 如果需要显示取消消息,可以取消注释
|
});
|
}
|
|
/**
|
* 查看项目日志
|
*/
|
const handleProjectLog = row => {
|
// 工时操作
|
editId.value = row.id
|
showEdit.value = 4
|
}
|
|
/**
|
* 查看项目统计
|
*/
|
const handleProjectStatistics = row => {
|
// 工时操作
|
editId.value = row.id
|
showEdit.value = 5
|
}
|
|
const handleProjectHours = row => {
|
// 工时操作
|
editId.value = row.id
|
showEdit.value = 3
|
}
|
|
const handleSizeChange = val => {
|
pageSize.value = val
|
getBusinessDailyPage()
|
}
|
|
const handleCurrentChange = val => {
|
currentPage.value = val
|
getBusinessDailyPage()
|
}
|
|
const editClose = () => {
|
showEdit.value = 0
|
getBusinessDailyPage()
|
}
|
|
const add = () => {
|
showEdit.value = 1
|
editId.value = ''
|
}
|
|
return {
|
loading,
|
|
projectTypeArr,
|
projectStatusArr,
|
projectStageArr,
|
|
queryForm,
|
tableData,
|
search,
|
handleEdit,
|
handleDelete,
|
handleProjectSetUp,
|
handleProjectStart,
|
handleProjectComplete,
|
handleProjectTermination,
|
handleProjectHours,
|
handleProjectLog,
|
handleProjectStatistics,
|
|
currentPage,
|
pageSize,
|
totalSize,
|
|
handleSizeChange,
|
handleCurrentChange,
|
|
editClose,
|
add,
|
editId,
|
showEdit,
|
|
projectInfoArr,
|
}
|
},
|
}
|
</script>
|
|
<style scoped>
|
.demo-form-inline .el-input {
|
--el-input-width: 220px;
|
}
|
|
.page-container {
|
padding: 10px;
|
}
|
|
.search-section {
|
margin-bottom: 10px;
|
padding: 20px;
|
/* background-color: #f5f5f5; */
|
border-radius: 4px;
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
}
|
|
.table-section {
|
padding: 20px;
|
background-color: #fff;
|
border-radius: 4px;
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
}
|
|
.demo-pagination-block {
|
margin-top: 10px;
|
}
|
|
.demo-pagination-block .demonstration {
|
margin-bottom: 16px;
|
}
|
|
.icon_btn_class {
|
width: 1em;
|
height: 1em;
|
margin-left: 4px;
|
margin-right: 4px;
|
}
|
|
.el-form-item {
|
width: 220px;
|
}
|
</style>
|