Ver Fonte

基础信息保存修改

duy há 3 meses atrás
pai
commit
2eaae20b3f

+ 68 - 65
src/views/tentative/detect/components/basicInfo.vue

@@ -6,7 +6,7 @@
                     <div class="text-bold">基础信息</div>
                 </template>
                 <template #extra>
-                    <el-button hc-btn type="success" @click="handleSave">保存</el-button>
+                    <el-button hc-btn type="success" :loading="handleSaveLoad" @click="handleSave">保存</el-button>
                     <el-button hc-btn type="warning" @click="handleRefresh">重新获取数据</el-button>
                 </template>
 
@@ -134,50 +134,18 @@
                             </el-col>
                         </el-row>
                         <el-row :gutter="20">
-                            <el-col :span="8">
-                                <el-form-item label="样品品种">
-                                    <el-select
-                                        v-model="value"
-                                        placeholder="请选择"
-                                        style="width: 100%"
-                                    >
-                                        <el-option
-                                            v-for="item in checkOptions"
-                                            :key="item.value"
-                                            :label="item.label"
-                                            :value="item.value"
-                                        />
-                                    </el-select>
-                                </el-form-item>
-                            </el-col>
-                            <el-col :span="8">
-                                <el-form-item label="代号">
-                                    <el-select
-                                        v-model="value"
-                                        placeholder="请选择"
-                                        style="width: 100%"
-                                    >
-                                        <el-option
-                                            v-for="item in checkOptions"
-                                            :key="item.value"
-                                            :label="item.label"
-                                            :value="item.value"
-                                        />
-                                    </el-select>
-                                </el-form-item>
-                            </el-col>
-                            <el-col :span="8">
-                                <el-form-item label="强度等级">
+                            <el-col v-for="(item, index) in ypList" :key="item.id" :span="8">
+                                <el-form-item :label="item.name">
                                     <el-select
-                                        v-model="value"
+                                        v-model="ypList[index].value"
                                         placeholder="请选择"
                                         style="width: 100%"
                                     >
                                         <el-option
-                                            v-for="item in checkOptions"
-                                            :key="item.value"
-                                            :label="item.label"
-                                            :value="item.value"
+                                            v-for="item1 in item.info"
+                                            :key="item1.id"
+                                            :label="item1.name"
+                                            :value="item1.id"
                                         />
                                     </el-select>
                                 </el-form-item>
@@ -193,7 +161,7 @@
                     </div>
                 </div>
                 <div>
-                    <hc-table :column="tableColumn" :datas="tableData">
+                    <hc-table :column="tableColumn" :datas="basicInfoData.trailDeviceUseInfoDTOS">
                         <template #action="{ row, index }">
                             <el-link size="small" type="warning">删除</el-link>
                         </template>
@@ -274,7 +242,7 @@ const props = defineProps({
 
     },
 })
-
+const emit = defineEmits(['change'])
 
 const useAppState = useAppStore()
 const userInfo = ref(useAppState.getUserInfo)
@@ -286,7 +254,7 @@ const dataId = ref(props.dataId)
 const projectId = ref(props.projectId)
 const contractId = ref(props.contractId)
 const ids = ref(props.ids)
