Pārlūkot izejas kodu

Merge branch 'master' into test-dev

duy 1 mēnesi atpakaļ
vecāks
revīzija
384d5b13cd

+ 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,
+        })
+    },
+   
 
 }

+ 143 - 12
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" />
                         预览
@@ -31,10 +34,27 @@
                 </HcTooltip>
                 <HcTooltip keys="system-service-plan-send-btn">
                     <el-button
+                        v-if="status === 1 "
                         class="node-card-plan-btn ml-6"
                         hc-btn
                         keys="system-service-plan-send-btn"
                         type="warning"
+                        :loading="sendPlanLoad"
+                        :disabled="!isWriteUserAuthorized"
+                        @click="sendPlan"
+                    >
+                        <HcIcon name="send-plane" />
+                        发送计划
+                    </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" />
@@ -43,11 +63,14 @@
                 </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)"
                     >
                         <HcIcon name="arrow-go-back" />
                         计划回退
@@ -55,11 +78,14 @@
                 </HcTooltip>
                 <HcTooltip keys="system-service-plan-comfirm-btn">
                     <el-button
+                        v-if="status === 2"
+                        :loading="sendPlanLoad"
                         class="node-card-plan-btn ml-6"
                         hc-btn
                         keys="system-service-plan-comfirm-btn"
-                      
                         type="success"
+                        :disabled="!isSendUserAuthorized"
+                        @click="sendPlanClick(4)"
                     >
                         <HcIcon name="check" />
                         确认计划
@@ -86,11 +112,12 @@
 </template>
 
 <script setup>
-import { ref, watch } from 'vue'
+import { computed, ref, watch } from 'vue'
 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 +129,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 +144,25 @@ const isTableForm = ref(false)
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
 const contractId = ref(useAppState.getContractId)
+const { user_id } = ref(useAppState.getUserInfo)
+const status = ref()
 
 watch(isShow, (val) => {
+
+    
     if (val) {
-            if (dataId.value) getAddLogBusinessData()
+          if (val) getExcelHtml()
+             tableFormData.value = {}
+                excelHtmlData.value = ''
+                isTableForm.value = false
+
+            if (dataId.value) {
+               
+
+                getDetailData()
+                 getAddLogBusinessData()
+            }
+
     }
 })
 //监听
@@ -136,7 +179,7 @@ watch(() => [
         excelIdVal.value = '1937773223861026822'
     }
     
-     if (val) getExcelHtml()
+   
     
 })
 
@@ -200,24 +243,62 @@ const tableFormRender = (form) => {
 }
 const goBack = () => {
     isShow.value = false
+     emit('close')
 }
 const sendPlan = ()=>{
+    userData.value = []
+
     isUserModalShow.value = true
 
 }
+// 计算属性:判断 writeUser 是否包含 user_id
+const isWriteUserAuthorized = computed(() => {
+    return writeUser.value.includes(user_id.value)
+})
+// 计算属性:判断 sendUser 是否包含 user_id
+const isSendUserAuthorized = computed(() => {
+    return sendUser.value.includes(user_id.value)
+})
 const isUserModalShow = ref(false)
 const userData = ref([])
 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(2)
+
+    
+}
+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)
+            getDetailData()
+           
+        } else {
+            sendPlanLoad.value = false
+          
+          
+        }
 }
 //保存数据
 const saveLoading = ref(false)
@@ -229,6 +310,8 @@ const savePlan = async ()=>{
         projectId: projectId.value,
         contractId: contractId.value,
         pkeyId: excelIdVal.value,
+        groupId: dataId.value,
+       
        
     }
     saveLoading.value = true
