Quellcode durchsuchen

feat: 接口管理增加创建第三方服务的接口功能,并将modbus接口配置上去

yanglzh vor 1 Jahr
Ursprung
Commit
91325d39a7

+ 2 - 1
.env

@@ -25,4 +25,5 @@ VITE_TOPO_URL = '/plugin/topo/'
 # modbus服务
 VITE_MODBUS_API = '/base-api/modbus'
 # ice104协议网关服务
-VITE_ICE104_API = '/base-api/ice104'
+VITE_ICE104_API = 'http://qt9nk7.natappfree.cc'
+# VITE_ICE104_API = '/base-api/ice104'

+ 1 - 0
src/api/model/system/menu.ts

@@ -23,6 +23,7 @@ export interface ApiRow {
   parentId?: number; // parentId
   menuIds: number[]; // 名称
   types: 1 | 2; // 1 分类 2接口
+  apiTypes: string; // IOT modbus 104
   method: string; // 请求方式
   name: string; // 名称
   address: string; // 接口地址

+ 1 - 2
src/utils/request_ice104.ts

@@ -4,8 +4,7 @@ import getOrigin from '/@/utils/origin'
 
 // 配置新建一个 axios 实例
 const service = axios.create({
-	// baseURL: getOrigin(import.meta.env.VITE_ICE104_API),
-	baseURL: 'http://qt9nk7.natappfree.cc',
+	baseURL: getOrigin(import.meta.env.VITE_ICE104_API),
 	timeout: 50000,
 	headers: { 'Content-Type': 'application/json' },
 });

+ 1 - 2
src/views/iot/device/channel/component/detail.vue

@@ -156,8 +156,7 @@ export default {
 		// 获取任务list
 		getList() {
 			this.listLoading = true;
-			api.task
-				.getList(this.listQuery)
+			api.task.getList(this.listQuery)
 				.then((res: any) => {
 					this.taskList = res.list || [];
 					this.total = res.Total;

+ 1 - 2
src/views/iot/device/template/component/dataAreaDialog.vue

@@ -78,8 +78,7 @@ export default {
 	methods: {
 		getList() {
 			this.listLoading = true;
-			api.area
-				.getList({ template_number: this.templateNumber })
+			api.area.getList({ template_number: this.templateNumber })
 				.then((res: any) => {
 					this.list = res.list || [];
 					this.total = res.Total;

+ 15 - 1
src/views/system/api/component/edit.vue

@@ -17,6 +17,11 @@
 						},
 					]" :props="{ checkStrictly: true, multiple: false, emitPath: false, value: 'id', label: 'name' }" placeholder="请选择关联页面" clearable class="w100" v-model="formData.parentId"></el-cascader>
 				</el-form-item>
+				<el-form-item label="接口类型" prop="apiTypes">
+					<el-select v-model="formData.apiTypes" filterable clearable placeholder="请选择接口类型" style="width: 100%;">
+						<el-option v-for="dict in api_types" :key="dict.value" :label="dict.label" :value="dict.value"> </el-option>
+					</el-select>
+				</el-form-item>
 				<el-form-item label="分类名称" prop="name">
 					<el-input v-model="formData.name" placeholder="输入接口名称" />
 				</el-form-item>
@@ -34,6 +39,11 @@
 				<el-form-item label="接口地址" prop="address">
 					<el-input v-model="formData.address" placeholder="接口地址" />
 				</el-form-item>
+				<el-form-item label="接口类型" prop="apiTypes">
+					<el-select v-model="formData.apiTypes" filterable clearable placeholder="请选择接口类型" style="width: 100%;">
+						<el-option v-for="dict in api_types" :key="dict.value" :label="dict.label" :value="dict.value"> </el-option>
+					</el-select>
+				</el-form-item>
 				<el-form-item label="访问类型" prop="method">
 					<el-select v-model="formData.method" placeholder="请选择访问类型">
 						<el-option v-for="item in methodOptions" :key="item.value" :label="item.key" :value="item.value"></el-option>
@@ -57,7 +67,7 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, reactive, nextTick, watch } from 'vue';
+import { ref, reactive, nextTick, watch, getCurrentInstance } from 'vue';
 import api from '/@/api/system';
 import { ApiRow } from '/@/api/model/system/menu';
 import { ruleRequired } from '/@/utils/validator';
@@ -65,6 +75,8 @@ import { ElMessage } from 'element-plus';
 import apiDatahub from '/@/api/datahub';
 
 const emit = defineEmits(['getList']);
+const { proxy } = getCurrentInstance() as any;
+const { api_types } = proxy.useDict('api_types');
 
 const showDialog = ref(false);
 const formRef = ref();
@@ -78,6 +90,7 @@ const baseForm: ApiRow = {
 	parentId: undefined,
 	name: '',
 	types: 2,
+	apiTypes: '',
 	address: '',
 	method: '',
 	remark: '',
@@ -100,6 +113,7 @@ const ruleForm = {
 	parentId: [ruleRequired('上级分类不能为空', 'change')],
 	// menuIds: [ruleRequired('关联页面不能为空', 'change')],
 	method: [ruleRequired('请求方式不能为空', 'change')],
+	apiTypes: [ruleRequired('接口类型不能为空', 'change')],
 	name: [ruleRequired('接口名称不能为空')],
 	address: [ruleRequired('接口地址不能为空')],
 };