Blame view

src/views/resource/printEquipmentAccountLabelList.vue 5.87 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
439c1b56   wuxw   开发完成设备台账功能
2
    <div class="print-equipment-account-label-container">
e0626fd0   wuxw   v1.9 优化设备中的设备台账相关...
3
4
5
6
7
8
9
10
11
12
13
      <div>
        <div class="row">
          <div class="col-sm-4">
            <span>{{ $t('printEquipmentAccount.machineId') }}:{{ printEquipmentAccountInfo.machineId }}</span>
          </div>
          <div class="col-sm-6">
            <span></span>
          </div>
          <div class="col-sm-2">
            <span>{{ $t('printEquipmentAccount.printTime') }}:{{ nowTime }}</span>
          </div>
439c1b56   wuxw   开发完成设备台账功能
14
15
        </div>
  
e0626fd0   wuxw   v1.9 优化设备中的设备台账相关...
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
        <table class="table table-bordered margin-top" style="margin-bottom: 0;">
          <thead>
            <tr>
              <th scope="col" colspan="6" class="text-center">
                <span style="font-size: 40px;">{{ $t('printEquipmentAccount.equipmentLabel') }}</span>
              </th>
            </tr>
          </thead>
          <tbody style="font-size: 28px;">
            <tr>
              <td>{{ $t('printEquipmentAccount.project') }}:{{ printEquipmentAccountInfo.yqName }}</td>
              <td>{{ $t('printEquipmentAccount.locationName') }}:{{ printEquipmentAccountInfo.locationDetail }}</td>
            </tr>
            <tr>
              <td>{{ $t('printEquipmentAccount.machineName') }}:{{ printEquipmentAccountInfo.machineName }}</td>
              <td>{{ $t('printEquipmentAccount.importanceLevel') }}:{{ printEquipmentAccountInfo.levelName }}</td>
            </tr>
            <tr>
              <td>{{ $t('printEquipmentAccount.systemName') }}:{{ printEquipmentAccountInfo.sysName }}</td>
              <td>{{ $t('printEquipmentAccount.enableDate') }}:{{ printEquipmentAccountInfo.firstEnableTime }}</td>
            </tr>
            <tr>
              <td>{{ $t('printEquipmentAccount.machineBrand') }}:{{ printEquipmentAccountInfo.brand }}</td>
              <td rowspan="4">
                <div id="qrcode" style="width:200px; height:200px;"></div>
              </td>
            </tr>
            <tr>
              <td>{{ $t('printEquipmentAccount.specificationModel') }}:{{ printEquipmentAccountInfo.model }}</td>
            </tr>
            <tr>
              <td>{{ $t('printEquipmentAccount.code') }}:{{ printEquipmentAccountInfo.machineCode }}</td>
            </tr>
            <tr>
              <td>{{ $t('printEquipmentAccount.responsiblePerson') }}:{{ printEquipmentAccountInfo.chargeUseName }}</td>
            </tr>
            <tr>
              <td colspan="2" class="text-center">设备标志 严禁损坏</td>
            </tr>
          </tbody>
        </table>
439c1b56   wuxw   开发完成设备台账功能
57
  
e0626fd0   wuxw   v1.9 优化设备中的设备台账相关...
58
        <div id="print-btn" class="btn-row">
439c1b56   wuxw   开发完成设备台账功能
59
60
61
62
63
64
65
          <el-button type="primary" class="float-right" @click="_printPurchaseApplyDiv">
            <i class="el-icon-check"></i>&nbsp;{{ $t('common.print') }}
          </el-button>
          <el-button type="warning" class="float-right" style="margin-right: 20px;" @click="_closePage">
            {{ $t('common.cancel') }}
          </el-button>
        </div>
e0626fd0   wuxw   v1.9 优化设备中的设备台账相关...
66
      </div>
