Browse Source

按钮修改

duy 1 month ago
parent
commit
bd00d841a5
2 changed files with 67 additions and 22 deletions
  1. 14 1
      src/api/modules/systemService/service.js
  2. 53 21
      src/views/systemService/fromDrawer.vue

+ 14 - 1
src/api/modules/systemService/service.js

@@ -83,5 +83,18 @@ export default {
         })
     },
    
-
+    async cancelServicePlan(form) {
+        return HcApi({
+            url: '/api/blade-manager/serviceplan/cancelServicePlan',
+            method: 'get',
+            params: form,
+        })
+    },
+      async confirmServicePlan(form) {
+        return HcApi({
+            url: '/api/blade-manager/serviceplan/confirmServicePlan ',
+            method: 'get',
+            params: form,
+        })
+    },
 }

+ 53 - 21
src/views/systemService/fromDrawer.vue

@@ -34,7 +34,7 @@
                 </HcTooltip>
                 <HcTooltip keys="system-service-plan-send-btn">
                     <el-button
-                        v-if="status === 1 "
+                        v-if="status === 1"
                         class="node-card-plan-btn ml-6"
                         hc-btn
                         keys="system-service-plan-send-btn"
@@ -47,30 +47,18 @@
                         发送计划
                     </el-button>
                 </HcTooltip>
-                <HcTooltip keys="system-service-plan-send-btn">
-                    <el-button
-                        v-if="status === 3 "
-                        class="node-card-plan-btn ml-6"
-                        hc-btn
-                        keys="system-service-plan-send-btn"
-                        type="warning"
-                        :loading="sendPlanLoad"
-                        @click="sendPlan"
-                    >
-                        <HcIcon name="send-plane" />
-                        发送计划
-                    </el-button>
-                </HcTooltip>
+           
                 <HcTooltip keys="system-service-plan-back-btn">
                     <el-button
                         v-if="status === 2"
                         class="node-card-plan-btn ml-6"
                         hc-btn
                         keys="system-service-plan-back-btn"
-                        :loading="sendPlanLoad"
+               
                         type="warning"
                         :disabled="!isSendUserAuthorized"
-                        @click="sendPlanClick(3)"
+                        :loading="backPlanLoad"
+                        @click="backPlan"
                     >
                         <HcIcon name="arrow-go-back" />
                         计划回退
@@ -79,13 +67,13 @@
                 <HcTooltip keys="system-service-plan-comfirm-btn">
                     <el-button
                         v-if="status === 2"
-                        :loading="sendPlanLoad"
+                        :loading="confirmPlanLoad"
                         class="node-card-plan-btn ml-6"
                         hc-btn
                         keys="system-service-plan-comfirm-btn"
                         type="success"
                         :disabled="!isSendUserAuthorized"
-                        @click="sendPlanClick(4)"
+                        @click="confirmPlan"
                     >
                         <HcIcon name="check" />
                         确认计划
@@ -118,6 +106,7 @@ import HcUserModal from './hc-tasks-user/user-modal.vue'
 import { useAppStore } from '~src/store'
 import dataApi from '~api/systemService/service'
 import { toPdfPage } from '~uti/btn-auth'
+
 //参数
 const props = defineProps({
     type: {
@@ -144,7 +133,7 @@ const isTableForm = ref(false)
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
 const contractId = ref(useAppState.getContractId)
-const { user_id } = ref(useAppState.getUserInfo)
+const user_id = ref(useAppState.getUserInfo.user_id ?? '')
 const status = ref()
 
 watch(isShow, (val) => {
@@ -283,7 +272,7 @@ const sendPlanClick = async (type)=>{
             {
                 id: dataId.value,
                 sendUser: userIds.value,
-                status:type,
+
                
             }
          
@@ -300,6 +289,45 @@ const sendPlanClick = async (type)=>{
           
         }
 }
+//回退计划
+const backPlanLoad = ref(false)
+const backPlan = async ()=>{
+    backPlanLoad.value = true
+    const { error, code, msg, data } = await dataApi.cancelServicePlan(
+            {
+                id: dataId.value,
+              
+            }
+         
+        , false)
+        backPlanLoad.value = false
+      if (!error && code === 200) {
+        
+            window?.$message?.success(msg)
+            getDetailData()
+           
+        } 
+}
+//确认计划
+const confirmPlanLoad = ref(false)
+const confirmPlan = async ()=>{
+    confirmPlanLoad.value = true
+      const { error, code, msg, data } = await dataApi.confirmServicePlan(
+            {
+                id: dataId.value,
+              
+            }
+         
+        , false)
+      confirmPlanLoad.value = false
+        if (!error && code === 200) {
+        
+            window?.$message?.success(msg)
+            getDetailData()
+           
+        } 
+          
+}
 //保存数据
 const saveLoading = ref(false)
 const savePlan = async ()=>{
@@ -367,6 +395,10 @@ const getDetailData = async ()=>{
        const res = getObjVal(data)
        
         status.value = res.status
+        console.log( status.value, ' status.value')
+        console.log(user_id, ' user_id.value')
+        
+        
        sendUser.value = res.sendUser
        writeUser.value = res.updateUser