| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <template>
- <confirm-dialog
- ref="configDialog"
- title="电源标签"
- @confirm="onSave"
- >
- <div class="c-grid-form auto u-align-self--center">
- <div class="c-grid-form__label">屏体电源标签</div>
- <el-input v-model.trim="config.power1" />
- <div class="c-grid-form__label">风机电源标签</div>
- <el-input v-model.trim="config.power2" />
- </div>
- </confirm-dialog>
- </template>
- <script>
- import {
- POWERTYPE,
- getTenantAttribute,
- updateTenantAttribute
- } from '../api'
- export default {
- name: 'PowerConfigDialog',
- data () {
- return {
- config: {
- power1: '',
- power2: ''
- }
- }
- },
- methods: {
- show () {
- getTenantAttribute(POWERTYPE).then(({ data }) => {
- if (data) {
- this.$temp = data.attributeValue
- this.$temp.split(',').forEach((val, index) => {
- this.config[`power${index + 1}`] = val
- })
- } else {
- this.$temp = ''
- }
- this.$refs.configDialog.show()
- })
- },
- onSave (done) {
- if (!this.config.power1) {
- this.$message({
- type: 'warning',
- message: '请配置屏体电源标签'
- })
- }
- if (!this.config.power2) {
- this.$message({
- type: 'warning',
- message: '请配置风机电源标签'
- })
- }
- const val = [
- this.config.power1,
- this.config.power2
- ].join(',')
- if (this.$temp === val) {
- done()
- return
- }
- updateTenantAttribute(POWERTYPE, val).then(done)
- }
- }
- }
- </script>
|