|
@@ -1,45 +1,9 @@
|
|
|
<template>
|
|
|
<div class="hc-page-layout-box">
|
|
|
- <!-- <div :style="`width:${leftWidth}px;`" class="hc-layout-left-box bg-white">
|
|
|
- <div class="hc-project-box">
|
|
|
- <div class="hc-project-icon-box">
|
|
|
- <HcIcon name="stack" />
|
|
|
- </div>
|
|
|
- <div class="ml-2 project-name-box">
|
|
|
- <span class="project-alias">{{ projectInfo.projectName }}</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="hc-tree-search-box">
|
|
|
- <div class="hc-search-tree-val">
|
|
|
- <el-input v-model="searchTreeVal" block clearable placeholder="请输入名称关键词检索" @keyup="searchTreeKeyUp">
|
|
|
- <template #suffix>
|
|
|
- <HcIcon name="search-2" ui="text-xl" />
|
|
|
- </template>
|
|
|
- </el-input>
|
|
|
- </div>
|
|
|
- <div v-loading="treeLoading" class="hc-tree-scrollbar" element-loading-text="获取数据中...">
|
|
|
- <el-scrollbar>
|
|
|
- <KeepAlive>
|
|
|
- <template v-if="isSearchTree">
|
|
|
- <HcTreeData :datas="searchTreeData" @change="testTreeCheckChange" />
|
|
|
- </template>
|
|
|
- <template v-else>
|
|
|
- <TestTree
|
|
|
- :contract-id="contractId" :project-id="projectId"
|
|
|
- @change="testTreeCheckChange"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </KeepAlive>
|
|
|
- </el-scrollbar>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="horizontal-drag-line" @mousedown="onmousedown" />
|
|
|
- </div> -->
|
|
|
<div class="hc-page-content-box">
|
|
|
<HcNewCard>
|
|
|
<template #header>
|
|
|
- <div class="w-40">
|
|
|
+ <div class="w-60">
|
|
|
<el-select v-model="searchForm.type" clearable placeholder="请选择检测类别">
|
|
|
<el-option
|
|
|
v-for="item in typeData" :key="item.value" :label="item.label"
|
|
@@ -52,15 +16,18 @@
|
|
|
</div>
|
|
|
<div class="w-64 ml-2">
|
|
|
<el-tree-select
|
|
|
+ ref="selectTree"
|
|
|
v-model="testId"
|
|
|
- :data="testData"
|
|
|
- :render-after-expand="false"
|
|
|
- show-checkbox
|
|
|
+ lazy
|
|
|
+ multiple
|
|
|
+ :load="tesrtreeload"
|
|
|
+ :props="testprops"
|
|
|
style="width: 240px"
|
|
|
+ show-checkbox
|
|
|
placeholder="请选择试验检测项目名称"
|
|
|
/>
|
|
|
</div>
|
|
|
- <div class="ml-2">
|
|
|
+ <div class="ml-14">
|
|
|
<el-button type="primary" @click="searchClick">
|
|
|
<HcIcon name="search-2" />
|
|
|
<span>搜索</span>
|
|
@@ -75,7 +42,7 @@
|
|
|
</el-button>
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="tentative_collect_monthly_print">
|
|
|
- <el-button hc-btn color="#567722">
|
|
|
+ <el-button hc-btn color="#567722" @click="print">
|
|
|
<HcIcon name="printer" />
|
|
|
<span>打印</span>
|
|
|
</el-button>
|
|
@@ -132,22 +99,22 @@
|
|
|
<script setup>
|
|
|
import { onMounted, ref, watch } from 'vue'
|
|
|
import { useAppStore } from '~src/store'
|
|
|
-import { useRoute, useRouter } from 'vue-router'
|
|
|
-import TestTree from './components/TestTree.vue'
|
|
|
-import HcTreeData from './components/HcTreeData.vue'
|
|
|
+
|
|
|
+
|
|
|
import queryApi from '~api/data-fill/query'
|
|
|
-import { getArrValue } from 'js-fast-way'
|
|
|
+import { calcDate, getArrValue } from 'js-fast-way'
|
|
|
import { getDictionary } from '~api/other'
|
|
|
+import samplingApi from '~api/tentative/material/sampling'
|
|
|
+import { editRemark, getMonthPage } from '~api/tentative/collect/month'
|
|
|
+import { isExactlyOneMonthApart } from '~uti/tools'
|
|
|
|
|
|
-//初始变量
|
|
|
-const router = useRouter()
|
|
|
-const useRoutes = useRoute()
|
|
|
const useAppState = useAppStore()
|
|
|
|
|
|
//全局变量
|
|
|
const projectId = ref(useAppState.getProjectId)
|
|
|
const contractId = ref(useAppState.getContractId)
|
|
|
const projectInfo = ref(useAppState.getProjectInfo)
|
|
|
+const userInfo = ref(useAppState.getUserInfo)
|
|
|
const isCollapse = ref(useAppState.getCollapse)
|
|
|
|
|
|
//监听
|
|
@@ -193,79 +160,38 @@ const searchTreeClick = async () => {
|
|
|
}
|
|
|
|
|
|
const testId = ref()
|
|
|
-const testData = ref([
|
|
|
-{
|
|
|
- value: '1',
|
|
|
- label: 'Level one 1',
|
|
|
- children: [
|
|
|
- {
|
|
|
- value: '1-1',
|
|
|
- label: 'Level two 1-1',
|
|
|
- children: [
|
|
|
- {
|
|
|
- value: '1-1-1',
|
|
|
- label: 'Level three 1-1-1',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- value: '2',
|
|
|
- label: 'Level one 2',
|
|
|
- children: [
|
|
|
- {
|
|
|
- value: '2-1',
|
|
|
- label: 'Level two 2-1',
|
|
|
- children: [
|
|
|
- {
|
|
|
- value: '2-1-1',
|
|
|
- label: 'Level three 2-1-1',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- value: '2-2',
|
|
|
- label: 'Level two 2-2',
|
|
|
- children: [
|
|
|
- {
|
|
|
- value: '2-2-1',
|
|
|
- label: 'Level three 2-2-1',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- value: '3',
|
|
|
- label: 'Level one 3',
|
|
|
- children: [
|
|
|
- {
|
|
|
- value: '3-1',
|
|
|
- label: 'Level two 3-1',
|
|
|
- children: [
|
|
|
- {
|
|
|
- value: '3-1-1',
|
|
|
- label: 'Level three 3-1-1',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- value: '3-2',
|
|
|
- label: 'Level two 3-2',
|
|
|
- children: [
|
|
|
- {
|
|
|
- value: '3-2-1',
|
|
|
- label: 'Level three 3-2-1',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
-])
|
|
|
+const selectTree = ref(null)
|
|
|
+const tesrtreeload = async (node, resolve) => {
|
|
|
+ let parentId = '0'
|
|
|
+ if (node.level !== 0) {
|
|
|
+ parentId = node?.data?.id
|
|
|
+ }
|
|
|
+ //获取数据
|
|
|
+ const { error, code, data } = await samplingApi.queryLazyTree({
|
|
|
+ wbsId:projectInfo.value?.referenceWbsTemplateIdTrial,
|
|
|
+ tenantId: userInfo.value?.tenant_id,
|
|
|
+ projectId: projectId.value,
|
|
|
+ parentId,
|
|
|
+ wbsType: 2,
|
|
|
+ })
|
|
|
+ //处理数据
|
|
|
+ if (!error && code === 200) {
|
|
|
+ resolve(getArrValue(data))
|
|
|
+ } else {
|
|
|
+ resolve([])
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const testprops = ref({
|
|
|
+ label: 'title',
|
|
|
+ children: 'children',
|
|
|
+ isLeaf: function (data) {
|
|
|
+ return !data.hasChildren
|
|
|
+ },
|
|
|
+})
|
|
|
//搜索表单
|
|
|
const searchForm = ref({
|
|
|
- type: null, approval: null, betweenTime: null,
|
|
|
+ type: '', contractId: '', endTime: '', startTime:'', ids:'',
|
|
|
current: 1, size: 20, total: 0,
|
|
|
})
|
|
|
//检测类别
|
|
@@ -289,13 +215,26 @@ const gettypeData = async () => {
|
|
|
//日期时间被选择
|
|
|
const betweenTime = ref(null)
|
|
|
const betweenTimeUpdate = ({ arr, query }) => {
|
|
|
+ const date1 = new Date(arr[0])
|
|
|
+ const date2 = new Date(arr[1])
|
|
|
+ // 计算两个日期的月份差
|
|
|
+ // const monthDiff = isExactlyOneMonthApart(date1, date2)
|
|
|
+ // console.log(monthDiff, 'monthDiff')
|
|
|
+ // if (!monthDiff) {
|
|
|
+ // window.$message.warning('起始时间必须为1个月')
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+
|
|
|
betweenTime.value = arr
|
|
|
- searchForm.value.betweenTime = query
|
|
|
+ searchForm.value.startTime = arr[0]
|
|
|
+ searchForm.value.endTime = arr[1]
|
|
|
}
|
|
|
|
|
|
//搜索
|
|
|
const searchClick = () => {
|
|
|
searchForm.value.current = 1
|
|
|
+ searchForm.value.ids = testId.value.join(',')
|
|
|
+ console.log(testId.value, '11111111')
|
|
|
getTableData()
|
|
|
}
|
|
|
|
|
@@ -325,52 +264,57 @@ const tableSpanMethod = ({ rowIndex, columnIndex }) => {
|
|
|
|
|
|
//获取数据
|
|
|
const tableLoading = ref(false)
|
|
|
-const tableData = ref([
|
|
|
- {
|
|
|
- title: 'No. 189, Grove St, Los Angeles',
|
|
|
- month: '本月',
|
|
|
- name: '100',
|
|
|
- state: '2',
|
|
|
- zip: 'CA 90036',
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'No. 189, Grove St, Los Angeles',
|
|
|
- month: '累计',
|
|
|
- name: '100',
|
|
|
- state: '2',
|
|
|
- zip: 'CA 90036',
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'No. 189, Grove St, Los Angeles',
|
|
|
- month: '本月',
|
|
|
- name: '100',
|
|
|
- state: '2',
|
|
|
- zip: 'CA 90036',
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'No. 189, Grove St, Los Angeles',
|
|
|
- month: '累计',
|
|
|
- name: '100',
|
|
|
- state: '2',
|
|
|
- zip: 'CA 90036',
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'No. 189, Grove St, Los Angeles',
|
|
|
- month: '本月',
|
|
|
- name: '100',
|
|
|
- state: '2',
|
|
|
- zip: 'CA 90036',
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'No. 189, Grove St, Los Angeles',
|
|
|
- month: '累计',
|
|
|
- name: '100',
|
|
|
- state: '2',
|
|
|
- zip: 'CA 90036',
|
|
|
- },
|
|
|
-])
|
|
|
-const getTableData = () => {
|
|
|
+const tableData = ref([])
|
|
|
+const getTableData = async () => {
|
|
|
+ if (!searchForm.value.type) {
|
|
|
+ window.$message.warning('请选择检查类别')
|
|
|
+ return
|
|
|
+ } else if (!searchForm.value.startTime || !searchForm.value.endTime) {
|
|
|
+ window.$message.warning('请选择开始时间和结束时间')
|
|
|
+ return
|
|
|
+ } else if (searchForm.value.ids) {
|
|
|
+ window.$message.warning('请选择试验检测项目名称')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ tableLoading.value = true
|
|
|
+ const { error, code, data } = await getMonthPage({
|
|
|
+ ...searchForm.value,
|
|
|
+ ids:'1635200237830144002',
|
|
|
+ contractId:contractId.value,
|
|
|
+ })
|
|
|
+ tableLoading.value = false
|
|
|
+ //判断状态
|
|
|
+ if (!error && code === 200) {
|
|
|
+ let resdata = getArrValue(data['records'])
|
|
|
+ let arr = []
|
|
|
+ resdata.forEach((ele)=>{
|
|
|
+ let obj1 = {
|
|
|
+ title:ele.trialProjectName,
|
|
|
+ month: '本月',
|
|
|
+ name: ele.currentMonth.qualifiedTotal,
|
|
|
+ state: ele.currentMonth.unQualifiedTotal,
|
|
|
+ zip: ele.currentMonth.remarks,
|
|
|
|
|
|
+ }
|
|
|
+ let obj2 = {
|
|
|
+ title:ele.trialProjectName,
|
|
|
+ month: '累计',
|
|
|
+ name: ele.totalMonth.qualifiedTotal,
|
|
|
+ state: ele.totalMonth.unQualifiedTotal,
|
|
|
+ zip: ele.totalMonth.remarks,
|
|
|
+
|
|
|
+ }
|
|
|
+ arr.push(obj1)
|
|
|
+ arr.push(obj2)
|
|
|
+ tableData.value = arr
|
|
|
+ searchForm.value.total = data['total']
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ tableData.value = []
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -383,8 +327,19 @@ const editorsNoteModalClick = (row) => {
|
|
|
|
|
|
//保存
|
|
|
const editorsNoteLoading = ref(false)
|
|
|
-const editorsNoteModalSave = () => {
|
|
|
- editorsNoteModal.value = true
|
|
|
+const editorsNoteModalSave = async (id) => {
|
|
|
+ // editorsNoteModal.value = true
|
|
|
+ const { error, code, data, msg } = await editRemark({
|
|
|
+ contractId: contractId.value,
|
|
|
+ recordId: id,
|
|
|
+ remarks:editorsNoteVal.value,
|
|
|
+
|
|
|
+ })
|
|
|
+ //判断状态
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message.success(msg)
|
|
|
+ editorsNoteModal.value = false
|
|
|
+ }
|
|
|
}
|
|
|
const editorsNoteModalClose = () => {
|
|
|
editorsNoteModal.value = false
|