Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
34124455b6
@ -3,7 +3,7 @@ project (application C CXX)
|
||||
set (VERSION 1.0.1)
|
||||
|
||||
option (USE_MQTT "use mqtt protocol" ON)
|
||||
option (USE_WEBSOCKET "use websocket" OFF)
|
||||
option (USE_WEBSOCKET "use websocket" ON)
|
||||
option (USE_SQLITE3 "use sqlite3" ON)
|
||||
|
||||
if (USE_SQLITE3)
|
||||
@ -41,9 +41,6 @@ else ()
|
||||
message ("else:${CMAKE_BUILD_TYPE}")
|
||||
message ("else:${CMAKE_C_FLAGS_RELEASE}")
|
||||
endif()
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc")
|
||||
add_definitions (-DMCU_BIG_ENDIAN)
|
||||
endif ()
|
||||
|
||||
option (HAVE_FTP_PROCESS "use ry ftp" ON)
|
||||
if (HAVE_FTP_PROCESS)
|
||||
@ -79,7 +76,6 @@ set (APP_SRCS
|
||||
hostmodbustcp/host_modbus_tcp.cpp
|
||||
rtustatusproc/rtustatus.cpp
|
||||
subiec104/sub_iec104.cpp
|
||||
submodbustcp/sub_modbus_rtu_tcp.cpp
|
||||
zjd3100proc/zjd3100pro.cpp
|
||||
)
|
||||
|
||||
@ -207,7 +203,6 @@ endif (USE_MQTT)
|
||||
|
||||
if (USE_SQLITE3)
|
||||
set (APP_SRCS ${APP_SRCS}
|
||||
subgdw104/sub_gdw104.cpp
|
||||
third_party/sqlite/KompexSQLiteBlob.cpp
|
||||
third_party/sqlite/KompexSQLiteDatabase.cpp
|
||||
third_party/sqlite/KompexSQLiteStatement.cpp
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "../subiec104/sub_iec104.h"
|
||||
#include "../hostmodbusrtu/host_modbus_rtu.h"
|
||||
#include "../hostmodbustcp/host_modbus_tcp.h"
|
||||
#include "../submodbustcp/sub_modbus_rtu_tcp.h"
|
||||
#include "../rtustatusproc/rtustatus.h"
|
||||
#include "../zjd3100proc/zjd3100pro.h"
|
||||
//#include "../bfftpfile2issmqtt/bfftpfile2issmqtt.h"
|
||||
@ -351,11 +350,6 @@ void CChangeMaster::StartUp(void)
|
||||
vLog(LOG_INFO, "协议<%d>创建为: modbus tcp主协议.\n", i);
|
||||
procs[i] = new CHostModbusTcpProcess(m_conn);
|
||||
}
|
||||
else if (PROTOCOL_SUB_MODBUS_TCP == config.processes[i].proto)
|
||||
{
|
||||
vLog(LOG_INFO, "协议<%d>创建为: modbus tcp从协议.\n", i);
|
||||
procs[i] = new CSubModbusTcpProcess();
|
||||
}
|
||||
else if (PROTOCOL_HOST_IEC104 == config.processes[i].proto)
|
||||
{
|
||||
vLog(LOG_INFO, "协议<%d>创建为: iec104主协议.\n", i);
|
||||
@ -376,13 +370,6 @@ void CChangeMaster::StartUp(void)
|
||||
vLog(LOG_INFO, "协议<%d>创建为: 网关状态协议.\n", i);
|
||||
procs[i] = new CRTUStatusProcess();
|
||||
}
|
||||
#if 0
|
||||
else if (PROTOCOL_BF_FTP == config.processes[i].proto)
|
||||
{//倍福FTP文件协议
|
||||
vLog(LOG_INFO, "协议<%d>创建为: 倍福FTP文件协议.\n", i);
|
||||
procs[i] = new CBFFTPFile2ISSMQTTProcess();
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
vLog(LOG_ERROR, "(%s,%d)系统不支持该协议或该协议未知.\n", config.processes[i].name, config.processes[i].proto);
|
||||
|
@ -5,14 +5,13 @@
|
||||
//The individual slave devices are assigned addresses in the range of 1 锟?C 247. //
|
||||
//Address 0 is used for the broadcast address, which all slave devices recognize.//
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define HAVE_FTP_PROCESS
|
||||
#ifdef HAVE_FTP_PROCESS
|
||||
|
||||
#define MODBUSP_READ_ID 100 //读取文件及文件夹ID
|
||||
|
||||
#define MODBUSP_READ_ID 100 //读取文件及文件夹ID
|
||||
#define MODBUSP_READ_ID_FUNCCODE 0x03 //读取文件及文件夹ID功能码。
|
||||
#define MODBUSP_READ_ID_REGISTER_ADDRESS 0x01 //读取文件及文件夹ID寄存器地址。
|
||||
#define MODBUSP_READ_ID_REGISTER_LENGTH 0x6 //读取文件及文件夹ID寄存器长须。
|
||||
#define MODBUSP_READ_ID_REGISTER_ADDRESS 150 //读取文件及文件夹ID寄存器地址。
|
||||
#define MODBUSP_READ_ID_REGISTER_LENGTH 9 //读取文件及文件夹ID寄存器长度。
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
@ -129,6 +128,14 @@ static void* ryftp_process(void* param)
|
||||
char password[128] = "123456";
|
||||
char ipaddress[128] = "127.0.0.1";
|
||||
|
||||
//根据协议创建一个本地协议目录
|
||||
int pid = mbt->GetCurID();
|
||||
if (pid < 0 || pid >= PROCESSES_NUM) return ((void*)0);
|
||||
char pathName[128];
|
||||
snprintf(pathName, sizeof(pathName), "%d", pid);
|
||||
if (mbt->_mkdir(pathName) < 0) return ((void*)0);
|
||||
|
||||
//配置的用户名和密码
|
||||
#if 0
|
||||
snprintf(user, sizeof(user), "%s", mbt->m_user);
|
||||
snprintf(password, sizeof(password), "%s", mbt->m_password);
|
||||
@ -143,23 +150,26 @@ static void* ryftp_process(void* param)
|
||||
while (TRUE) {
|
||||
sleep(1); //每秒执行一次
|
||||
//ftp获取文件
|
||||
snprintf(name, sizeof(name), "%d.rtd", mbt->m_currentFileNo + 1);
|
||||
snprintf(remote, sizeof(remote), "ftp://%s/data/rtdatalog/%d/%d.rtd", str, mbt->m_currentDirNo + 1, mbt->m_currentFileNo + 1);
|
||||
if (mbt->m_iv == 1) {
|
||||
//文件目录无效
|
||||
continue;
|
||||
}
|
||||
snprintf(name, sizeof(name), "%s/%d", pathName, mbt->m_currentFileNo);
|
||||
snprintf(remote, sizeof(remote), "ftp://%s/data/rtdatalog/%d/%d", str, mbt->m_currentDirNo, mbt->m_currentFileNo);
|
||||
|
||||
if (ftpget(remote, name, user, password)) {
|
||||
//成功,处理文件
|
||||
vLog(LOG_DEBUG, "get a file, then send to ws.\n");
|
||||
mbt->m_lastDirNo = mbt->m_currentDirNo;
|
||||
mbt->m_lastFileNo = mbt->m_currentFileNo;
|
||||
mbt->m_currentFileNo++;
|
||||
if (mbt->m_currentFileNo % 1000 == 0)
|
||||
{ //一个文件夹最多存放1000个文件
|
||||
mbt->m_currentFileNo = 0;
|
||||
if ((mbt->m_currentFileNo - mbt->m_lastStartFileNo) % 1000 == 0) {
|
||||
//一个文件夹最多存放1000个文件, mbt->m_currentFileNo = 0;
|
||||
mbt->m_currentDirNo++;
|
||||
if (mbt->m_currentDirNo >= 56)
|
||||
{ //7天数据大约有56个文件夹
|
||||
mbt->m_lastStartFileNo = mbt->m_currentFileNo;
|
||||
if (mbt->m_currentDirNo >= 56) { //7天数据大约有56个文件夹
|
||||
mbt->m_currentDirNo = 0;
|
||||
}
|
||||
//保存文件信息
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -269,11 +279,17 @@ CHostModbusTcpProcess::CHostModbusTcpProcess(noPollConn *conn)
|
||||
m_nNeedSend = FALSE;
|
||||
|
||||
//websocket接口
|
||||
m_conn = NULL;
|
||||
if (conn != NULL)
|
||||
{
|
||||
m_conn = conn;
|
||||
}
|
||||
|
||||
m_pid = 0;
|
||||
|
||||
//目录无效
|
||||
m_iv = 1;
|
||||
|
||||
m_currentDirNo = -1; //当前目录编号
|
||||
m_currentFileNo = -1; //当前文件编号
|
||||
m_lastDirNo = -1; //上一目录编号
|
||||
@ -440,7 +456,17 @@ void CHostModbusTcpProcess::calc2(void)
|
||||
if (yccount) ycparam = new STRUCT_PARAM[yccount];
|
||||
if (ymcount) ymparam = new STRUCT_PARAM[ymcount];
|
||||
if (yxcount) yxparam = new STRUCT_PARAM[yxcount];
|
||||
|
||||
#if 0
|
||||
//插入一帧读取信息的报文
|
||||
ycframes[0].FrameType = MODBUSP_READ_ID;
|
||||
ycframes[0].FuncCode = MODBUSP_READ_ID_FUNCCODE;
|
||||
ycframes[0].RegBegin = MODBUSP_READ_ID_REGISTER_ADDRESS;
|
||||
ycframes[0].RegCount = MODBUSP_READ_ID_REGISTER_LENGTH;
|
||||
|
||||
j = 1;
|
||||
#else
|
||||
j = 0;
|
||||
#endif
|
||||
if (ycparam)
|
||||
{
|
||||
memset(ycparam, 0, sizeof(STRUCT_PARAM) * yccount);
|
||||
@ -457,7 +483,7 @@ void CHostModbusTcpProcess::calc2(void)
|
||||
{
|
||||
WORD addr = MAKEWORD(ycparam[n].param[1], ycparam[n].param[2]);
|
||||
if (addr >= 65535) continue;
|
||||
for (j = 0; j < MODBUS_RTU_AUTOMATIC_FRAME; j++)
|
||||
for (; j < MODBUS_RTU_AUTOMATIC_FRAME; j++)
|
||||
{
|
||||
if (ycframes[j].FuncCode == 0)
|
||||
{
|
||||
@ -600,7 +626,25 @@ BOOLEAN CHostModbusTcpProcess::OnPreCreate(int id)
|
||||
m_nTimeout = 200;
|
||||
calc2();
|
||||
|
||||
//启动后,读取本地文件更新最后一次的文件夹及文件序号
|
||||
//启动后,创建ftp线程
|
||||
if (m_pid <= 0) {
|
||||
vLog(LOG_DEBUG, "create a ftp thread.\n");
|
||||
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setstacksize(&attr, MEMERY_1M);
|
||||
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
||||
|
||||
if (pthread_create(&m_pid, &attr, ryftp_process, this) < 0) {
|
||||
vLog(LOG_ERROR, "create ryftp_process error(%d,%s).\n", errno, strerror(errno));
|
||||
return TRUE;
|
||||
}
|
||||
char name[17];
|
||||
snprintf(name, 16, "%s_ftp", GetCurProcessName());
|
||||
pthread_setname_np(m_pid, name);
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -661,6 +705,8 @@ BOOLEAN CHostModbusTcpProcess::Run(void)
|
||||
pItem->m_nNum++;
|
||||
m_nSendPoint = system32.ticks;//0;
|
||||
m_nNeedSend = FALSE;
|
||||
|
||||
//fprintf(stderr, "tx<%d>: ", count+6); for (int a = 0; a < count+6; a++) fprintf(stderr, "%02X ", buffer[a]); fprintf(stderr, "\n");
|
||||
FeedDog();
|
||||
}
|
||||
}
|
||||
@ -701,10 +747,11 @@ BOOLEAN CHostModbusTcpProcess::OnTimer(void)
|
||||
pItem = (CHostModbusTcpProcessItem *)GetNextItem();
|
||||
if (pItem == NULL) return TRUE;
|
||||
m_nNeedSend = TRUE;
|
||||
|
||||
#if 1
|
||||
//启动时读取一次,后面自己维护序号
|
||||
if ((m_currentDirNo == -1) && (m_currentFileNo == -1))
|
||||
{ //当前文件和目录都为-1,程序第一次启动。需要获取ftp目录及文件ID
|
||||
/* code */
|
||||
vLog(LOG_DEBUG, "here..... add read id frame.\n");
|
||||
m_nFrameType = MODBUSP_READ_ID;
|
||||
m_nCurFuncCode = MODBUSP_READ_ID_FUNCCODE;
|
||||
m_nCurBeginReg = MODBUSP_READ_ID_REGISTER_ADDRESS;
|
||||
@ -712,6 +759,7 @@ BOOLEAN CHostModbusTcpProcess::OnTimer(void)
|
||||
pItem->m_nFramePoll |= MODBUSP_GET_DATA_FRAME;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
struModbusExtFrame* frame = pItem->GetNextFrame();
|
||||
if (frame != NULL)
|
||||
{
|
||||
@ -1179,29 +1227,30 @@ BOOLEAN CHostModbusTcpProcess::OnReceiveIDData(CHostModbusTcpProcessItem *pItem,
|
||||
|
||||
pBuf = pData;
|
||||
|
||||
//根据结构来处理得到id信息
|
||||
/*
|
||||
1)、路径信息是否有效 byte;
|
||||
2)、当前文件夹路径名的后缀 dint,按照顺序增加1(转字符串时在前补0);
|
||||
3)、当前文件夹下最后新文件的编号 dint;
|
||||
4)、当前文件夹下第一个文件的编号 dint;
|
||||
5)、当前文件夹下文件个数 dint;
|
||||
*/
|
||||
//路径有效性判断
|
||||
int iv = ((pBuf[0] << 8) | pBuf[1]); pBuf += 2;
|
||||
|
||||
//
|
||||
m_currentDirNo = 0;
|
||||
m_currentFileNo = 0;
|
||||
|
||||
vLog(LOG_DEBUG, "create a ftp thread.\n");
|
||||
//创建ftp线程
|
||||
pthread_attr_t attr;
|
||||
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setstacksize(&attr, MEMERY_1M);
|
||||
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
||||
|
||||
if (pthread_create(&m_pid, &attr, ryftp_process, this) < 0) {
|
||||
vLog(LOG_ERROR, "create ryftp_process error(%d,%s).\n", errno, strerror(errno));
|
||||
return TRUE;
|
||||
m_iv = iv;
|
||||
if (iv) {
|
||||
vLog(LOG_DEBUG, "路径信息无效\n");
|
||||
return FALSE;
|
||||
}
|
||||
char name[16];
|
||||
snprintf(name, 16, "%s_ftp", GetCurProcessName());
|
||||
pthread_setname_np(m_pid, name);
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
//当前文件夹路径名
|
||||
m_currentDirNo = (DWORD)((pBuf[2] << 24) | (pBuf[3] << 16) | (pBuf[0] << 8) | pBuf[1]); pBuf += 4;
|
||||
//当前文件夹下最后新文件
|
||||
m_currentFileNo = (DWORD)((pBuf[2] << 24) | (pBuf[3] << 16) | (pBuf[0] << 8) | pBuf[1]); pBuf += 4;
|
||||
//当前文件夹下第一个文件
|
||||
m_lastStartFileNo = (DWORD)((pBuf[2] << 24) | (pBuf[3] << 16) | (pBuf[0] << 8) | pBuf[1]); pBuf += 4;
|
||||
|
||||
vLog(LOG_DEBUG, "dir: %d, file: %d: start: %d\n", m_currentDirNo, m_currentFileNo, m_lastStartFileNo);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "netproc.h"
|
||||
#include "modbus_def.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <nopoll.h>
|
||||
#include <nopoll_decl.h>
|
||||
|
||||
@ -60,16 +61,28 @@ private:
|
||||
|
||||
public:
|
||||
noPollConn *m_conn;
|
||||
int m_currentDirNo; //当前目录编号
|
||||
int m_currentFileNo; //当前文件编号
|
||||
int m_lastDirNo; //上一目录编号
|
||||
int m_lastFileNo; //上一文件编号
|
||||
int m_iv;
|
||||
LONG m_currentDirNo; //当前目录编号
|
||||
LONG m_currentFileNo; //当前文件编号
|
||||
LONG m_lastDirNo; //上一目录编号
|
||||
LONG m_lastFileNo; //上一文件编号
|
||||
LONG m_lastStartFileNo; //文件开始编号
|
||||
|
||||
//ftp参数信息
|
||||
char m_user[128];
|
||||
char m_password[128];
|
||||
char m_remoteIp[64];
|
||||
|
||||
int _mkdir(const char* pathName) {
|
||||
if (access(pathName, F_OK) == 0) return 0;
|
||||
// 创建目录
|
||||
if (mkdir(pathName, 0777) == -1) {
|
||||
vLog(LOG_ERROR, "创建文件夹 %s失败<%d,%s>\r\n", pathName, errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public:
|
||||
CHostModbusTcpProcess(noPollConn *conn);
|
||||
virtual ~CHostModbusTcpProcess();
|
||||
|
@ -47,11 +47,15 @@ public:
|
||||
config.processes[m_nProcess].softdog = 0;
|
||||
}
|
||||
|
||||
inline char* GetCurProcessName() const
|
||||
inline char* GetCurProcessName(void) const
|
||||
{
|
||||
if (m_nProcess < 0 || m_nProcess >= PROCESSES_NUM) return NULL;
|
||||
return config.processes[m_nProcess].name;
|
||||
}
|
||||
inline int GetCurID(void) const
|
||||
{
|
||||
return m_nProcess;
|
||||
}
|
||||
|
||||
inline int GetCurOrder() const
|
||||
{
|
||||
|
@ -53,15 +53,16 @@
|
||||
"@types/node": "20.14.0",
|
||||
"@types/nprogress": "0.2.3",
|
||||
"@types/sortablejs": "1.15.8",
|
||||
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
||||
"@typescript-eslint/parser": "^7.13.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.9.0",
|
||||
"@typescript-eslint/parser": "^8.9.0",
|
||||
"@vitejs/plugin-vue": "5.0.5",
|
||||
"async-validator": "4.2.5",
|
||||
"crypto-js": "^4.2.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint": "^9.0.0",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"eslint-plugin-react": "^7.34.3",
|
||||
"eslint-plugin-vue": "9.26.0",
|
||||
"glob": "^11.0.0",
|
||||
"globals": "^15.6.0",
|
||||
"prettier": "^3.3.2",
|
||||
"sass": "1.77.4",
|
||||
|
@ -322,7 +322,7 @@ const addInstitutional = (rightClick = false) => {
|
||||
const submitAddForm = () => {
|
||||
console.log(formModel.value)
|
||||
if (!formRef.value) return
|
||||
formRef.value.validate((valid:boolean) => {
|
||||
formRef.value.validate((valid: boolean) => {
|
||||
if (valid) {
|
||||
if (dialogTitle.value === '新增机构') {
|
||||
formModel.value.parentOrgId = formModel.value.parentOrgId ?? '0'
|
||||
@ -330,7 +330,7 @@ const submitAddForm = () => {
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
ElMessage.success('新增成功')
|
||||
getInstitutionList()
|
||||
getInstitutionList({parentOrgId:rightClickMenuData.value?.parentOrgId})
|
||||
dialogVible.value = false
|
||||
refreshTreeData(formModel.value.parentOrgId)
|
||||
} else {
|
||||
@ -345,7 +345,7 @@ const submitAddForm = () => {
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
ElMessage.success('编辑成功')
|
||||
getInstitutionList()
|
||||
getInstitutionList({parentOrgId:rightClickMenuData.value?.parentOrgId})
|
||||
dialogVible.value = false
|
||||
refreshTreeData(rightClickMenuData.value!.parentOrgId).then(() => {
|
||||
refreshTreeData(formModel.value.parentOrgId)
|
||||
@ -368,7 +368,14 @@ const closeAddForm = () => {
|
||||
const getInstitutionList = (data: getDataType = { name: null }) => {
|
||||
getInstitutionalListReq(data).then((res) => {
|
||||
pageTotal.value = res.total
|
||||
originData.value = res.rows
|
||||
console.log(res.rows);
|
||||
|
||||
originData.value = res.rows.map(item=>{
|
||||
return {
|
||||
...item,
|
||||
parentOrgName:item.parentOrgName ? item.parentOrgName : '无'
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@ -450,7 +457,7 @@ const delForm = (column: getTreeDataReturnType) => {
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
ElMessage.success('删除成功')
|
||||
getInstitutionList()
|
||||
getInstitutionList({parentOrgId:rightClickMenuData.value?.parentOrgId})
|
||||
refreshTreeData(column.parentOrgId)
|
||||
} else {
|
||||
ElMessage.error(res?.msg ?? '删除失败')
|
||||
@ -470,6 +477,7 @@ const treeReplaceProps = {
|
||||
const treeSelectReplaceProps = {
|
||||
label: 'name',
|
||||
children: 'children',
|
||||
isLeaf: 'isLeaf',
|
||||
}
|
||||
const loadTreeData = (node: Node, resolve: any) => {
|
||||
if (node.level === 0) {
|
||||
@ -489,7 +497,6 @@ const loadTreeData = (node: Node, resolve: any) => {
|
||||
})
|
||||
}
|
||||
const loadSelectTreeData = (node: Node, resolve: any) => {
|
||||
console.log(node)
|
||||
|
||||
if (node.level === 0) {
|
||||
return getTreeData(null)
|
||||
@ -497,7 +504,8 @@ const loadSelectTreeData = (node: Node, resolve: any) => {
|
||||
if (!res.length) {
|
||||
node.data.isLeaf = true
|
||||
}
|
||||
resolve(res)
|
||||
|
||||
resolve([{ id: '0', name: '无', isLeaf: true }, ...res])
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
@ -552,8 +560,6 @@ const refreshTreeData = (parentOrgId: string | number | null) => {
|
||||
return new Promise((resolve) => {
|
||||
const data = parentOrgId === 0 || parentOrgId === '0' ? null : parentOrgId
|
||||
getTreeData(data).then((res) => {
|
||||
console.log('res,', res)
|
||||
console.log(data)
|
||||
if (data) {
|
||||
treeRef.value?.updateKeyChildren(parentOrgId!, res)
|
||||
} else {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<template v-for="item in formColumnList" :key="item.prop">
|
||||
<el-form-item :label="item.label" :rules="item.rule" :label-width="80" :prop="item.prop">
|
||||
<template v-if="item.type === 'input'">
|
||||
<el-input v-model="formModel[item.prop]" :placeholder="'请输入' + item.label"></el-input>
|
||||
<el-input v-model="formModel[item.prop] as string" :placeholder="'请输入' + item.label"></el-input>
|
||||
</template>
|
||||
<template v-if="item.type === 'custom'">
|
||||
<template v-if="item.prop === 'authList'">
|
||||
@ -241,13 +241,15 @@ const getRoleList = (roleName = '') => {
|
||||
getRoleListReq({
|
||||
roleName,
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
|
||||
pageTotal.value = res.total
|
||||
originData.value = res.rows.map((item) => {
|
||||
return {
|
||||
roleCode: item.roleCode,
|
||||
roleName: item.roleName,
|
||||
listName: item.list.map((item) => item.authorityName).join(','),
|
||||
authList: item.list.map((item) => item.id),
|
||||
authList: item.list.map((item) => parseInt(item.id)),
|
||||
id: item.id,
|
||||
revision: item.revision,
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ export type formDataType = {
|
||||
roleCode: string
|
||||
}
|
||||
|
||||
|
||||
|
||||
export type formDataEnumKeyJointType = keyof typeof formDataEnum
|
||||
|
||||
export type formColumnListType<T extends formDataEnumKeyJointType> = {
|
||||
@ -49,7 +51,7 @@ export type tableDataType<T extends authorityDataListType> = {
|
||||
roleCode: number
|
||||
roleName: string
|
||||
listName: T['authorityName']
|
||||
authList: T['id'][]
|
||||
authList: number[]
|
||||
}
|
||||
|
||||
export type tableColumnType<T extends tableDataColumnTypeJointType> = {
|
||||
|
@ -132,10 +132,10 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属设备:">
|
||||
<el-form-item label="所属风电场:">
|
||||
<el-tree-select
|
||||
:disabled="editDeviceData.objectType === '风电场'"
|
||||
:placeholder="editAddDeviceData.objectType === '风电场' ? '该所属设备不可选择' : '请选择所属设备'"
|
||||
:placeholder="editDeviceData.objectType === '风电场' ? '无' : '请选择所属风电场'"
|
||||
v-model="editDeviceData.parentEquipmentId"
|
||||
:data="belongingEquipment"
|
||||
:props="defaultEquipmentProps"
|
||||
@ -145,6 +145,16 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属线路:">
|
||||
<el-input placeholder="请输入所属线路" v-model="editDeviceData.belongLine" style="width: 200px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="标杆机组:">
|
||||
<el-switch @change="edithandleSwitchChange" :active-value="1" :inactive-value="0" v-model="editDeviceData.standard" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
@ -277,10 +287,10 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属设备:">
|
||||
<el-form-item label="所属风电场:">
|
||||
<el-tree-select
|
||||
:disabled="editAddDeviceData.objectType === '风电场'"
|
||||
:placeholder="editAddDeviceData.objectType === '风电场' ? '该所属设备不可选择' : '请选择所属设备'"
|
||||
:placeholder="editAddDeviceData.objectType === '风电场' ? '无' : '请选择所属风电场'"
|
||||
v-model="editAddDeviceData.parentEquipmentId"
|
||||
:data="belongingEquipment"
|
||||
:props="defaultEquipmentProps"
|
||||
@ -290,6 +300,21 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属线路:">
|
||||
<el-input placeholder="请输入所属线路" v-model="editAddDeviceData.belongLine" style="width: 200px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="标杆机组:">
|
||||
<el-switch
|
||||
@change="addhandleSwitchChange"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
v-model="editAddDeviceData.standard"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
@ -416,7 +441,6 @@ const equipTypeList = () => {
|
||||
formQuery.pageNum = currentPage.value
|
||||
formQuery.objectType = res.data[0].equipmentTypeId
|
||||
equipQuery(formQuery).then((res) => {
|
||||
|
||||
deviceList.value = res.rows
|
||||
pageTotal.value = res.total
|
||||
})
|
||||
@ -424,7 +448,7 @@ const equipTypeList = () => {
|
||||
equipModeList({
|
||||
objectType: res.data[0].equipmentTypeId,
|
||||
})
|
||||
queryParameter.value.equipmentTypeId = res.data[0].equipmentTypeId
|
||||
queryParameter.value.equipmentTypeId = res.data[0].equipmentTypeId
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -451,9 +475,17 @@ const equipOrgList = () => {
|
||||
const belongingEquipment = ref()
|
||||
const equipOrgBelonging = () => {
|
||||
equipTree().then((res) => {
|
||||
belongingEquipment.value = res.data
|
||||
belongingEquipment.value = filterEquipments(res.data)
|
||||
})
|
||||
}
|
||||
const filterEquipments = (data: any) => {
|
||||
return data
|
||||
.filter((item: any) => item.objectType == 10001)
|
||||
?.map((item: any) => ({
|
||||
...item,
|
||||
equipChildren: filterEquipments(item.equipChildren),
|
||||
}))
|
||||
}
|
||||
|
||||
const treeSelectLoad = (node: any, resolve: any) => {
|
||||
if (node.level === 0) {
|
||||
@ -474,8 +506,7 @@ const treeSelectLoad = (node: any, resolve: any) => {
|
||||
}
|
||||
return resolve(res.data)
|
||||
})
|
||||
.catch((err) => {
|
||||
})
|
||||
.catch((err) => {})
|
||||
}
|
||||
}
|
||||
|
||||
@ -510,6 +541,7 @@ const handleNodeClick = (data: any) => {
|
||||
formQuery.objectType = data.equipmentTypeId
|
||||
equipQuery(formQuery).then((res) => {
|
||||
deviceList.value = res.rows
|
||||
|
||||
pageTotal.value = res.total
|
||||
})
|
||||
equipModeList({
|
||||
@ -600,6 +632,8 @@ const addDeviceList = () => {
|
||||
editAddDeviceData.orgId = ''
|
||||
editAddDeviceData.parentEquipmentId = ''
|
||||
editAddDeviceData.iotModelId = ''
|
||||
editAddDeviceData.belongLine = ''
|
||||
editAddDeviceData.standard = 0
|
||||
}
|
||||
|
||||
// 查看设备详情
|
||||
@ -620,6 +654,8 @@ const editDeviceData = reactive({
|
||||
parentEquipmentId: '',
|
||||
iotModelId: '',
|
||||
id: '',
|
||||
belongLine: '',
|
||||
standard: 0,
|
||||
})
|
||||
|
||||
const size = ref<'default' | 'large' | 'small'>('default')
|
||||
@ -647,6 +683,8 @@ const viewDeviceDetails = (data: any) => {
|
||||
editDeviceData.orgId = data.row.orgId
|
||||
editDeviceData.parentEquipmentId = data.row.parentEquipmentId
|
||||
editDeviceData.iotModelId = data.row.iotModelId
|
||||
editDeviceData.belongLine = data.row.belongLine
|
||||
editDeviceData.standard = data.row.standard || 0
|
||||
}
|
||||
|
||||
// 设备删除
|
||||
@ -766,7 +804,15 @@ const editAddDeviceData = reactive({
|
||||
orgId: '',
|
||||
parentEquipmentId: '',
|
||||
iotModelId: '',
|
||||
belongLine: '',
|
||||
standard: 0,
|
||||
})
|
||||
const addhandleSwitchChange = (value: any) => {
|
||||
editAddDeviceData.standard = value ? 1 : 0
|
||||
}
|
||||
const edithandleSwitchChange = (value: any) => {
|
||||
editDeviceData.standard = value ? 1 : 0
|
||||
}
|
||||
|
||||
// 设备新增字段校验
|
||||
const editAddDeviceRules = reactive({
|
||||
|
Loading…
Reference in New Issue
Block a user