ZaiZai 1 год назад
Родитель
Сommit
74a23e7858

+ 1 - 1
src/views/tentative/detect/commission.vue

@@ -457,7 +457,7 @@ const rowActionSave = async () => {
     const { primaryKeyId } = nodeDataInfo.value
     setStoreValue('testTreeItem', nodeDataInfo.value)
     setStoreValue('prenodeDataInfo', nodeDataInfo.value)
-    const { error, code, msg } = await mainApi.update({ id, expCount })
+    const { error, code, msg } = await mainApi.update({ id, expCount, sampleStatus: 4 })
     if (!error && code === 200) {
         window.$message.success('创建成功')
         rowActionLoading.value = false

+ 67 - 13
src/views/tentative/detect/components/linkAssociation.vue

@@ -31,7 +31,7 @@
                         <el-tag v-if="row.status === 4" type="success" effect="dark">委托完成</el-tag>
                     </template>
                     <template #action="{ row }">
-                        <el-link v-if="row.id == currentId" type="success" @click="rowCancel(row)">取消选择</el-link>
+                        <el-link v-if="row.id == curId" type="success" @click="rowCancel(row)">取消选择</el-link>
                         <el-link v-else type="primary" :disabled="row.status !== 4" @click="rowSelect(row)">选择</el-link>
                     </template>
                 </hc-table>
@@ -45,17 +45,37 @@
             <el-button hc-btn type="primary" @click="linkSamplingClick">确定</el-button>
         </template>
     </hc-new-dialog>
+
+    <!-- 关联更换 -->
+    <hc-new-dialog v-model="isCountShow" is-footer-center title="关联更换" widths="30rem" @close="linkCountClose">
+        <el-form ref="formRef" :model="formModel" :rules="formRules" label-position="top" label-width="auto">
+            <el-form-item label="试验数量:" prop="expCount">
+                <el-input v-model="formModel.expCount" placeholder="试验数量" />
+            </el-form-item>
+        </el-form>
+        <template #footer>
+            <el-button @click="linkCountClose">取消</el-button>
+            <el-button hc-btn type="primary" @click="linkCountClick">确定</el-button>
+        </template>
+    </hc-new-dialog>
 </template>
 
 <script setup>
 import { ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
-import { getArrValue } from 'js-fast-way'
+import { formValidate, getArrValue, getObjValue } 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'
 import TestTree from '~src/views/tentative/material/components/TestTree.vue'
 
+const props = defineProps({
+    ids: {
+        type: [String, Number],
+        default: '',
+    },
+})
+const emit = defineEmits(['change', 'close'])
 //变量
 const useAppState = useAppStore()
 const userInfo = ref(useAppState.getUserInfo)
@@ -68,14 +88,9 @@ const isShow = defineModel('modelValue', {
 })
 
 //深度监听数据
-const curId = defineModel('id', {
-    type: [String, Number],
-    default: '',
-})
-
-//监听
-watch(() => curId.value, (id) => {
-    currentId.value = id
+const curId = ref(props.ids)
+watch(() => props.ids, (id) => {
+    curId.value = id
 })
 
 //监听
@@ -157,23 +172,62 @@ const getTableData = async () => {
 
 //选择
 const currentId = ref(null)
-const rowSelect = (row) => {
-    currentId.value = row.id
+const rowSelect = async ({ id }) => {
+    isCountShow.value = true
+    currentId.value = id
+    const { data } = await mainApi.detail(id)
+    formModel.value = getObjValue(data)
 }
 
 //取消选择
 const rowCancel = () => {
     currentId.value = null
+    formModel.value = {}
 }
 
 //确认关联取样材料
 const linkSamplingClick = () => {
-    curId.value = currentId.value
+    emit('change', curId.value)
     linkSamplingClose()
 }
 
 //取消关联取样材料
 const linkSamplingClose = () => {
     isShow.value = false
+    formModel.value = {}
+    emit('close')
+}
+
+//表单数据
+const formRef = ref(null)
+const formModel = ref({})
+const formRules = {
+    expCount: {
+        required: true,
+        trigger: 'blur',
+        message: '请填写试验数量',
+    },
+}
+
+//确定
+const isCountShow = ref(false)
+const linkCountClick = async () => {
+    const isForm = await formValidate(formRef.value)
+    if (!isForm) return
+    const { id, expCount } = formModel.value
+    const { error, code, msg } = await mainApi.update({ id, expCount, sampleStatus: 4 })
+    if (!error && code === 200) {
+        window.$message.success('选择成功')
+        curId.value = currentId.value
+        linkCountClose()
+    } else {
+        window.$message.error(msg || '选择失败')
+    }
+}
+
+//取消
+const linkCountClose = () => {
+    isCountShow.value = false
+    formModel.value = {}
 }
 </script>

Разница между файлами не показана из-за своего большого размера
+ 795 - 792
src/views/tentative/detect/test-form.vue


Некоторые файлы не были показаны из-за большого количества измененных файлов