Bladeren bron

发送计划

duy 1 maand geleden
bovenliggende
commit
eb5b211f2d
3 gewijzigde bestanden met toevoegingen van 150 en 19 verwijderingen
  1. 15 1
      src/api/modules/systemService/service.js
  2. 90 10
      src/views/systemService/fromDrawer.vue
  3. 45 8
      src/views/systemService/plan.vue

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

@@ -68,6 +68,20 @@ export default {
         })
     },
 
-
+    async getSendUserAndWriteUser(form) {
+        return HcApi({
+            url: '/api/blade-manager/serviceplan/getSendUserAndWriteUser',
+            method: 'get',
+            params: form,
+        })
+    },
+    async sendServicePlan(form) {
+        return HcApi({
+            url: '/api/ /blade-manager/serviceplan/sendServicePlan',
+            method: 'get',
+            params: form,
+        })
+    },
+   
 
 }

+ 90 - 10
src/views/systemService/fromDrawer.vue

@@ -1,5 +1,5 @@
 <template>
-    <hc-drawer v-model="isShow" to-id="node-card-plan" is-close>
+    <hc-drawer v-model="isShow" to-id="node-card-plan" is-close @close="goBack">
         <hc-card>
             <template #header>
                 <el-link type="primary" @click="goBack">返回</el-link>
@@ -24,6 +24,9 @@
                         hc-btn
                         keys="system-service-plan-preview-btn"
                         color="#3F9EFF"
+                        :loading="preViewLoad"
+                        :disabled="dataId.length === 0 "
+                        @click="previewPlan"
                     >
                         <HcIcon name="eye" />
                         预览
@@ -35,6 +38,7 @@
                         hc-btn
                         keys="system-service-plan-send-btn"
                         type="warning"
+                        :loading="sendPlanLoad"
                         @click="sendPlan"
                     >
                         <HcIcon name="send-plane" />
@@ -46,8 +50,9 @@
                         class="node-card-plan-btn ml-6"
                         hc-btn
                         keys="system-service-plan-back-btn"
-                      
+                        :loading="sendPlanLoad"
                         type="warning"
+                        @click="sendPlanClick(2)"
                     >
                         <HcIcon name="arrow-go-back" />
                         计划回退
@@ -55,11 +60,12 @@
                 </HcTooltip>
                 <HcTooltip keys="system-service-plan-comfirm-btn">
                     <el-button
+                        :loading="sendPlanLoad"
                         class="node-card-plan-btn ml-6"
                         hc-btn
                         keys="system-service-plan-comfirm-btn"
-                      
                         type="success"
+                        @click="sendPlanClick(3)"
                     >
                         <HcIcon name="check" />
                         确认计划
@@ -91,6 +97,7 @@ import { arrToKey, deepClone, getObjVal, isString } from 'js-fast-way'
 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: {
@@ -102,6 +109,7 @@ const props = defineProps({
         default:'',
     },
 })
