Blame view

src/views/machine/printerRuleList.vue 3.19 KB
d68983e7   wuxw   保养功能开发完成
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
  <template>
    <div class="printer-rule-container">
      <el-row :gutter="20">
        <el-col :span="4">
          <printer-rule-div @switch-rule="handleSwitchRule" />
        </el-col>
        <el-col :span="20">
          <el-card class="box-card">
            <div slot="header" class="text-left">
              <h5>{{ printerRuleInfo.curPrinterRule.ruleName }}</h5>
              <div class="role-context">{{ printerRuleInfo.curPrinterRule.remark }}</div>
            </div>
            <div class="role-menu flex justify-start">
              <el-button :type="printerRuleInfo.tabName === 'printerRuleMachine' ? 'primary' : 'text'"
                @click="_changePrinterRuleTab('printerRuleMachine')">
                {{ $t('printerRule.tab.machine') }}
              </el-button>
              <el-button :type="printerRuleInfo.tabName === 'printerRuleFees' ? 'primary' : 'text'"
                @click="_changePrinterRuleTab('printerRuleFees')">
                {{ $t('printerRule.tab.fees') }}
              </el-button>
              <el-button :type="printerRuleInfo.tabName === 'printerRuleRepair' ? 'primary' : 'text'"
                @click="_changePrinterRuleTab('printerRuleRepair')">
                {{ $t('printerRule.tab.repair') }}
              </el-button>
            </div>
  
            <div v-if="printerRuleInfo.tabName === 'printerRuleMachine'">
              <printer-rule-machine  />
            </div>
            <div v-if="printerRuleInfo.tabName === 'printerRuleFees'">
              <printer-rule-fees />
            </div>
            <div v-if="printerRuleInfo.tabName === 'printerRuleRepair'">
              <printer-rule-repair />
            </div>
          </el-card>
        </el-col>
      </el-row>
  
  
    </div>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  import PrinterRuleDiv from '@/components/machine/printerRuleDiv'
  import PrinterRuleMachine from '@/components/machine/printerRuleMachine'
  import PrinterRuleFees from '@/components/machine/printerRuleFees'
  import PrinterRuleRepair from '@/components/machine/printerRuleRepair'
  
  
  export default {
    name: 'PrinterRuleList',
    components: {
      PrinterRuleDiv,
      PrinterRuleMachine,
      PrinterRuleFees,
      PrinterRuleRepair,
  
    },
    data() {
      return {
        printerRuleInfo: {
          curPrinterRule: {},
          tabName: 'printerRuleMachine'
        },
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
    },
    methods: {
      handleSwitchRule(rule) {
        this.printerRuleInfo.curPrinterRule = rule
        this._changePrinterRuleTab('printerRuleMachine')
      },
      _changePrinterRuleTab(tabName) {
        this.printerRuleInfo.tabName = tabName
        setTimeout(() => {
          this.$refs[tabName].open(this.printerRuleInfo.curPrinterRule.ruleId)
        },500)
        
      },
      handleSuccess() {
        this.$refs.printerRuleDiv.refreshList()
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .printer-rule-container {
    padding: 20px;
  
    .line-x {
      border-top: 1px solid #eee;
      margin: 15px 0;
    }
  
    .role-menu {
      margin-bottom: 20px;
  
      .el-button {
        margin-right: 15px;
      }
    }
  
    .role-title {
      font-size: 18px;
      font-weight: bold;
      margin-bottom: 10px;
    }
  
    .role-context {
      color: #666;
      font-size: 14px;
    }
  }
  </style>