1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <template>
- <div>
- <div class="my-title">上机</div>
- <!-- 表单 -->
- <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
- <el-form-item label="选择设备" prop="equipmentId">
- <device-component v-model="dataForm.equipmentId" :device-id="dataForm.equipmentId"/>
- </el-form-item>
- </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 DeviceComponent from '@/views/modules/common/device-component.vue'
- export default {
- name: 'use-add',
- components: {DeviceComponent},
- data () {
- return {
- visible: false,
- id: 0,
- optionsModel: [],
- dataForm: {},
- dataRule: {
- equipmentId: [{ required: true, message: '请选择设备', trigger: 'change' }]
- }
- }
- },
- methods: {
- onChose () {
- this.$emit('onChose')
- },
- async init () { },
- validateField (type) {
- this.$refs.dataForm.validateField(type)
- },
- // 表单提交
- dataFormSubmit () {
- this.$refs['dataForm'].validate((valid) => {
- if (valid) {
- this.$http({
- url: this.$http.adornUrl(`/biz-service/prodEquipmentUsageRecord/insert`),
- 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>
|