From 13272e92a6c98daad06aa166a6674bf4dac7cc4b Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期一, 21 十月 2024 11:06:55 +0800 Subject: [PATCH] 问题审核1021 --- src/views/fysp/check/components/CompProblemCard.vue | 233 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 197 insertions(+), 36 deletions(-) diff --git a/src/views/fysp/check/components/CompProblemCard.vue b/src/views/fysp/check/components/CompProblemCard.vue index 7423ba5..3db8c37 100644 --- a/src/views/fysp/check/components/CompProblemCard.vue +++ b/src/views/fysp/check/components/CompProblemCard.vue @@ -59,15 +59,9 @@ <el-row v-if="true" style="margin-top: 16px"> <el-col :span="12"> <el-row justify="start" class="btn-group"> - <el-button type="success" size="small" @click="updatePro" plain>淇敼闂</el-button> - <el-button - type="primary" - size="small" - @click="updateChange" - plain - :disabled="!proStatus.changeable" - >淇敼鏁存敼</el-button - > + <el-button type="success" size="small" @click="updatePro" plain>闂鏇存</el-button> + <el-button type="primary" size="small" @click="updateChange" plain>鏁存敼妫�楠�</el-button> + <el-button type="info" size="small" @click="currProRecent" plain>闂澶嶇幇</el-button> </el-row> </el-col> <el-col :span="12"> @@ -85,19 +79,103 @@ </el-col> </el-row> </el-card> + <div class="dialog-wrapper"> + <el-dialog + title="闂鏇存" + width="80%" + v-model="proAddOrUpdDialogVisible" + :before-close="proAddOrUpdDialogClose" + > + <CompProblemAddOrUpd + v-if="proAddOrUpdDialogVisible" + :problem="deepCopyPro" + :subtask="deepCopySubtask" + :topTask="deepCopyTopTask" + ref="compProblemAddOrUpdRef" + @submited="onProSubmited" + /> + </el-dialog> + </div> + <el-dialog width="80%" title="鏁存敼鎻愪氦" v-model="addChangeDialogVisible"> + <ComChangeEdit + :changeType="0" + v-if="addChangeDialogVisible" + :problemId="problem.guid" + :subtask="subtask" + :month="month" + @submited="onAddChangeSubmited" + /> + </el-dialog> + <el-dialog + width="80%" + title="鏁存敼妫�楠�" + v-model="changeEditDialogVisible" + :before-close="changeEditDialogClose" + > + <ComChangeEdit + :changeType="1" + v-if="changeEditDialogVisible" + :problemId="problem.guid" + :oldChangeFileList="problem.mediafileList" + :subtask="subtask" + :month="month" + @submited="onChangeSubmited" + /> + </el-dialog> + <!-- 闂澶嶇幇 --> + <el-dialog + width="80%" + title="闂澶嶇幇" + v-model="proRecentDialogVisible" + :before-close="proRecentDialogClose" + > + <CompProRecent + v-if="proRecentDialogVisible" + :subtask="subtask" + :topTask="topTask" + :problem="problem" + /> + </el-dialog> </template> <script> -import ProCheckProxy from '../ProCheckProxy' -import problemApi from '@/api/fysp/problemApi' -import { useMessageBoxTip } from '@/composables/messageBox' - +import ProCheckProxy from '../ProCheckProxy'; +import problemApi from '@/api/fysp/problemApi'; +import { useMessageBoxTip } from '@/composables/messageBox'; +import CompProblemAddOrUpd from './CompProblemAddOrUpd.vue'; +import ComChangeEdit from './ComChangeEdit.vue'; +import CompProRecent from './CompProRecent.vue'; +import { useCloned } from '@vueuse/core'; export default { + components: { + CompProblemAddOrUpd, + ComChangeEdit, + CompProRecent + }, props: { + // 鍙閫夐」 + readonly: { + type: Boolean, + default: () => { + return false; + } + }, + topTask: { + type: Object, + default: () => {} + }, + subtask: { + type: Object, + default: () => {} + }, + insGuid: { + type: String, + default: () => '' + }, problem: { type: Object, default: () => { - return {} + return {}; } }, index: { @@ -105,9 +183,18 @@ default: 1 } }, - emits:['submit'], + emits: ['submit'], data() { return { + addChangeDialogVisible: false, + // 杩戞湡鎯呭喌 + proRecentDialogVisible: false, + month: -1, + deepCopyPro: {}, + deepCopySubtask: {}, + deepCopyTopTask: {}, + proAddOrUpdDialogVisible: false, + changeEditDialogVisible: false, // 瀹℃牳姝ラ steps: [ { @@ -123,12 +210,13 @@ aft: '鏁存敼宸插鏍�' } ] - } + }; }, + mounted() {}, computed: { // 闂鍚嶇О title() { - return this.problem.problemname + return this.problem.problemname; }, // 闂鎻忚堪 descriptions() { @@ -141,11 +229,11 @@ name: '鎻愪氦鏃堕棿', value: this.problem.time.replace('T', ' ').split('.')[0] } - ] + ]; }, // 闂鍥剧墖 pics() { - return ProCheckProxy.proPics(this.problem) + return ProCheckProxy.proPics(this.problem); }, /** * 鑾峰彇褰撳墠闂瀹℃牳姝ラ @@ -153,46 +241,119 @@ getSteps() { return this.steps.map((v, i) => { if (i >= this.proStatus.index) { - return v.bef + return v.bef; } else { - return v.aft + return v.aft; } - }) + }); }, // 闂鐘舵�� proStatus() { - return ProCheckProxy.proStatusMap(this.problem.extension3) + return ProCheckProxy.proStatusMap(this.problem.extension3); } }, methods: { - deletePro() {}, + onAddChangeSubmited() { + this.$emit('updated', true); + this.addChangeDialogVisible = false; + }, + // 杩戞湡鎯呭喌寮圭獥鍏抽棴 + proRecentDialogClose() { + this.proRecentDialogVisible = false; + }, + newProblem() { + this.proAddOrUpdDialogVisible = true; + }, + onProSubmited(isOk) { + this.$emit('updated', isOk); + this.proAddOrUpdDialogVisible = false; + }, + onChangeSubmited(isOk) { + this.$emit('updated', isOk); + this.changeEditDialogVisible = false; + }, + proAddOrUpdDialogClose() { + this.proAddOrUpdDialogVisible = false; + }, + changeEditDialogClose() { + this.changeEditDialogVisible = false; + }, + deletePro() { + useMessageBoxTip({ + confirmMsg: '鏄惁鍒犻櫎闂', + confirmTitle: '纭畾', + onConfirm: () => { + return problemApi + .deleteProblem({ + pid: this.problem.guid + }) + .then((res) => { + if (res.success) { + this.$emit('submit') + } + }); + } + }); + }, rejectPro() { - this.checkPro(false) + this.checkPro(false); }, passPro() { - this.checkPro(true) + this.checkPro(true); }, checkPro(pass) { - const pro = this.problem - let doneMsg = pass ? '閫氳繃' : '椹冲洖' + const pro = this.problem; + let doneMsg = pass ? '閫氳繃' : '椹冲洖'; useMessageBoxTip({ confirmMsg: `纭鏄惁${doneMsg}璇ラ棶棰橈紵`, confirmTitle: '闂瀹℃牳', onConfirm: () => { - const { status, action } = ProCheckProxy.proNextStatus(pro.extension3, pass) + const { status, action } = ProCheckProxy.proNextStatus(pro.extension3, pass); return problemApi.checkProblem({ pId: pro.guid, action: action }).then((res) => { if (res.success) { - pro.extension3 = status - this.$emit('submit') + pro.extension3 = status; + this.$emit('submit'); } - }) + }); } - }) + }); }, - updatePro() {}, - updateChange() {} + addChange() { + this.addChangeDialogVisible = true; + }, + updatePro() { + this.deepCopyPro = useCloned(this.problem).cloned.value; + this.deepCopySubtask = useCloned(this.subtask).cloned.value; + this.deepCopyTopTask = useCloned(this.topTask).cloned.value; + this.$nextTick(() => { + this.proAddOrUpdDialogVisible = true; + }); + }, + getCurrentMouth() { + // 浣跨敤Date瀵硅薄瑙f瀽鏃ユ湡瀛楃涓� + var date = new Date(this.subtask.subtask.planstarttime); + // 鑾峰彇鏈堜唤淇℃伅锛屾湀浠芥槸浠�0寮�濮嬬殑锛屾墍浠ラ渶瑕佸姞1 + this.month = date.getMonth() + 1; + if (String(this.month).length == 1) { + this.month = `0${this.month}`; + } + // 鑾峰彇骞翠唤 + var year = date.getFullYear(); + this.month = `${year}-${this.month}`; + }, + updateChange() { + this.getCurrentMouth(); + if (!this.problem.ischanged) { + this.addChange(); + } else { + this.changeEditDialogVisible = true; + } + }, + currProRecent() { + this.proRecentDialogVisible = true; + } } -} +}; </script> <style scoped> .layout { -- Gitblit v1.9.3