|
@@ -0,0 +1,159 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-dialog
|
|
|
+ :title="!id ? '新增': display ? '详情' : '修改'"
|
|
|
+ width="70%"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :visible.sync="visible">
|
|
|
+ <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" :disabled="display || !id" placeholder="系统自动生成,无需填写"></el-input>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- </el-col>-->
|
|
|
+<!-- <el-col :span="8" style="padding-left: 10px">-->
|
|
|
+<!-- <el-form-item label="名称" prop="name">-->
|
|
|
+<!-- <el-input v-model="dataForm.name" :disabled="display" placeholder="名称"></el-input>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- </el-col>-->
|
|
|
+<!-- <el-col :span="8" style="padding-left: 10px">-->
|
|
|
+<!-- <el-form-item label="型号规格" prop="specifications">-->
|
|
|
+<!-- <el-input v-model="dataForm.specifications" :disabled="display" placeholder="型号规格"></el-input>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- </el-col>-->
|
|
|
+<!-- </el-row>-->
|
|
|
+<!-- <el-row class="my-row">-->
|
|
|
+<!-- <el-col :span="8">-->
|
|
|
+<!-- <el-form-item label="制造商" prop="manufacturers">-->
|
|
|
+<!-- <el-input v-model="dataForm.manufacturers" :disabled="display" placeholder="制造商"></el-input>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- </el-col>-->
|
|
|
+<!-- <el-col :span="8" style="padding-left: 10px">-->
|
|
|
+<!-- <el-form-item label="检定日期" prop="verificationDate">-->
|
|
|
+<!-- <el-date-picker-->
|
|
|
+<!-- :disabled="display"-->
|
|
|
+<!-- v-model="dataForm.verificationDate"-->
|
|
|
+<!-- value-format="yyyy-MM-dd"-->
|
|
|
+<!-- type="date">-->
|
|
|
+<!-- </el-date-picker>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- </el-col>-->
|
|
|
+<!-- <el-col :span="8" style="padding-left: 10px">-->
|
|
|
+<!-- <el-form-item label="检定有效期" prop="validityDate">-->
|
|
|
+<!-- <el-date-picker-->
|
|
|
+<!-- :disabled="display"-->
|
|
|
+<!-- v-model="dataForm.validityDate"-->
|
|
|
+<!-- value-format="yyyy-MM-dd"-->
|
|
|
+<!-- type="date">-->
|
|
|
+<!-- </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">-->
|
|
|
+<!-- <el-input v-if="display" v-model="dataForm.responsibilityUserName" disabled></el-input>-->
|
|
|
+<!-- <user-component v-else v-model="dataForm.responsibilityUser"/>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- </el-col>-->
|
|
|
+<!-- <el-col :span="8" style="padding-left: 20px">-->
|
|
|
+<!-- <el-form-item label="操作人" prop="userOf">-->
|
|
|
+<!-- <el-input v-if="display" v-model="dataForm.userOfName" disabled></el-input>-->
|
|
|
+<!-- <user-component v-else v-model="dataForm.userOf"/>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- </el-col>-->
|
|
|
+<!-- </el-row>-->
|
|
|
+<!-- <el-row class="my-row">-->
|
|
|
+<!-- <upload-component :display="display" :title="'使用说明书'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>-->
|
|
|
+<!-- </el-row>-->
|
|
|
+<!-- <el-row class="my-row" style="margin-top: 20px">-->
|
|
|
+<!-- <el-form-item label="备注" prop="notes">-->
|
|
|
+<!-- <el-input type="textarea" v-model="dataForm.notes" :disabled="display" placeholder="备注"></el-input>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- </el-row>-->
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="visible = false">取消</el-button>
|
|
|
+ <el-button v-if="!display" type="primary" @click="dataFormSubmit()">确定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import { getEquipmentDetail } from '@/api/production'
|
|
|
+ export default {
|
|
|
+ name: 'ibc-add-or-update',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ visible: false,
|
|
|
+ display: false,
|
|
|
+ dataList: [],
|
|
|
+ id: 0,
|
|
|
+ dataForm: {},
|
|
|
+ dataRule: {
|
|
|
+ // name: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async init (id, display) {
|
|
|
+ this.dataForm = {}
|
|
|
+ this.visible = true
|
|
|
+ this.id = id || 0
|
|
|
+ this.display = display
|
|
|
+ if (!id) return
|
|
|
+ await getEquipmentDetail(this.id).then(({data}) => {
|
|
|
+ if (data && data.code === '200') {
|
|
|
+ this.dataForm = data.data
|
|
|
+ // 文件列表
|
|
|
+ this.fileList = []
|
|
|
+ if (data.data.attachList) {
|
|
|
+ data.data.attachList.forEach((item) => {
|
|
|
+ this.fileList.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) {
|
|
|
+ this.$http({
|
|
|
+ url: !this.id ? this.$http.adornUrl(`/biz-service/equipment/save`) : this.$http.adornUrl(`/biz-service/equipment/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.visible = false
|
|
|
+ this.$emit('refreshDataList')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error(data.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|