This commit is contained in:
zmj 2024-05-24 00:00:40 +08:00
parent de29f1b566
commit e1427f488d
9 changed files with 620 additions and 20 deletions

63
src/api/oa_work.ts Normal file
View File

@ -0,0 +1,63 @@
import request from "@/utils/request";
// 汇报工作表列表
export function apiOaWorkLists(params: any) {
return request.get({ url: "/works.rcbg.oa_work/lists", params });
}
// 添加汇报工作表
export function apiOaWorkAdd(params: any) {
return request.post({ url: "/works.rcbg.oa_work/add", params });
}
// 编辑汇报工作表
export function apiOaWorkEdit(params: any) {
return request.post({ url: "/works.rcbg.oa_work/edit", params });
}
// 删除汇报工作表
export function apiOaWorkDelete(params: any) {
return request.post({ url: "/works.rcbg.oa_work/delete", params });
}
// 汇报工作表详情
export function apiOaWorkDetail(params: any) {
return request.get({ url: "/works.rcbg.oa_work/detail", params });
}
// 汇报工作表列表
export function apiOaWorkrecordLists(params: any) {
return request.get({ url: "/works.rcbg.oa_work_record/lists", params });
}
// 汇报工作表详情
export function apiOaWorkrecordDetail(params: any) {
return request.get({ url: "/works.rcbg.oa_work_record/detail", params });
}
// 删除汇报工作表
export function apiOaWorkrecordDelete(params: any) {
return request.post({ url: "/works.rcbg.oa_work_record/delete", params });
}
// 汇报工作表列表
export function apiOaWorkrcommentLists(params: any) {
return request.get({
url: "/works.rcbg.oa_work_comment/lists",
params,
});
}
// 汇报工作表列表
export function apiOaWorkrcommentAdd(params: any) {
return request.post({
url: "/works.rcbg.oa_work_comment/add",
params,
});
}
// 汇报工作表列表
export function apiOaWorkrcommentDelete(params: any) {
return request.get({
url: "/works.rcbg.oa_work_comment/delete",
params,
});
}

View File

