瀏覽代碼

任务管理

ZaiZai 1 年之前
父節點
當前提交
ec392e47fe

+ 8 - 0
src/api/modules/tasks/hc-data.js

@@ -33,4 +33,12 @@ export default {
             params: { id },
         }, false)
     },
+    //获取任务数据信息详情
+    async getDataDetail(form) {
+        return HcApi({
+            url: '/api/blade-meter/task/data/detail',
+            method: 'get',
+            params: form,
+        }, false)
+    },
 }

+ 1 - 0
src/views/tasks/components/hc-data/material-form.vue

@@ -72,6 +72,7 @@
 <script setup>
 import { onMounted, ref, watch } from 'vue'
 import { getHeader } from 'hc-vue3-ui'
+import mainApi from '~api/tasks/hc-data'
 
 const props = defineProps({
     isEdit: {

+ 23 - 8
src/views/tasks/components/hc-data/middlepay-form.vue

@@ -122,12 +122,13 @@
 <script setup>
 import { getArrValue } from 'js-fast-way'
 import { onMounted, ref, watch } from 'vue'
+import { useAppStore } from '~src/store'
 import HcBillBaseModal from '~src/views/debit-pay/admin/components/middlepay/addBillBaseModal.vue'
+import middlepayApi from '~api/debit-pay/admin/middlepay'
+import mainApi from '~api/tasks/hc-data'
 import BigNumber from 'bignumber.js'
 import { getHeader } from 'hc-vue3-ui'
 
-import mainApi from '~api/tasks/hc-data'
-
 const props = defineProps({
     isEdit: {
         type: Boolean,
@@ -139,6 +140,10 @@ const props = defineProps({
     },
 })
 
+const useAppState = useAppStore()
+const projectId = ref(useAppState.getProjectId || '')
+const contractId = ref(useAppState.getContractId || '')
+
 //双向绑定
 // eslint-disable-next-line no-undef
 const rowInfo = defineModel('modelValue', {
@@ -169,22 +174,32 @@ onMounted(() => {
 
 //设置任务信息
 const taskInfo = ref({})
-const setTaskInfo = async (info) => {
+const setTaskInfo = (info) => {
     taskInfo.value = info
-    getAllPeriod(info.contractId).then()
+    console.log(info)
+    getAllPeriod()
+    getDataDetail()
 }
 
 //获取合同计量期列表
 const periods = ref([])
-const getAllPeriod = async (cid) => {
-    if (cid === '') return
-    const { data } = await mainApi.getAllPeriod({
-        contractId: cid,
+const getAllPeriod = async () => {
+    const { data } = await middlepayApi.getAllPeriod({
+        projectId: projectId.value,
+        contractId: contractId.value,
         type: 1,
     })
     periods.value = getArrValue(data)
 }
 
+//获取任务数据信息详情
+const getDataDetail = async () => {
+    const id = taskInfo.value.id
+    /*const { data } = await mainApi.getDetail({
+        id: id
+    })*/
+}
+
 //基础表单
 const baseFormRef = ref(null)
 const baseForm = ref({ fileList: [], pictureUrl: '' })

+ 24 - 26
src/views/tasks/components/hc-data/task-form.vue

@@ -1,16 +1,16 @@
 <template>
     <div class="hc-task-form-body">
-        <el-tabs v-if="isType === 1" type="border-card">
+        <el-tabs v-if="taskInfo.meterType === 1" type="border-card">
             <el-tab-pane label="计量信息">
-                <HcMiddlepayForm />
+                <HcMiddlepayForm v-model="taskInfo" />
             </el-tab-pane>
             <el-tab-pane label="质保资料" disabled>
-                <HcMassForm />
+                <HcMassForm v-model="taskInfo" />
             </el-tab-pane>
         </el-tabs>
-        <HcStartWorkForm v-if="isType === 2" />
-        <HcAlterForm v-if="isType === 3" />
-        <HcMaterialForm v-if="isType === 4" />
+        <HcMaterialForm v-if="taskInfo.meterType === 2" v-model="taskInfo" />
+        <HcStartWorkForm v-if="taskInfo.meterType === 3" v-model="taskInfo" />
+        <HcAlterForm v-if="taskInfo.meterType === 4" v-model="taskInfo" />
         <hc-card-item class="hc-card-footer mt-3">
             <div class="relative">
                 <el-radio-group v-model="approval" size="large">
@@ -32,22 +32,21 @@ import HcMassForm from './mass-form.vue'
 import HcStartWorkForm from './start-work-form.vue'
 import HcAlterForm from './alter-form.vue'
 import HcMaterialForm from './material-form.vue'
+import mainApi from '~api/tasks/hc-data'
 
 const props = defineProps({
     isEdit: {
         type: Boolean,
         default: true,
     },
-    type: {
-        type: [String, Number],
-        default: '',
+    info: {
+        type: Object,
+        default: () => ({}),
+    },
+    table: {
+        type: Object,
+        default: () => ({}),
     },
-})
-
-//双向绑定
-// eslint-disable-next-line no-undef
-const rowInfo = defineModel('modelValue', {
-    default: () => ({}),
 })
 
 //监听可否编辑
@@ -56,26 +55,25 @@ watch(() => props.isEdit, (val) => {
     isEdits.value = val
 }, { immediate: true, deep: true })
 
-//监听类型
-const isType = ref(props.type)
-watch(() => props.type, (val) => {
-    isType.value = val
-}, { immediate: true, deep: true })
-
 //监听数据
-watch(() => rowInfo, (val) => {
-    setTaskInfo(val.value)
+watch(() => [
+    props.table,
+    props.info,
+], ([table, row]) => {
+    setTaskInfo(table, row)
 }, { deep: true })
 
 //渲染完成
 onMounted(() => {
-    setTaskInfo(rowInfo.value)
+    setTaskInfo(props.table, props.info)
 })
 
 //设置任务信息
 const taskInfo = ref({})
-const setTaskInfo = async (info) => {
-    taskInfo.value = info
+const tableInfo = ref({})
+const setTaskInfo = async (table, row) => {
+    tableInfo.value = table
+    taskInfo.value = row
 }
 
 //同意还是驳回

+ 40 - 60
src/views/tasks/components/hc-data/task-review.vue

@@ -12,13 +12,13 @@
                     <hc-body class="hc-task-body-card" padding="10px" scrollbar>
                         <el-timeline class="hc-time-line">
                             <template v-for="(item, index) in flowList" :key="index">
-                                <el-timeline-item :class="item.currentBol ? 'success' : item.current ? 'primary' : ''" size="large">
+                                <el-timeline-item :class="item.status === '2' ? 'success' : 'primary'" size="large">
                                     <div class="timeline-item-icon">
-                                        <hc-icon v-if="item.currentBol" class="check-icon" name="check" />
+                                        <hc-icon v-if="item.status === '2'" class="check-icon" name="check" />
                                     </div>
                                     <div class="reply-name">{{ item.name }}</div>
-                                    <div class="reply-time">{{ item.time }}</div>
-                                    <div class="reply-content" v-html="item.content" />
+                                    <div class="reply-time">{{ item.date }}</div>
+                                    <div class="reply-content" v-html="item.flowValue" />
                                 </el-timeline-item>
                             </template>
                         </el-timeline>
@@ -27,20 +27,19 @@
                 <div :id="`hc_task_table_${uuid}`" class="hc-task-table">
                     <hc-body class="hc-task-body-card" padding="10px">
                         <hc-table
-                            ref="tableRef" :column="tableColumn" :datas="tableData"
-                            :is-stripe="false" is-new :index-style="{ width: 60 }" is-current-row
-                            @row-click="tableRowClick"
+                            ref="tableRef" :column="tableColumn" :datas="tableData" :is-stripe="false"
+                            is-new :index-style="{ width: 60 }" is-current-row @row-click="tableRowClick"
                         >
                             <template #action="{ row }">
-                                <div class="hc-task-table-action" :class="row.isRemark ? 'is-cur' : ''" @click="rowRemarkClick(row)">
+                                <div class="hc-task-table-action" :class="row.isComment === 1 ? 'is-cur' : ''" @click="rowRemarkClick(row)">
                                     <i class="i-iconoir-star-solid" />
                                 </div>
                             </template>
                             <template #state="{ row }">
                                 <div class="hc-task-table-state">
-                                    <i v-if="row.state === 1" class="i-iconoir-xmark-circle-solid is-danger" />
-                                    <i v-else-if="row.state === 2" class="i-iconoir-check-circle-solid is-success" />
-                                    <span v-else-if="row.state === 3">审批结束</span>
+                                    <i v-if="row.status === 1" class="i-iconoir-check-circle-solid is-success" />
+                                    <i v-else-if="row.status === 2" class="i-iconoir-xmark-circle-solid is-danger" />
+                                    <span v-else-if="row.status === 3">审批结束</span>
                                     <i v-else class="i-iconoir-help-circle-solid" />
                                 </div>
                             </template>
@@ -49,7 +48,7 @@
                 </div>
                 <div :id="`hc_task_form_${uuid}`" class="hc-task-form">
                     <hc-body class="hc-task-body-card" padding="10px" scrollbar>
-                        <HcTaskForm v-model="tableInfo" :is-edit="tabsKey === 1" :type="rowInfo.meterType" />
+                        <HcTaskForm :table="tableInfo" :info="rowInfo" :is-edit="tabsKey === 1" />
                     </hc-body>
                 </div>
             </div>
@@ -67,8 +66,7 @@
 
 <script setup>
 import { nextTick, ref, watch } from 'vue'
-import { useAppStore } from '~src/store'
-import { getRandom } from 'js-fast-way'
+import { getArrValue, getObjValue, getRandom } from 'js-fast-way'
 import HcTaskForm from './task-form.vue'
 import HcTaskNotes from './task-notes.vue'
 import mainApi from '~api/tasks/hc-data'
@@ -85,12 +83,6 @@ const props = defineProps({
 })
 //事件
 const emit = defineEmits(['finish', 'close'])
-
-//项目合同段信息
-const useAppState = useAppStore()
-const projectId = ref(useAppState.getProjectId || '')
-const contractId = ref(useAppState.getContractId || '')
-
 const uuid = getRandom(4)
 
 //双向绑定
@@ -159,15 +151,30 @@ const getTableDetail = async () => {
     isLoading.value = true
     rejectionLoading.value = true
     confirmLoading.value = true
+    //获取数据
     const { data } = await mainApi.getDetail(rowInfo.value.id)
-    console.log(data)
+    const { taskProcessInfo, taskCenterDataInfo } = getObjValue(data)
+    tableData.value = getArrValue(taskCenterDataInfo)
+    flowList.value = getArrValue(taskProcessInfo)
+
+    //默认选中第一行
+    let info = {}
+    if (tableData.value.length > 0) {
+        info = tableData.value[0]
+    }
+    await nextTick(() => {
+        tableInfo.value = info
+        tableRef.value?.tableRef?.setCurrentRow(info)
+    })
+
+    //关闭加载状态
+    isLoading.value = false
+    rejectionLoading.value = false
+    confirmLoading.value = false
 }
 
-//流程信息
-const flowList = ref([
-    { currentBol: true, current: false, name: '张三', time: '2023-10-17 10:00:21', content: '上报' },
-    { currentBol: false, current: true, name: '李四', time: '2023-11-01 09:00:21', content: '结束流程</br>同意' },
-])
+//流程信息,1待审批,2已审批
+const flowList = ref([])
 
 //中间计量单的表格数据
 const middlepayTableColumn = ref([
@@ -205,35 +212,8 @@ const materialTableColumn = ref([
 ])
 
 //表格数据
-const tableLoading = ref(false)
 const tableColumn = ref([])
-const tableData = ref([
-    { isRemark: false, key1: '你猜1', key2: '猜猜1', state: 1 },
-    { isRemark: false, key1: '你猜2', key2: '猜猜2', state: 1 },
-    { isRemark: true, key1: '你猜3', key2: '猜猜3', state: 2 },
-    { isRemark: true, key1: '你猜4', key2: '猜猜4', state: 2 },
-])
-const getTableData = async () => {
-    //tableData.value = []
-    tableLoading.value = true
-    /*const { data } = await mainApi.getPage({
-        ...searchForm.value,
-        projectId: projectId.value,
-        contractId: contractId.value,
-    })
-    tableData.value = getArrValue(data)*/
-    tableLoading.value = false
-    //默认选中第一行
-    let info = {}
-    if (tableData.value.length > 0) {
-        info = tableData.value[0]
-    }
-    await nextTick(() => {
-        tableInfo.value = info
-        tableRef.value?.tableRef?.setCurrentRow(info)
-    })
-    //getTableDetail(info).then()
-}
+const tableData = ref([])
 
 //表格行被点击
 const tableInfo = ref({})
@@ -241,13 +221,12 @@ const tableRowClick = ({ row }) => {
     tableInfo.value = row
 }
 
-//批注
+//批注, isComment 是否已批注,1=是,0=否
 const isNotesShow = ref(false)
 const rowRemarkClick = (row) => {
     isNotesShow.value = true
 }
 
-
 //确认审批
 const confirmLoading = ref(false)
 const confirmClick = () => {
@@ -263,11 +242,12 @@ const rejectionClick = () => {
 //取消审批
 const cancelClick = () => {
     isShow.value = false
-    rowInfo.value = {}
-    tabsKey.value = ''
-    tableLoading.value = false
+    isLoading.value = false
+    rejectionLoading.value = false
+    confirmLoading.value = false
     tableColumn.value = []
-    //tableData.value = []
+    tableData.value = []
+    tableInfo.value = {}
     emit('close')
 }
 </script>