<template>
	<page-meta><navigation-bar :title="$tt('navBar.simulation')" title-align="center" background-color="#007AFF" /></page-meta>
	<view class="container">
		<view style="background-color:#fff;padding:10px;margin-bottom:10px;">
			<text style="font-size:14px;color:#999">{{$tt('message.config')}}</text>
			<u--form labelPosition="left" labelWidth="100" :model="device" :rules="rules" ref="form1">
				<u-form-item :label="$tt('home.serialNumber')" prop="deviceNum" borderBottom leftIcon="tags"><u--input
						v-model="device.deviceNum" border="none"></u--input></u-form-item>
				<u-form-item :label="$tt('share.userId')" prop="userId" borderBottom leftIcon="tags"><u--input v-model="device.userId"
						border="none"></u--input></u-form-item>
				<u-form-item :label="$tt('modbus.firmware')" prop="firmwareVersion" borderBottom leftIcon="tags"><u--input
						v-model="device.firmwareVersion" border="none"></u--input></u-form-item>
				<u-form-item :label="$tt('message.NTP')" prop="ntpServer" borderBottom leftIcon="tags"><u--input
						v-model="device.ntpServer" border="none"></u--input></u-form-item>
			</u--form>
		</view>
		<view style="background-color:#fff;padding:10px;margin-bottom:10px;">
			<text style="font-size:14px;color:#999">{{$tt('message.productConfig')}}</text>
			<u--form labelPosition="left" labelWidth="100" :model="device" :rules="rules" ref="form2">
				<u-form-item :label="$tt('linkDevice.productNum')" prop="productId" borderBottom leftIcon="tags"><u--input
						v-model="device.productId" border="none"></u--input></u-form-item>
				<u-form-item :label="$tt('message.productPassword')" prop="productSecret" borderBottom leftIcon="tags"><u--input
						v-model="device.productSecret" border="none" type="password"></u--input></u-form-item>
			</u--form>
		</view>

		<view style="background-color:#fff;padding:10px;margin-bottom:10px;">
			<text style="font-size:14px;color:#999">{{$tt('message.mqttConfig')}}</text>
			<u--form labelPosition="left" labelWidth="100" :model="device" :rules="rules" ref="form3">
				<u-form-item :label="$tt('message.mqttAddress')" prop="mqttUrl" borderBottom leftIcon="tags"><u--input
						v-model="device.mqttUrl" border="none"></u--input></u-form-item>
				<u-form-item :label="$tt('message.mqttAccount')" prop="mqttUserName" borderBottom leftIcon="tags"><u--input
						v-model="device.mqttUserName" border="none"></u--input></u-form-item>
				<u-form-item :label="$tt('message.mqttPassword')" prop="mqttPassword" borderBottom leftIcon="tags"><u--input
						v-model="device.mqttPassword" border="none" type="password"></u--input></u-form-item>
			</u--form>
		</view>

		<view class="button-content">
			<u-button :text="$tt('message.save')" type="primary" customStyle="margin-bottom:20px;"></u-button>
			<view class="button-item"><u-button :text="$tt('message.report')" size="small" type="primary" @click="click"></u-button>
			</view>
			<view class="button-item"><u-button :text="$tt('message.reportfunction')" size="small" type="success"></u-button></view>
			<view class="button-item"><u-button :text="$tt('message.event')" size="small" type="error"></u-button></view>
			<view class="button-item"><u-button :text="$tt('message.abtainTime')" size="small" type="success"></u-button></view>
			<view class="button-item"><u-button :text="$tt('message.monitior')" size="small" type="warning"></u-button></view>
		</view>
	</view>
</template>

<script>
	// // 订阅的主题
	// String prefix = "/" + productId + "/" + deviceNum;
	// String sOtaTopic = prefix + "/ota/get";
	// String sNtpTopic = prefix + "/ntp/get";
	// String sPropertyTopic = prefix + "/property/get";
	// String sFunctionTopic = prefix + "/function/get";
	// String sPropertyOnline = prefix + "/property-online/get";
	// String sFunctionOnline = prefix + "/function-online/get";
	// String sMonitorTopic = prefix + "/monitor/get";
	// // 发布的主题
	// String pInfoTopic = prefix + "/info/post";
	// String pNtpTopic = prefix + "/ntp/post";
	// String pPropertyTopic = prefix + "/property/post";
	// String pFunctionTopic = prefix + "/function/post";
	// String pMonitorTopic = prefix + "/monitor/post";
	// String pEventTopic = prefix + "/event/post";

	export default {
		data () {
			return {
				device: {
					deviceNum: 'D08DFEEFFFDDB',
					userId: '1',
					productId: '2',
					productSecret: 'STDJKKKLLSSQL',
					firmwareVersion: '1.1',
					mqttUrl: 'localhost:1883',
					mqttUserName: 'wumei-smart',
					mqttPassword: 'PWDFDSDFSDSF',
					ntpServer: 'https://iot.fastbee.cn'
				},
				actions: [{
						name: '男'
					},
					{
						name: '女'
					},
					{
						name: '保密'
					}
				],
				rules: {
					deviceNum: {
						type: 'string',
						required: true,
						message: '请填写设备编号',
						trigger: ['blur', 'change']
					}
				}
			};
		},
		methods: {}
	};
</script>

<style lang="scss">
	page {
		background: #eef3f7;
	}

	.container {
		padding-bottom: 100px;
	}

	.button-content {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		padding: 10px;
	}

	.button-item {
		margin: 0 15px 15px 0;
	}
</style>