iZaiZaiA 2 rokov pred
rodič
commit
0f803b1188
2 zmenil súbory, kde vykonal 244 pridanie a 16 odobranie
  1. 7 0
      src/api/modules/other.js
  2. 237 16
      src/views/other/first-item.vue

+ 7 - 0
src/api/modules/other.js

@@ -32,3 +32,10 @@ export const userConfigInfo = (form, msg = true) => httpApi({
     method: 'get',
     params: form
 }, msg);
+
+//获取上报批次
+export const getReportNumber = (form, msg = true) => httpApi({
+    url: '/api/blade-business/informationWriteQuery/getReportNumberByContractId',
+    method: 'get',
+    params: form
+}, msg);

+ 237 - 16
src/views/other/first-item.vue

@@ -21,17 +21,82 @@
         <div class="hc-layout-content-box first-item">
             <HcCard :scrollbar="false" actionSize="lg">
                 <template #header>
-
+                    <HcTooltip keys="other-first-item-report" v-if="tabTypeKey === 'mark'">
+                        <el-button type="primary" hc-btn :disabled="tableSelectionKeys.length <= 0" @click="firstReportClick">
+                            <HcIcon name="send-plane-2"/>
+                            <span>上报首件</span>
+                        </el-button>
+                    </HcTooltip>
+                    <HcTooltip keys="other-first-item-report-approval" v-if="tabTypeKey === 'query'">
+                        <el-button type="primary" hc-btn :disabled="tableSelectionKeys.length <= 0" @click="reportModalClick">
+                            <HcIcon name="send-plane-2"/>
+                            <span>上报审批</span>
+                        </el-button>
+                    </HcTooltip>
+                    <HcTooltip keys="other-first-item-repeal">
+                        <el-button hc-btn :disabled="tableSelectionKeys.length <= 0">
+                            <HcIcon name="delete-bin-3"/>
+                            <span>批量废除</span>
+                        </el-button>
+                    </HcTooltip>
+                    <HcTooltip keys="other-first-item-down-print">
+                        <el-button hc-btn :disabled="tableSelectionKeys.length <= 0">
+                            <HcIcon name="printer"/>
+                            <span>预览/打印</span>
+                        </el-button>
+                    </HcTooltip>
                 </template>
                 <template #extra>
                     <HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" @change="tabTypeChange"/>
                 </template>
                 <template #search>
-
+                    <div class="w-32">
+                        <el-select v-model="searchForm.status" placeholder="流程状态" clearable>
+                            <el-option v-for="item in processStatus" :label="item['dictValue']" :value="item['dictKey']"/>
+                        </el-select>
+                    </div>
+                    <div class="w-32 ml-3">
+                        <el-select v-model="searchForm.reportNumber" placeholder="上报批次" clearable>
+                            <el-option v-for="item in reportBatch" :label="item" :value="item"/>
+                        </el-select>
+                    </div>
+                    <div class="w-64 ml-3">
+                        <HcDatePicker :dates="betweenTime" clearable @change="betweenTimeUpdate"/>
+                    </div>
+                    <div class="w-64 ml-3">
+                        <el-input v-model="searchForm.queryValue" placeholder="请输入名称关键词检索" clearable @keyup="keyUpEvent"/>
+                    </div>
+                    <div class="ml-2">
+                        <el-button type="primary" @click="searchClick">
+                            <HcIcon name="search-2"/>
+                            <span>搜索</span>
+                        </el-button>
+                    </div>
                 </template>
 
+                <HcTable ref="tableListRef" :column="tableListColumn" :datas="tableListData" :loading="tableLoading" isCheck @selection-change="tableSelectionChange">
+                    <template #name="{row}">
+                        <span class="text-link" @click="tableRowName(row)">{{row?.name}}</span>
+                    </template>
+                    <template #waitingUserList="{row}">
+                        <template v-for="item in row['waitingUserList']">
+                            <el-tag :type="`${item.status === 2 ? 'success' : item.status === 3 ? 'warning' : item.status === 999 ? 'danger' : 'info'}`"
+                                    class="mx-1" effect="dark" v-if="item['waitingUserName']">{{item['waitingUserName']}}</el-tag>
+                        </template>
+                    </template>
+                </HcTable>
                 <template #action>
-
+                    <div class="lr-dialog-footer">
+                        <div class="left">
+                            <span class="text-success">任务人中:</span>
+                            <el-tag type="success" class="mx-1" effect="dark">已签字</el-tag>
+                            <el-tag type="warning" class="mx-1" effect="dark">已废除</el-tag>
+                            <el-tag type="danger" class="mx-1" effect="dark">签字异常</el-tag>
+                        </div>
+                        <div class="right">
+                            <HcPages :pages="searchForm" @change="pageChange"/>
+                        </div>
+                    </div>
                 </template>
             </HcCard>
         </div>
@@ -44,7 +109,10 @@ import {useAppStore} from "~src/store";
 import {useRouter, useRoute} from 'vue-router'
 import WbsTree from "./components/WbsTree.vue"
 import {getStoreData, setStoreData} from '~src/utils/storage'
-import {downloadBlob, getArrValue, deepClone} from "vue-utils-plus"
+import {getArrValue, deepClone} from "vue-utils-plus"
+import {getReportNumber} from "~api/other";
+import firstApi from '~api/other/first-item';
+import tasksApi from '~api/tasks/data';
 
 //变量
 const router = useRouter()
@@ -66,6 +134,7 @@ watch(() => [
     isCollapse.value = Collapse
 })
 
+
 //自动展开缓存
 const TreeAutoExpandKeys = ref(getStoreData('firstItemTreeKeys') || [])
 