439c1b56   wuxw   开发完成设备台账功能
67
68
69
70
71
72
    </div>
  </template>
  
  <script>
  import { getEquipmentAccountList } from '@/api/resource/printEquipmentAccountLabelApi'
  import QRCode from 'qrcodejs2'
19bafb73   wuxw   v1.9 优化采购相关bug
73
  import { getCommunityId ,getCommunityName} from '@/api/community/communityApi'
439c1b56   wuxw   开发完成设备台账功能
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
  
  export default {
    name: 'PrintEquipmentAccountLabelList',
    data() {
      return {
        printEquipmentAccountInfo: {
          machineId: '',
          machineName: '',
          machineCode: '',
          brand: '',
          model: '',
          locationDetail: '',
          firstEnableTime: '',
          warrantyDeadline: '',
          usefulLife: '',
          importanceLevel: '',
          levelName: '',
          state: '',
          purchasePrice: '',
          netWorth: '',
          useOrgId: '',
          useOrgName: '',
          useUserId: '',
          useUserName: '',
          useUseTel: '',
          chargeOrgId: '',
          chargeOrgName: '',
          chargeOrgTel: '',
          chargeUseId: '',
          chargeUseName: '',
          remark: '',
          yqName: '',
          url: ''
        },
        printFlag: '0',
        nowTime: '',
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
      this._initPrintRepairDetailDateInfo()
      const myDate = new Date()
      this.nowTime = myDate.toLocaleDateString()
19bafb73   wuxw   v1.9 优化采购相关bug
118
      this.printEquipmentAccountInfo.yqName = getCommunityName()
439c1b56   wuxw   开发完成设备台账功能
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
    },
    methods: {
      async _initPrintRepairDetailDateInfo() {
        const machineId = this.$route.query.machineId
        try {
          const res = await getEquipmentAccountList({
            page: 1,
            row: 1,
            machineId: machineId,
            communityId: this.communityId
          })
          const data = res.data[0]
          Object.assign(this.printEquipmentAccountInfo, data)
  
          document.getElementById('qrcode').innerHTML = ''
          new QRCode(document.getElementById('qrcode'), {
            text: this.printEquipmentAccountInfo.url,
            width: 200,
            height: 200,
            colorDark: '#000000',
            colorLight: '#ffffff',
            correctLevel: QRCode.CorrectLevel.H
          })
        } catch (error) {
          console.error('请求失败:', error)
        }
      },
      _printPurchaseApplyDiv() {
        this.printFlag = '1'
        document.getElementById('print-btn').style.display = 'none'
        window.print()
        window.opener = null
        window.close()
      },
      _closePage() {
        window.opener = null
        window.close()
      }
    }
  }
  </script>
  
  <style scoped>
  .print-equipment-account-label-container {
    padding: 20px;
  }
  
e0626fd0   wuxw   v1.9 优化设备中的设备台账相关...
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
  .row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }
  .col-sm-4 { flex: 0 0 33.3333%; max-width: 33.3333%; }
  .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
  .col-sm-2 { flex: 0 0 16.6667%; max-width: 16.6667%; }
  
  .table {
    width: 100%;
    border-collapse: collapse;
  }
  .table-bordered {
    border: 1px solid #ebeef5;
  }
  .table-bordered th,
  .table-bordered td {
    border: 1px solid #ebeef5;
    padding: 12px 10px;
  }
  .text-center { text-align: center; }
  .margin-top { margin-top: 20px; }
  
439c1b56   wuxw   开发完成设备台账功能
190
191
192
193
194
195
196
197
  .float-right {
    float: right;
  }
  
  .margin-top {
    margin-top: 20px;
  }
  
e0626fd0   wuxw   v1.9 优化设备中的设备台账相关...
198
199
  .btn-row { margin-top: 20px; }
  
439c1b56   wuxw   开发完成设备台账功能
200
201
202
203
204
205
  @media print {
    #print-btn {
      display: none !important;
    }
  }
  </style>