|
@@ -0,0 +1,138 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <div class="my-title">检定</div>
|
|
|
+ <el-form
|
|
|
+ :model="dataForm"
|
|
|
+ :rules="dataRule"
|
|
|
+ ref="dataForm"
|
|
|
+ @keyup.enter.native="dataFormSubmit()"
|
|
|
+ label-width="140px"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="检定有效期(止)" prop="validityDate">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="dataForm.validityDate"
|
|
|
+ type="datetime"
|
|
|
+ placeholder="选择日期"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ style="width: 100%;" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="检定日期" prop="verificationDate">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="dataForm.verificationDate"
|
|
|
+ type="datetime"
|
|
|
+ placeholder="选择日期"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ style="width: 100%;" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="附件" prop="attachListVerification">
|
|
|
+ <upload-component
|
|
|
+ :accept="'*'"
|
|
|
+ :file-obj-list="fileList"
|
|
|
+ @uploadSuccess="uploadSuccess"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="onChose">取消</el-button>
|
|
|
+ <el-button type="primary" @click="dataFormSubmit()" v-reClick>确定</el-button>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import UploadComponent from '../common/upload-component'
|
|
|
+export default {
|
|
|
+ name: 'device-check',
|
|
|
+ components: {UploadComponent},
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ dataForm: {
|
|
|
+ id: 0,
|
|
|
+ validityDate: '',
|
|
|
+ verificationDate: '',
|
|
|
+ attachListVerification: []
|
|
|
+ },
|
|
|
+ fileList: [],
|
|
|
+ dataRule: {
|
|
|
+ validityDate: [{required: true, message: '请选择检定有效期(止)', trigger: 'change'}],
|
|
|
+ verificationDate: [{required: true, message: '请选择检定日期', trigger: 'change'}]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {},
|
|
|
+ methods: {
|
|
|
+ init (row) {
|
|
|
+ this.dataForm.id = row.id
|
|
|
+ this.dataForm.validityDate = row.validityDate
|
|
|
+ this.dataForm.verificationDate = row.verificationDate
|
|
|
+ if (row.attachListVerification && row.attachListVerification.length > 0) {
|
|
|
+ this.fileList = []
|
|
|
+ row.attachListVerification.forEach((item) => {
|
|
|
+ this.fileList.push({
|
|
|
+ name: item.fileName,
|
|
|
+ url: item.url,
|
|
|
+ id: item.url
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onChose () {
|
|
|
+ this.$emit('onChose')
|
|
|
+ },
|
|
|
+ uploadSuccess (fileList) {
|
|
|
+ this.fileList = fileList
|
|
|
+ },
|
|
|
+ dataFormSubmit () {
|
|
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ // 添加附件
|
|
|
+ let fList = this.fileList
|
|
|
+ if (fList.length > 0) {
|
|
|
+ this.dataForm.attachListVerification = []
|
|
|
+ for (let i = 0; i < fList.length; i++) {
|
|
|
+ this.dataForm.attachListVerification.push({
|
|
|
+ fileName: fList[i].name,
|
|
|
+ url: fList[i].url
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error('请上传文件')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl(`/biz-service/equipment/updateVerification`),
|
|
|
+ method: 'post',
|
|
|
+ data: this.$http.adornData({ ...this.dataForm })
|
|
|
+ }).then(({ data }) => {
|
|
|
+ if (data && data.code === '200') {
|
|
|
+ this.$message({
|
|
|
+ message: '操作成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 1500,
|
|
|
+ onClose: () => {
|
|
|
+ this.onChose()
|
|
|
+ this.$emit('refreshDataList')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error(data.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+</style>
|