| | |
| | | <view class="flex">
|
| | | <text>中草药</text>
|
| | | <text>丨</text>
|
| | | <text @click="showLongName(showValue(item.herbName))" class="text-cut flex-twice">{{showValue(item.herbName)}}</text>
|
| | | <text @click="showLongName(showValue(item.herbName))"
|
| | | class="text-cut flex-twice">{{showValue(item.herbName)}}</text>
|
| | | <!-- <view class="margin-lr-sm">
|
| | | <u-tag text="报警一次" plain size="mini" type="warning"></u-tag>
|
| | | </view> -->
|
| | |
| | |
|
| | | },
|
| | | onReady() {
|
| | | const userinfo = uni.getStorageSync('userinfo');
|
| | | const tenantid = userinfo.loginTenantId
|
| | | uni.getSystemInfo({
|
| | | success: (res) => {
|
| | | let deviceId = res.deviceId
|
| | | if (!deviceId) {
|
| | | deviceId = 'mobile-' + tenantid + '-' + Date.parse(new Date())
|
| | | }
|
| | | uni.setStorageSync(this.$constant.DEVICE_ID, 'mobile-' + tenantid + '-' + res.deviceId);
|
| | | }
|
| | | })
|
| | | this.startConnect();
|
| | |
|
| | |
|
| | |
|
| | | let month = uni.$u.timeFormat(new Date(), 'yyyy-mm')
|
| | | this.getMonth(month)
|
| | |
|
| | | let day = uni.$u.timeFormat(new Date(), 'yyyy-mm-dd')
|
| | | this.getOrderList(day, day)
|
| | | this.getOrderList(day, day);
|
| | |
|
| | |
|
| | | },
|
| | | methods: { |
| | | showLongName(longName){ |
| | | this.$refs.uToast.show({ |
| | | type: 'default', |
| | | message: longName |
| | | }) |
| | | |
| | | methods: {
|
| | | /* 连接MQTT */
|
| | | async startConnect() {
|
| | | var _this = this
|
| | | const account = uni.getStorageSync('account');
|
| | | const deviceid = uni.getStorageSync(this.$constant.DEVICE_ID);
|
| | |
|
| | | if (!account) {
|
| | |
|
| | | return false
|
| | | }
|
| | | let opts = {
|
| | | // #ifdef H5
|
| | | url: 'ws://' + this.$api.mqttBaseUrl + ':8083/mqtt',
|
| | | // #endif
|
| | | // #ifdef APP-PLUS
|
| | | url: 'wx://' + this.$api.mqttBaseUrl + ':8083/mqtt',
|
| | | // #endif
|
| | | clientId: deviceid,
|
| | | username: account.username,
|
| | | password: account.password
|
| | | }
|
| | | if (!this.$mqttTool.client) {
|
| | | var client = await this.$mqttTool.connect(opts);
|
| | | }
|
| | | //订阅查询设备状态返回数据
|
| | | this.$mqttTool.subscribe({
|
| | | topic: this.$constant.SERVICE_DOWN + '/' + deviceid + '/#',
|
| | | qos: 0
|
| | | }).then(res => {
|
| | | console.error(res)
|
| | | })
|
| | | //订阅发送指令返回结果
|
| | | // this.$mqttTool.subscribe({
|
| | | // topic: this.$constant.SERVICE_RES_EQU_CMD,
|
| | | // qos: 0
|
| | | // }).then(res => {
|
| | | // console.error(res)
|
| | | // })
|
| | | // if (!client) {
|
| | | // return false
|
| | | // }
|
| | |
|
| | | client.on('connect', function(res) {
|
| | | console.error('连接成功')
|
| | | })
|
| | | client.on('reconnect', function(res) {
|
| | | console.error('重新连接')
|
| | | })
|
| | | client.on('error', function(res) {
|
| | | console.info('连接错误')
|
| | | })
|
| | | client.on('close', function(res) {
|
| | |
|
| | | console.error('关闭成功')
|
| | |
|
| | | })
|
| | | client.on('message', function(topic, message, buffer) {
|
| | | //console.info(message)
|
| | | })
|
| | | },
|
| | |
|
| | |
|
| | | showLongName(longName) {
|
| | | this.$refs.uToast.show({
|
| | | type: 'default',
|
| | | message: longName
|
| | | })
|
| | |
|
| | | },
|
| | | dayChange(dayInfo) { // 点击日期
|
| | | this.model.date = dayInfo.date
|