+const emit = defineEmits(['close'])
 const type = ref(props.type)
 const dataId = ref(props.dataId)
 const isShow = defineModel('modelValue', {
@@ -116,10 +124,14 @@ const isTableForm = ref(false)
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
 const contractId = ref(useAppState.getContractId)
+const status = ref()
 
 watch(isShow, (val) => {
     if (val) {
-            if (dataId.value) getAddLogBusinessData()
+            if (dataId.value) {
+                getDetailData()
+                 getAddLogBusinessData()
+            }
     }
 })
 //监听
@@ -200,6 +212,7 @@ const tableFormRender = (form) => {
 }
 const goBack = () => {
     isShow.value = false
+     emit('close')
 }
 const sendPlan = ()=>{
     isUserModalShow.value = true
@@ -211,13 +224,39 @@ const dataInfo = ref({
     projectId:projectId.value,
     contractId:contractId.value,
 })
-const fixedUserFinish = (data) => {
+const userIds = ref('')
+const fixedUserFinish = async (data) => {
     const res = deepClone(data)
-    console.log(res, 'res')
     userData.value = res
-    const userIds = arrToKey(res, 'userId', ',')
-    let userIdsArr = userIds.split(',')
- 
+     userIds.value = arrToKey(res, 'userId', ',')
+
+    console.log(userIds, 'userIds')
+    sendPlanClick(1)
+
+    
+}
+const sendPlanLoad = ref(false)
+const sendPlanClick = async (type)=>{
+     sendPlanLoad.value = true
+      const { error, code, msg, data } = await dataApi.sendServicePlan(
+            {
+                id: dataId.value,
+                sendUser: userIds.value,
+                status:type,
+               
+            }
+         
+        , false)
+      sendPlanLoad.value = false
+        if (!error && code === 200) {
+        
+            window?.$message?.success(msg)
+           
+        } else {
+            sendPlanLoad.value = false
+          
+          
+        }
 }
 //保存数据
 const saveLoading = ref(false)
@@ -229,6 +268,8 @@ const savePlan = async ()=>{
         projectId: projectId.value,
         contractId: contractId.value,
         pkeyId: excelIdVal.value,
+        id: dataId.value,
+       
        
     }
     saveLoading.value = true
@@ -238,7 +279,8 @@ const savePlan = async ()=>{
         , false)
       saveLoading.value = false
         if (!error && code === 200) {
-         
+         dataId.value = data
+
             window?.$message?.success(msg)
            
         } else {
@@ -247,6 +289,44 @@ const savePlan = async ()=>{
           
         }
 }
+//预览
+const preViewLoad = ref(false)
+const previewPlan = async ()=>{
+    preViewLoad.value = true
+    const { error, code, data } = await dataApi.getDetail({
+        id: dataId.value,
+
+    }, false)
+    preViewLoad.value = false
+    if (!error && code === 200) {
+       const res = getObjVal(data)
+       const { pdfUrl } = res
+       if (pdfUrl) {
+        toPdfPage(pdfUrl)
+
+       } else {
+        window?.$message?.error('暂无预览文件')
+       
+       }
+
+    } else {
+        window?.$message?.error('暂无预览文件')
+    }
+}
+const getDetailData = async ()=>{
+    const { error, code, data } = await dataApi.getDetail({
+        id: dataId.value,
+
+    }, false)
+    if (!error && code === 200) {
+       const res = getObjVal(data)
+       const { status } = res
+        status.value = status
+    } else {
+     
+        status.value = ''
+    }
+}
 </script>
 
 <style scoped lang="scss">

+ 45 - 8
src/views/systemService/plan.vue

@@ -53,14 +53,14 @@
             <template #action="{ row }">
                 <el-link type="primary" @click="editRow(row)">编辑</el-link>
                 <el-link type="success">查看</el-link>
-                <el-link type="warning">删除</el-link>
+                <el-link v-del-com:[handleDelete]="row" type="warning">删除</el-link>
             </template>
         </hc-table>
 
         <template #action>
             <HcPages :pages="searchForm" @change="pageChange" />
         </template>
-        <fromDrawer v-model="isShowForm" :type="typeVal" :data-id="dataId" />
+        <fromDrawer v-model="isShowForm" :type="typeVal" :data-id="dataId" @close="closeDrawer" />
     </hc-card>
 </template>
 
@@ -73,6 +73,7 @@ import { arrToId, getArrValue } from 'js-fast-way'
 
 onMounted(()=>{
         getTableData()
+        getPreparedList()
 })
 const store = useAppStore()
 const projectId = ref(store.getProjectId)
@@ -93,13 +94,10 @@ const tasksStatus = ref([
     { dictKey: '4', dictValue: '已计划' },
 ])
 const preparedList = ref([
-    { id: 1, name: '张三' },
-    { id: 2, name: '李四' },
+  
 
 ])
 const postList = ref([
-    { id: 1, name: '张三' },
-    { id: 2, name: '李四' },
 
 ])
 
@@ -112,9 +110,7 @@ const betweenTimeUpdate = ({ val, arr }) => {
     getTableData()
 
 }
-const searchClick = ()=>{
 
-}
 const tableColumn = [
     { key: 'fileInType', name: '填写类型' },
     { key: 'planTime', name: '计划时间' },
@@ -156,6 +152,24 @@ const getTableData = async () => {
       
     }
 }
+//获取发送人
+const getPreparedList = async (id) => {
+    const { error, code, data } = await dataApi.getSendUserAndWriteUser({
+        projectId: projectId.value,
+        contractId: contractId.value,
+       
+       
+    })
+    //判断状态
+    if (!error && code === 200) {
+        preparedList.value = getArrValue(data['records'])
+        postList.value = getArrValue(data['records'])
+
+    } else {
+        preparedList.value = []
+         postList.value = []
+    }
+}
 const isShowForm = ref(false)
 const typeVal = ref('')
 const createMonthPlan = (type)=>{
@@ -163,10 +177,33 @@ const createMonthPlan = (type)=>{
     isShowForm.value = true
     typeVal.value = type
 }
+const closeDrawer = ()=>{
+    isShowForm.value = false
+    // getTableData()
+}
 const dataId = ref(null)
 const editRow = (row)=>{
     isShowForm.value = true
     typeVal.value = row.fileInType
     dataId.value = row.id
 }
+const handleDelete = async ({ item }, resolve) => {
+    await delData(item.id)
+    resolve()
+}
+//删除请求
+const delData = async (id) => {
+    const { error, code, msg, data } = await dataApi.remove({
+     ids:id,
+       
+    }, false)
+    //判断状态
+    if (!error && code === 200) {
+        window?.$message?.success(msg)
+      
+        getTableData()
+    } else {
+        window?.$message?.error(msg)
+    }
+}
 </script>