소스 검색

变更令

ZaiZai 1 년 전
부모
커밋
49726448b5
2개의 변경된 파일96개의 추가작업 그리고 6개의 파일을 삭제
  1. 59 0
      src/views/tasks/components/hc-data/task-form.vue
  2. 37 6
      src/views/tasks/components/hc-data/task-review.vue

+ 59 - 0
src/views/tasks/components/hc-data/task-form.vue

@@ -0,0 +1,59 @@
+<template>
+    <div>
+        11111
+    </div>
+</template>
+
+<script setup>
+import { onMounted, ref, watch } from 'vue'
+
+const props = defineProps({
+    isEdit: {
+        type: Boolean,
+        default: true,
+    },
+    type: {
+        type: [String, Number],
+        default: '',
+    },
+})
+
+//双向绑定
+// eslint-disable-next-line no-undef
+const rowInfo = defineModel('modelValue', {
+    default: () => ({}),
+})
+
+//监听可否编辑
+const isEdits = ref(props.isEdit)
+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)
+}, { deep: true })
+
+//渲染完成
+onMounted(() => {
+    setTaskInfo(rowInfo.value)
+})
+
+//设置任务信息
+const taskInfo = ref({})
+const setTaskInfo = async (info) => {
+    taskInfo.value = info
+    console.log(info)
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 37 - 6
src/views/tasks/components/hc-data/task-review.vue

@@ -27,13 +27,12 @@
                 <div class="hc-task-table">
                     <hc-body class="hc-task-body-card" padding="10px">
                         <hc-table
-                            :column="tableColumn" :datas="tableData"
-                            :loading="tableLoading" :is-stripe="false"
-                            is-new :index-style="{ width: 60 }" is-current-row
+                            ref="tableRef" :column="tableColumn" :datas="tableData"
+                            :loading="tableLoading" :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' : ''">
+                                <div class="hc-task-table-action" :class="row.isRemark ? 'is-cur' : ''" @click="rowRemarkClick(row)">
                                     <i class="i-iconoir-star-solid" />
                                 </div>
                             </template>
@@ -50,7 +49,7 @@
                 </div>
                 <div class="hc-task-form">
                     <hc-body class="hc-task-body-card" padding="10px" scrollbar>
-                        222
+                        <HcTaskForm v-model="tableInfo" :is-edit="tabsKey === 1" :type="rowInfo.type" />
                     </hc-body>
                 </div>
             </div>
@@ -59,7 +58,9 @@
 </template>
 
 <script setup>
-import { ref, watch } from 'vue'
+import { nextTick, ref, watch } from 'vue'
+import { getArrValue } from 'js-fast-way'
+import HcTaskForm from './task-form.vue'
 
 const props = defineProps({
     tabs: {
@@ -82,6 +83,7 @@ const isShow = defineModel('modelValue', {
 })
 
 //监听
+const tableRef = ref(null)
 const tabsKey = ref(props.tabs)
 const rowInfo = ref(props.row)
 const taskInfo = ref({})
@@ -118,6 +120,7 @@ const setTaskInfo = async () => {
     } else {
         tableColumn.value = []
     }
+    getTableData().then()
 }
 
 //流程信息
@@ -170,12 +173,40 @@ const tableData = ref([
     { 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 tableInfo = ref({})
 const tableRowClick = ({ row }) => {
+    tableInfo.value = row
+}
+
+//批注
+const rowRemarkClick = (row) => {
 
 }
 
+
 //确认审批
 const confirmLoading = ref(false)
 const confirmClick = () => {