🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
接口目录结构: ![](https://img.kancloud.cn/7b/4d/7b4d906d8f3f3411bd484e577f38b179_387x336.png) ### 1.**get** 请求:一般用于查询数据,需要传递对象 ``` //实例1 : 表格查询接口 export function flowLzTypeList(data) { return request({ url: `/workFlow/type/pageType`, method: 'get', params: data }) } 接口使用: 先引入接口:import {flowLzTypeList,} from "@/api/flow0"; getType() { flowLzTypeList(this.queryInfo).then((res) => { console.log(res); this.typeData = res.list; this.total = res.total; this.queryInfo.pageSize = res.pageSize; this.queryInfo.page = res.pageNum; this.queryInfo.pages = res.pages; }); }, 实例2:修改单条数据时通过id获取单条数据,接口需要返回查询的id export function flowLzTypeEditData(data){ return request({ url : `/workFlow/type/selectTypeById`, method : 'get', params : data }) } 接口调用: flowLzTypeEditData({ id: id }).then((res) => { this.addEditForm.lanId = res.lanId; this.addEditForm.remark = res.remark; this.addEditForm.seqNo = res.seqNo; this.editId = res.id; }); 实例三:查询表格数据,传递两个对象参数 export function flowLzNodeOptActionListQuery(data,nid){ return request({ url : `/workFlow/nodeConAction/pageC/${nid}`, method : 'get', params : data,nid }) } 使用接口: flowLzNodeOptActionListQuery(this.optActionQueryInfo,this.optActionForm.nodeId).then(res=>{ this.optActionData = res.list this.optActionQueryInfo.page = res.pageNum this.optActionQueryInfo.pageSize = res.pageSize this.optActionQueryInfo.pages = res.pages this.optActionTotal = res.total }).catch(()=>{ console.log("请求失败") }) ``` ### 2.**post**请求:一般用户提交数据 ``` 实例1 : 提交表单数据 export function flowLzTypeAdd(data){ return request({ url : `/workFlow/type/insertTypeByDto`, method : 'post', data }) } 引入后使用 : //添加类型接口 flowLzTypeAdd(this.addEditForm).then((res) => { this.$message.success("添加类型成功"); this.addEditDialogVisible = false; //重新请求数据 this.getType(); }); 实例2 : 两个参数 export function flowLzNodesSave(data,wid){ return request({ url : `/workFlow/nodeInfo/insertOrUpdateAll/${wid}`, method : 'post', data }) } 使用 : flowLzNodesSave(this.ruleForm.tableData, this.wid) .then((res) => { console.log(res); this.$message.success("新增节点成功"); this.toThird(); }) .catch((err) => { return false; }); ```