| | |
| | | v-model="currentDate" |
| | | :type="datePickerType" |
| | | placeholder="éæ©æ¥æ" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 180px; margin-left: 10px" |
| | | @change="handleDateChange" |
| | | /> |
| | |
| | | <div class="right-actions"> |
| | | <el-button type="primary" @click="handleAddPlan">æ°å¢è®¡å</el-button> |
| | | <el-button @click="handleExport">导åºè®¡å</el-button> |
| | | <el-button @click="handleShare">å
±äº«è®¡å</el-button> |
| | | <!-- <el-button @click="handleShare">å
±äº«è®¡å@</el-button> --> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <span>{{ getCurrentLevelText() }} - {{ getCurrentPeriodText() }}</span> |
| | | <div> |
| | | <el-button size="small" @click="handleRefresh">å·æ°</el-button> |
| | | <el-button size="small" @click="handleFilter">çé</el-button> |
| | | <!-- <el-button size="small" @click="handleFilter">çé@</el-button> --> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | <div class="plan-actions"> |
| | | <el-button size="small" @click="handleEditPlan(plan)">ç¼è¾</el-button> |
| | | <el-button size="small" @click="handleViewDetail(plan)">详æ
</el-button> |
| | | <el-dropdown @command="handleMoreAction"> |
| | | <el-dropdown @command="(command) => handleMoreAction(plan, command)"> |
| | | <el-button size="small"> |
| | | æ´å¤<el-icon class="el-icon--right"><ArrowDown /></el-icon> |
| | | </el-button> |
| | | <template #dropdown> |
| | | <el-dropdown-menu> |
| | | <el-dropdown-item command="share">å
񄧮</el-dropdown-item> |
| | | <el-dropdown-item command="copy">å¤å¶</el-dropdown-item> |
| | | <!-- <el-dropdown-item command="share">å
񄧮@</el-dropdown-item> --> |
| | | <!-- <el-dropdown-item command="copy">å¤å¶@</el-dropdown-item> --> |
| | | <el-dropdown-item command="delete" divided>å é¤</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </template> |
| | |
| | | <!-- æ°å¢/ç¼è¾è®¡åå¯¹è¯æ¡ --> |
| | | <el-dialog |
| | | v-model="planDialogVisible" |
| | | :title="dialogTitle" |
| | | :title="operationType === 'add' ? 'åå¸è®¡å' : 'ç¼è¾è®¡å'" |
| | | width="600px" |
| | | @close="handleDialogClose" |
| | | > |
| | |
| | | <el-date-picker |
| | | v-model="planForm.startDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | placeholder="éæ©å¼å§æ¶é´" |
| | | style="width: 100%" |
| | | /> |
| | |
| | | <el-date-picker |
| | | v-model="planForm.endDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | placeholder="éæ©ç»ææ¶é´" |
| | | style="width: 100%" |
| | | /> |
| | |
| | | <el-option label="ä½" value="low" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ ç¾"> |
| | | <!-- <el-form-item label="æ ç¾"> |
| | | <el-input v-model="planForm.tags" placeholder="请è¾å
¥æ ç¾ï¼ç¨éå·åé" /> |
| | | </el-form-item> --> |
| | | <el-form-item label="æ ç¾" prop="tags"> |
| | | <!-- <el-checkbox-group v-model="planForm.tags"> |
| | | <el-checkbox label="all"></el-checkbox> |
| | | <el-checkbox label="manager">管çå±</el-checkbox> |
| | | <el-checkbox label="hr">人äºé¨é¨</el-checkbox> |
| | | <el-checkbox label="finance">è´¢å¡é¨é¨</el-checkbox> |
| | | <el-checkbox label="tech">ææ¯é¨é¨</el-checkbox> |
| | | </el-checkbox-group> --> |
| | | <el-select |
| | | v-model="planForm.tags" |
| | | multiple |
| | | placeholder="è¯·éæ©æ ç¾" |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="dept in departments" |
| | | :key="dept" |
| | | :label="dept" |
| | | :value="dept" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ" prop="status"> |
| | | <el-select v-model="planForm.status" placeholder="éæ©ç¶æ" style="width: 100%"> |
| | | <el-option label="æªå¼å§" value="not_started" /> |
| | | <el-option label="è¿è¡ä¸" value="in_progress" /> |
| | | <el-option label="已宿" value="completed" /> |
| | | <el-option label="å·²æå" value="paused" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="è¿åº¦" prop="progress"> |
| | | <el-input-number |
| | | v-model="planForm.progress" |
| | | min="0" |
| | | max="100" |
| | | step="1" |
| | | placeholder="请è¾å
¥è¿åº¦" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <!-- 计å详æ
å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="showPlanDetailDialog" title="计å详æ
" width="700px"> |
| | | <div v-if="currentPlanDetail" class="mb10"> |
| | | <el-descriptions :column="2" border> |
| | | <el-descriptions-item label="è®¡åæ é¢">{{ currentPlanDetail.title }}</el-descriptions-item> |
| | | <el-descriptions-item label="计åæè¿°">{{ currentPlanDetail.description }}</el-descriptions-item> |
| | | <el-descriptions-item label="计å级å«">{{ getCurrentLevelText(currentPlanDetail.level) }}</el-descriptions-item> |
| | | <el-descriptions-item label="æ¶é´å¨æ">{{ getCurrentPeriodText(currentPlanDetail.period) }}</el-descriptions-item> |
| | | <el-descriptions-item label="å¼å§æ¶é´">{{ currentPlanDetail.startDate }}</el-descriptions-item> |
| | | <el-descriptions-item label="ç»ææ¶é´">{{ currentPlanDetail.endDate }}</el-descriptions-item> |
| | | <el-descriptions-item label="è´è´£äºº">{{ currentPlanDetail.assignee }}</el-descriptions-item> |
| | | <el-descriptions-item label="ä¼å
级">{{ getPriorityText(currentPlanDetail.priority) }}</el-descriptions-item> |
| | | <el-descriptions-item label="æ ç¾">{{ currentPlanDetail.tags.join(', ') }}</el-descriptions-item> |
| | | <el-descriptions-item label="ç¶æ">{{ getStatusText(currentPlanDetail.status) }}</el-descriptions-item> |
| | | <el-descriptions-item label="è¿åº¦">{{ currentPlanDetail.progress }}%</el-descriptions-item> |
| | | </el-descriptions> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed, onMounted } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | const { proxy } = getCurrentInstance(); |
| | | import { |
| | | User, |
| | | UserFilled, |
| | |
| | | Flag, |
| | | ArrowDown |
| | | } from '@element-plus/icons-vue' |
| | | import { listDutyPlan, addDutyPlan, updateDutyPlan, delDutyPlan,NumDutyPlan,exportDutyPlan } from '@/api/collaborativeApproval/planTemplate.js' |
| | | |
| | | // ååºå¼æ°æ® |
| | | const operationType = ref('add') |
| | | const currentLevel = ref('personal') |
| | | const currentPeriod = ref('week') |
| | | const currentDate = ref(new Date()) |
| | | const planDialogVisible = ref(false) |
| | | const dialogTitle = ref('æ°å¢è®¡å') |
| | | const planFormRef = ref() |
| | | const showPlanDetailDialog = ref(false) |
| | | const currentPlanDetail = ref(null) |
| | | |
| | | // è¡¨åæ°æ® |
| | | const planForm = reactive({ |
| | | id: '', |
| | | title: '', |
| | | description: '', |
| | | level: 'personal', |
| | |
| | | endDate: '', |
| | | assignee: '', |
| | | priority: 'medium', |
| | | tags: '' |
| | | tags: [], |
| | | status: '', |
| | | progress: 0 |
| | | }) |
| | | |
| | | // 表åéªè¯è§å |
| | |
| | | assignee: [{ required: true, message: '请è¾å
¥è´è´£äºº', trigger: 'blur' }], |
| | | priority: [{ required: true, message: 'è¯·éæ©ä¼å
级', trigger: 'change' }] |
| | | } |
| | | |
| | | const departments = ["产å", "åæ", "è°ç ",'ææ¯', 'æ¶æ', '设计','å¸åº', 'æ¨å¹¿', 'è¥é']; |
| | | // æ¦è§æ°æ® |
| | | const overviewData = reactive({ |
| | | personal: { total: 12, completion: 75 }, |
| | | group: { total: 8, completion: 60 }, |
| | | department: { total: 15, completion: 45 }, |
| | | company: { total: 6, completion: 30 } |
| | | personal: { total: 0, completion: 0 }, |
| | | group: { total: 0, completion: 0 }, |
| | | department: { total: 0, completion: 0 }, |
| | | company: { total: 0, completion: 0 } |
| | | }) |
| | | |
| | | // 计ååè¡¨æ°æ® |
| | | const planList = ref([ |
| | | { |
| | | id: 1, |
| | | title: '产åéæ±åæ', |
| | | description: '对æ°äº§åè¿è¡è¯¦ç»çéæ±åæåå¸åºè°ç ï¼å¶å®äº§åè§åæ¹æ¡', |
| | | level: 'personal', |
| | | period: 'week', |
| | | startDate: '2025-01-15', |
| | | endDate: '2025-01-21', |
| | | assignee: 'éå¿å¼º', |
| | | priority: 'high', |
| | | status: 'in_progress', |
| | | progress: 80, |
| | | tags: ['产å', 'åæ', 'è°ç '] |
| | | }, |
| | | { |
| | | id: 2, |
| | | title: 'ææ¯æ¶æè®¾è®¡', |
| | | description: 'è®¾è®¡ç³»ç»ææ¯æ¶æï¼å
æ¬æ°æ®åºè®¾è®¡ãæ¥å£è®¾è®¡ç', |
| | | level: 'group', |
| | | period: 'month', |
| | | startDate: '2025-01-01', |
| | | endDate: '2025-01-31', |
| | | assignee: 'åé
å©·', |
| | | priority: 'high', |
| | | status: 'completed', |
| | | progress: 100, |
| | | tags: ['ææ¯', 'æ¶æ', '设计'] |
| | | }, |
| | | { |
| | | id: 3, |
| | | title: 'å¸åºæ¨å¹¿è®¡å', |
| | | description: 'å¶å®å¹´åº¦å¸åºæ¨å¹¿çç¥åè¥é计å', |
| | | level: 'department', |
| | | period: 'year', |
| | | startDate: '2025-01-01', |
| | | endDate: '2025-12-31', |
| | | assignee: 'ç建å½', |
| | | priority: 'medium', |
| | | status: 'not_started', |
| | | progress: 0, |
| | | tags: ['å¸åº', 'æ¨å¹¿', 'è¥é'] |
| | | }, |
| | | { |
| | | id: 4, |
| | | title: 'å¢é建设活å¨', |
| | | description: 'ç»ç»å¢é建设活å¨ï¼æåå¢éåèååå使ç', |
| | | level: 'company', |
| | | period: 'month', |
| | | startDate: '2025-01-15', |
| | | endDate: '2025-02-15', |
| | | assignee: '赵丽å', |
| | | priority: 'low', |
| | | status: 'in_progress', |
| | | progress: 30, |
| | | tags: ['å¢é', '建设', 'æ´»å¨'] |
| | | } |
| | | ]) |
| | | const planList = ref([]) |
| | | |
| | | // 计ç®å±æ§ |
| | | const datePickerType = computed(() => { |
| | |
| | | // æ¹æ³ |
| | | const handleLevelChange = (value) => { |
| | | console.log('计å级å«åæ´:', value) |
| | | getPlanList() |
| | | // è¿éå¯ä»¥æ ¹æ®çº§å«çéæ°æ® |
| | | } |
| | | |
| | | const handlePeriodChange = (value) => { |
| | | console.log('æ¶é´å¨æåæ´:', value) |
| | | getPlanList() |
| | | // è¿éå¯ä»¥æ ¹æ®å¨æçéæ°æ® |
| | | } |
| | | |
| | | const handleDateChange = (value) => { |
| | | console.log('æ¥æåæ´:', value) |
| | | getPlanList() |
| | | // è¿éå¯ä»¥æ ¹æ®æ¥æçéæ°æ® |
| | | } |
| | | |
| | | const handleAddPlan = () => { |
| | | operationType.value = 'add' |
| | | dialogTitle.value = 'æ°å¢è®¡å' |
| | | planDialogVisible.value = true |
| | | // é置表å |
| | |
| | | planForm.level = 'personal' |
| | | planForm.period = 'week' |
| | | planForm.priority = 'medium' |
| | | planForm.status = 'not_started' |
| | | planForm.progress = 0 |
| | | } |
| | | |
| | | const handleEditPlan = (plan) => { |
| | | operationType.value = 'edit' |
| | | dialogTitle.value = 'ç¼è¾è®¡å' |
| | | planDialogVisible.value = true |
| | | // å¡«å
è¡¨åæ°æ® |
| | | Object.keys(planForm).forEach(key => { |
| | | if (key === 'tags') { |
| | | planForm[key] = plan[key].join(', ') |
| | | } else { |
| | | planForm[key] = plan[key] |
| | | } |
| | | }) |
| | | Object.assign(planForm, plan) |
| | | // // å¡«å
è¡¨åæ°æ® |
| | | // Object.keys(planForm).forEach(key => { |
| | | // if (key === 'tags') { |
| | | // planForm[key] = plan[key].join(', ') |
| | | // } else { |
| | | // planForm[key] = plan[key] |
| | | // } |
| | | // }) |
| | | } |
| | | |
| | | const handleViewDetail = (plan) => { |
| | | ElMessage.info(`æ¥ç计å详æ
: ${plan.title}`) |
| | | currentPlanDetail.value = plan |
| | | showPlanDetailDialog.value = true |
| | | // ElMessage.info(`æ¥ç计å详æ
: ${plan.title}`) |
| | | } |
| | | |
| | | const handleMoreAction = (command) => { |
| | | const handleMoreAction = async(plan,command) => { |
| | | let ids = []; |
| | | ids.push(plan.id); |
| | | console.log("ids",ids) |
| | | switch (command) { |
| | | case 'share': |
| | | ElMessage.success('计åå·²å
񄧮') |
| | |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | ElMessage.success('计åå·²å é¤') |
| | | |
| | | delDutyPlan(ids).then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success('计åå·²å é¤') |
| | | ids.value = []; |
| | | getPlanList() |
| | | } |
| | | }) |
| | | }) |
| | | break |
| | | } |
| | | } |
| | | |
| | | // |
| | | const handleSavePlan = async () => { |
| | | try { |
| | | await planFormRef.value.validate() |
| | | ElMessage.success('计åä¿åæå') |
| | | planDialogVisible.value = false |
| | | if (operationType.value === 'add') { |
| | | addDutyPlan(planForm).then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success('计åä¿åæå') |
| | | planDialogVisible.value = false |
| | | } |
| | | getPlanList() |
| | | }) |
| | | } else { |
| | | |
| | | updateDutyPlan(planForm).then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success('计åä¿åæå') |
| | | planDialogVisible.value = false |
| | | } |
| | | getPlanList() |
| | | }) |
| | | } |
| | | } catch (error) { |
| | | console.log('表åéªè¯å¤±è´¥:', error) |
| | | } |
| | |
| | | } |
| | | |
| | | const handleRefresh = () => { |
| | | ElMessage.success('æ°æ®å·²å·æ°') |
| | | getPlanList() |
| | | // ElMessage.success('æ°æ®å·²å·æ°') |
| | | } |
| | | |
| | | const handleFilter = () => { |
| | |
| | | } |
| | | |
| | | const handleExport = () => { |
| | | ElMessage.success('计å已导åº') |
| | | } |
| | | |
| | | ElMessageBox.confirm("æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | // exportDutyPlan().then(res => { |
| | | |
| | | // }) |
| | | proxy.download("/dutyPlan/export", {}, "计å管ç.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | const handleShare = () => { |
| | | ElMessage.success('计åå·²å
񄧮') |
| | | } |
| | |
| | | if (progress >= 50) return '#E6A23C' |
| | | return '#F56C6C' |
| | | } |
| | | //è·åæ°æ®å表 |
| | | const getPlanList = async () => { |
| | | const params = { |
| | | level: currentLevel.value, |
| | | period: currentPeriod.value, |
| | | queryDate:currentDate.value |
| | | } |
| | | listDutyPlan(params).then(res => { |
| | | if (res.code === 200) { |
| | | planList.value = res.data.records |
| | | } |
| | | }).catch(err => { |
| | | console.log(err) |
| | | }) |
| | | } |
| | | //è·åæ°æ® |
| | | const getPlanNum = async () => { |
| | | NumDutyPlan().then(res => { |
| | | if (res.code === 200) { |
| | | // console.log(res.data) |
| | | //è®²ç»æéé¢çæ°æ®æ ¹æ®level èµå¼ç»overviewData |
| | | res.data.forEach(item => { |
| | | overviewData[item.level].total = item.num |
| | | overviewData[item.level].completion = item.completion |
| | | }) |
| | | |
| | | } |
| | | }).catch(err => { |
| | | console.log(err) |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getPlanList() |
| | | getPlanNum() |
| | | console.log('å¤çº§è®¡å模æ¿é¡µé¢å·²å è½½') |
| | | }) |
| | | </script> |