<!-- 生物样品分析溶液配制表 -->
<template>
	<div>
		<div class="detail-container">
			<div class="detail-title"><img src="@/assets/images/detail-title.png">{{ formData.bdmc }}<img
					src="@/assets/images/detail-title.png" /></div>
			<div class="detail-content">
				<div class="content">
					<BaseInfoFormPackage fieldItemLabel="template.common.baseInfo" label="template.common.baseInfo"
						:ref="refConfig.baseInfoRef" :formConfig="baseInfoFormConfig" :formData="formData" />
					<BaseInfoFormPackage fieldItemLabel="试验内容" label="试验内容"
						:ref="refConfig.synrRef" :formConfig="synrFormConfig" :formData="formData" />
					<BaseInfoFormPackage fieldItemLabel="仪器结果" label="仪器结果"
						:ref="refConfig.yqjgRef" :formConfig="yqjgFormConfig" :formData="formData" />
					<BaseInfoFormPackage fieldItemLabel="采集日期" label="采集日期"
						:ref="refConfig.cjrqRef" :formConfig="cjrqFormConfig" :formData="formData" />
					<BaseInfoFormPackage fieldItemLabel="分析批数据文件" label="分析批数据文件"
						:ref="refConfig.fxpsjwjRef" :formConfig="fxpsjwjFormConfig" :formData="formData" />
					<BaseInfoFormPackage fieldItemLabel="template.common.remark" label="template.common.remark"
						:ref="refConfig.remarkRef" :formConfig="remarkConig" :formData="formData" />
				</div>
			</div>
		</div>
		<!-- <button @click="onSave">保存</button> -->
	</div>
</template>

<script>
import BaseInfoFormPackage from "@/components/Template/BaseInfoFormPackage";
import LineLabel from "@/components/Template/LineLabel";
import TableList from "@/components/Template/Table";
import Step from "@/components/Template/Step";
import templateMixin from "../../mixins/templateMixin";
import CustomTable from '@/components/Template/CustomTable.vue';
import TableOpertaionDelete from "@/components/Template/operation/TableOpertaionDelete.vue"

import { getBaseInfoFormConfig} from "../../formConfig/sp/SP0019";
import { getSynrFormConfig, getYqjgFormConfig, getCjrqFormConfig, getFxpsjwjFormConfig} from "../../formConfig/sp/SP0020";

const refConfig = {
	baseInfoRef: "baseInfoRef",
	remarkRef: "remarkRef",
	synrRef: "synrRef",
	yqjgRef: "yqjgRef",
	cjrqRef: "cjrqRef",
	fxpsjwjRef: "fxpsjwjRef",
}

const compRefs = Object.values(refConfig);

export default {
	name: "SP0020",
	components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable,TableOpertaionDelete },
	mixins: [templateMixin],
	props: {
		fillType: {
			type: String,
			default: 'preFill',
		},
	},
	computed: {
		//分析批数据文件
		fxpsjwjFormConfig(){
			return getFxpsjwjFormConfig(this);
		},
		//采集日期
		cjrqFormConfig(){
			return getCjrqFormConfig(this);
		},
		//仪器结果
		yqjgFormConfig(){
			return getYqjgFormConfig(this);
		},
		//试验内容
		synrFormConfig(){
			return getSynrFormConfig(this);
		},
		// 试验基本信息表单配置
		baseInfoFormConfig() {
			return getBaseInfoFormConfig('sp0020');
		},
		
		// 备注表单配置
		remarkConig() {
			return [
				{
					type: "cellItem",
					config: {
						remark: {
							label: "",
							type: "textarea",
							fillType: "actFill",
							span: 1,
							placeholder: 'template.common.remarkPlaceholder',
							maxlength: 1000,
							rows: 5
						}
					}
				}
			]
		},
	
	},
	data() {
		return {
			formData: {},
			refConfig
		};
	},
	mounted() {
	

	},
	methods: {
		onRegentSubmit(e){
			const {selectInfo, key, col, rowIndex, colIndex, rowData} = e;
			const {row} = selectInfo;
			if(key === "rymc"){
				const params = {
					pzrq: row.pzrq,
					sxr: row.sxr,
				}
				this.$refs.ryTableRef.updateDataSourceByRowIndex(rowIndex, params);
			}
		},
		//获取已填写的表单数据
		getFilledFormData() {
			return this.getFilledFormDataByRefs(compRefs)
		},
		//获取填写完成的表单数据
		async getFormData() {
			let content = await this.validFormFields(compRefs);
			console.log(content)
			return content;
		},
		//保存
		async onSave() {
			const formData = await this.getFormData();
			console.log(formData)
		},
	}
};
</script>
<style rel="stylesheet/scss" lang="scss">
.mt-20 {
	margin-top: 20px;
}

.print-btn {
	margin-bottom: 20px;
}
</style>