|
@@ -1,276 +0,0 @@
|
|
|
-<template>
|
|
|
- <div>
|
|
|
- <div class="my-title">{{ !id ? '新增': '修改' }}</div>
|
|
|
- <!-- 表单 -->
|
|
|
- <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="8">
|
|
|
- <!-- 网关编码(后端自动生成) -->
|
|
|
- <el-form-item label="网关编码" prop="code">
|
|
|
- <el-input v-model="dataForm.code" placeholder="网关编码"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="设备编号" prop="codeNumber">
|
|
|
- <el-input v-model="dataForm.codeNumber" placeholder="设备编号"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="设备名称" prop="name">
|
|
|
- <el-input v-model="dataForm.name" placeholder="设备名称"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="设备型号" prop="model">
|
|
|
- <el-input v-model="dataForm.model" placeholder="设备型号"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="设备规格" prop="specifications">
|
|
|
- <el-input v-model="dataForm.specifications" placeholder="设备规格"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="设备用途" prop="useFor">
|
|
|
- <el-input v-model="dataForm.useFor" placeholder="设备用途"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="设备精度" prop="accuracy">
|
|
|
- <el-input v-model="dataForm.accuracy" placeholder="设备精度"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="制造厂家" prop="manufacturers">
|
|
|
- <el-input v-model="dataForm.manufacturers" placeholder="制造厂家"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="设备出厂编号" prop="manufacturingNumber">
|
|
|
- <el-input v-model="dataForm.manufacturingNumber" placeholder="设备出厂编号"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="设备出厂日期" prop="leaveFactoryDate">
|
|
|
- <el-date-picker
|
|
|
- v-model="dataForm.leaveFactoryDate"
|
|
|
- type="datetime"
|
|
|
- placeholder="设备出厂日期"
|
|
|
- value-format="yyyy-MM-dd HH:mm:ss">
|
|
|
- </el-date-picker>
|
|
|
- </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">
|
|
|
- </el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <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">
|
|
|
- </el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="责任人" prop="responsibilityUser">
|
|
|
- <user-component v-model="dataForm.responsibilityUser"/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="设备状态" prop="status">
|
|
|
- <el-select v-model="dataForm.state" placeholder="请选择" style="width: 100%">
|
|
|
- <el-option
|
|
|
- v-for="item in stateOption"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-form-item label="备注" prop="notes">
|
|
|
- <el-input v-model="dataForm.notes" type="textarea" placeholder="备注"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="操作说明书">
|
|
|
- <upload-component
|
|
|
- :displayStar="false"
|
|
|
- :accept="'*'"
|
|
|
- :file-obj-list="fileList1"
|
|
|
- @uploadSuccess="uploadSuccess1"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="检定报告附件">
|
|
|
- <upload-component
|
|
|
- :displayStar="false"
|
|
|
- :accept="'*'"
|
|
|
- :file-obj-list="fileList2"
|
|
|
- @uploadSuccess="uploadSuccess2"
|
|
|
- />
|
|
|
- </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 UserComponent from '../common/user-component'
|
|
|
- import uploadComponent from '@/views/modules/common/upload-component.vue'
|
|
|
- import {getDeviceDetails} from '@/api/device'
|
|
|
- import {optionsEquipmentState} from '@/utils/enums'
|
|
|
-
|
|
|
-export default {
|
|
|
- name: 'repair-add-or-update',
|
|
|
- components: {uploadComponent, UserComponent},
|
|
|
- computed: {
|
|
|
- orgId: {
|
|
|
- get () { return this.$store.state.user.orgId }
|
|
|
- }
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- id: 0,
|
|
|
- fileList1: [],
|
|
|
- fileList2: [],
|
|
|
- dataForm: {},
|
|
|
- stateOption: optionsEquipmentState,
|
|
|
- dataRule: {
|
|
|
- code: [{ required: true, message: '网关编码不能为空', trigger: 'blur' }],
|
|
|
- codeNumber: [{ required: true, message: '设备编号不能为空', trigger: 'blur' }],
|
|
|
- name: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }]
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- onChose () {
|
|
|
- this.$emit('onChose')
|
|
|
- },
|
|
|
- async init (id) {
|
|
|
- this.dataForm = {}
|
|
|
- this.id = id || 0
|
|
|
- // id 不存在表示新增,id 存在表示编辑
|
|
|
- if (!id) return
|
|
|
- await getDeviceDetails(this.id).then(({data}) => {
|
|
|
- if (data && data.code === '200') {
|
|
|
- this.dataForm = data.data
|
|
|
- console.log('dataForm', this.dataForm)
|
|
|
- // 操作说明书
|
|
|
- if (this.dataForm.attachList) {
|
|
|
- this.fileList1 = []
|
|
|
- this.dataForm.attachList.forEach((item) => {
|
|
|
- this.fileList1.push({
|
|
|
- name: item.fileName,
|
|
|
- url: item.url,
|
|
|
- id: item.url
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
- // 检定报告附件
|
|
|
- if (this.dataForm.attachListVerification) {
|
|
|
- this.fileList2 = []
|
|
|
- this.dataForm.attachListVerification.forEach((item) => {
|
|
|
- this.fileList2.push({
|
|
|
- name: item.fileName,
|
|
|
- url: item.url,
|
|
|
- id: item.url
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- validateField (type) {
|
|
|
- this.$refs.dataForm.validateField(type)
|
|
|
- },
|
|
|
- // 表单提交
|
|
|
- dataFormSubmit () {
|
|
|
- this.$refs['dataForm'].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- // 检查操作说明
|
|
|
- if (this.fileList1.length > 0) {
|
|
|
- this.dataForm.attachList = []
|
|
|
- for (let i = 0; i < this.fileList1.length; i++) {
|
|
|
- this.dataForm.attachList.push({
|
|
|
- fileName: this.fileList1[i].name,
|
|
|
- url: this.fileList1[i].url
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$message.error('请上传操作说明书')
|
|
|
- }
|
|
|
- // 检查检定报告附件
|
|
|
- if (this.fileList2.length > 0) {
|
|
|
- this.dataForm.attachListVerification = []
|
|
|
- for (let i = 0; i < this.fileList2.length; i++) {
|
|
|
- this.dataForm.attachListVerification.push({
|
|
|
- fileName: this.fileList2[i].name,
|
|
|
- url: this.fileList2[i].url
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$message.error('请上传检定报告附件')
|
|
|
- }
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl(`/biz-service/equipment/${!this.dataForm.id ? 'save' : 'update'}`),
|
|
|
- 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)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- uploadSuccess1 (fileList) {
|
|
|
- this.fileList1 = fileList
|
|
|
- },
|
|
|
- uploadSuccess2 (fileList) {
|
|
|
- this.fileList2 = fileList
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-</script>
|
|
|
-
|
|
|
-<style scoped>
|
|
|
-
|
|
|
-</style>
|