|
@@ -14,9 +14,8 @@
|
|
|
</el-select>
|
|
|
</div>
|
|
|
<div class="ml-2 w-40">
|
|
|
- <el-select v-model="searchForm.contractId" placeholder="委托单状态" filterable clearable block>
|
|
|
- <el-option label="测试1" value="1" />
|
|
|
- <el-option label="测试2" value="2" />
|
|
|
+ <el-select v-model="searchForm.status" placeholder="委托单状态" filterable clearable block>
|
|
|
+ <el-option v-for="item in entrustStatus" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
|
</div>
|
|
|
<div class="ml-2 w-250px">
|
|
@@ -49,16 +48,16 @@
|
|
|
:column="tableColumn" :datas="tableData" :loading="tableLoading" is-check
|
|
|
:index-style="{ width: 60 }" :check-style="{ width: 29 }" @selection-change="tableSelection"
|
|
|
>
|
|
|
- <template #key5="{ row }">
|
|
|
- <el-tag v-if="row.key5 === 1" type="info" effect="dark">未上报</el-tag>
|
|
|
- <el-tag v-if="row.key5 === 2" type="warning" effect="dark">已上报-待审批</el-tag>
|
|
|
- <el-tag v-if="row.key5 === 3" type="primary" effect="dark">待试验</el-tag>
|
|
|
- <el-tag v-if="row.key5 === 4" type="success" effect="dark">委托完成</el-tag>
|
|
|
+ <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.key5 === 1" type="primary" @click="rowEdit(row)">修改</el-link>
|
|
|
+ <el-link v-if="row.status === 1" type="primary" @click="rowEdit(row)">修改</el-link>
|
|
|
<el-link v-else type="success" @click="rowView(row)">查看</el-link>
|
|
|
- <el-link type="danger" :disabled="row.key5 !== 1" @click="rowReports(row)">创建报告</el-link>
|
|
|
+ <el-link type="danger" :disabled="row.status !== 1" @click="rowReports(row)">创建报告</el-link>
|
|
|
</template>
|
|
|
</hc-table>
|
|
|
<template #action>
|
|
@@ -67,8 +66,15 @@
|
|
|
</hc-new-card>
|
|
|
|
|
|
<!-- 新增委托 -->
|
|
|
- <hc-new-dialog v-model="delegateModal" is-footer-center is-table title="新增委托" widths="60rem" @close="delegateModalClose">
|
|
|
- html表单
|
|
|
+ <hc-new-dialog v-model="delegateModal" ui="hc-delegate-html-modal" is-footer-center is-table title="新增委托" widths="60rem" @close="delegateModalClose">
|
|
|
+ <div class="hc-delegate-contract hc-flex h-40px">
|
|
|
+ <el-select v-model="delegateContractId" placeholder="请先选择合同段" filterable class="w-400px" @change="delegateContractChange">
|
|
|
+ <el-option v-for="item in contractData" :key="item.id" :label="item.contractName" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="hc-delegate-html" :class="delegateContractId ? 'is-show' : ''">
|
|
|
+ <hc-table-form ref="htmlRef" :pkey="nodeErTreeId" :form="delegateHtmlForm" :html="delegateHtml" :loading="delegateHtmlLoading" @render="delegateHtmlRender" />
|
|
|
+ </div>
|
|
|
<template #footer>
|
|
|
<el-button @click="delegateModalClose">取消</el-button>
|
|
|
<el-button hc-btn type="warning" @click="linkSamplingShow">关联取样材料</el-button>
|
|
@@ -141,14 +147,15 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { onActivated, ref } from 'vue'
|
|
|
-import samplingApi from '~api/tentative/material/sampling'
|
|
|
import { useAppStore } from '~src/store'
|
|
|
import { getStoreValue, setStoreValue } from '~src/utils/storage'
|
|
|
-import { getArrValue } from 'js-fast-way'
|
|
|
+import { deepClone, getArrValue, isNullES, isString } from 'js-fast-way'
|
|
|
import TestTree from '~src/views/tentative/material/components/TestTree.vue'
|
|
|
+import { getDictionaryData } from '~uti/tools'
|
|
|
import SamplingPage from './commission/sampling.vue'
|
|
|
import { getErtractInfo } from '~api/other'
|
|
|
import mainApi from '~api/tentative/detect/commission'
|
|
|
+import samplingApi from '~api/tentative/material/sampling'
|
|
|
|
|
|
//变量
|
|
|
const useAppState = useAppStore()
|
|
@@ -160,6 +167,7 @@ const projectInfo = ref(useAppState.getProjectInfo)
|
|
|
//渲染完成
|
|
|
onActivated(() => {
|
|
|
getContractData()
|
|
|
+ getEntrustStatusData()
|
|
|
})
|
|
|
|
|
|
//搜索表单
|
|
@@ -170,8 +178,10 @@ 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)
|
|
@@ -189,6 +199,12 @@ const getContractData = async () => {
|
|
|
contractData.value = getArrValue(data)
|
|
|
}
|
|
|
|
|
|
+//获取状态
|
|
|
+const entrustStatus = ref([])
|
|
|
+const getEntrustStatusData = async () => {
|
|
|
+ entrustStatus.value = await getDictionaryData('entrust_status', true)
|
|
|
+}
|
|
|
+
|
|
|
//搜索
|
|
|
const searchClick = () => {
|
|
|
searchForm.value.current = 1
|
|
@@ -208,8 +224,8 @@ const tableColumn = ref([
|
|
|
{ key: 'entrustInfo', name: '委托单位' },
|
|
|
{ key: 'entrustNo', name: '委托单编号' },
|
|
|
{ key: 'entrustName', name: '委托单名称' },
|
|
|
- { key: 'key4', name: '关联材料名称' },
|
|
|
- { key: 'key5', name: '委托单状态', width: 120, align: 'center' },
|
|
|
+ { key: 'materialName', name: '关联材料名称' },
|
|
|
+ { key: 'status', name: '委托单状态', width: 120, align: 'center' },
|
|
|
{ key: 'action', name: '操作', width: 120, align: 'center' },
|
|
|
])
|
|
|
|
|
@@ -217,11 +233,7 @@ const tableColumn = ref([
|
|
|
const tableLoading = ref(false)
|
|
|
const getTableData = async () => {
|
|
|
tableLoading.value = true
|
|
|
- const { error, code, data } = await mainApi.page({
|
|
|
- ...searchForm.value,
|
|
|
- projectId: projectId.value,
|
|
|
- contractId: contractId.value,
|
|
|
- })
|
|
|
+ const { error, code, data } = await mainApi.page(searchForm.value)
|
|
|
//处理数据
|
|
|
tableLoading.value = false
|
|
|
if (!error && code === 200) {
|
|
@@ -244,10 +256,49 @@ const delModalClick = async (_, resolve) => {
|
|
|
resolve()
|
|
|
}
|
|
|
|
|
|
+//委托单变量
|
|
|
+const htmlRef = ref(null)
|
|
|
+const delegateHtml = ref('')
|
|
|
+const delegateHtmlForm = ref({})
|
|
|
+const delegateHtmlLoading = ref(false)
|
|
|
+const delegateContractId = ref(null)
|
|
|
+
|
|
|
//新增
|
|
|
const delegateModal = ref(false)
|
|
|
const addFormData = () => {
|
|
|
delegateModal.value = true
|
|
|
+ const { contractId } = deepClone(searchForm.value)
|
|
|
+ delegateContractId.value = contractId
|
|
|
+ if (!isNullES(contractId)) {
|
|
|
+ delegateContractChange()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//合同段被选择
|
|
|
+const delegateContractChange = async () => {
|
|
|
+ delegateHtmlLoading.value = true
|
|
|
+ await getDelegateExcelHtml()
|
|
|
+ delegateHtmlLoading.value = false
|
|
|
+}
|
|
|
+
|
|
|
+//获取委托html
|
|
|
+const getDelegateExcelHtml = async () => {
|
|
|
+ const { error, code, msg, data } = await samplingApi.getExcelHtml({
|
|
|
+ primaryKeyId: nodeErTreeId.value,
|
|
|
+ projectId: projectId.value,
|
|
|
+ contractId: delegateContractId.value,
|
|
|
+ })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ delegateHtml.value = isString(data) ? data : ''
|
|
|
+ } else {
|
|
|
+ delegateHtml.value = ''
|
|
|
+ window.$message.error(msg || '获取委托信息失败')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//委托单html渲染完成
|
|
|
+const delegateHtmlRender = (form) => {
|
|
|
+ delegateHtmlForm.value = form
|
|
|
}
|
|
|
|
|
|
//修改
|
|
@@ -316,6 +367,35 @@ const rowActionModalClose = () => {
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped lang="scss">
|
|
|
-
|
|
|
+<style lang="scss">
|
|
|
+.el-overlay-dialog .el-dialog.hc-new-dialog.hc-delegate-html-modal {
|
|
|
+ .hc-new-dialog-body {
|
|
|
+ padding: 0;
|
|
|
+ }
|
|
|
+ .hc-table-form-data-item {
|
|
|
+ padding: 0;
|
|
|
+ .el-scrollbar__bar.is-vertical {
|
|
|
+ right: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.hc-delegate-html-modal {
|
|
|
+ .hc-delegate-html {
|
|
|
+ position: relative;
|
|
|
+ height: calc(100% - 40px);
|
|
|
+ &::after {
|
|
|
+ content: "";
|
|
|
+ position: absolute;
|
|
|
+ inset: 0;
|
|
|
+ background: rgb(161 161 161 / 40%);
|
|
|
+ z-index: 22;
|
|
|
+ }
|
|
|
+ &.is-show {
|
|
|
+ &::after {
|
|
|
+ display: none;
|
|
|
+ z-index: -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|