| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="subtext-upload"> |
| | | <el-form |
| | | :model="dataForm" |
| | | :rules="dataRule" |
| | | ref="dataForm" |
| | | label-width="80px"> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="ææ¬ç±»å" prop="textType"> |
| | | <el-radio-group v-model="dataForm.textType"> |
| | | <el-radio :label="0">åè¡ææ¬</el-radio> |
| | | <el-radio :label="1">å¤è¡ææ¬</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-col :span="24"> |
| | | <div style="padding: 10px"> |
| | | ææ¾å
容 |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <div class="content-in"> |
| | | <el-form-item label="" lable-width="0px" prop="content" v-if="dataForm.textType == 0"> |
| | | <el-input v-if="dataForm.textType == 0" v-model="dataForm.content" placeholder="ææ¾åå¹å
容"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="" lable-width="0px" prop="content" v-if="dataForm.textType == 1"> |
| | | <el-input type="textarea" :rows="4" v-model="dataForm.content" placeholder="ææ¾åå¹å
容"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </el-col> |
| | | </el-col> |
| | | <el-col :span="16"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åä½å¤§å°" prop="fontSize"> |
| | | <el-input v-model="dataForm.fontSize" placeholder="1为é»è®¤å¤§å°" type="number"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ¾æ¬¡æ°" prop="num"> |
| | | <el-input v-model="dataForm.num" placeholder="-1æ°¸ä¹
æ»å¨" type="number"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç§»å¨é´é" prop="interval"> |
| | | <el-input v-model="dataForm.interval" placeholder="åä½:毫ç§" type="number"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç§»å¨è·ç¦»" prop="step"> |
| | | <el-input v-model="dataForm.step" placeholder="åä½:åç´ " type="number"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åè¿æ¹å" prop="direction" v-if="dataForm.textType == 0"> |
| | | <el-select v-model="dataForm.direction" placeholder="è¯·éæ©" @change="directionChange"> |
| | | <el-option |
| | | v-for="item in directionList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åè¿æ¹å" prop="direction" v-if="dataForm.textType == 1"> |
| | | <el-select v-model="dataForm.direction" placeholder="è¯·éæ©" @change="directionChange"> |
| | | <el-option |
| | | v-for="item in directionMultVerticalList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¾ç¤ºä½ç½®" prop="align" v-if="dataForm.textType == 0"> |
| | | <el-select v-model="dataForm.align" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in alignList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ¾ç¤ºä½ç½®" prop="align" v-if="dataForm.textType == 1"> |
| | | <el-select v-model="dataForm.align" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in alignVerticalList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="èæ¯é¢è²" prop="color"> |
| | | <el-color-picker v-model="dataForm.color"></el-color-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æåé¢è²" prop="fontColor"> |
| | | <el-color-picker v-model="dataForm.fontColor"></el-color-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <div> |
| | | <button class="btn" @click="dataFormSubmit()"></button> |
| | | </div> |
| | | <div style="clear:both"></div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data () { |
| | | return { |
| | | visible: false, |
| | | dataForm: { |
| | | id: '', |
| | | color: '', |
| | | content: '', |
| | | fontSize: '', |
| | | fontColor: '', |
| | | num: '', |
| | | interval: '', |
| | | step: '', |
| | | direction: '', |
| | | align: '', |
| | | textType: '' |
| | | }, |
| | | directionList: [{ |
| | | value: 'left', |
| | | label: 'å左移å¨' |
| | | }, { |
| | | value: 'right', |
| | | label: 'åå³ç§»å¨' |
| | | }, { |
| | | value: 'up', |
| | | label: 'åä¸ç§»å¨' |
| | | }, { |
| | | value: 'down', |
| | | label: 'åä¸ç§»å¨' |
| | | }], |
| | | directionVerticalList: [{ |
| | | value: 'up', |
| | | label: 'åä¸ç§»å¨' |
| | | }, { |
| | | value: 'down', |
| | | label: 'åä¸ç§»å¨' |
| | | }], |
| | | directionMultVerticalList: [{ |
| | | value: 'up', |
| | | label: 'åä¸ç§»å¨' |
| | | }, { |
| | | value: 'down', |
| | | label: 'åä¸ç§»å¨' |
| | | }, { |
| | | value: 'static', |
| | | label: '鿢' |
| | | }], |
| | | alignList: [], |
| | | alignHorizonList: [{ |
| | | value: 'top', |
| | | label: 'ä¸' |
| | | }, { |
| | | value: 'center', |
| | | label: 'ä¸' |
| | | }, { |
| | | value: 'bottom', |
| | | label: 'ä¸' |
| | | }], |
| | | alignVerticalList: [{ |
| | | value: 'left', |
| | | label: 'å·¦' |
| | | }, { |
| | | value: 'center', |
| | | label: 'ä¸' |
| | | }, { |
| | | value: 'right', |
| | | label: 'å³' |
| | | }], |
| | | dataRule: { |
| | | content: [ |
| | | { required: true, message: 'ææ¾å
容ä¸è½ä¸ºç©º', trigger: 'blur' } |
| | | ], |
| | | fontSize: [ |
| | | { required: true, message: 'åä½å¤§å°ä¸è½ä¸ºç©º', trigger: 'blur' } |
| | | ], |
| | | num: [ |
| | | { required: true, message: 'ææ¾æ¬¡æ°ä¸è½ä¸ºç©º', trigger: 'blur' } |
| | | ], |
| | | interval: [ |
| | | { required: true, message: 'è¿æ¥é´éä¸è½ä¸ºç©º', trigger: 'blur' } |
| | | ], |
| | | step: [ |
| | | { required: true, message: 'è¿æ¥è·ç¦»ä¸è½ä¸ºç©º', trigger: 'blur' } |
| | | ], |
| | | direction: [ |
| | | { required: true, message: 'åè¿æ¹åä¸è½ä¸ºç©º', trigger: 'blur' } |
| | | ], |
| | | align: [ |
| | | { required: true, message: 'æ¾ç¤ºä½ç½®ä¸è½ä¸ºç©º', trigger: 'blur' } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | mounted () { |
| | | this.init(this.$store.state.led.lightemitId) |
| | | }, |
| | | methods: { |
| | | init (id) { |
| | | this.$nextTick(() => { |
| | | this.$refs['dataForm'].resetFields() |
| | | this.dataForm.id = id || 0 |
| | | this.dataForm.color = '#000000' |
| | | this.dataForm.content = '' |
| | | this.dataForm.fontSize = 1 |
| | | this.dataForm.fontColor = '#fff' |
| | | this.dataForm.num = -1 |
| | | this.dataForm.interval = 50 |
| | | this.dataForm.step = 1 |
| | | this.dataForm.direction = 'left' |
| | | this.dataForm.align = 'center' |
| | | this.dataForm.textType = 0 |
| | | this.visible = true |
| | | this.alignList = this.alignHorizonList |
| | | }) |
| | | }, |
| | | dataFormSubmit () { |
| | | this.$refs['dataForm'].validate((vaild) => { |
| | | if (vaild) { |
| | | this.$http({ |
| | | url: this.$http.adornUrl(`/pole/polelightemit/subTitleSet`), |
| | | method: 'post', |
| | | data: this.$http.adornData({ |
| | | 'id': this.dataForm.id, |
| | | 'color': this.dataForm.color, |
| | | 'content': this.dataForm.content, |
| | | 'fontSize': this.dataForm.fontSize, |
| | | 'fontColor': this.dataForm.fontColor, |
| | | 'num': this.dataForm.num, |
| | | 'interval': this.dataForm.interval, |
| | | 'step': this.dataForm.step, |
| | | 'direction': this.dataForm.direction, |
| | | 'align': this.dataForm.align, |
| | | 'textType': this.dataForm.textType |
| | | }) |
| | | }).then(({data}) => { |
| | | if (data && data.code === 0) { |
| | | this.$message({ |
| | | message: 'æä½æå', |
| | | type: 'success', |
| | | duration: 1500, |
| | | onClose: () => { |
| | | this.visible = false |
| | | } |
| | | }) |
| | | } else { |
| | | this.$message.error(data.msg) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | // æ¹åæ¹å触å彿° |
| | | directionChange (val) { |
| | | if (val === 'left' || val === 'right') { |
| | | this.alignList = this.alignHorizonList |
| | | } else if (val === 'up' || val === 'down') { |
| | | this.alignList = this.alignVerticalList |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .subtext-upload { |
| | | padding: 0 10px; |
| | | max-height: 100%; |
| | | /deep/ .el-form-item { |
| | | .el-form-item__label { |
| | | color: white; |
| | | }; |
| | | .el-radio__label { |
| | | color: white; |
| | | }; |
| | | } |
| | | /deep/ .content-in { |
| | | .el-form-item__content { |
| | | margin-left: 0px !important; |
| | | } |
| | | }; |
| | | .btn { |
| | | border-style: none; |
| | | width: 100px; |
| | | height: 35px; |
| | | background: url(~@/assets/img/btn-config.png); |
| | | background-repeat:no-repeat; |
| | | border-style: none; |
| | | background-size: 100%; |
| | | color: #fff; |
| | | font-size: 1.1em; |
| | | font-weight: 550; |
| | | }; |
| | | /deep/ .el-input__inner { |
| | | background-color: transparent; |
| | | color: #fff |
| | | } |
| | | /deep/ .el-textarea__inner { |
| | | background-color: transparent; |
| | | color: #fff |
| | | } |
| | | } |
| | | </style> |