|
@@ -234,7 +234,14 @@
|
|
|
|
|
|
<!-- 创建委托 -->
|
|
|
<hc-new-dialog v-model="delegateModal" ui="hc-delegate-html-modal" is-footer-center is-table title="创建委托" widths="60rem" @close="delegateModalClose">
|
|
|
- <hc-table-form ref="htmlRef" :pkey="nodeErTreeId" :form="delegateHtmlForm" :html="delegateHtml" :loading="delegateHtmlLoading" @render="delegateHtmlRender" />
|
|
|
+ <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="primary" :loading="creatingDelegateLoading" @click="creatingDelegate">创建</el-button>
|
|
@@ -249,6 +256,7 @@ import { useAppStore } from '~src/store'
|
|
|
import TestTree from './components/TestTree.vue'
|
|
|
import HcDragUpload from './components/HcDragUpload.vue'
|
|
|
import { getStoreValue, setStoreValue } from '~src/utils/storage'
|
|
|
+import commissionApi from '~api/tentative/detect/commission'
|
|
|
import samplingApi from '~api/tentative/material/sampling'
|
|
|
import approachApi from '~api/tentative/material/approach'
|
|
|
import { getContractUserList, getDictionary } from '~api/other'
|
|
@@ -774,7 +782,8 @@ const delegateModal = ref(false)
|
|
|
const delegateHtml = ref('')
|
|
|
const delegateHtmlForm = ref({})
|
|
|
const delegateHtmlLoading = ref(false)
|
|
|
-const delegationClick = async () => {
|
|
|
+const delegateContractId = ref(null)
|
|
|
+const delegationClick = () => {
|
|
|
const rows = tableCheckedKeys.value
|
|
|
if (rows.length <= 0) {
|
|
|
window.$message.warning('请先勾选一条需要委托的数据')
|
|
@@ -784,22 +793,34 @@ const delegationClick = async () => {
|
|
|
return
|
|
|
}
|
|
|
delegateModal.value = true
|
|
|
+ editHtmlId.value = rows[0].id
|
|
|
+ const { contractId } = deepClone(searchForm.value)
|
|
|
+ delegateContractId.value = contractId
|
|
|
+ if (!isNullES(contractId)) {
|
|
|
+ delegateContractChange()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//合同段被选择
|
|
|
+const editHtmlId = ref('')
|
|
|
+const delegateContractChange = async () => {
|
|
|
delegateHtmlLoading.value = true
|
|
|
+ if (!isNullES(editHtmlId.value)) {
|
|
|
+ await getDelegateDataInfo(editHtmlId.value)
|
|
|
+ }
|
|
|
await getDelegateExcelHtml()
|
|
|
- //await getDelegateDataInfo(rows[0])
|
|
|
delegateHtmlLoading.value = false
|
|
|
}
|
|
|
|
|
|
//获取委托数据
|
|
|
-const getDelegateDataInfo = async (row) => {
|
|
|
+const getDelegateDataInfo = async (editId) => {
|
|
|
const { error, code, msg, data } = await samplingApi.getBussDataInfoTrialEntrust({
|
|
|
- id: row.id,
|
|
|
+ id: editId,
|
|
|
pkeyId: nodeErTreeId.value,
|
|
|
projectId: projectId.value,
|
|
|
- contractId: contractId.value,
|
|
|
+ contractId: delegateContractId.value,
|
|
|
})
|
|
|
if (!error && code === 200) {
|
|
|
- console.log(data)
|
|
|
delegateHtmlForm.value = getObjValue(data)
|
|
|
} else {
|
|
|
delegateHtmlForm.value = {}
|
|
@@ -812,7 +833,7 @@ const getDelegateExcelHtml = async () => {
|
|
|
const { error, code, msg, data } = await samplingApi.getExcelHtml({
|
|
|
primaryKeyId: nodeErTreeId.value,
|
|
|
projectId: projectId.value,
|
|
|
- contractId: contractId.value,
|
|
|
+ contractId: delegateContractId.value,
|
|
|
})
|
|
|
if (!error && code === 200) {
|
|
|
delegateHtml.value = isString(data) ? data : ''
|
|
@@ -834,8 +855,20 @@ const creatingDelegate = async () => {
|
|
|
window.$message.error('暂无委托单信息')
|
|
|
return
|
|
|
}
|
|
|
- console.log(delegateHtmlForm.value)
|
|
|
- //delegateModalClose()
|
|
|
+ const form = delegateHtmlForm.value
|
|
|
+ if (isNullES(delegateContractId.value)) {
|
|
|
+ window.$message.warning('请先选择合同段')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ form.contractId = delegateContractId.value
|
|
|
+ form.nodeErTreeId = nodeErTreeId.value
|
|
|
+ const { error, code, msg } = await commissionApi.htmlSave(form)
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message.success('创建成功')
|
|
|
+ delegateModalClose()
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg || '创建失败')
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//关闭委托
|
|
@@ -863,4 +896,26 @@ const delegateModalClose = () => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+.hc-delegate-html-modal {
|
|
|
+ .hc-delegate-html {
|
|
|
+ position: relative;
|
|
|
+ height: calc(100% - 40px);
|
|
|
+ .hc-table-form-data-item {
|
|
|
+ background-color: #efefef;
|
|
|
+ }
|
|
|
+ &::after {
|
|
|
+ content: "";
|
|
|
+ position: absolute;
|
|
|
+ inset: 0;
|
|
|
+ background: rgb(161 161 161 / 40%);
|
|
|
+ z-index: 22;
|
|
|
+ }
|
|
|
+ &.is-show {
|
|
|
+ &::after {
|
|
|
+ display: none;
|
|
|
+ z-index: -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|