-const handleSave = () => {}
+
 const handleRefresh = () => {}
 const isShow = defineModel('modelValue', {
     default: false,
@@ -302,7 +270,7 @@ const getYpList = async (id)=>{
     //处理数据
     ypLoad.value = false
     if (!error && code === 200) {
-        ypList.value = getObjValue(data)
+        ypList.value = getArrValue(data)
         console.log(ypList.value, 'ypList')
         
        
@@ -367,17 +335,19 @@ console.log(nodeId.value, dataId.value, projectId.value)
     if (!error && code === 200) {
       console.log(data, '基础信息数据')
         basicInfoData.value = getObjValue(data)
-        const { trialSampleInfoList } = basicInfoData.value
+        const { trialSampleInfoList, trailDeviceUseInfoDTOS } = basicInfoData.value
         if (!trialSampleInfoList) {
-            console.log('111111111')
             basicInfoData.value.trialSampleInfoList = {
                 materialName:'',
                 specificationNumber:'',
                 sampleDescription:'',
                 samplingDate:'',
             }
-            console.log(' basicInfoData.value.trialSampleInfoList', basicInfoData.value.trialSampleInfoList)
-
+            
+        }
+        if (!trailDeviceUseInfoDTOS) {
+            basicInfoData.value.trailDeviceUseInfoDTOS = []
+           
         }
    
 
@@ -390,25 +360,23 @@ const value = ref('')
 
 const checkOptions = ref([])
 const tableColumn = [
-    { key: 'name', name: '设备名称' },
-    { key: 'text', name: '设备型号' },
-    { key: 'color', name: '设备编号' },
-    { key: 'color', name: '测量范围' },
-    { key: 'color', name: '精准度' },
-    { key: 'color', name: '使用日期' },
-    { key: 'color', name: '使用开始时间(h:min)' },
-    { key: 'color', name: '使用结束时间(h:min)' },
-    { key: 'color', name: '使用时间(min)' },
-    { key: 'color', name: '运转前检查情况' },
-    { key: 'color', name: '运转后检查情况' },
-    { key: 'color', name: '操作人' },
-    { key: 'color', name: '备注' },
+    { key: 'deviceName', name: '设备名称' },
+    { key: 'deviceModel', name: '设备型号' },
+    { key: 'deviceNumber', name: '设备编号' },
+    { key: 'measuringRange', name: '测量范围' },
+    { key: 'afterRunCheck', name: '精准度' },
+    { key: 'useDate', name: '使用日期' },
+    { key: 'startDate', name: '使用开始时间(h:min)' },
+    { key: 'endDate', name: '使用结束时间(h:min)' },
+    { key: 'useDuration', name: '使用时间(min)' },
+    { key: 'beforeRunCheck', name: '运转前检查情况' },
+    { key: 'afterRunCheck', name: '运转后检查情况' },
+    { key: 'managerName', name: '操作人' },
+    { key: 'remarks', name: '备注' },
     { key: 'action', name: '操作' },
 ]
 const tableData = ref([
-    { name: '名称1', text: '文本1', color: 'red' },
-    { name: '名称2', text: '文本2', color: 'blue' },
-    { name: '名称3', text: '文本3', color: '无' },
+  
    
 ])
 //关联取样
@@ -478,6 +446,8 @@ const linksSampleModalSave = () => {
     console.log(tableSampleCheckedKeys.value, 'tableSampleCheckedKeys.value')
     if (tableSampleCheckedKeys.value.length > 0) {
       basicInfoData.value.trialSampleInfoList = tableSampleCheckedKeys.value[0]
+        basicInfoData.value.sampleIds = tableSampleCheckedKeys.value[0].id
+
 
     }
     
@@ -507,6 +477,7 @@ const isLinksAssociation = ref(false)
 const commissionChange = (id, data) => {
 
     basicInfoData.value.entrustNo = data.specificationNumber
+     basicInfoData.value.entrustId = id
 
    
 }
@@ -541,9 +512,41 @@ const linksAcquisitionClose = () => {
     linksAcquisitionLoading.value = false
 }
 
-const linkAcquisitionChange = (ids) => {
+const linkAcquisitionChange = (ids, rows) => {
     console.log(ids)
+    console.log(rows, 'rows')
+    // tableData.value.push
+    if (rows.length > 0) {
+      rows.forEach((item)=>{
+        basicInfoData.value.trailDeviceUseInfoDTOS.push(item)
+      })
+    }
     linkAcquisitionLoadDataId.value = ids
+        basicInfoData.value.deviceUseIds = ids
+}
+
+//保存
+const handleSaveLoad = ref(false)
+const handleSave = async () => {
+  const standardInfoIds = ypList.value
+        .filter(item => item.value != null && item.value !== '')
+        .map(item => item.value)
+        .join(',')
+
+    basicInfoData.value.standardInfoIds = standardInfoIds
+    // emit('change', basicInfoData.value)
+    handleSaveLoad.value = true
+          const { error, code, data, msg } = await dataApi.saveExcelBussData({
+                    ...basicInfoData.value,
+                    isBatchSave: 1,
+                })
+            handleSaveLoad.value = false
+            if (!error && code === 200) {
+                window.$message.success(msg)
+                isShow.value = false
+
+              
+            }
 }
 </script>
 

+ 14 - 1
src/views/tentative/detect/components/linkAcquisition.vue

@@ -92,6 +92,7 @@ const getDataApi = async () => {
 const dataIds = ref([])
 watch(() => curId.value, (id) => {
     dataIds.value = isNullES(id) ? [] : id.split(',')
+    checkRows.value = []
 })
 
 //分割配置
@@ -328,9 +329,21 @@ const rowSelect = (id, row) => {
         return
     }
     ids.push(id)
+  
+
+
     dataIds.value = ids
+    checkRows.value = []
+
+    tableData.value.forEach((item) => {
+        if (ids.indexOf(item.id) !== -1) {
+            checkRows.value.push(item)
+        }
+    })
+
+
     curId.value = ids.join(',')
-    emit('change', ids.join(','))
+    emit('change', ids.join(','), checkRows.value)
 }
 
 //取消选择

+ 1 - 1
src/views/tentative/detect/components/linkAssociation.vue

@@ -201,7 +201,7 @@ const rowCancel = () => {
 const linkSamplingClick = () => {
  
     
-    emit('change', curId.value)
+    emit('change', curId.value, formModel.value)
     linkSamplingClose()
 }
 

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

@@ -203,7 +203,15 @@
 
         <!-- 关联委托单 -->
         <LinkAssociation v-model="isLinksAssociation" :ids="listItemBaseData.commissionId" :cid="contractId" @change="commissionChange" @close="isLinksAssociation = false" />
-        <basicInfo v-model="isShowBasic" :node-id="nodeId" :data-id="dataId.length > 0 ? dataId : nodeIdvalue" :project-id="projectId" :contract-id="contractId" :ids="listItemBaseData.commissionId" />
+        <basicInfo 
+            v-model="isShowBasic" 
+            :node-id="nodeId" 
+            :data-id="dataId.length > 0 ? dataId : nodeIdvalue" 
+            :project-id="projectId" 
+            :contract-id="contractId" 
+            :ids="listItemBaseData.commissionId"
+            @change="basicInfoChange"
+        />
     </div>
 </template>
 
@@ -1580,6 +1588,10 @@ const isShowBasic = ref(false)
 const BasicClick = () => {
     isShowBasic.value = true
 }
+const basicInfoChange = (val) => {
+   console.log(val, 'val')
+   
+}
 </script>
 
 <style lang="scss" scoped>