<template>
|
<Dialog width="60%" v-model="dialogVisible" :title="dialogTitle">
|
<el-tabs>
|
<el-tab-pane label="浮沉实验台账">
|
<el-form :model="formData" :rules="formRules" ref="formRef" v-loading="formLoading"
|
label-width="120px">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="code" label="流水号">
|
<el-input size="mini" disabled v-model="formData.code" placeholder="流水号"/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item prop="ny" label="年月">
|
<el-date-picker
|
style="width: 100%"
|
v-model="formData.ny"
|
type="month"
|
value-format="YYYY-MM"
|
placeholder="年月"/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="syrq" label="实验日期">
|
<el-date-picker
|
style="width: 100%"
|
v-model="formData.syrq"
|
type="date"
|
placeholder="实验日期"/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item prop="mz" label="煤种">
|
<el-select v-model="formData.mz" placeholder="煤种"
|
clearable >
|
<el-option
|
v-for="dict in getStrDictOptions(DICT_TYPE.YMMZ)"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="fcfa" label="浮沉方案">
|
<el-select v-model="formData.fcfa" placeholder="浮沉方案"
|
clearable >
|
<el-option
|
v-for="dict in getStrDictOptions(DICT_TYPE.FCFA)"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item prop="drl" label="调入量">
|
<el-input-number v-model="formData.drl" placeholder="调入量" :min="0"/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item prop="bz" label="备注">
|
<el-input size="mini" v-model="formData.bz" placeholder="备注" type="textarea"
|
:rows="2"/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</el-tab-pane>
|
<el-tab-pane label="浮沉数据">
|
<el-form :inline="true">
|
<el-form-item>
|
<el-upload
|
class="upload-demo"
|
:action="action"
|
:on-success="handleExcel"
|
:multiple="false"
|
:show-file-list="false"
|
:on-change="changeFile"
|
:file-list="fileList">
|
<el-button size="mini" type="primary">点击上传</el-button>
|
</el-upload>
|
</el-form-item>
|
<el-form-item>
|
<el-button size="mini" type="success" @click="downloadExcel">下载模板</el-button>
|
</el-form-item>
|
</el-form>
|
<el-form :model="formData" :rules="dataRule" ref="formDataDet"
|
label-width="120px">
|
<el-table
|
:data="formData.detList"
|
border
|
height="400"
|
style="width: 100%;">
|
<el-table-column prop="mdjName" label="密度级" header-align="center"
|
align="center"/>
|
<el-table-column label="综合累计" header-align="center">
|
<el-table-column prop="zhljcl" label="产率(%)" header-align="center" align="center">
|
<template #default="scope">
|
<el-input-number v-model="scope.row.zhljcl"
|
size="mini"
|
placeholder="产率(%)"
|
:precision="2"
|
:controls="false"
|
:min="0"
|
:max="100" class="curves-det-input"/>
|
</template>
|
</el-table-column>
|
<el-table-column prop="zhljhf" label="灰分(%)" header-align="center" align="center">
|
<template #default="scope">
|
<el-input-number v-model="scope.row.zhljhf"
|
size="mini"
|
placeholder="灰分(%)"
|
:precision="2"
|
:controls="false"
|
:min="0"
|
:max="100" class="curves-det-input"/>
|
</template>
|
</el-table-column>
|
</el-table-column>
|
<el-table-column label="浮物累计" header-align="center" >
|
<el-table-column prop="fwljcl" label="产率(%)" header-align="center" align="center">
|
<template #default="scope">
|
<el-input-number v-model="scope.row.fwljcl"
|
:disabled="true"
|
size="mini"
|
placeholder="产率(%)"
|
:precision="2"
|
:controls="false"
|
:min="0"
|
:max="100" class="curves-det-input"/>
|
</template>
|
</el-table-column>
|
<el-table-column prop="fwljhf" label="灰分(%)" header-align="center" align="center">
|
<template #default="scope">
|
<el-input-number v-model="scope.row.fwljhf"
|
:disabled="true"
|
size="mini"
|
placeholder="灰分(%)"
|
:precision="2"
|
:controls="false"
|
:min="0"
|
:max="100" class="curves-det-input"/>
|
</template>
|
</el-table-column>
|
</el-table-column>
|
<el-table-column label="沉物累计" header-align="center" >
|
<el-table-column prop="cwljcl" label="产率(%)" header-align="center" align="center">
|
<template #default="scope">
|
<el-input-number v-model="scope.row.cwljcl"
|
:disabled="true"
|
size="mini"
|
placeholder="产率(%)"
|
:precision="2"
|
:controls="false"
|
:min="0"
|
:max="100" class="curves-det-input"/>
|
</template>
|
</el-table-column>
|
<el-table-column prop="cwljhf" label="灰分(%)" header-align="center" align="center">
|
<template #default="scope">
|
<el-input-number v-model="scope.row.cwljhf"
|
:disabled="true"
|
size="mini"
|
placeholder="灰分(%)"
|
:precision="2"
|
:controls="false"
|
:min="0"
|
:max="100" class="curves-det-input"/>
|
</template>
|
</el-table-column>
|
</el-table-column>
|
<el-table-column prop="md" label="密度" header-align="center" align="center" >
|
<template #default="scope">
|
<el-input-number v-model="scope.row.md"
|
size="mini"
|
placeholder="密度"
|
:precision="2"
|
:controls="false"
|
:min="0"
|
:max="100" class="curves-det-input"/>
|
</template>
|
</el-table-column>
|
<el-table-column prop="hl" label="±0.1含量" header-align="center" align="center" >
|
<template #default="scope">
|
<el-input-number v-model="scope.row.hl"
|
:disabled="true"
|
size="mini"
|
placeholder="±0.1含量"
|
:precision="2"
|
:controls="false"
|
:min="0"
|
:max="100" class="curves-det-input"/>
|
</template>
|
</el-table-column>
|
<el-table-column prop="lf" label="硫分(%)" header-align="center" align="center" >
|
<template #default="scope">
|
<el-input-number v-model="scope.row.lf"
|
size="mini"
|
placeholder="硫分(%)"
|
:precision="2"
|
:controls="false"
|
:min="0"
|
:max="100" class="curves-det-input"/>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-form>
|
</el-tab-pane>
|
</el-tabs>
|
<template #footer>
|
<el-button :disabled="formLoading" type="primary" @click="submitForm()">确定</el-button>
|
<el-button @click="dialogVisible = false">取消</el-button>
|
</template>
|
</Dialog>
|
</template>
|
|
<script lang="ts" setup>
|
import * as WashCurvesApi from '@/api/xmcpms/coal-quality/analysis/wash-curves/index'
|
import {DICT_TYPE, getStrDictOptions} from '@/utils/dict'
|
|
defineOptions({name: ' WashCurvesForm'})
|
|
const {t} = useI18n() // 国际化
|
const message = useMessage() // 消息弹窗
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogTitle = ref('') // 弹窗的标题
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
const formRef = ref() // 表单 Ref
|
const formData = ref({
|
id: undefined,
|
code: undefined,
|
ny: undefined,
|
syrq: undefined,
|
mz: undefined,
|
drl: undefined,
|
fcfa: undefined,
|
bz: undefined,
|
detList: []
|
})
|
|
const open = async (type: string, id?: string) => {
|
dialogVisible.value = true
|
dialogTitle.value = t('action.' + type)
|
formType.value = type
|
resetForm()
|
//修改时,设置数据
|
if (id) {
|
formLoading.value = true
|
try {
|
formData.value = await WashCurvesApi.getWashCurvesInfo(id)
|
} finally {
|
formLoading.value = false
|
}
|
}
|
}
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
/** 提交表单 */
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
const submitForm = async () => {
|
// 校验表单
|
if (!formRef) return
|
const valid = await formRef.value.validate()
|
if (!valid) return
|
// 提交请求
|
formLoading.value = true
|
try {
|
const data = formData.value as WashCurvesApi.WashCurvesVO
|
if (formType.value === 'create') {
|
await WashCurvesApi.createWashCurves(data)
|
message.success(t('common.createSuccess'))
|
} else {
|
await WashCurvesApi.updateWashCurves(data)
|
message.success(t('common.updateSuccess'))
|
}
|
dialogVisible.value = false
|
// 发送操作成功的事件
|
emit('success')
|
} finally {
|
formLoading.value = false
|
}
|
}
|
|
/** 重置表单 */
|
const resetForm = () => {
|
formData.value = {
|
id: undefined,
|
code: undefined,
|
ny: undefined,
|
syrq: undefined,
|
mz: undefined,
|
drl: undefined,
|
fcfa: undefined,
|
bz: undefined,
|
detList: []
|
}
|
formRef.value?.resetFields()
|
}
|
|
</script>
|
<style>
|
.curves-det-input {
|
width: 100%;
|
}
|
</style>
|