@@ -238,8 +321,10 @@ const savePlan = async ()=>{
         , false)
       saveLoading.value = false
         if (!error && code === 200) {
-         
+         dataId.value = data
+
             window?.$message?.success(msg)
+            getDetailData()
            
         } else {
             saveLoading.value = false
@@ -247,6 +332,52 @@ 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 sendUser = ref('')
+const writeUser = ref('')
+const getDetailData = async ()=>{
+    const { error, code, data } = await dataApi.getDetail({
+        id: dataId.value,
+
+    }, false)
+    if (!error && code === 200) {
+       const res = getObjVal(data)
+       
+        status.value = res.status
+       sendUser.value = res.sendUser
+       writeUser.value = res.updateUser
+
+        
+    } else {
+     
+        status.value = ''
+        sendUser.value = ''
+        writeUser.value = ''
+    }
+}
 </script>
 
 <style scoped lang="scss">

+ 68 - 21
src/views/systemService/plan.vue

@@ -16,23 +16,23 @@
             </div>
             <div class="ml-3 w-32">
                 <el-select v-model="searchForm.createUser" clearable block placeholder="编写人" @change="getTableData">
-                    <el-option v-for="item in preparedList" :key="item.id" :label="item.name" :value="item.id" />
+                    <el-option v-for="item in preparedList" :key="item.userId" :label="item.userName" :value="item.userId" />
                 </el-select>
             </div>
             <div class="ml-3 w-32">
                 <el-select v-model="searchForm.sendUser" placeholder="发送人" clearable multiple block @change="getTableData">
-                    <el-option v-for="item in postList" :key="item.batch" :label="item.name" :value="item.id" />
+                    <el-option v-for="item in postList" :key="item.userId" :label="item.userName" :value="item.userId" />
                 </el-select>
             </div>
         </template>
         <template #extra>
             <el-button type="primary" @click="createMonthPlan(1)">
                 <HcIcon name="add" />
-                <span>创建月度计划</span>
+                <span>创建月度服务计划</span>
             </el-button>
             <el-button type="primary" @click="createMonthPlan(2)">
                 <HcIcon name="add" />
-                <span>创建服务计划</span>
+                <span>服务完成确认单</span>
             </el-button>
         </template>
     
@@ -51,16 +51,16 @@
                 </el-tag>
             </template>
             <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-if="row.status !== 4" type="primary" @click="editRow(row)">编辑</el-link>
+                <el-link v-if="row.status !== 1 " type="success" @click="viewPlan(row)">查看</el-link>
+                <el-link v-if="row.status === 1 " 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>
 
@@ -70,9 +70,11 @@ import fromDrawer from './fromDrawer.vue'
 import dataApi from '~api/systemService/service'
 import { useAppStore } from '~src/store'
 import { arrToId, getArrValue } from 'js-fast-way'
+import { toPdfPage } from '~uti/btn-auth'
 
 onMounted(()=>{
         getTableData()
+        getPreparedList()
 })
 const store = useAppStore()
 const projectId = ref(store.getProjectId)
@@ -88,18 +90,15 @@ const fillType = ref([
 ])
 const tasksStatus = ref([
     { dictKey: '1', dictValue: '计划中' },
-    { dictKey: '2', dictValue: '协同中-甲方' },
-    { dictKey: '3', dictValue: '协同中-系统' },
+    { dictKey: '2', dictValue: '确认中-甲方' },
+    { dictKey: '3', dictValue: '反馈中-系统' },
     { dictKey: '4', dictValue: '已计划' },
 ])
 const preparedList = ref([
-    { id: 1, name: '张三' },
-    { id: 2, name: '李四' },
+  
 
 ])
 const postList = ref([
-    { id: 1, name: '张三' },
-    { id: 2, name: '李四' },
 
 ])
 
@@ -112,22 +111,18 @@ const betweenTimeUpdate = ({ val, arr }) => {
     getTableData()
 
 }
-const searchClick = ()=>{
 
-}
 const tableColumn = [
     { key: 'fileInType', name: '填写类型' },
     { key: 'planTime', name: '计划时间' },
     { key: 'statusValue', name: '状态' },
-    { key: 'createUser', name: '编写人' },
+    { key: 'writeUserName', name: '编写人' },
     { key: 'createTime', name: '创建时间' },
-    { key: 'sendUser', name: '发送人员' },
+    { key: 'sendUserName', name: '发送人员' },
     { key: 'action', name: '操作', width:150 },
 ]
 const tableData = ref([
-    { name: '名称1', text: '文本1', key3: '已计划' },
-    { name: '名称2', text: '文本2', key3: '计划中' },
-    { name: '名称3', text: '文本3', key3: '协同中-甲方' },
+
 ])
 //分页被点击
 const pageChange = ({ current, size }) => {
@@ -156,6 +151,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['writeUser'])
+        postList.value = getArrValue(data['sendUser'])
+
+    } else {
+        preparedList.value = []
+         postList.value = []
+    }
+}
 const isShowForm = ref(false)
 const typeVal = ref('')
 const createMonthPlan = (type)=>{
@@ -163,10 +176,44 @@ const createMonthPlan = (type)=>{
     isShowForm.value = true
     typeVal.value = type
 }
+const closeDrawer = ()=>{
+    isShowForm.value = false
+        getTableData()
+        getPreparedList()
+}
 const dataId = ref(null)
 const editRow = (row)=>{
     isShowForm.value = true
     typeVal.value = row.fileInType
     dataId.value = row.id
 }
+const viewPlan = (row)=>{
+     const { pdfUrl } = row
+           if (pdfUrl) {
+        toPdfPage(pdfUrl)
+
+       } else {
+        window?.$message?.error('暂无预览文件')
+       
+       }
+}
+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>    

+ 23 - 1
src/views/user/index.vue

@@ -231,7 +231,13 @@
                     ref="recycleTableRef" :column="recycleTableColumn" :datas="recycleTableData" :loading="recycleTableLoading"
                     is-new :index-style="{ width: 60 }" is-check :check-style="{ width: 29 }"
                     @selection-change="recycleTableSelectionChange"
-                />
+                >
+                    <template #fileName="{ row }">
+                        <div :class="{ 'text-red': row?.status === 2 }">
+                            {{ row?.fileName }}
+                        </div>
+                    </template>
+                </HcTable>
                 <template #action>
                     <div class="foot-recycle">
                         <el-button
@@ -771,6 +777,22 @@ const recycleTableSelectionChange = (val) => {
 const recycleBtnLoading = ref(false)
 const recycleBtnClick = async () => {
     const rows = RecycleCheckedKeys.value
+        let hasUnoperableData = false
+
+    // 遍历每一行数据,检查 status 字段
+    for (const row of rows) {
+        if (row.status === 2) {
+            hasUnoperableData = true
+            break
+        }
+    }
+
+    // 如果存在 status = 2 的数据,则提示用户并返回
+    if (hasUnoperableData) {
+        window.$message.warning('存在不可操作的数据,请检查后再操作。')
+        return
+    }
+
     if (rows.length > 0) {
         //请求数据
         recycleBtnLoading.value = true