@ -1,6 +1,7 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="80vw" @confirm="handleSubmit" @close="handleClose">
<popup ref="popupRef" :title="popupTitle" :async="true" width="80vw" @confirm="handleSubmit"
@close="handleClose">
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
<el-row>
<el-col :span="8">
@ -109,7 +110,8 @@
</el-col>
<el-col :span="8">
<el-form-item label="申请人" prop="applicant">
<el-input v-model="formData.applicant_name" @click="userclick('applicant')" clearable placeholder="请输入申请人" />
<el-input v-model="formData.applicant_name" @click="userclick('applicant')" clearable
placeholder="请输入申请人" />
</el-form-item>
</el-col>
<el-col :span="8">
@ -134,7 +136,8 @@
</el-col>
<el-col :span="8">
<el-form-item label="实际借章人" prop="sjborrower">
<el-input v-model="formData.sjborrower_name" @click="userclick('sjborrower')" clearable placeholder="请输入实际借章人" />
<el-input v-model="formData.sjborrower_name" @click="userclick('sjborrower')" clearable
placeholder="请输入实际借章人" />
</el-form-item>
</el-col>
<el-col :span="8">
@ -146,7 +149,8 @@
</el-col>
<el-col :span="8">
<el-form-item label="实际归还人" prop="returnee">
<el-input v-model="formData.returnee_name" @click="userclick('returnee')" clearable placeholder="请输入实际归还人" />
<el-input v-model="formData.returnee_name" @click="userclick('returnee')" clearable
placeholder="请输入实际归还人" />
</el-form-item>
</el-col>
<el-col :span="8">
@ -242,7 +246,7 @@ let keys;
//
const userclick = async (key) => {
keys=key
keys = key
showDialog3.value = true
await nextTick()
personnel.value.open()
@ -253,7 +257,7 @@ const userclick = async (key) => {
//
const submituser = (e: any) => {
formData[keys] = e.id
formData[keys+'_name'] = e.name
formData[keys + '_name'] = e.name
showDialog3.value = false
}

View File

@ -1,6 +1,7 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit"
@close="handleClose">
<el-form ref="formRef" :model="formData" label-width="110px" :rules="formRules">
<el-form-item label="离职员工" prop="uid_name">
<el-input v-model="formData.uid_name" clearable placeholder="点击选择" @click="userclick('uid', 1)" />

View File

@ -1,6 +1,7 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit"
@close="handleClose">
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
<el-form-item label="工作记录主题" prop="title">
<el-input v-model="formData.title" clearable placeholder="请输入工作记录主题" />
@ -149,17 +150,6 @@ const getDetail = async (row: Record<string, any>) => {
function getHour(params) {
const now = new Date(params);
const hours = now.getHours();
const minutes = now.getMinutes();
const formattedHours = hours < 10 ? '0' + hours : hours;
const formattedMinutes = minutes < 10 ? '0' + minutes : minutes;
const timeString = `${formattedHours}:${formattedMinutes}`;
return String(' ' + timeString)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
@ -176,7 +166,7 @@ const handleSubmit = async () => {
//
const open = (type = 'add', start_time = '') => {
mode.value = type
formData.date = start_time
formData.date = timeFormat(new Date(start_time), 'yyyy-mm-dd')
popupRef.value?.open()
}

View File

@ -0,0 +1,105 @@
<template>
<el-form class="mb-[-16px] mt-5" :model="queryParams" inline>
<el-form-item label="类型" prop="type">
<el-select v-model="queryParams.type" clearable placeholder="请选择类型" class="flex-1">
<el-option label="月报" :value="3" />
<el-option label="周报" :value="2" />
<el-option label="日报" :value="1" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
<div class="mt-4">
<el-button v-perms="['works.rcbg.oa_work/delete']" :disabled="!selectData.length"
@click="handleDelete(selectData)">
删除
</el-button>
</div>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="汇报类型" prop="type_text" show-overflow-tooltip />
<el-table-column label="汇报人" prop="from_user_name" show-overflow-tooltip />
<el-table-column label="汇报工作内容" prop="works" show-overflow-tooltip />
<el-table-column label="汇报时间" prop="send_time" show-overflow-tooltip />
<el-table-column label="状态" prop="is_read" show-overflow-tooltip />
<el-table-column label="附件(个)" prop="remark" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button v-perms="['works.rcbg.oa_work/edit']" type="primary" link @click="handleEdit(row)">
查看
</el-button>
<el-button v-perms="['works.rcbg.oa_work/delete']" type="danger" link @click="handleDelete(row.id)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue';
import editPopup from '../report.vue';
import { apiOaWorkrecordLists, apiOaWorkrecordDelete, apiOaWorkrecordDetail } from '@/api/oa_work'
import { usePaging } from '@/hooks/usePaging';
import feedback from '@/utils/feedback';
const editRef = ref(null)
//
const showEdit = ref(false)
//
const queryParams = reactive({
type: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiOaWorkrecordLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
let res = await apiOaWorkrecordDetail({ id: data.id })
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(res)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiOaWorkrecordDelete({ id })
getLists()
}
getLists()
</script>

View File

@ -0,0 +1,111 @@
<template>
<el-form class="mb-[-16px] mt-5" :model="queryParams" inline>
<el-form-item label="类型" prop="type">
<el-select v-model="queryParams.type" clearable placeholder="请选择类型" class="flex-1">
<el-option label="月报" :value="3" />
<el-option label="周报" :value="2" />
<el-option label="日报" :value="1" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
<div class="mt-4">
<!-- <el-button v-perms="['works.rcbg.oa_work/add']" type="primary" @click="handleAdd"> -->
<el-button type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button v-perms="['works.rcbg.oa_work/delete']" :disabled="!selectData.length"
@click="handleDelete(selectData)">
删除
</el-button>
</div>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="类型" prop="type_text" show-overflow-tooltip />
<el-table-column label="接受人员" prop="type_user_names" show-overflow-tooltip />
<el-table-column label="汇报工作内容" prop="works" show-overflow-tooltip />
<el-table-column label="计划工作内容" prop="plans" show-overflow-tooltip />
<el-table-column label="其他事项" prop="remark" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button v-perms="['works.rcbg.oa_work/edit']" type="primary" link @click="handleEdit(row)">
编辑
</el-button>
<el-button v-perms="['works.rcbg.oa_work/delete']" type="danger" link @click="handleDelete(row.id)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue';
import editPopup from '../edit.vue';
import { apiOaWorkLists, apiOaWorkDelete } from '@/api/oa_work'
import { usePaging } from '@/hooks/usePaging';
import feedback from '@/utils/feedback';
const editRef = ref(null)
//
const showEdit = ref(false)
//
const queryParams = reactive({
type: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiOaWorkLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiOaWorkDelete({ id })
getLists()
}
getLists()
</script>

156
src/views/oa_work/edit.vue Normal file
View File

@ -0,0 +1,156 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit"
@close="handleClose">
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
<el-form-item label="类型" prop="type">
<el-select v-model="formData.type" clearable placeholder="请选择类型" class="flex-1">
<el-option label="月报" :value="3" />
<el-option label="周报" :value="2" />
<el-option label="日报" :value="1" />
</el-select>
</el-form-item>
<el-form-item label="接受人员" prop="type_user">
<el-input v-model="formData.type_user_names" @click="userclick" clearable placeholder="点击选择接受人员" />
</el-form-item>
<el-form-item label="汇报工作内容" prop="works">
<el-input v-model="formData.works" clearable placeholder="请输入汇报工作内容" type="textarea" />
</el-form-item>
<el-form-item label="计划工作内容" prop="plans">
<el-input v-model="formData.plans" clearable placeholder="请输入计划工作内容" type="textarea" />
</el-form-item>
<el-form-item label="其他事项" prop="remark">
<el-input v-model="formData.remark" clearable placeholder="请输入其他事项" type="textarea" />
</el-form-item>
<el-form-item label="附件" prop="annex">
<UploadAnnex :form-data="formData"></UploadAnnex>
</el-form-item>
</el-form>
<div v-if="showDialog">
<personnelselector ref="personnel" @confirm="submituser" type="2">
</personnelselector>
</div>
</popup>
</div>
</template>
<script lang="ts" setup name="oaWorkEdit">
import type { FormInstance } from "element-plus";
import Popup from "@/components/popup/index.vue";
import { apiOaWorkAdd, apiOaWorkEdit, apiOaWorkDetail } from "@/api/oa_work";
import { timeFormat } from "@/utils/util";
import type { PropType } from "vue";
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({}),
},
});
const emit = defineEmits(["success", "close"]);
const formRef = shallowRef<FormInstance>();
const popupRef = shallowRef<InstanceType<typeof Popup>>();
const mode = ref("add");
const showDialog = ref(false)
const personnel = ref(null)
//
const popupTitle = computed(() => {
return mode.value == "edit" ? "编辑汇报工作表" : "新增汇报工作表";
});
//
const formData = reactive({
id: "",
type: "",
type_user: "",
type_user_names: "",
works: "",
plans: "",
remark: "",
annex: [],
});
const userclick = async () => {
showDialog.value = true
await nextTick()
personnel.value.open()
}
const submituser = (e: any) => {
formData.type_user = e.map((item: any) => {
return item.id
}).join(',')
formData.type_user_names = e.map((item: any) => {
return item.name
}).join(',')
showDialog.value = false
}
//
const formRules = reactive<any>({
type: [
{
required: true,
message: "请输入类型1 日报 2周报 3月报",
trigger: ["blur"],
},
],
type_user: [
{
required: true,
message: "请输入接受人员ID",
trigger: ["blur"],
},
],
works: [
{
required: true,
message: "请输入汇报工作内容",
trigger: ["blur"],
},
],
});
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key];
}
}
};
const getDetail = async (row: Record<string, any>) => {
const data = await apiOaWorkDetail({
id: row.id,
});
setFormData(data);
};
//
const handleSubmit = async () => {
await formRef.value?.validate();
const data = { ...formData };
mode.value == "edit" ? await apiOaWorkEdit(data) : await apiOaWorkAdd(data);
popupRef.value?.close();
emit("success");
};
//
const open = (type = "add") => {
mode.value = type;
popupRef.value?.open();
};
//
const handleClose = () => {
emit("close");
};
defineExpose({
open,
setFormData,
getDetail,
});
</script>

