158 lines
5.6 KiB
Vue
158 lines
5.6 KiB
Vue
<!--
|
|
* @Descripttion:
|
|
* @version:
|
|
* @Author: fzq
|
|
* @Date: 2022-03-05 17:45:46
|
|
* @LastEditors: fzq
|
|
* @LastEditTime: 2022-03-07 09:19:34
|
|
-->
|
|
<template>
|
|
<!-- <el-dialog
|
|
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
|
|
:visible.sync="visible"
|
|
> -->
|
|
<el-dialog
|
|
:title="'btn.edit' | i18nFilter"
|
|
:visible.sync="visible"
|
|
>
|
|
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
|
|
<el-form-item :label="$t('module.report.substrate.substrateCode')" prop="substrateCode">
|
|
<el-input v-model="dataForm.substrateCode" :placeholder="$i18nForm(['placeholder.input', $t('module.report.substrate.substrateCode')])" clearable />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('module.report.substrate.location')" prop="location">
|
|
<el-input v-model="dataForm.location" :placeholder="$i18nForm(['placeholder.input', $t('module.report.substrate.location')])" clearable />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('module.report.substrate.storeTime')" prop="storeTime">
|
|
<el-input v-model="dataForm.storeTime" :placeholder="$i18nForm(['placeholder.input', $t('module.report.substrate.storeTime')])" clearable />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('module.report.substrate.substrateStatus')" prop="substrateStatus">
|
|
<el-input v-model="dataForm.substrateStatus" :placeholder="$i18nForm(['placeholder.input', $t('module.report.substrate.substrateStatus')])" clearable />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('module.report.substrate.interCode')" prop="interCode">
|
|
<el-input v-model="dataForm.interCode" :placeholder="$i18nForm(['placeholder.input', $t('module.report.substrate.interCode')])" clearable />
|
|
</el-form-item>
|
|
</el-form>
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
|
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script>
|
|
import { updateSubstrate, listSubstrate } from '@/api/report-manage/report'
|
|
|
|
export default {
|
|
props: {
|
|
id: {
|
|
type: String,
|
|
default: () => {
|
|
return ''
|
|
}
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
visible: false,
|
|
dataForm: {
|
|
id: '',
|
|
substrateCode: '',
|
|
location: '',
|
|
storeTime: '',
|
|
substrateStatus: '',
|
|
code: '',
|
|
storageBoxId: '',
|
|
storageCode: '',
|
|
interCode: ''
|
|
},
|
|
list: {
|
|
id: '',
|
|
location: '',
|
|
storeTime: '',
|
|
substrateCode: '',
|
|
substrateStatus: ''
|
|
},
|
|
dataRule: {
|
|
substrateCode: [
|
|
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.report.substrate.substrateCode')]), trigger: 'blur' }
|
|
],
|
|
code: [
|
|
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.report.substrate.substrateCode')]), trigger: 'blur' }
|
|
],
|
|
interCode: [
|
|
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.report.substrate.substrateCode')]), trigger: 'blur' }
|
|
]
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
this.init()
|
|
},
|
|
methods: {
|
|
// init(id) {
|
|
// // this.dataForm.id = id || ''
|
|
// this.dataForm.storageBoxId = this.$route.query.id
|
|
// this.dataForm.storageCode = this.$route.query.code
|
|
// this.visible = true
|
|
// this.$nextTick(() => {
|
|
// this.$refs['dataForm'].resetFields()
|
|
// // console.log(this.dataForm)
|
|
// listSubstrate(this.dataForm).then(res => {
|
|
// this.dataForm.id = res.data.id
|
|
// this.dataForm.location = res.data.location
|
|
// this.dataForm.storeTime = res.data.storeTime
|
|
// this.dataForm.substrateCode = res.data.substrateCode
|
|
// this.dataForm.substrateStatus = res.data.substrateStatus
|
|
// // console.log(this.dataForm)
|
|
// })
|
|
// })
|
|
// },
|
|
init(id) {
|
|
// this.dataForm.id = id || ''
|
|
this.dataForm.storageBoxId = this.$route.query.id
|
|
this.dataForm.storageCode = this.$route.query.code
|
|
this.visible = true
|
|
// console.log(this.dataForm)
|
|
listSubstrate(this.dataForm).then(res => {
|
|
console.log(res.data[0])
|
|
this.dataForm.id = res.data[0].id
|
|
this.dataForm.location = res.data[0].location
|
|
this.dataForm.storeTime = res.data[0].storeTime
|
|
this.dataForm.substrateCode = res.data[0].substrateCode
|
|
this.dataForm.substrateStatus = res.data[0].substrateStatus
|
|
this.dataForm.interCode = res.data[0].interCode
|
|
// console.log(this.dataForm)
|
|
})
|
|
},
|
|
// 表单提交
|
|
dataFormSubmit() {
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
if (valid) {
|
|
const data = {
|
|
'substrateStatus': this.dataForm.substrateStatus,
|
|
'storeTime': this.dataForm.storeTime,
|
|
'id': this.dataForm.id,
|
|
'substrateCode': this.dataForm.substrateCode,
|
|
'location': this.dataForm.location,
|
|
'interCode': this.dataForm.interCode,
|
|
'storageBoxId': this.dataForm.storageBoxId
|
|
}
|
|
console.log(data)
|
|
updateSubstrate(data).then(res => {
|
|
this.$message({
|
|
message: this.$t('module.basicData.visual.success'),
|
|
type: 'success',
|
|
duration: 1500,
|
|
onClose: () => {
|
|
this.visible = false
|
|
this.$emit('refreshDataList')
|
|
}
|
|
})
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|