Browse Source

任务管理

ZaiZai 1 year ago
parent
commit
3bf749a730
1 changed files with 18 additions and 1 deletions
  1. 18 1
      src/views/tasks/components/hc-data/task-review.vue

+ 18 - 1
src/views/tasks/components/hc-data/task-review.vue

@@ -67,6 +67,7 @@
 <script setup>
 import { nextTick, ref, watch } from 'vue'
 import { getArrValue, getObjValue, getRandom } from 'js-fast-way'
+import { useAppStore } from '~src/store'
 import HcTaskForm from './task-form.vue'
 import HcTaskNotes from './task-notes.vue'
 import mainApi from '~api/tasks/hc-data'
@@ -85,6 +86,10 @@ const props = defineProps({
 const emit = defineEmits(['finish', 'close'])
 const uuid = getRandom(4)
 
+const useAppState = useAppStore()
+const projectId = ref(useAppState.getProjectId || '')
+const contractId = ref(useAppState.getContractId || '')
+
 //双向绑定
 // eslint-disable-next-line no-undef
 const isShow = defineModel('modelValue', {
@@ -240,7 +245,19 @@ const taskFormFinish = () => {
 //确认审批
 const confirmLoading = ref(false)
 const confirmClick = async () => {
-    //emit('finish')
+    confirmLoading.value = true
+    const { error, code, msg } = await mainApi.taskApprove({
+        taskId: rowInfo.value.id,
+        projectId: projectId.value,
+        contractId: contractId.value,
+    })
+    confirmLoading.value = false
+    if (!error && code === 200) {
+        window.$message.success('审批成功')
+        emit('finish')
+    } else {
+        window.$message.error(msg ?? '审批失败')
+    }
 }
 
 //驳回审批