View File

@ -0,0 +1,26 @@
<template>
<el-card class="!border-none mb-4" shadow="never">
<el-tabs v-model="activeName" type="card" class="demo-tabs">
<el-tab-pane label="发送的汇报" name="first">
<sendReport />
</el-tab-pane>
<el-tab-pane label="接受的汇报" name="second">
<reciveReport></reciveReport>
</el-tab-pane>
</el-tabs>
</el-card>
</template>
<script lang="ts" setup name="oaWorkLists">
import type { TabsPaneContext } from 'element-plus'
import sendReport from './components/sendReport.vue'
import reciveReport from './components/reciveReport.vue'
const activeName = ref('first')
</script>

View File

@ -0,0 +1,144 @@
<template>
<div class="detail-popup">
<popup ref="popupRef" title="汇报详情" :async="true" width="60vw" @confirm="handleSubmit" @close="handleClose">
<el-descriptions :column="1" border>
<el-descriptions-item label="汇报人" label-align="left" align="left" label-class-name="my-label">
{{ formData.from_user_name }}
</el-descriptions-item>
<el-descriptions-item label="汇报类型" label-align="left" align="left" label-class-name="my-label">
{{ formData.work_info.type_text }}
</el-descriptions-item>
<el-descriptions-item label="汇报时间" label-align="left" align="left" label-class-name="my-label">
{{ formData.send_time }}
</el-descriptions-item>
<el-descriptions-item label="接受人" label-align="left" align="left" label-class-name="my-label">
{{ formData.work_info.type_user_names }}
</el-descriptions-item>
<el-descriptions-item label="工作内容" label-align="left" align="left" label-class-name="my-label">
{{ formData.work_info.works }}
</el-descriptions-item>
<el-descriptions-item label="工作计划" label-align="left" align="left" label-class-name="my-label">
{{ formData.work_info.plans }}
</el-descriptions-item>
<el-descriptions-item label="其他事项" label-align="left" align="left" label-class-name="my-label">
{{ formData.work_info.remark }}
</el-descriptions-item>
<el-descriptions-item label="附件" label-align="left" align="left" label-class-name="my-label">
<annexLink :annex="formData.work_info.annex"></annexLink>
</el-descriptions-item>
</el-descriptions>
<el-card>
<template #header>
工作点评
</template>
<div>评论零</div>
<div>
<el-input v-model="msg" type='textarea' placeholder='请输入评论内容'></el-input>
<el-button class="mt-2 float-right" type="primary" @click="handleSend">
<template #icon>
<el-icon>
<Position />
</el-icon>
</template>
发送</el-button>
</div>
</el-card>
</popup>
</div>
</template>
<script lang="ts" setup name="customdetail">
import annexLink from './../../components/annexLink/index.vue'
import Popup from '@/components/popup/index.vue'
import { apiOaWorkrcommentLists, apiOaWorkrcommentAdd, apiOaWorkrcommentDelete } from "@/api/oa_work";
const emit = defineEmits(['close'])
const popupRef = shallowRef<InstanceType<typeof Popup>>()
//
const formData = reactive({
id: '',
annex: [],
work_info: {
"type": 2,
"type_user": "",
"works": "",
"plans": "",
"remark": "",
"annex": [],
"type_user_names": "",
"type_text": ""
},
send_time: '',
from_user_name: ""
})
let commentList = ref([])
//
const getCommentList = async () => {
let res = await apiOaWorkrcommentLists({
work_id: formData.id
})
commentList.value = res.data
}
//
const msg = ref('')
const handleSend = async () => {
await apiOaWorkrcommentAdd({
work_id: formData.id,
content: msg.value
})
getCommentList()
msg.value = ''
}
//
const handleDelete = async (id: string) => {
await apiOaWorkrcommentDelete({
id: id
})
getCommentList()
}
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
getCommentList()
}
//
const handleSubmit = async () => {
popupRef.value?.close()
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
})
</script>