diff --git a/README.md b/README.md
index aaef5ba..a4acea8 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,12 @@
👉 https://maimengcloud.com 👈
+## 快速导航
+- [唛盟-后端开发底座](https://gitee.com/qingqinkj/mdp-core)
+- [前端组件](https://e.gitee.com/qingqinkj/repos/qingqinkj/mdp-lcode-ui-web/sources)
+- [后端服务](https://e.gitee.com/qingqinkj/repos/qingqinkj/mdp-lcode-backend/sources)
+- [体验环境](https://maimengcloud.com/lcode/m1/)
+ 登陆界面上选择演示账号登陆或者直接扫码登陆,无须注册
## 📢 简介[唛盟低代码开发平台mdp-lcode](/)
唛盟低代码开发平台简称唛盟或者mdp.
diff --git a/src/api/mdp/lcode/dev.js b/src/api/mdp/lcode/dev.js
index 87307bf..55d6a3c 100644
--- a/src/api/mdp/lcode/dev.js
+++ b/src/api/mdp/lcode/dev.js
@@ -5,4 +5,8 @@ import axios from '@/utils/request'
let base = config.getLcodeContext();
//在线生成crud代码并下载
-export const crudCodeGen = params => { return axios.get(`${base}/mdp/dev/code/gen`, {params:params}); };
\ No newline at end of file
+export const crudCodeGen = params => { return axios.get(`${base}/mdp/dev/code/gen`, {params:params}); };
+
+
+//查询数据源列表
+export const dataSourceList = params => { return axios.get(`${base}/mdp/dev/db/dataSource/list`, {params:params}); };
\ No newline at end of file
diff --git a/src/api/mdp_pub/mdp_api_base.js b/src/api/mdp_pub/mdp_api_base.js
index bd34a82..ec8bfc0 100644
--- a/src/api/mdp_pub/mdp_api_base.js
+++ b/src/api/mdp_pub/mdp_api_base.js
@@ -69,6 +69,7 @@ clearDictCache:function(itemCode,params){
**/
ajaxGetDictOptions:function(itemCode, params)
{
+ debugger;
var codeKey=funcs.getCodeKey(itemCode,params);
return new Promise((resolve,reject)=>{
var data=funcs.getDictOptionsFromCache(codeKey,itemCode,params)
@@ -108,7 +109,11 @@ ajaxGetDictOptions:function(itemCode, params)
sessionStorage.setItem(lockKey,"1")
funcs.getDicts(params).then(res=>{
- if(res.data.tips && res.data.tips.isOk && res.data.data && res.data.data.length>0){
+ if(res.data.tips && res.data.tips.isOk){
+ if(!res.data.data || res.data.data.length==0){
+ resolve({tips:res.data.tips,data:{}})
+ return;
+ }
var item=res.data.data[0]
if(item.options && item.options.length>0){
item.options.forEach(k=>{
diff --git a/src/views/mdp/lcode/formDef/Form.vue b/src/views/mdp/lcode/formDef/Form.vue
index 1a4bf9a..e5096f5 100644
--- a/src/views/mdp/lcode/formDef/Form.vue
+++ b/src/views/mdp/lcode/formDef/Form.vue
@@ -20,7 +20,7 @@
-
+
@@ -36,24 +36,32 @@
-
-
+
+
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -72,6 +80,7 @@ import { mapGetters } from 'vuex'
import { MdpFormMixin } from '@/components/mdp-ui/mixin/MdpFormMixin.js';
import FormField from '../formField/Index'
import MdpSource from '../source/Index'
+import {dataSourceList} from '@/api/mdp/lcode/dev'
export default {
name:'formDefForm',
mixins:[MdpFormMixin],
@@ -123,7 +132,7 @@ export default {
]
},
editForm: {
- id:'',tableName:'',tableOwner:'',isCreateTable:'0',formName:'',userid:'',deptid:'',formType:'',isTemplate:'',bizType:'',ctime:'',branchId:'',categoryId:'',tagIds:'',tagNames:'',username:'',deptName:'',groupsJson:'',pks:'',dataType:'1',dataField:'extInfos'
+ id:'',tableName:'',tableOwner:'',isCreateTable:'0',formName:'',userid:'',deptid:'',formType:'',isTemplate:'',bizType:'',ctime:'',branchId:'',categoryId:'',tagIds:'',tagNames:'',username:'',deptName:'',groupsJson:'',pks:'',dataType:'1',dataField:'ext_infos',ctType:'2'
},
//增删改查(含批量)接口
apis:{
@@ -138,6 +147,7 @@ export default {
}
},
methods: {
+ dataSourceList,
//由组件扩展添加其它的初始页面的逻辑(mounted+onOpen都会调用此函数,建议只添加公共逻辑)
initCurrData(){
if(!this.formId){
@@ -201,49 +211,57 @@ export default {
return true;
},
saveSubmit: function () {
- if(this.editForm.formName==''){
- this.$notify({position:'bottom-left',showClose:true,message: '表单名称不能为空', type: 'error' });
- return;
- }
- var formFields=this.$refs.formFields.getFieldList();
- if(formFields.length==0 ){
- this.$notify({position:'bottom-left',showClose:true,message: '最少需要定义一个字段', type: 'error' });
- return;
- }
- this.$confirm('确认提交吗?', '提示', {}).then(() => {
- this.load.edit=true
- let formDef = Object.assign({}, this.editForm);
- if(this.currOpType=='add'){
- formDef.deptid=this.userInfo.deptid
- formDef.branchId=this.userInfo.branchId
+ this.$refs['editFormRef'].validate(valid=>{
+ if(valid==false){
+ this.$notify({position:'bottom-left',showClose:true,message: '表单验证不通过', type: 'error' });
+ return;
}
-
- this.$refs.formFields.setPrimaryKeys();
-
- formFields.forEach((i,index)=>{i.seq=index});
- var params={formDef:formDef,formFields:formFields};
- if(!this.preParamCheck(params)){
- this.load.edit=false
+ if(this.editForm.formName==''){
+ this.$notify({position:'bottom-left',showClose:true,message: '表单名称不能为空', type: 'error' });
return;
}
- var func=this.apis.add
- if(this.currOpType=='edit'){
- func=this.apis.edit
+ var formFields=this.$refs.formFields.getFieldList();
+ if(formFields.length==0 ){
+ this.$notify({position:'bottom-left',showClose:true,message: '最少需要定义一个字段', type: 'error' });
+ return;
}
- func(params).then((res) => {
- this.load.edit=false
- var tips=res.data.tips;
- if(tips.isOk){
- this.$mdp.removeFormFieldsCache(formDef.id)
- this.currOpType='edit'
- var data=res.data.data
- Object.assign(this.editForm,data.formDef)
- this.formFields=data.formFields
- this.afterSubmit(res,tips.isOk,this.currOpType);
+ this.$confirm('确认提交吗?', '提示', {}).then(() => {
+ this.load.edit=true
+ let formDef = Object.assign({}, this.editForm);
+ if(this.currOpType=='add'){
+ formDef.deptid=this.userInfo.deptid
+ formDef.branchId=this.userInfo.branchId
+ }
+
+ this.$refs.formFields.setPrimaryKeys();
+
+ formFields.forEach((i,index)=>{i.seq=index});
+ var params={formDef:formDef,formFields:formFields};
+ if(!this.preParamCheck(params)){
+ this.load.edit=false
+ return;
+ }
+ var func=this.apis.add
+ if(this.currOpType=='edit'){
+ func=this.apis.edit
}
- this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
- }).catch( err =>this.load.edit=false);
- });
+ func(params).then((res) => {
+ this.load.edit=false
+ var tips=res.data.tips;
+ if(tips.isOk){
+ this.$mdp.removeFormFieldsCache(formDef.id)
+ this.currOpType='edit'
+ var data=res.data.data
+ Object.assign(this.editForm,data.formDef)
+ this.formFields=data.formFields
+ this.afterSubmit(res,tips.isOk,this.currOpType);
+ }
+ this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
+ }).catch( err =>this.load.edit=false);
+ });
+
+ })
+
},
goToFormDefIndex(){
this.$router.push({path:'/mdp/lcode/index'})
diff --git a/src/views/mdp/lcode/formDef/Index.vue b/src/views/mdp/lcode/formDef/Index.vue
index c16edc1..6597f29 100644
--- a/src/views/mdp/lcode/formDef/Index.vue
+++ b/src/views/mdp/lcode/formDef/Index.vue
@@ -117,11 +117,6 @@
-
-
-
-
-
@@ -136,7 +131,7 @@
设计
权限
- 数据
+ 数据