Browse Source

任务管理

ZaiZai 1 year ago
parent
commit
c7d3a15a9e
5 changed files with 77 additions and 18 deletions
  1. 1 1
      public/version.json
  2. 16 8
      src/api/modules/tasks/hc-data.js
  3. 1 1
      src/config/index.json
  4. 1 3
      src/utils/tools.js
  5. 58 5
      src/views/tasks/hc-data.vue

+ 1 - 1
public/version.json

@@ -1,3 +1,3 @@
 {
-  "value": "20231226111819"
+  "value": "20231227144957"
 }

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

@@ -1,20 +1,28 @@
 import { HcApi } from '../../request/index'
 
 export default {
-    //合同计量期列表-全部
-    async getAllPeriod(form, msg = false) {
+    //获取任务类型或任务状态
+    async queryTaskTypeStatus(form) {
         return HcApi({
-            url: '/api/blade-meter/contractMeterPeriod/allPeriod',
+            url: '/api/blade-business/task/query-task-type-status',
             method: 'get',
             params: form,
-        }, msg)
+        }, false)
     },
-    //材料计量期列表-已审批
-    async getMeterPeriod(form, msg = false) {
+    //获取当前合同段的上报批次
+    async queryBatchList(form) {
         return HcApi({
-            url: '/api/blade-meter/meterPeriod/approvalPeriod',
+            url: '/api/blade-business/task/query-batch-list',
             method: 'get',
             params: form,
-        }, msg)
+        }, false)
+    },
+    //获取任务列表分页
+    async getPage(form) {
+        return HcApi({
+            url: '/api/blade-meter/task/page',
+            method: 'post',
+            data: form,
+        }, false)
     },
 }

+ 1 - 1
src/config/index.json

@@ -1,6 +1,6 @@
 {
     "version": "20230607160059",
-    "target": "http://192.168.0.152:8090",
+    "target": "http://192.168.0.109:8090",
     "smsPhone": "",
     "vite": {
         "port": 5180,

+ 1 - 3
src/utils/tools.js

@@ -15,9 +15,7 @@ export const isNumberReg = (text, lose = true) => {
 
 //获取字典数据
 export const getDictionaryData = async (code) => {
-    const { data } = await getDictionary({
-        code: code,
-    })
+    const { data } = await getDictionary({ code: code })
     //处理数据
     let newArr = []
     const newData = getArrValue(data)

+ 58 - 5
src/views/tasks/hc-data.vue

@@ -6,16 +6,16 @@
         <template #search>
             <div class="w-32">
                 <el-select v-model="searchForm.typeValue" clearable block placeholder="任务类型">
-                    <!-- el-option v-for="item in tasksType" :label="item.dictValue" :value="item.dictKey" / -->
+                    <el-option v-for="item in tasksType" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
                 </el-select>
             </div>
             <div class="ml-2 w-32">
                 <el-select v-model="searchForm.statusValue" clearable block placeholder="任务状态">
-                    <!-- el-option v-for="item in tasksStatus" :label="item.dictValue" :value="item.dictKey" / -->
+                    <el-option v-for="item in tasksStatus" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
                 </el-select>
             </div>
             <div class="ml-2 w-32">
-                <el-select v-model="searchForm.batch" clearable block placeholder="上报批次">
+                <el-select v-model="searchForm.batchValue" clearable block placeholder="上报批次">
                     <!-- el-option v-for="item in reportBatch" :label="item.batch" :value="item.batch" / -->
                 </el-select>
             </div>
@@ -74,11 +74,20 @@
 
 <script setup>
 import { onMounted, ref } from 'vue'
+import { getArrValue } from 'js-fast-way'
+import mainApi from '~api/tasks/hc-data'
+import { useAppStore } from '~src/store'
 import taskReview from './components/hc-data/task-review.vue'
 
+const useAppState = useAppStore()
+const projectId = ref(useAppState.getProjectId || '')
+const contractId = ref(useAppState.getContractId || '')
+
 //渲染完成
 onMounted(() => {
-
+    queryTaskType()
+    queryTaskStatus()
+    getTableData()
 })
 
 //类型处理
@@ -90,13 +99,31 @@ const tabsData = [
 ]
 const tabsClick = ({ key }) => {
     tabsKey.value = key
+    searchForm.value.selectedType = key
+    searchForm.value.current = 1
+    getTableData()
 }
 
 //搜索条件
 const searchForm = ref({
+    selectedType: 1, typeValue: '', statusValue: '', batchValue: '', queryValue: '', startTimeValue: '', endTimeValue: '',
     current: 1, size: 200, total: 0,
 })
 
+//获取任务类型
+const tasksType = ref([])
+const queryTaskType = async () => {
+    const { data } = await mainApi.queryTaskTypeStatus({ typeOrStatus: 'task_type' })
+    tasksType.value = getArrValue(data)
+}
+
+//获取任务状态
+const tasksStatus = ref([])
+const queryTaskStatus = async () => {
+    const { data } = await mainApi.queryTaskTypeStatus({ typeOrStatus: 'task_status' })
+    tasksStatus.value = getArrValue(data)
+}
+
 //日期范围选择
 const betweenTime = ref(null)
 const betweenTimeUpdate = ({ val, arr }) => {
@@ -108,17 +135,18 @@ const betweenTimeUpdate = ({ val, arr }) => {
 //搜索
 const searchClick = () => {
     searchForm.value.current = 1
+    getTableData()
 }
 
 //分页被点击
 const pageChange = ({ current, size }) => {
     searchForm.value.current = current
     searchForm.value.size = size
+    getTableData()
 }
 
 //获取数据
 const tableListRef = ref(null)
-const tableLoading = ref(false)
 const tableListColumn = ref([
     { key: 'taskName', name: '任务名称' },
     { key: 'taskTypeName', name: '任务类型', width: '120' },
@@ -137,6 +165,31 @@ const tableListData = ref([
     { taskName: '材料预付款计量申请审批模板', type: 4 },
 ])
 
+//获取表格数据
+const tableLoading = ref(false)
+const getTableData = async () => {
+    tableLoading.value = true
+    //清空数据
+    tableListData.value = []
+    tableListRef.value?.clearSelection()
+    tableCheckedKeys.value = []
+    //发起请求
+    const { error, code, data } = await mainApi.getPage({
+        ...searchForm.value,
+        projectId: projectId.value,
+        contractId: contractId.value,
+    })
+    //处理数据
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableListData.value = getArrValue(data['records'])
+        searchForm.value.total = data.total || 0
+    } else {
+        tableListData.value = []
+        searchForm.value.total = 0
+    }
+}
+
 //多选
 const tableCheckedKeys = ref([])
 const tableSelectionChange = (rows) => {