Browse Source

fix:设备驱动修复

master
涂强 2 weeks ago
parent
commit
b05b848310
  1. 2
      hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceExtraServiceImpl.java
  2. 6
      hd/nladmin-system/src/main/resources/config/application-dev.yml
  3. 2
      hd/nladmin-system/src/main/resources/config/application-prod.yml
  4. 1
      hd/nladmin-system/src/main/resources/logback-spring.xml
  5. 116
      qd/src/views/acs/device/UploadDialog.vue
  6. 64
      qd/src/views/acs/device/index.vue

2
hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceExtraServiceImpl.java

@ -78,7 +78,7 @@ public class DeviceExtraServiceImpl implements DeviceExtraService {
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("acs_device_extra");
JSONObject json = JSONObject.fromObject(dto);
com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(dto);
wo.insert(json);
}

6
hd/nladmin-system/src/main/resources/config/application-dev.yml

@ -8,11 +8,11 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:zgln_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:ssj1_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:luonanyaun_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lny_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root}
# password: ${DB_PWD:P@ssw0rd}
password: ${DB_PWD:Root.123456}
password: ${DB_PWD:123456}
# password: ${DB_PWD:123456}
# 初始连接数
initial-size: 5

2
hd/nladmin-system/src/main/resources/config/application-prod.yml

@ -8,7 +8,7 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:zgln_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:zgln}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
password: ${DB_PWD:123456}
# 初始连接数

1
hd/nladmin-system/src/main/resources/logback-spring.xml

@ -68,6 +68,7 @@ https://juejin.cn/post/6844903775631572999
<springProfile name="prod">
<root level="error">
<appender-ref ref="asyncFileAppender"/>
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>

116
qd/src/views/acs/device/UploadDialog.vue

@ -0,0 +1,116 @@
<template>
<el-dialog
title="导入Excel文件"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="400px"
:show-close="true"
@close="close"
@open="open"
>
<el-upload
ref="upload"
class="upload-demo"
action=""
drag
:on-exceed="is_one"
:limit="1"
:auto-upload="false"
:multiple="false"
:show-file-list="true"
:on-change="uploadByJsqd"
:file-list="fileList"
accept=".xlsx,.xls"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处
<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">只能上传Excel文件且不超过10MB</div>
</el-upload>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog>
</template>
<script>
import crudDevice from '@/api/acs/device/device'
import CRUD, { crud } from '@crud/crud'
export default {
name: 'UploadDialog',
mixins: [crud()],
components: {},
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: String
}
},
data() {
return {
dialogVisible: false,
fileList: [],
file1: ''
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
openParam: {
handler(newValue, oldValue) {
this.opendtlParam = newValue
}
}
},
methods: {
open() {
},
close() {
this.$emit('update:dialogShow', false)
},
is_one() {
this.crud.notify('只能上传一个excel文件!', CRUD.NOTIFICATION_TYPE.WARNING)
},
//
beforeAvatarUpload(file) {
// 2Mb
if (file.size > 10 * 1024 * 1024) {
return false
}
return true
},
//
uploadByJsqd(file) {
this.file1 = file
},
submit() {
if (this.beforeAvatarUpload(this.file1)) {
this.fileList.name = this.file1.name
this.fileList.url = ''
var formdata = new FormData()
formdata.append('file', this.file1.raw)
// excelImport formdata
crudDevice.excelImport(formdata).then((res) => {
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.$emit('tableChanged3', '')
this.$emit('update:dialogShow', false)
})
} else {
this.crud.notify('文件过大,请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
}
}
}
}
</script>

64
qd/src/views/acs/device/index.vue

@ -26,30 +26,30 @@
>
<el-option v-for="item in device_types" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
<el-select
v-model="query.region"
clearable
filterable
size="small"
placeholder="区域名称"
class="filter-item"
style="width: 190px"
@change="crud.toQuery"
>
<el-option v-for="item in regions" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
<el-select
v-model="query.is_config"
clearable
filterable
size="small"
placeholder="是否配置"
class="filter-item"
style="width: 190px"
@change="crud.toQuery"
>
<el-option v-for="item in is_configs" :key="item.id" :label="item.label" :value="item.value" />
</el-select>
<!-- <el-select-->
<!-- v-model="query.region"-->
<!-- clearable-->
<!-- filterable-->
<!-- size="small"-->
<!-- placeholder="区域名称"-->
<!-- class="filter-item"-->
<!-- style="width: 190px"-->
<!-- @change="crud.toQuery"-->
<!-- >-->
<!-- <el-option v-for="item in regions" :key="item.id" :label="item.label" :value="item.value" />-->
<!-- </el-select>-->
<!-- <el-select-->
<!-- v-model="query.is_config"-->
<!-- clearable-->
<!-- filterable-->
<!-- size="small"-->
<!-- placeholder="是否配置"-->
<!-- class="filter-item"-->
<!-- style="width: 190px"-->
<!-- @change="crud.toQuery"-->
<!-- >-->
<!-- <el-option v-for="item in is_configs" :key="item.id" :label="item.label" :value="item.value" />-->
<!-- </el-select>-->
<rrOperation />
</div>
<crudOperation :permission="permission">
@ -120,16 +120,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="是否配置" prop="is_config">
<el-select v-model="form.is_config" style="width: 370px" placeholder="请选择">
<el-option
v-for="item in is_configs"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="顺序号" prop="seq_num">
<el-input-number v-model="form.seq_num" value="1" :min="1" label="描述文字" />
</el-form-item>
@ -234,7 +224,6 @@ const defaultForm = {
device_code: null,
device_name: null,
device_type: null,
region: null,
is_config: null,
remark: null,
region: null
@ -260,11 +249,10 @@ export default {
del: ['admin', 'device:del']
},
device_types: [],
regions: [],
is_configs: [],
regions: [],
uploadShow: false,
device_code: '',
regions: [],
rules: {
device_code: [
{ required: true, message: '设备编码不能为空', trigger: 'blur' }
@ -288,7 +276,7 @@ export default {
this.device_types = data.content
})
//
get('region').then(data => {
get('region_type').then(data => {
this.regions = data.content
})
//

Loading…
Cancel
Save