ZaiZai 1 năm trước cách đây
mục cha
commit
23dad335c2

+ 9 - 2
src/views/tentative/detect/components/linkAssociation.vue

@@ -64,7 +64,7 @@
 <script setup>
 import { ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
-import { formValidate, getArrValue, getObjValue } from 'js-fast-way'
+import { formValidate, getArrValue, getObjValue, isNullES } 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'
@@ -75,6 +75,10 @@ const props = defineProps({
         type: [String, Number],
         default: '',
     },
+    cid: {
+        type: [String, Number],
+        default: '',
+    },
 })
 const emit = defineEmits(['change', 'close'])
 //变量
@@ -111,7 +115,10 @@ const getContractData = async () => {
     })
     const res = getArrValue(data)
     contractData.value = res
-    if (res.length > 0) {
+    if (!isNullES(props.cid)) {
+        searchForm.value.contractId = props.cid
+    }
+    if (isNullES(props.cid) && res.length > 0) {
         searchForm.value.contractId = res[0].id
     }
 }

+ 1 - 1
src/views/tentative/detect/test-form.vue

@@ -201,7 +201,7 @@
         />
 
         <!-- 关联委托单 -->
-        <LinkAssociation v-model="isLinksAssociation" :ids="listItemBaseData.commissionId" @change="commissionChange" @close="isLinksAssociation = false" />
+        <LinkAssociation v-model="isLinksAssociation" :ids="listItemBaseData.commissionId" :cid="contractId" @change="commissionChange" @close="isLinksAssociation = false" />
     </div>
 </template>