gaoluyang
2025-02-25 8696b4d4c235a73f2bc5c030e20f1ad7c0a7166e
src/views/CNAS/process/demand/AddContracts.vue
@@ -1,5 +1,5 @@
<template>
    <el-dialog title="新增检验委托单" :visible.sync="visible" width="1200px">
    <el-dialog :title="title" :visible.sync="visible" width="1200px">
        <div id="dialogBody">
            <div style="max-height: 75vh;overflow-y: auto;">
                <div id="dialogBody">
@@ -119,7 +119,6 @@
                                <el-radio-group 
                                    v-if="operationType !== 'view'"
                                    v-model="currentInfo.isLeave" 
                                    v-removeAriaHidden
                                >
                                    <el-radio :label="1">是</el-radio>
                                    <el-radio :label="0">否</el-radio>
@@ -133,7 +132,7 @@
                                <p>样品处理方式</p>
                            </td>
                            <td v-if="operationType !== 'view'">
                                <el-radio-group v-model="currentInfo.processing" v-removeAriaHidden>
                                <el-radio-group v-model="currentInfo.processing">
                                    <el-radio :label="0">委托单位取回</el-radio>
                                    <el-radio :label="1">实验室处理</el-radio>
                                </el-radio-group>
@@ -169,7 +168,7 @@
                            <td >
                                <el-radio-group 
                                    v-if="operationType !== 'view'"
                                    v-model="currentInfo.send" v-removeAriaHidden
                                    v-model="currentInfo.send"
                                >
                                    <el-radio :label="1">自取</el-radio>
                                    <el-radio :label="0">其他</el-radio>
@@ -222,7 +221,7 @@
                                <p>判定规则</p>
                            </td>
                            <td v-if="operationType !== 'view'" colspan="3">
                                <el-radio-group v-model="currentInfo.criterionRule" v-removeAriaHidden>
                                <el-radio-group v-model="currentInfo.criterionRule">
                                    <el-radio :label="0">不考虑不确定度</el-radio>
                                    <el-radio :label="1">考虑不确定度</el-radio>
                                </el-radio-group>
@@ -348,10 +347,7 @@
        </div>
        <span v-if="operationType !== 'view'" slot="footer" class="dialog-footer">
            <el-button @click="detailDialogVisible = false">取 消</el-button>
            <el-button v-if="operationType === 'add'" :loading="buttonLoading" type="primary" @click="handleAdd">
                确 定
            </el-button>
            <el-button v-if="operationType === 'edit'" :loading="buttonLoading" type="primary" @click="handleEdit">
            <el-button :loading="buttonLoading" type="primary" @click="handleSubmit">
                确 定
            </el-button>
        </span>
@@ -359,21 +355,72 @@
</template>
<script>
import ZTTLogo from "@/assets/logo/ZTTlogo.png"
import { getInspectionOrderByInsOderId, getInspectionOrderOne, addInspectionOrder, editInspectionOrder } from "@/api/cnas/process/demand/demand.js"
export default {
    name: 'AddContracts',
    props: {
        operationType: {
            type: String,
            default: ''
        },
    },
    data() {
        return {
            title: '',
            ZTTLogo,
            visible: false,
            operationType: '',
            currentInfo:{
                orderDetailList: []
            },
            buttonLoading: false
        }
    },
    methods: {
        open() {
        open(row) {
            this.visible = true
            if(operationType == 'add') {
                this.goAddOrder(row)
            } else {
            }
        },
        // 打开弹窗的时候,查询需要新增的委托单详情
        async goAddOrder(row) {
            this.title = '新增检验委托单';
            const { code, data } = await getInspectionOrderByInsOderId({
                insOrderId: row.id
            })
            if(code == 200) {
                this.currentInfo = res.data
                this.detailDialogVisible = true
            }
        },
        async goUpdateOrder(row) {
            this.title = '编辑检验委托单';
            const { code, data } = await getInspectionOrderOne({
                insOrderId: row.inspectionOrderId
            })
            if(code == 200) {
                this.currentInfo = res.data
                this.detailDialogVisible = true
            }
        },
        addOrderDetailList() {
            if (this.currentInfo.orderDetailList == null) {
                this.currentInfo.orderDetailList = []
            }
            this.currentInfo.orderDetailList.push({
                sampleNumber: '',
                testItem: '',
                testStandard: '',
                standardMethodList: '',
                remark: '',
            })
        },
        async handleSubmit() {
            this.operationType == 'add' ? await addInspectionOrder(this.currentInfo) : await editInspectionOrder(this.currentInfo)
        }
    }
}