|
@@ -1,32 +1,58 @@
|
|
|
<template>
|
|
|
- <hc-body split :project-nmae="projectInfo?.projectName" padding="10px">
|
|
|
- <template #tree>
|
|
|
- <TestTree
|
|
|
- :auto-expand-keys="treeAutoExpandKeys" :project-id="projectId" :tenant-id="userInfo?.tenant_id"
|
|
|
- :wbs-temp-id="projectInfo?.referenceWbsTemplateIdTrial" :wbs-type="2" @node-tap="wbsElTreeClick"
|
|
|
- />
|
|
|
- </template>
|
|
|
- <hc-new-card>
|
|
|
- <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" :index-style="{ width: 60 }">
|
|
|
- <template #key4="{ row }">
|
|
|
- <el-tag v-if="row.key4 === 1" type="success" effect="dark">已通过</el-tag>
|
|
|
- <el-tag v-if="row.key4 === 2" type="danger" effect="dark">已废除</el-tag>
|
|
|
+ <hc-new-dialog v-model="isShow" is-footer-center is-table title="关联委托单" widths="80%" @close="linkSamplingClose">
|
|
|
+ <hc-body split padding="10px">
|
|
|
+ <template #left>
|
|
|
+ <hc-new-card scrollbar>
|
|
|
+ <TestTree
|
|
|
+ :auto-expand-keys="treeAutoExpandKeys" :project-id="projectId" :tenant-id="userInfo?.tenant_id"
|
|
|
+ :wbs-temp-id="projectInfo?.referenceWbsTemplateIdTrial" :wbs-type="2" @node-tap="wbsElTreeClick"
|
|
|
+ />
|
|
|
+ </hc-new-card>
|
|
|
+ </template>
|
|
|
+ <hc-new-card>
|
|
|
+ <template #header>
|
|
|
+ <div class="w-50">
|
|
|
+ <el-select v-model="searchForm.contractId" placeholder="选择合同段" filterable block>
|
|
|
+ <el-option v-for="item in contractData" :key="item.id" :label="item.contractName" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="ml-2">
|
|
|
+ <el-button type="primary" @click="searchClick">
|
|
|
+ <hc-icon name="search-2" />
|
|
|
+ <span>搜索</span>
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
- <template #action="{ row }">
|
|
|
- <el-link type="primary">选择</el-link>
|
|
|
- <el-link type="warning">取消选择</el-link>
|
|
|
+ <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" :index-style="{ width: 60 }">
|
|
|
+ <template #status="{ row }">
|
|
|
+ <el-tag v-if="row.status === 1" type="info" effect="dark">未上报</el-tag>
|
|
|
+ <el-tag v-if="row.status === 2" type="warning" effect="dark">已上报-待审批</el-tag>
|
|
|
+ <el-tag v-if="row.status === 3" type="primary" effect="dark">待试验</el-tag>
|
|
|
+ <el-tag v-if="row.status === 4" type="success" effect="dark">委托完成</el-tag>
|
|
|
+ </template>
|
|
|
+ <template #action="{ row }">
|
|
|
+ <el-link v-if="row.id == currentId" type="success" @click="rowCancel(row)">取消选择</el-link>
|
|
|
+ <el-link v-else type="primary" @click="rowSelect(row)">选择</el-link>
|
|
|
+ </template>
|
|
|
+ </hc-table>
|
|
|
+ <template #action>
|
|
|
+ <hc-pages :pages="searchForm" @change="pageChange" />
|
|
|
</template>
|
|
|
- </hc-table>
|
|
|
- <template #action>
|
|
|
- <hc-pages :pages="searchForm" @change="pageChange" />
|
|
|
- </template>
|
|
|
- </hc-new-card>
|
|
|
- </hc-body>
|
|
|
+ </hc-new-card>
|
|
|
+ </hc-body>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="linkSamplingClose">取消</el-button>
|
|
|
+ <el-button hc-btn type="primary" @click="linkSamplingClick">确定</el-button>
|
|
|
+ </template>
|
|
|
+ </hc-new-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { onActivated, onDeactivated, ref } from 'vue'
|
|
|
+import { ref, watch } from 'vue'
|
|
|
import { useAppStore } from '~src/store'
|
|
|
+import { getArrValue } from 'js-fast-way'
|
|
|
+import mainApi from '~api/tentative/detect/commission'
|
|
|
+import samplingApi from '~api/tentative/material/sampling'
|
|
|
import { getStoreValue, setStoreValue } from '~src/utils/storage'
|
|
|
import TestTree from '~src/views/tentative/material/components/TestTree.vue'
|
|
|
|
|
@@ -37,24 +63,63 @@ const projectId = ref(useAppState.getProjectId)
|
|
|
const contractId = ref(useAppState.getContractId)
|
|
|
const projectInfo = ref(useAppState.getProjectInfo)
|
|
|
|
|
|
-//渲染完成
|
|
|
-onActivated(() => {
|
|
|
+const isShow = defineModel('modelValue', {
|
|
|
+ default: false,
|
|
|
+})
|
|
|
|
|
|
+//深度监听数据
|
|
|
+const curId = defineModel('id', {
|
|
|
+ type: [String, Number],
|
|
|
+ default: '',
|
|
|
+})
|
|
|
+
|
|
|
+//监听
|
|
|
+watch(() => curId.value, (id) => {
|
|
|
+ currentId.value = id
|
|
|
+})
|
|
|
+
|
|
|
+//监听
|
|
|
+watch(() => isShow.value, (show) => {
|
|
|
+ if (show) getContractData()
|
|
|
})
|
|
|
|
|
|
//搜索表单
|
|
|
const searchForm = ref({ current: 1, size: 20, total: 0 })
|
|
|
|
|
|
+//获取合同段信息
|
|
|
+const contractData = ref([])
|
|
|
+const getContractData = async () => {
|
|
|
+ const { data } = await samplingApi.getErtractInfo({
|
|
|
+ projectId: projectId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
+ })
|
|
|
+ const res = getArrValue(data)
|
|
|
+ contractData.value = res
|
|
|
+ if (res.length > 0) {
|
|
|
+ searchForm.value.contractId = res[0].id
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//自动展开缓存
|
|
|
const treeAutoExpandKeys = ref(getStoreValue('testTreeExpandKeys') || [])
|
|
|
|
|
|
//树被点击
|
|
|
const nodeDataInfo = ref({})
|
|
|
+const nodeErTreeId = ref('')
|
|
|
const wbsElTreeClick = ({ data, keys }) => {
|
|
|
nodeDataInfo.value = data
|
|
|
+ nodeErTreeId.value = data['erTreeId'] || ''
|
|
|
//缓存自动展开
|
|
|
treeAutoExpandKeys.value = keys
|
|
|
setStoreValue('testTreeExpandKeys', keys)
|
|
|
+ //获取表格
|
|
|
+ searchClick()
|
|
|
+}
|
|
|
+
|
|
|
+//搜索
|
|
|
+const searchClick = () => {
|
|
|
+ searchForm.value.current = 1
|
|
|
+ getTableData()
|
|
|
}
|
|
|
|
|
|
//分页被点击
|
|
@@ -65,21 +130,51 @@ const pageChange = ({ current, size }) => {
|
|
|
}
|
|
|
|
|
|
//表格数据
|
|
|
-const tableData = ref([
|
|
|
- { key4:1 }, { key4:2 },
|
|
|
-])
|
|
|
+const tableData = ref([])
|
|
|
const tableColumn = ref([
|
|
|
- { key: 'key1', name: '委托单位' },
|
|
|
- { key: 'key2', name: '委托单编号' },
|
|
|
- { key: 'key3', name: '委托单名称' },
|
|
|
- { key: 'key4', name: '委托单状态', width: 120, align: 'center' },
|
|
|
- { key: 'action', name: '操作', width: 120, align: 'center' },
|
|
|
+ { key: 'entrustInfo', name: '委托单位' },
|
|
|
+ { key: 'entrustNo', name: '委托单编号' },
|
|
|
+ { key: 'entrustName', name: '委托单名称' },
|
|
|
+ { key: 'status', name: '委托单状态', width: 120, align: 'center' },
|
|
|
+ { key: 'action', name: '操作', width: 120, align: 'center', fixed: 'right' },
|
|
|
])
|
|
|
|
|
|
//获取数据
|
|
|
const tableLoading = ref(false)
|
|
|
const getTableData = async () => {
|
|
|
+ tableLoading.value = true
|
|
|
+ const { error, code, data } = await mainApi.page(searchForm.value)
|
|
|
+ //处理数据
|
|
|
+ tableLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ tableData.value = getArrValue(data['records'])
|
|
|
+ searchForm.value.total = data.total || 0
|
|
|
+ } else {
|
|
|
+ tableData.value = []
|
|
|
+ searchForm.value.total = 0
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//选择
|
|
|
+const currentId = ref(null)
|
|
|
+const rowSelect = (row) => {
|
|
|
+ currentId.value = row.id
|
|
|
+}
|
|
|
+
|
|
|
+//取消选择
|
|
|
+const rowCancel = () => {
|
|
|
+ currentId.value = null
|
|
|
+}
|
|
|
+
|
|
|
+//确认关联取样材料
|
|
|
+const linkSamplingClick = () => {
|
|
|
+ curId.value = currentId.value
|
|
|
+ linkSamplingClose()
|
|
|
+}
|
|
|
|
|
|
+//取消关联取样材料
|
|
|
+const linkSamplingClose = () => {
|
|
|
+ isShow.value = false
|
|
|
}
|
|
|
</script>
|
|
|
|