doum
7 天以前 7a0b33a5f2e0ba589bf35a1b8d896700a21f94a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<template>
  <GlobalWindow
    :title="title"
    :visible.sync="visible"
    :confirm-working="isWorking"
    @confirm="confirm"
  >
    <div class="tip-warn" >
      <i class="el-icon-warning"></i>
      正在为门店【<span style="color: red;font-weight: 600;">{{form.name}}</span>】设置打印机信息</div>
    <el-form :model="form" ref="form" :rules="rules">
      <el-form-item label="打印机序列号" prop="printerSn">
        <el-input v-model="form.printerSn" placeholder="请输入排序码" v-trim/>
      </el-form-item>
    </el-form>
  </GlobalWindow>
</template>
 
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import {maintainPrinter} from '@/api/business/shopInfo'
export default {
  name: 'OperaCategoryWindow',
  extends: BaseOpera,
  components: { GlobalWindow },
  data () {
    return {
      isUploading: false,
      // 表单数据
      form: {
        id: null,
        name: null,
        printerSn: ''
      },
      // 验证规则
      rules: {
        printerSn: [{ required: true, message: '请输入打印机序列号' }]
      }
    }
  },
  methods: {
    open (title, target) {
      console.log("=======================",target)
      this.title = title
      this.visible = true
      this.form = target
 
      console.log("=======================",  this.form)
    },
    __confirmEdit () {
      this.$refs.form.validate((valid) => {
        if (!valid) {
          return
        }
        // 调用更新接口
        this.isWorking = true
        maintainPrinter(this.form)
          .then(() => {
            this.visible = false
            this.$tip.apiSuccess('修改成功')
            this.$emit('success')
          })
          .catch(e => {
            this.$tip.apiFailed(e)
          })
          .finally(() => {
            this.isWorking = false
          })
      })
    }
  }
}
</script>