From 22ce3a4c8453b54c2bfe6d582b734195f899f195 Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期二, 10 十二月 2024 14:59:50 +0800 Subject: [PATCH] 1. 新增socket生命周期管理、心跳机制、重连机制 2. 新增socket消息校验、解析、生成 3. 新增socket消息类型枚举类src\enum\socketMessage 3. 新增消息管理类src\socket\MessageManager 4. 新增观察者模式消息的发布订阅机制src\socket\eventBus 5. 修改后台任务页面注册后台任务状态消息并修改状态的逻辑 --- src/views/fysp/check/components/CompProblemCard.vue | 196 +++++++++++++++++++++++++++++++++++++----------- 1 files changed, 151 insertions(+), 45 deletions(-) diff --git a/src/views/fysp/check/components/CompProblemCard.vue b/src/views/fysp/check/components/CompProblemCard.vue index 04947c6..9ab31b5 100644 --- a/src/views/fysp/check/components/CompProblemCard.vue +++ b/src/views/fysp/check/components/CompProblemCard.vue @@ -1,6 +1,11 @@ <template> <el-card class="layout" shadow="hover"> - <el-steps :active="proStatus.index" finish-status="success" style="" align-center> + <el-steps + :active="proStatus.index" + finish-status="success" + style="" + align-center + > <el-step v-for="(s, i) in getSteps" :key="i" :title="s" /> </el-steps> @@ -30,12 +35,20 @@ </el-descriptions> <el-scrollbar> - <el-descriptions title=" " :column="2" direction="vertical" size="small" border> + <el-descriptions + title=" " + :column="2" + direction="vertical" + size="small" + border + > <template v-for="(pic, t) in pics" :key="t"> <template v-if="pic.path.length > 0"> <el-descriptions-item :label="pic.title" - :label-class-name="t == 0 ? 'descriptions-label-1' : 'descriptions-label-2'" + :label-class-name=" + t == 0 ? 'descriptions-label-1' : 'descriptions-label-2' + " > <el-space> <el-image @@ -59,50 +72,86 @@ <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 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-button type="info" size="small" @click="currProRecent" plain + >闂澶嶇幇</el-button + > </el-row> </el-col> <el-col :span="12"> <el-row justify="end" class="btn-group"> - <el-button type="danger" size="small" @click="deletePro" :disabled="!proStatus.deletable" + <el-button + type="danger" + size="small" + @click="deletePro" + :disabled="!proStatus.deletable" >鍒犻櫎</el-button > - <el-button type="warning" size="small" @click="rejectPro" :disabled="!proStatus.checkable" + <el-button + type="danger" + size="small" + @click="beforePro" + :disabled="proStatus.checkable" + >鎾ら攢</el-button + > + <el-button + type="warning" + size="small" + @click="rejectPro" + :disabled="!proStatus.checkable" >椹冲洖</el-button > - <el-button type="success" size="small" @click="passPro" :disabled="!proStatus.checkable" + <el-button + type="success" + size="small" + @click="passPro" + :disabled="!proStatus.checkable" >閫氳繃</el-button > </el-row> </el-col> </el-row> </el-card> - <el-dialog v-model="proAddOrUpdDialogVisible" :before-close="proAddOrUpdDialogClose" width="80%"> - <CompProblemAddOrUpd - v-if="proAddOrUpdDialogVisible" - :problem="deepCopyPro" - :subtask="deepCopySubtask" - :topTask="deepCopyTopTask" - ref="compProblemAddOrUpdRef" - @submited="onProSubmited" + <div class="dialog-wrapper"> + <el-dialog + title="闂鏇存" + width="50%" + 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%" + width="50%" title="鏁存敼妫�楠�" v-model="changeEditDialogVisible" :before-close="changeEditDialogClose" > <ComChangeEdit + :changeType="1" v-if="changeEditDialogVisible" :problemId="problem.guid" :oldChangeFileList="problem.mediafileList" @@ -113,16 +162,17 @@ </el-dialog> <!-- 闂澶嶇幇 --> <el-dialog - width="80%" + width="50%" title="闂澶嶇幇" v-model="proRecentDialogVisible" :before-close="proRecentDialogClose" > - <CompProRecent - v-if="proRecentDialogVisible" + <CompProRecent + v-if="proRecentDialogVisible" :subtask="subtask" :topTask="topTask" - :problem="problem"/> + :problem="problem" + /> </el-dialog> </template> @@ -174,6 +224,7 @@ emits: ['submit'], data() { return { + addChangeDialogVisible: false, // 杩戞湡鎯呭喌 proRecentDialogVisible: false, month: -1, @@ -199,10 +250,7 @@ ] }; }, - mounted() { - console.log(this.topTask); - - }, + mounted() {}, computed: { // 闂鍚嶇О title() { @@ -243,6 +291,10 @@ } }, methods: { + onAddChangeSubmited() { + this.$emit('updated', true); + this.addChangeDialogVisible = false; + }, // 杩戞湡鎯呭喌寮圭獥鍏抽棴 proRecentDialogClose() { this.proRecentDialogVisible = false; @@ -255,8 +307,6 @@ this.proAddOrUpdDialogVisible = false; }, onChangeSubmited(isOk) { - console.log("zhenggaisubmit"); - this.$emit('updated', isOk); this.changeEditDialogVisible = false; }, @@ -266,12 +316,55 @@ changeEditDialogClose() { this.changeEditDialogVisible = false; }, - deletePro() {}, + deletePro() { + useMessageBoxTip({ + confirmMsg: '鏄惁鍒犻櫎闂', + confirmTitle: '纭畾', + onConfirm: () => { + return problemApi + .deleteProblem({ + pid: this.problem.guid + }) + .then((res) => { + if (res.success) { + this.$emit('submit'); + } + }); + } + }); + }, rejectPro() { this.checkPro(false); }, passPro() { this.checkPro(true); + }, + beforePro() { + const pro = this.problem; + let status = this.proStatus; + let doneMsg; + if (status.index <= 2) { + doneMsg = '闂鏈鏍�'; + } else if (status.index <= 3) { + doneMsg = '鏁存敼鏈鏍�'; + } + useMessageBoxTip({ + confirmMsg: `纭鎾ゅ洖鍒�${doneMsg}锛焋, + confirmTitle: '瀹℃牳鎾ゅ洖', + onConfirm: () => { + const { status, action } = ProCheckProxy.proBeforeStatus( + pro.extension3 + ); + return problemApi + .checkProblem({ pId: pro.guid, action: action }) + .then((res) => { + if (res.success) { + pro.extension3 = status; + this.$emit('submit', false); + } + }); + } + }); }, checkPro(pass) { const pro = this.problem; @@ -280,19 +373,25 @@ confirmMsg: `纭鏄惁${doneMsg}璇ラ棶棰橈紵`, confirmTitle: '闂瀹℃牳', onConfirm: () => { - 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'); - } - }); + 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', false); + } + }); } }); }, + addChange() { + this.addChangeDialogVisible = true; + }, updatePro() { - console.log("clone", this.topTask); - this.deepCopyPro = useCloned(this.problem).cloned.value; this.deepCopySubtask = useCloned(this.subtask).cloned.value; this.deepCopyTopTask = useCloned(this.topTask).cloned.value; @@ -300,7 +399,7 @@ this.proAddOrUpdDialogVisible = true; }); }, - updateChange() { + getCurrentMouth() { // 浣跨敤Date瀵硅薄瑙f瀽鏃ユ湡瀛楃涓� var date = new Date(this.subtask.subtask.planstarttime); // 鑾峰彇鏈堜唤淇℃伅锛屾湀浠芥槸浠�0寮�濮嬬殑锛屾墍浠ラ渶瑕佸姞1 @@ -311,7 +410,14 @@ // 鑾峰彇骞翠唤 var year = date.getFullYear(); this.month = `${year}-${this.month}`; - this.changeEditDialogVisible = true; + }, + updateChange() { + this.getCurrentMouth(); + if (!this.problem.ischanged) { + this.addChange(); + } else { + this.changeEditDialogVisible = true; + } }, currProRecent() { this.proRecentDialogVisible = true; -- Gitblit v1.9.3