瀏覽代碼

委托单

ZaiZai 1 年之前
父節點
當前提交
01d09be418
共有 2 個文件被更改,包括 41 次插入2 次删除
  1. 8 0
      src/api/modules/tentative/material/sampling.js
  2. 33 2
      src/views/tentative/material/sampling.vue

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

@@ -91,6 +91,14 @@ export default {
             params: form,
         }, msg)
     },
+    //获取html回显
+    async getBussDataInfoTrialEntrust(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-manager/wbsPrivate/get-buss-dataInfo-trial_entrust',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
     //材料取样-获取合同段信息
     async getErtractInfo(form, msg = true) {
         return HcApi({

+ 33 - 2
src/views/tentative/material/sampling.vue

@@ -252,7 +252,7 @@ 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, isNullES, isString } from 'js-fast-way'
+import { arrIndex, arrToId, deepClone, formValidate, getArrValue, getObjValue, isNullES, isString } from 'js-fast-way'
 import { toPdfPage } from '~uti/btn-auth'
 
 //变量
@@ -775,14 +775,45 @@ const delegateHtml = ref('')
 const delegateHtmlForm = ref({})
 const delegateHtmlLoading = ref(false)
 const delegationClick = async () => {
+    const rows = tableCheckedKeys.value
+    if (rows.length <= 0) {
+        window.$message.warning('请先勾选一条需要委托的数据')
+        return
+    } else if (rows.length > 1) {
+        window.$message.warning('只能选择其中一条数据进行委托')
+        return
+    }
     delegateModal.value = true
     delegateHtmlLoading.value = true
+    await getDelegateExcelHtml()
+    await getDelegateDataInfo(rows[0])
+    delegateHtmlLoading.value = false
+}
+
+//获取委托数据
+const getDelegateDataInfo = async (row) => {
+    const { error, code, msg, data } = await samplingApi.getBussDataInfoTrialEntrust({
+        id: row.id,
+        pkeyId: nodeErTreeId.value,
+        projectId: projectId.value,
+        contractId: contractId.value,
+    })
+    if (!error && code === 200) {
+        console.log(data)
+        delegateHtmlForm.value = getObjValue(data)
+    } else {
+        delegateHtmlForm.value = {}
+        window.$message.error(msg || '获取委托信息失败')
+    }
+}
+
+//获取委托html
+const getDelegateExcelHtml = async () => {
     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 {