Compare commits
3 Commits
7631ff402f
...
aa91bf9e92
Author | SHA1 | Date | |
---|---|---|---|
aa91bf9e92 | |||
f5c12be04d | |||
8584e5eb42 |
@ -39,9 +39,11 @@ public class MqttAutoStart implements ApplicationRunner {
|
|||||||
@Value("${imt.data.mqtt.Qos}")
|
@Value("${imt.data.mqtt.Qos}")
|
||||||
private int Qos;
|
private int Qos;
|
||||||
|
|
||||||
|
private static final boolean START = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) throws MqttException {
|
public void run(ApplicationArguments args) throws MqttException {
|
||||||
if(true){
|
if(START){
|
||||||
// 创建MQTT客户端
|
// 创建MQTT客户端
|
||||||
MyMqttClient myMqttClient = new MyMqttClient(host, userName, password, clientId, timeOut, keepAlive);
|
MyMqttClient myMqttClient = new MyMqttClient(host, userName, password, clientId, timeOut, keepAlive);
|
||||||
logger.info("############## 1、mqtt 客户端创建完成##############");
|
logger.info("############## 1、mqtt 客户端创建完成##############");
|
||||||
|
@ -25,7 +25,7 @@ public interface GatewayCardInfoMapper extends BaseMapperX<GatewayCardInfoDO> {
|
|||||||
.eqIfPresent(GatewayCardInfoDO::getCardName, reqVO.getCardName())
|
.eqIfPresent(GatewayCardInfoDO::getCardName, reqVO.getCardName())
|
||||||
.eqIfPresent(GatewayCardInfoDO::getCardTableMapping, reqVO.getCardTableMapping())
|
.eqIfPresent(GatewayCardInfoDO::getCardTableMapping, reqVO.getCardTableMapping())
|
||||||
.eqIfPresent(GatewayCardInfoDO::getMsgType, reqVO.getMsgType())
|
.eqIfPresent(GatewayCardInfoDO::getMsgType, reqVO.getMsgType())
|
||||||
.orderByDesc(GatewayCardInfoDO::getCardId));
|
.orderByAsc(GatewayCardInfoDO::getCreateTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -27,4 +27,15 @@ public interface GatewayCardParamsMapper extends BaseMapperX<GatewayCardParamsDO
|
|||||||
.orderByDesc(GatewayCardParamsDO::getChannelId));
|
.orderByDesc(GatewayCardParamsDO::getChannelId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过采集卡id查询参数列表
|
||||||
|
* @param cardId 采集卡id
|
||||||
|
* @return 参数列表
|
||||||
|
*/
|
||||||
|
default List<GatewayCardParamsDO> selectList(String cardId) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<GatewayCardParamsDO>()
|
||||||
|
.eqIfPresent(GatewayCardParamsDO::getCardId, cardId)
|
||||||
|
.orderByAsc(GatewayCardParamsDO::getChannelName)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
@ -99,7 +99,7 @@ public class GatewayCardParamsServiceImpl implements GatewayCardParamsService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<GatewayCardParamsDO> getGatewayCardParamsByCardId(String cardId){
|
public List<GatewayCardParamsDO> getGatewayCardParamsByCardId(String cardId){
|
||||||
return gatewayCardParamsMapper.selectList("cardId",cardId);
|
return gatewayCardParamsMapper.selectList(cardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -36,9 +36,9 @@ export function deleteGatewayCardParams(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获得机床网关采集卡参数
|
// 获得机床网关采集卡参数
|
||||||
export function getGatewayCardParams(id) {
|
export function getGatewayCardParamsByCardId(cardId) {
|
||||||
return request({
|
return request({
|
||||||
url: "/imt/gateway-card-params/get?id=" + id,
|
url: "/imt/gateway-card-params/getByCardId?cardId=" + cardId,
|
||||||
method: "get",
|
method: "get",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ export default {
|
|||||||
mobile: "",
|
mobile: "",
|
||||||
mobileCode: "",
|
mobileCode: "",
|
||||||
rememberMe: false,
|
rememberMe: false,
|
||||||
tenantName: "芋道源码",
|
tenantName: "浪潮智能生产",
|
||||||
},
|
},
|
||||||
scene: 21,
|
scene: 21,
|
||||||
|
|
||||||
|
@ -93,12 +93,6 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div class="add-table">
|
<div class="add-table">
|
||||||
<el-button
|
|
||||||
class="mb10"
|
|
||||||
size="mini"
|
|
||||||
type="primary"
|
|
||||||
@click="addTableRow"
|
|
||||||
>新 增</el-button>
|
|
||||||
<el-form
|
<el-form
|
||||||
:model="paramsForm"
|
:model="paramsForm"
|
||||||
ref="paramsForm"
|
ref="paramsForm"
|
||||||
@ -174,6 +168,13 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
<div style="margin-top:10px">
|
||||||
|
<el-button
|
||||||
|
class="mb10"
|
||||||
|
type="info"
|
||||||
|
@click="addTableRow"
|
||||||
|
>新增参数行</el-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
slot="footer"
|
slot="footer"
|
||||||
@ -197,6 +198,16 @@ export default {
|
|||||||
name: "GatewayCardInfoForm",
|
name: "GatewayCardInfoForm",
|
||||||
components: {},
|
components: {},
|
||||||
data() {
|
data() {
|
||||||
|
const checkRepeatName = (rule, value, callback) => {
|
||||||
|
const repeatName = this.paramsForm.paramsList.filter(
|
||||||
|
(e) => e.channelName == value
|
||||||
|
);
|
||||||
|
if (repeatName.length > 1) {
|
||||||
|
callback(new Error("通道名称不允许重复"));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
dialogTitle: "",
|
dialogTitle: "",
|
||||||
@ -294,6 +305,7 @@ export default {
|
|||||||
message: "通道名称长度不能超过30个字符",
|
message: "通道名称长度不能超过30个字符",
|
||||||
trigger: "blur",
|
trigger: "blur",
|
||||||
},
|
},
|
||||||
|
{ validator: checkRepeatName, trigger: "blur" },
|
||||||
],
|
],
|
||||||
paramMappingName: [
|
paramMappingName: [
|
||||||
{
|
{
|
||||||
@ -338,9 +350,15 @@ export default {
|
|||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(async () => {
|
||||||
if (rows[index].id) {
|
// console.log("rows:", rows);
|
||||||
|
// console.log("index:", index);
|
||||||
|
// console.log("删除参数:", rows[index].channelId);
|
||||||
|
if (rows[index].channelId) {
|
||||||
//调用删除接口删除
|
//调用删除接口删除
|
||||||
|
await GatewayCardParamsApi.deleteGatewayCardParams(
|
||||||
|
rows[index].channelId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
rows.splice(index, 1);
|
rows.splice(index, 1);
|
||||||
this.$message({
|
this.$message({
|
||||||
@ -369,7 +387,11 @@ export default {
|
|||||||
this.formLoading = true;
|
this.formLoading = true;
|
||||||
try {
|
try {
|
||||||
const res = await GatewayCardInfoApi.getGatewayCardInfo(id);
|
const res = await GatewayCardInfoApi.getGatewayCardInfo(id);
|
||||||
// const paramsRes = await GatewayCardParamsApi.getGatewayCardParams();
|
const paramsRes =
|
||||||
|
await GatewayCardParamsApi.getGatewayCardParamsByCardId(id);
|
||||||
|
if (paramsRes.data.length > 0) {
|
||||||
|
this.paramsForm.paramsList = paramsRes.data;
|
||||||
|
}
|
||||||
this.formData = res.data;
|
this.formData = res.data;
|
||||||
this.dialogTitle = "修改机床网关采集卡信息";
|
this.dialogTitle = "修改机床网关采集卡信息";
|
||||||
} finally {
|
} finally {
|
||||||
@ -380,7 +402,7 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
async submitForm() {
|
async submitForm() {
|
||||||
console.log("paramsList", this.paramsList);
|
// console.log("paramsList", this.paramsList);
|
||||||
// 校验主表
|
// 校验主表
|
||||||
await this.$refs["formRef"].validate();
|
await this.$refs["formRef"].validate();
|
||||||
await this.$refs["paramsForm"].validate();
|
await this.$refs["paramsForm"].validate();
|
||||||
@ -390,6 +412,13 @@ export default {
|
|||||||
// 修改的提交
|
// 修改的提交
|
||||||
if (data.cardId) {
|
if (data.cardId) {
|
||||||
await GatewayCardInfoApi.updateGatewayCardInfo(data);
|
await GatewayCardInfoApi.updateGatewayCardInfo(data);
|
||||||
|
if (this.paramsForm.paramsList) {
|
||||||
|
this.refreshGatewayCardParams(
|
||||||
|
this.paramsForm.paramsList,
|
||||||
|
this.formData,
|
||||||
|
data.cardId
|
||||||
|
);
|
||||||
|
}
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
this.$emit("success");
|
this.$emit("success");
|
||||||
@ -400,13 +429,10 @@ export default {
|
|||||||
const cardId = cardInfo.data;
|
const cardId = cardInfo.data;
|
||||||
//新增参数
|
//新增参数
|
||||||
if (this.paramsForm.paramsList) {
|
if (this.paramsForm.paramsList) {
|
||||||
this.paramsForm.paramsList.forEach((e) => {
|
this.refreshGatewayCardParams(
|
||||||
e.equipId = this.formData.equipId;
|
this.paramsForm.paramsList,
|
||||||
e.gatewayId = this.formData.gatewayId;
|
this.formData,
|
||||||
e.cardId = cardId;
|
cardId
|
||||||
});
|
|
||||||
await GatewayCardParamsApi.submitGatewayCardParams(
|
|
||||||
this.paramsForm.paramsList
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
@ -416,6 +442,16 @@ export default {
|
|||||||
this.formLoading = false;
|
this.formLoading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async refreshGatewayCardParams(paramsList, formData, cardId) {
|
||||||
|
paramsList.forEach((e) => {
|
||||||
|
e.equipId = formData.equipId;
|
||||||
|
e.gatewayId = formData.gatewayId;
|
||||||
|
e.cardId = cardId;
|
||||||
|
});
|
||||||
|
await GatewayCardParamsApi.submitGatewayCardParams(
|
||||||
|
this.paramsForm.paramsList
|
||||||
|
);
|
||||||
|
},
|
||||||
/** 表单重置 */
|
/** 表单重置 */
|
||||||
reset() {
|
reset() {
|
||||||
this.formData = {
|
this.formData = {
|
||||||
|
@ -101,6 +101,8 @@
|
|||||||
:data="list"
|
:data="list"
|
||||||
:stripe="true"
|
:stripe="true"
|
||||||
:show-overflow-tooltip="true"
|
:show-overflow-tooltip="true"
|
||||||
|
:row-key="rowKey"
|
||||||
|
:expand-row-keys="expandRowKeys"
|
||||||
@expand-change="tableExpandChange"
|
@expand-change="tableExpandChange"
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
@ -168,7 +170,14 @@
|
|||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="openCardForm(scope.row.cardId,scope.row)"
|
@click="openCardForm(scope.row.cardId,scope.row)"
|
||||||
v-hasPermi="['imt:gateway-info:create']"
|
v-hasPermi="['imt:gateway-info:create']"
|
||||||
>修改</el-button>
|
>采集卡信息修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleCardDelete(scope.row)"
|
||||||
|
v-hasPermi="['imt:gateway-info:delete']"
|
||||||
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -311,7 +320,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as GatewayInfoApi from "@/api/system/gatewayinfo/gatewayinfo";
|
import * as GatewayInfoApi from "@/api/system/gatewayinfo/gatewayinfo";
|
||||||
import * as GatewayCardInfoApi from "@/api/system/gatewayinfo/card";
|
import * as GatewayCardInfoApi from "@/api/system/gatewayinfo/card";
|
||||||
@ -366,6 +375,7 @@ export default {
|
|||||||
],
|
],
|
||||||
cardLoading: false,
|
cardLoading: false,
|
||||||
expandGateway: {},
|
expandGateway: {},
|
||||||
|
expandRowKeys: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -374,14 +384,21 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
tableExpandChange(row, e) {
|
tableExpandChange(row, e) {
|
||||||
if (e.length != 0) {
|
if (e.length != 0) {
|
||||||
console.log("展开数据:", row);
|
// console.log("展开数据:", row);
|
||||||
console.log("展开数据e:", e);
|
// console.log("展开数据e:", e);
|
||||||
|
if (e.length == 2) {
|
||||||
|
e.shift();
|
||||||
|
}
|
||||||
this.expandGateway = row;
|
this.expandGateway = row;
|
||||||
this.cardLoading = true;
|
this.cardLoading = true;
|
||||||
//加载该网关下的采集卡
|
//加载该网关下的采集卡
|
||||||
this.getCardList(row.gatewayId);
|
this.getCardList(row.gatewayId);
|
||||||
|
this.expandRowKeys = e.map((item) => item.gatewayId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
rowKey(row) {
|
||||||
|
return row.gatewayId;
|
||||||
|
},
|
||||||
async getCardList(id) {
|
async getCardList(id) {
|
||||||
try {
|
try {
|
||||||
this.cardQueryParams.gatewayId = id;
|
this.cardQueryParams.gatewayId = id;
|
||||||
@ -398,6 +415,17 @@ export default {
|
|||||||
openCardForm(id, row) {
|
openCardForm(id, row) {
|
||||||
this.$refs["cardFormRef"].open(id, row, this.expandGateway);
|
this.$refs["cardFormRef"].open(id, row, this.expandGateway);
|
||||||
},
|
},
|
||||||
|
async handleCardDelete(row) {
|
||||||
|
const cardId = row.cardId;
|
||||||
|
await this.$modal.confirm(
|
||||||
|
'是否确认删除机床网关信息编号为"' + cardId + '"的数据项?'
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
await GatewayCardInfoApi.deleteGatewayCardInfo(cardId);
|
||||||
|
await this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
} catch {}
|
||||||
|
},
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
async getList() {
|
async getList() {
|
||||||
try {
|
try {
|
||||||
@ -452,4 +480,3 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user