@@ -76,7 +145,11 @@ const tabTypeTab = ref([
     {key:'query', name: '首件查询'}
 ]);
 const tabTypeChange = (item) => {
-    tabTypeKey.value = item?.key;
+    tabTypeKey.value = item?.key
+    if (searchForm.value.wbsId) {
+        searchForm.value.current = 1;
+        getTableData()
+    }
     //路由跳转
     router.push({
         path: useRoutes.path,
@@ -84,26 +157,174 @@ const tabTypeChange = (item) => {
     })
 }
 
+//渲染完成
+onMounted(() => {
+    firstTaskStatus()
+})
+
 //项目树被点击
 const treeItem = ref({})
 const nodeWbsElTreeClick = ({data, keys}) => {
-    if (data.leaf === true) {
-        treeItem.value = data
-        //wbsId.value = data['primaryKeyId']
-        //formValue.value.wbsId = data['primaryKeyId']
-        //缓存自动展开
-        TreeAutoExpandKeys.value = keys
-        console.log(keys)
-        setStoreData('firstItemTreeKeys', keys)
+    treeItem.value = data
+    searchForm.value.contractIdRelation = data['contractIdRelation']
+    searchForm.value.wbsId = data['primaryKeyId']
+    //缓存自动展开
+    TreeAutoExpandKeys.value = keys
+    setStoreData('firstItemTreeKeys', keys)
+    //获取相关数据
+    getReportNumberByContractId(data['contractIdRelation'])
+    searchClick()
+}
+
+
+//获取流程状态
+const processStatus = ref([])
+const firstTaskStatus = async () => {
+    const { data } = await tasksApi.queryTaskTypeStatus({
+        typeOrStatus: 'first_task_status'
+    })
+    //处理数据
+    processStatus.value = getArrValue(data)
+}
+
+//获取上报批次
+const reportBatch = ref([])
+const getReportNumberByContractId = async (cid) => {
+    const { data } = await getReportNumber({
+        contractId: contractId.value,
+        contractIdRelation: cid ?? ''
+    })
+    //处理数据
+    reportBatch.value = getArrValue(data)
+}
+
+//搜索表单
+const searchForm = ref({
+    wbsId: '', status: null, reportNumber: null, queryValue: '', betweenTime: '',
+    contractIdRelation: '', current: 1, size: 20, total: 0
+})
+
+//日期时间被选择
+const betweenTime = ref(null)
+const betweenTimeUpdate = ({val,arr}) => {
+    betweenTime.value = arr
+    searchForm.value.betweenTime = `${val['start']}~${val['end']}`
+}
+
+//回车搜索
+const keyUpEvent = (e) => {
+    if (e.key === "Enter") {
+        searchClick()
+    }
+}
+
+//搜索
+const searchClick = () => {
+    if (searchForm.value.wbsId) {
+        searchForm.value.current = 1;
+        getTableData()
+    } else {
+        window?.$message?.warning('请先在左边选择一个树节点')
+    }
+}
+
+//分页被点击
+const pageChange = ({current, size}) => {
+    searchForm.value.current = current
+    searchForm.value.size = size
+    getTableData()
+}
+
+//表格表头
+const tableListColumn = ref([
+    {key:'name', name: '文件名称'},
+    {key:'waitingUserList', name: '任务人'},
+    {key:'startTime', name: '开始时间', width: 180},
+    {key:'taskStatusStr', name: '流程状态', width: 140},
+    {key:'reportNumber', name: '上报批次', width: 120},
+])
+
+//获取表格数据
+const tableLoading = ref(false)
+const tableListData = ref([])
+const getTableData = async () => {
+    const searchInfo = searchForm.value
+    const tabKey = tabTypeKey.value
+    if (!!searchInfo.wbsId) {
+        //初始处理
+        tableLoading.value = true
+        tableListRef.value?.clearSelection()
+        tableSelectionKeys.value = []
+        tableListData.value = []
+
+        //获取相关数据
+        let firstListData = {}
+        const treeInfo = treeItem.value
+        if (tabKey === 'mark') {
+            //获取已标记的首件
+            firstListData = await firstApi.getQueryPageData({
+                projectId: projectId.value,
+                contractId: contractId.value,
+                ...searchInfo,
+                wbsId: treeInfo['contractIdRelation'] ? treeInfo['id'] : treeInfo['primaryKeyId'],
+                isFirst: 1,
+            })
+        } else if (tabKey === 'query') {
+            //首件查询数据
+            firstListData = await firstApi.getPageData({
+                projectId: projectId.value,
+                contractId: contractId.value,
+                ...searchInfo,
+            })
+        } else {
+            firstListData = {error: true}
+        }
+
+        //处理数据
+        const { error, code, data } = firstListData
+        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
+        }
     } else {
-        //wbsId.value = ''
-        treeItem.value = {}
-        //formValue.value.wbsId = null
+        window?.$message?.warning('请先选择一个树节点')
     }
 }
 
+//多选
+const tableListRef = ref(null)
+const tableSelectionKeys = ref([]);
+const tableSelectionChange = (rows) => {
+    tableSelectionKeys.value = rows.filter((item) => {
+        return (item??'') !== '';
+    })
+}
 
+//文件名称被点击
+const tableRowName = (row) => {
+    //如果 evisaPdfUrl 不为空,使用evisaPdfUrl,反之使用pdfUrl
+    if (row['evisaPdfUrl']) {
+        window.open(row['evisaPdfUrl'],'_blank')
+    } else if (row['pdfUrl']) {
+        window.open(row['pdfUrl'],'_blank')
+    } else {
+        window.$message?.warning('文件不存在')
+    }
+}
 
+//上报首件
+const firstReportClick = () => {
+
+}
+
+//上报审批
+const reportModalClick = () => {
+
+}
 
 //拼接ID
 const rowsToId = (rows) => {