Browse Source

委托单

ZaiZai 1 year ago
parent
commit
3806dccb22

+ 16 - 0
src/api/modules/tentative/material/sampling.js

@@ -83,4 +83,20 @@ export default {
             data: form,
         }, msg)
     },
+    //试验-客户端获取表的HTML
+    async getExcelHtml(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-manager/wbsPrivate/get-excel-html',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //材料取样-获取合同段信息
+    async getErtractInfo(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-manager/contractInfo/get-ertract-Info',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
 }

+ 2 - 2
src/config/index.json

@@ -1,7 +1,7 @@
 {
     "version": "20230607160059",
-    "target1": "http://192.168.0.102:8090",
-    "target": "http://39.108.216.210:8090",
+    "target": "http://192.168.0.102:8090",
+    "target1": "http://39.108.216.210:8090",
     "smsPhone": "",
     "vite": {
         "port": 5174,

+ 60 - 12
src/views/tentative/material/sampling.vue

@@ -10,11 +10,10 @@
             <template #headerToSearch>
                 <div class="w-50">
                     <el-select v-model="searchForm.contractId" placeholder="选择合同段" filterable block>
-                        <el-option label="测试1" value="1" />
-                        <el-option label="测试2" value="2" />
+                        <el-option v-for="item in contractData" :key="item.id" :label="item.contractName" :value="item.id" />
                     </el-select>
                 </div>
-                <div class="ml-2 w-64">
+                <div class="ml-2 w-250px">
                     <hc-date-picker :dates="betweenTime" clearable @change="betweenTimeUpdate" />
                 </div>
                 <div class="ml-2 w-72">
@@ -64,7 +63,7 @@
                         <span>导入</span>
                     </el-button>
                 </hc-tooltip>
-                <el-button hc-btn color="#E75643" @click="delegationClick">
+                <el-button hc-btn color="#E75643" :disabled="!nodeErTreeId" @click="delegationClick">
                     <hc-icon name="slack" />
                     <span>委托</span>
                 </el-button>
@@ -234,8 +233,8 @@
         </hc-new-dialog>
 
         <!-- 创建委托 -->
-        <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">
+            <hc-table-form ref="htmlRef" :pkey="nodeErTreeId" :form="delegateHtmlForm" :html="delegateHtml" :loading="delegateHtmlLoading" @render="delegateHtmlRender" />
             <template #footer>
                 <el-button @click="delegateModalClose">取消</el-button>
                 <el-button hc-btn type="primary" @click="creatingDelegate">创建</el-button>
@@ -248,12 +247,12 @@
 import { onActivated, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import TestTree from './components/TestTree.vue'
-import { getStoreValue, setStoreValue } from '~src/utils/storage'
 import HcDragUpload from './components/HcDragUpload.vue'
+import { getStoreValue, setStoreValue } from '~src/utils/storage'
 import samplingApi from '~api/tentative/material/sampling'
 import approachApi from '~api/tentative/material/approach'
 import { getContractUserList, getDictionary } from '~api/other'
-import { arrIndex, arrToId, deepClone, formValidate, getArrValue } from 'js-fast-way'
+import { arrIndex, arrToId, deepClone, formValidate, getArrValue, isString } from 'js-fast-way'
 import { toPdfPage } from '~uti/btn-auth'
 
 //变量
@@ -274,6 +273,7 @@ const treeAutoExpandKeys = ref(getStoreValue('testTreeExpandKeys') || [])
 
 //渲染完成
 onActivated(() => {
+    getContractData()
     getUserListData()
     getMaterialType()
 })
@@ -298,6 +298,15 @@ const getRowTableMaterialType = (type) => {
     }
 }
 
+//获取合同段信息
+const contractData = ref([])
+const getContractData = async () => {
+    const { data } = await samplingApi.getErtractInfo({
+        projectId: projectId.value,
+        contractId: contractId.value,
+    })
+    contractData.value = getArrValue(data)
+}
 
 //获取用户列表
 const userListData = ref([])
@@ -316,6 +325,7 @@ const searchForm = ref({
 
 //树相关的变量
 const primaryKeyId = ref('')
+const nodeErTreeId = ref('')
 const nodeItemInfo = ref({})
 const nodeDataInfo = ref({})
 
@@ -324,6 +334,7 @@ const wbsElTreeClick = ({ node, data, keys }) => {
     nodeItemInfo.value = node
     nodeDataInfo.value = data
     primaryKeyId.value = data['primaryKeyId'] || ''
+    nodeErTreeId.value = data['erTreeId'] || ''
     //缓存自动展开
     treeAutoExpandKeys.value = keys
     setStoreValue('testTreeExpandKeys', keys)
@@ -411,9 +422,7 @@ const getTableData = async () => {
 //多选
 const tableCheckedKeys = ref([])
 const tableSelection = (rows) => {
-    tableCheckedKeys.value = rows.filter((item) => {
-        return (item ?? '') !== ''
-    })
+    tableCheckedKeys.value = rows
 }
 
 //新增
@@ -760,9 +769,31 @@ const downloadImportClick = () => {
 }
 
 //委托
+const htmlRef = ref(null)
 const delegateModal = ref(false)
-const delegationClick = () => {
+const delegateHtml = ref('')
+const delegateHtmlForm = ref({})
+const delegateHtmlLoading = ref(false)
+const delegationClick = async () => {
     delegateModal.value = true
+    delegateHtmlLoading.value = true
+    const { error, code, msg, data } = await samplingApi.getExcelHtml({
+        primaryKeyId: nodeErTreeId.value,
+        projectId: projectId.value,
+        contractId: contractId.value,
+    })
+    delegateHtmlLoading.value = false
+    if (!error && code === 200) {
+        delegateHtml.value = isString(data) ? data : ''
+    } else {
+        delegateHtml.value = ''
+        window.$message.error(msg || '获取委托信息失败')
+    }
+}
+
+//渲染完成
+const delegateHtmlRender = () => {
+
 }
 
 //创建委托
@@ -773,9 +804,26 @@ const creatingDelegate = async () => {
 //关闭委托
 const delegateModalClose = () => {
     delegateModal.value = false
+    delegateHtml.value = ''
+    delegateHtmlForm.value = {}
+    delegateHtmlLoading.value = false
 }
 </script>
 
 <style lang="scss" scoped>
 @import "../../../styles/tentative/material/sampling.scss";
 </style>
+
+<style lang="scss">
+.el-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;
+        }
+    }
+}
+</style>