Bladeren bron

新增服务计划修改

duy 1 maand geleden
bovenliggende
commit
55e007001e
3 gewijzigde bestanden met toevoegingen van 86 en 21 verwijderingen
  1. 12 1
      src/api/modules/systemService/service.js
  2. 44 6
      src/views/systemService/fromDrawer.vue
  3. 30 14
      src/views/systemService/plan.vue

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

@@ -54,9 +54,20 @@ export default {
     },
     async getHtmlBus(form) {
         return HcApi({
-            url: '/api//blade-manager/serviceplan/get-html-buss-cols',
+            url: '/api/blade-manager/serviceplan/get-html-buss-cols',
             method: 'post',
             data: form,
         })
     },
+    
+    async getServiceBussData(form) {
+        return HcApi({
+            url: '/api/blade-manager/serviceplan/getServiceBussData',
+            method: 'get',
+            params: form,
+        })
+    },
+
+
+
 }

+ 44 - 6
src/views/systemService/fromDrawer.vue

@@ -87,7 +87,7 @@
 
 <script setup>
 import { ref, watch } from 'vue'
-import { arrToKey, deepClone, isString } from 'js-fast-way'
+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'
@@ -97,9 +97,13 @@ const props = defineProps({
         type:[String, Number],
         default:'',
     },
+    dataId: {
+        type:[String, Number],
+        default:'',
+    },
 })
 const type = ref(props.type)
-
+const dataId = ref(props.dataId)
 const isShow = defineModel('modelValue', {
     default: false,
 })
@@ -114,28 +118,32 @@ const projectId = ref(useAppState.getProjectId)
 const contractId = ref(useAppState.getContractId)
 
 watch(isShow, (val) => {
-   
+    if (val) {
+            if (dataId.value) getAddLogBusinessData()
+    }
 })
 //监听
 watch(() => [
     props.type,
-], ([val]) => {
+    props.dataId,
+], ([val, id]) => {
     type.value = val
+    dataId.value = id
 
     if (val === 1) {
         excelIdVal.value = '1937773223861026820'
     } else {
         excelIdVal.value = '1937773223861026822'
     }
+    
      if (val) getExcelHtml()
+    
 })
 
 //获取模板标签数据
 
-
 const getExcelHtml = async () => {
    loading.value = true
-
         //获取数据
         const { error, code, data } = await dataApi.getServiceHtml({
             contractId: contractId.value || '',
@@ -156,6 +164,36 @@ const getExcelHtml = async () => {
         }
    
 }
+//获取填写数据
+const getAddLogBusinessData = async () => {
+
+    const { data } = await dataApi.getServiceBussData({
+        id: dataId.value,
+       pkeyId: excelIdVal.value,
+    
+    }, false)
+    //设置默认数据
+    let formArrData = getObjVal(data)
+    const defaultData = setFormDefaultData(formArrData)
+    //   tableFormData.value = defaultData
+          if (getObjVal(defaultData)) {
+            tableFormData.value = defaultData
+        } else {
+            tableFormData.value = {}
+        }
+       tableFormRef.value?.setExcelHtml()
+}
+//设置表单默认数据
+const setFormDefaultData = (formInfo = {}) => {
+    return {
+      
+        ...formInfo,
+        projectId: projectId.value,
+        contractId: contractId.value,
+        pkeyId: excelIdVal.value,
+      
+    }
+}
 //渲染表单完成
 const tableFormRender = (form) => {
     isTableForm.value = form.isRenderForm

+ 30 - 14
src/views/systemService/plan.vue

@@ -38,16 +38,20 @@
     
 
         <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoad ">
-            <template #key3="{ row }">
+            <template #fileInType="{ row }">
+                <span>{{ row.fileInType === 1 ? '月度服务计划' : '服务完成确认单' }}</span>
+            </template>
+            
+            <template #statusValue="{ row }">
                 <el-tag
-                    v-if="row?.key3"
-                    :type="`${row.key3 === '已计划' ? 'success' : row.key3 === '计划中' ? 'info' : 'warning'}`" class="mx-1" effect="dark"
+                    v-if="row?.statusValue"
+                    :type="`${row.statusValue === '已计划' ? 'success' : row.statusValue === '计划中' ? 'info' : 'warning'}`" class="mx-1" effect="dark"
                 >
-                    {{ row.key3 }}
+                    {{ row.statusValue }}
                 </el-tag>
             </template>
             <template #action="{ row }">
-                <el-link type="primary">编辑</el-link>
+                <el-link type="primary" @click="editRow(row)">编辑</el-link>
                 <el-link type="success">查看</el-link>
                 <el-link type="warning">删除</el-link>
             </template>
@@ -56,16 +60,20 @@
         <template #action>
             <HcPages :pages="searchForm" @change="pageChange" />
         </template>
-        <fromDrawer v-model="isShowForm" :type="typeVal" />
+        <fromDrawer v-model="isShowForm" :type="typeVal" :data-id="dataId" />
     </hc-card>
 </template>
 
 <script setup>
-import { nextTick, ref, watch } from 'vue'
+import { nextTick, onMounted, ref } from 'vue'
 import fromDrawer from './fromDrawer.vue'
 import dataApi from '~api/systemService/service'
 import { useAppStore } from '~src/store'
 import { arrToId, getArrValue } from 'js-fast-way'
+
+onMounted(()=>{
+        getTableData()
+})
 const store = useAppStore()
 const projectId = ref(store.getProjectId)
 const contractId = ref(store.getContractId)
@@ -79,9 +87,10 @@ const fillType = ref([
     { dictKey: '2', dictValue: '服务完成确认单' },
 ])
 const tasksStatus = ref([
-    { dictKey: '1', dictValue: '待审核' },
-    { dictKey: '2', dictValue: '已审核' },
-    { dictKey: '3', dictValue: '退回' },
+    { dictKey: '1', dictValue: '计划中' },
+    { dictKey: '2', dictValue: '协同中-甲方' },
+    { dictKey: '3', dictValue: '协同中-系统' },
+    { dictKey: '4', dictValue: '已计划' },
 ])
 const preparedList = ref([
     { id: 1, name: '张三' },
@@ -107,9 +116,9 @@ const searchClick = ()=>{
 
 }
 const tableColumn = [
-    { key: 'fileInType', name: '服务完成确认单' },
-    { key: 'key2', name: '计划时间' },
-    { key: 'status', name: '状态' },
+    { key: 'fileInType', name: '填写类型' },
+    { key: 'planTime', name: '计划时间' },
+    { key: 'statusValue', name: '状态' },
     { key: 'createUser', name: '编写人' },
     { key: 'createTime', name: '创建时间' },
     { key: 'sendUser', name: '发送人员' },
@@ -140,7 +149,7 @@ const getTableData = async () => {
     //处理数据
     tableLoad.value = false
     if (!error && code === 200) {
-        tableData.value = getArrValue(data['list'])
+        tableData.value = getArrValue(data['records'])
       
     } else {
         tableData.value = []
@@ -150,7 +159,14 @@ const getTableData = async () => {
 const isShowForm = ref(false)
 const typeVal = ref('')
 const createMonthPlan = (type)=>{
+     dataId.value = ''
     isShowForm.value = true
     typeVal.value = type
 }
+const dataId = ref(null)
+const editRow = (row)=>{
+    isShowForm.value = true
+    typeVal.value = row.fileInType
+    dataId.value = row.id
+}
 </script>