|
@@ -1,6 +1,380 @@
|
|
-<script setup lang="ts"></script>
|
|
|
|
|
|
+<script setup lang="ts">
|
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
|
+import { GlobalStore } from '@/stores/index'
|
|
|
|
+import { ref, reactive, nextTick } from 'vue'
|
|
|
|
+import { UserFilled } from '@element-plus/icons-vue'
|
|
|
|
+import TableBase from '@/components/TableBase/index.vue'
|
|
|
|
+import { ColumnProps } from '@/components/TableBase/interface/index'
|
|
|
|
+import { Project_List, Project_Get, Project_Edit, Project_User_List } from '@/api/project/index'
|
|
|
|
+import { Edit, View } from '@element-plus/icons-vue'
|
|
|
|
+import Drawer from '@/components/Drawer/index.vue'
|
|
|
|
+import ProjectDetail from './ProjectDetail.vue'
|
|
|
|
+import type { FormInstance, FormRules } from 'element-plus'
|
|
|
|
+import { useTablePublic } from '@/hooks/useTablePublic'
|
|
|
|
+
|
|
|
|
+interface UserInfoIn {
|
|
|
|
+ T_name: string
|
|
|
|
+ T_type_name: string
|
|
|
|
+ T_text: string
|
|
|
|
+ T_uuid: string
|
|
|
|
+ T_dept_name: string
|
|
|
|
+ T_post_name: string
|
|
|
|
+}
|
|
|
|
+const userInfo = ref<UserInfoIn>({
|
|
|
|
+ T_name: '',
|
|
|
|
+ T_type_name: '',
|
|
|
|
+ T_text: '',
|
|
|
|
+ T_uuid: '',
|
|
|
|
+ T_dept_name: '',
|
|
|
|
+ T_post_name: ''
|
|
|
|
+})
|
|
|
|
+const isNew = ref(true)
|
|
|
|
+const disabled = ref(false)
|
|
|
|
+const TableRef = ref()
|
|
|
|
+const formLabelWidth = ref('120px')
|
|
|
|
+const globalStore = GlobalStore()
|
|
|
|
+const User_tokey = globalStore.GET_User_tokey
|
|
|
|
+const ruleFormRef = ref<FormInstance>()
|
|
|
|
+const drawerRef = ref<InstanceType<typeof Drawer> | null>(null)
|
|
|
|
+const projectDetailRef = ref<InstanceType<typeof ProjectDetail> | null>(null)
|
|
|
|
+const { tableRowClassName } = useTablePublic()
|
|
|
|
+const tableRowClassNameHandle = (data: any): any => tableRowClassName(data.row.T_uuid, userInfo.value.T_uuid)
|
|
|
|
+
|
|
|
|
+const columns: ColumnProps[] = [{ prop: 'T_name', label: '姓名' }]
|
|
|
|
+const columnsProject: ColumnProps[] = [
|
|
|
|
+ { prop: 'Id', label: 'ID' },
|
|
|
|
+ { prop: 'T_name', label: '项目名称' },
|
|
|
|
+ { prop: 'T_user_name', label: '项目负责人' },
|
|
|
|
+ { prop: 'T_set_up_date', label: '立项日期' },
|
|
|
|
+ { prop: 'T_end_date', label: '结束时间' },
|
|
|
|
+ { prop: 'T_planning_cycle', label: '计划完成周期(工作日)', width: 125 },
|
|
|
|
+ { prop: 'T_bonus', label: '绩效总金额' },
|
|
|
|
+ { prop: 'T_Perf', label: '状态' },
|
|
|
|
+ { prop: 'operation', label: '操作', width: 200, fixed: 'right' }
|
|
|
|
+]
|
|
|
|
+const initParam = { User_tokey: globalStore.GET_User_tokey }
|
|
|
|
+const initParamProject = reactive({ User_tokey: globalStore.GET_User_tokey, T_uuid: userInfo.value.T_uuid, page_z: 99 })
|
|
|
|
+
|
|
|
|
+const form = ref({
|
|
|
|
+ Id: '',
|
|
|
|
+ T_name: '',
|
|
|
|
+ T_end_date: '',
|
|
|
|
+ T_set_up_date: '',
|
|
|
|
+ T_description: '',
|
|
|
|
+ T_detail: '',
|
|
|
|
+ T_planning_cycle: '',
|
|
|
|
+ T_reality_cycle: '',
|
|
|
|
+ T_bonus: '',
|
|
|
|
+ T_Perf: '',
|
|
|
|
+ T_remark: '',
|
|
|
|
+ T_approver: '',
|
|
|
|
+ T_advance_day: '',
|
|
|
|
+ T_uuid: ''
|
|
|
|
+})
|
|
|
|
+const rules = reactive<FormRules>({
|
|
|
|
+ T_name: [{ required: true, message: '请输入项目名称', trigger: 'blur' }]
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+const openProjectDrawer = (type: string, row?: any) => {
|
|
|
|
+ isNew.value = type === 'view' ? true : false
|
|
|
|
+ nextTick(async () => {
|
|
|
|
+ if (type === 'view') disabled.value = true
|
|
|
|
+ form.value = { ...row }
|
|
|
|
+ form.value.T_approver = row.T_approver_name
|
|
|
|
+ form.value.T_uuid = row.T_approver
|
|
|
|
+ const res: any = await Project_Get({ T_id: row.Id })
|
|
|
|
+ if (res.Code === 200) {
|
|
|
|
+ projectDetailRef.value?.setDetailData(res.Data.T_Detail)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ drawerRef.value?.openDrawer()
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const getSalaryParams = (row: any) => {
|
|
|
|
+ userInfo.value.T_uuid = ''
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ userInfo.value = { ...row }
|
|
|
|
+ initParamProject.T_uuid = userInfo.value.T_uuid
|
|
|
|
+ }, 100)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const callbackDrawer = (done: () => void) => {
|
|
|
|
+ resetForm(ruleFormRef.value)
|
|
|
|
+ projectDetailRef.value?.clearDetail()
|
|
|
|
+ isNew.value = true
|
|
|
|
+ disabled.value = false
|
|
|
|
+ done()
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const resetForm = (formEl: FormInstance | undefined) => {
|
|
|
|
+ if (!formEl) return
|
|
|
|
+ formEl.resetFields()
|
|
|
|
+}
|
|
|
|
+const addProject = (formEl: FormInstance | undefined) => {
|
|
|
|
+ if (!formEl) return
|
|
|
|
+ formEl.validate(async valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ let detail = ''
|
|
|
|
+ projectDetailRef.value?.getDetailInfo().forEach((item: any) => {
|
|
|
|
+ detail += `${item.T_function},${item.T_planned_time},${item.T_finish}|`
|
|
|
|
+ })
|
|
|
|
+ const params = {
|
|
|
|
+ User_tokey,
|
|
|
|
+ ...form.value,
|
|
|
|
+ T_detail: detail,
|
|
|
|
+ T_approver: form.value.T_uuid
|
|
|
|
+ }
|
|
|
|
+ console.log(params)
|
|
|
|
+
|
|
|
|
+ const res: any = await Project_Edit({ ...params, T_id: form.value.Id })
|
|
|
|
+
|
|
|
|
+ if (res.Code === 200) {
|
|
|
|
+ ElMessage.success('项目修改成功!')
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ isNew.value = true
|
|
|
|
+ TableRef.value?.getTableList()
|
|
|
|
+ drawerRef.value?.closeDrawer()
|
|
|
|
+ resetForm(ruleFormRef.value)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ } else return false
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+</script>
|
|
<template>
|
|
<template>
|
|
- <div></div>
|
|
|
|
|
|
+ <div class="project">
|
|
|
|
+ <div style="width: 290px" class="project-table">
|
|
|
|
+ <TableBase
|
|
|
|
+ ref="TableRef"
|
|
|
|
+ :columns="columns"
|
|
|
|
+ :requestApi="Project_User_List"
|
|
|
|
+ :initParam="initParam"
|
|
|
|
+ layout="prev, pager, next"
|
|
|
|
+ :rowClick="getSalaryParams"
|
|
|
|
+ :tableRowClassName="tableRowClassNameHandle"
|
|
|
|
+ >
|
|
|
|
+ <template #table-header>
|
|
|
|
+ <h3 class="title">员工列表</h3>
|
|
|
|
+ </template>
|
|
|
|
+ </TableBase>
|
|
|
|
+ </div>
|
|
|
|
+ <transition
|
|
|
|
+ leave-active-class="animate__animated animate__fadeOutRight"
|
|
|
|
+ enter-active-class="animate__animated animate__fadeInLeft"
|
|
|
|
+ >
|
|
|
|
+ <div class="project-container" v-if="userInfo.T_uuid">
|
|
|
|
+ <el-card class="box-card">
|
|
|
|
+ <h3 class="text title m-b-5">员工基本信息</h3>
|
|
|
|
+ <div class="info-content">
|
|
|
|
+ <el-avatar shape="square" size="large" :icon="UserFilled" />
|
|
|
|
+ <div class="info-name">
|
|
|
|
+ <h4>名字:{{ userInfo.T_name }}</h4>
|
|
|
|
+ <h4>部门: {{ userInfo.T_dept_name }}</h4>
|
|
|
|
+ <h4>岗位: {{ userInfo.T_post_name }}</h4>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </el-card>
|
|
|
|
+ <TableBase
|
|
|
|
+ :columns="columnsProject"
|
|
|
|
+ :requestApi="Project_List"
|
|
|
|
+ :initParam="initParamProject"
|
|
|
|
+ :displayHeader="true"
|
|
|
|
+ :pagination="false"
|
|
|
|
+ >
|
|
|
|
+ <template #right="{ row }">
|
|
|
|
+ <el-button link type="success" size="small" :icon="View" @click="openProjectDrawer('view', row)"
|
|
|
|
+ >详情</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button link type="primary" size="small" :icon="Edit" @click="openProjectDrawer('edit', row)"
|
|
|
|
+ >编辑</el-button
|
|
|
|
+ >
|
|
|
|
+ </template>
|
|
|
|
+ </TableBase>
|
|
|
|
+ </div>
|
|
|
|
+ </transition>
|
|
|
|
+ <Drawer ref="drawerRef" :handleClose="callbackDrawer" size="50%">
|
|
|
|
+ <template #header="{ params }">
|
|
|
|
+ <h4 :id="params.titleId" :class="params.titleClass">项目 - {{ isNew ? '详情' : '编辑' }}</h4>
|
|
|
|
+ </template>
|
|
|
|
+ <el-form ref="ruleFormRef" :model="form" :rules="rules">
|
|
|
|
+ <el-form-item label="项目名称:" :label-width="formLabelWidth" prop="T_name">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.T_name"
|
|
|
|
+ class="w-50"
|
|
|
|
+ :disabled="disabled"
|
|
|
|
+ type="text"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ placeholder="请输入项目名称"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="项目结束日期:" :label-width="formLabelWidth" prop="T_end_date">
|
|
|
|
+ <el-date-picker
|
|
|
|
+ style="flex: 0 0 50%"
|
|
|
|
+ class="my-date-picker"
|
|
|
|
+ v-model="form.T_end_date"
|
|
|
|
+ :disabled="disabled"
|
|
|
|
+ type="date"
|
|
|
|
+ placeholder="项目结束日期"
|
|
|
|
+ format="YYYY-MM-DD"
|
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="项目立项日期:" :label-width="formLabelWidth" prop="T_set_up_date">
|
|
|
|
+ <el-date-picker
|
|
|
|
+ style="flex: 0 0 50%"
|
|
|
|
+ class="my-date-picker"
|
|
|
|
+ v-model="form.T_set_up_date"
|
|
|
|
+ :disabled="disabled"
|
|
|
|
+ type="date"
|
|
|
|
+ placeholder="项目立项日期"
|
|
|
|
+ format="YYYY-MM-DD"
|
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="项目简介:" :label-width="formLabelWidth" prop="T_description">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.T_description"
|
|
|
|
+ :disabled="disabled"
|
|
|
|
+ :autosize="{ minRows: 6, maxRows: 8 }"
|
|
|
|
+ type="textarea"
|
|
|
|
+ placeholder="请输入项目简介"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="项目明细:" :label-width="formLabelWidth" prop="T_detail">
|
|
|
|
+ <ProjectDetail ref="projectDetailRef" :disabled="disabled" :isShow="false"></ProjectDetail>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="计划完成周期:" :label-width="formLabelWidth" prop="T_planning_cycle">
|
|
|
|
+ <div style="display: flex; white-space: nowrap; flex: 1">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.T_planning_cycle"
|
|
|
|
+ style="flex: 0 0 33.33%"
|
|
|
|
+ :disabled="true"
|
|
|
|
+ type="text"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ placeholder="请输入计划完成周期"
|
|
|
|
+ />
|
|
|
|
+ <span style="margin: 0 10px">工作日</span>
|
|
|
|
+ <span style="color: #bbb"
|
|
|
|
+ ><el-icon><QuestionFilled /></el-icon>备注;根据项目明细计划时间自动计算</span
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="实际完成周期:" :label-width="formLabelWidth" prop="T_reality_cycle">
|
|
|
|
+ <div style="display: flex; white-space: nowrap; flex: 1">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.T_reality_cycle"
|
|
|
|
+ class="w-50"
|
|
|
|
+ :disabled="disabled"
|
|
|
|
+ type="text"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ placeholder="请输入实际完成周期"
|
|
|
|
+ />
|
|
|
|
+ <span style="margin: 0 10px">工作日</span>
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="提前完成天数:" :label-width="formLabelWidth" prop="T_advance_day">
|
|
|
|
+ <div style="display: flex; white-space: nowrap; flex: 1">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.T_advance_day"
|
|
|
|
+ class="w-50"
|
|
|
|
+ :disabled="disabled"
|
|
|
|
+ type="text"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ placeholder="请输入提前完成天数"
|
|
|
|
+ />
|
|
|
|
+ <span style="margin: 0 10px">工作日</span>
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="奖励金额:" :label-width="formLabelWidth" prop="T_bonus">
|
|
|
|
+ <div style="display: flex; white-space: nowrap; flex: 1">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.T_bonus"
|
|
|
|
+ class="w-50"
|
|
|
|
+ :disabled="disabled"
|
|
|
|
+ type="text"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ placeholder="请输入奖励金额"
|
|
|
|
+ />
|
|
|
|
+ <span style="margin: 0 10px">元</span>
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="绩效总金额:" :label-width="formLabelWidth" prop="T_Perf">
|
|
|
|
+ <div style="display: flex; white-space: nowrap; flex: 1">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="form.T_Perf"
|
|
|
|
+ class="w-50"
|
|
|
|
+ :disabled="disabled"
|
|
|
|
+ type="text"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ placeholder="请输入绩效总金额"
|
|
|
|
+ />
|
|
|
|
+ <span style="margin: 0 10px">元</span>
|
|
|
|
+ </div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item :label-width="formLabelWidth" v-if="!disabled">
|
|
|
|
+ <el-button class="btn" color="#626aef" @click="addProject(ruleFormRef)">提交</el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ </Drawer>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
-<style scoped></style>
|
|
|
|
|
|
+<style scoped lang="scss">
|
|
|
|
+@import '@/styles/var.scss';
|
|
|
|
+.project {
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 100%;
|
|
|
|
+ display: flex;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ .project-table {
|
|
|
|
+ z-index: 1;
|
|
|
|
+ @include f-direction;
|
|
|
|
+ }
|
|
|
|
+ .project-container {
|
|
|
|
+ @include f-direction;
|
|
|
|
+ width: calc(100% - 290px);
|
|
|
|
+ z-index: 0;
|
|
|
|
+ margin-left: 12px;
|
|
|
|
+ .box-card {
|
|
|
|
+ border-radius: 8px;
|
|
|
|
+ }
|
|
|
|
+ :deep(.el-table tr) {
|
|
|
|
+ &:hover {
|
|
|
|
+ transition: all 5s ease-in-out;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ :deep(.el-table .cell) {
|
|
|
|
+ white-space: normal !important;
|
|
|
|
+ }
|
|
|
|
+ .text {
|
|
|
|
+ text-align: left;
|
|
|
|
+ }
|
|
|
|
+ .info-content {
|
|
|
|
+ display: flex;
|
|
|
|
+ color: #606266;
|
|
|
|
+ .info-name {
|
|
|
|
+ flex: 1;
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: space-around;
|
|
|
|
+ align-items: center;
|
|
|
|
+ padding-left: 0.75rem;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ :deep(.table-header),
|
|
|
|
+ :deep(.card) {
|
|
|
|
+ margin: 0;
|
|
|
|
+ border-radius: 8px;
|
|
|
|
+ }
|
|
|
|
+ .title {
|
|
|
|
+ width: 100%;
|
|
|
|
+ text-align: center;
|
|
|
|
+ line-height: 1.7em;
|
|
|
|
+ font-size: 20px;
|
|
|
|
+ color: #707b84;
|
|
|
|
+ }
|
|
|
|
+ .w-50 {
|
|
|
|
+ flex: 0 0 50%;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</style>
|