Commit 38a54565 by 蒋勇

d

parent c811efaa
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
"title":"功能清单", "title":"功能清单",
cols:1, cols:1,
ctls:[ ctls:[
{ "type": "textarea", "label": "功能清单", "prop": "functionJSON", "placeHolder": "请输入功能清单", "style": {width:"100%",height:"400px"}, rules: [{ validator: "validatex", trigger: "blur" }]}, { "type": "textarea", "label": "功能清单", "prop": "functionJSON", "placeHolder": "请输入功能清单", "style": {width:"100%",height:"400px"}, rules: [{ validator: "validatex", trigger: "blur",iscustom:true}]},
// { "type": "upload", "label": "功能清单", "prop": "functionUrl", "placeHolder": "请上传功能清单", "style": "", rules: [] }, // { "type": "upload", "label": "功能清单", "prop": "functionUrl", "placeHolder": "请上传功能清单", "style": "", rules: [] },
] ]
}, },
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
metaName="app_info" metaName="app_info"
packageName="common" packageName="common"
isMulti isMulti
:refvalidatemethod2="validatemethod" :refvalidatemethod="validmethod"
@onexec="onexec" @onexec="onexec"
></BizTable> ></BizTable>
</div> </div>
...@@ -22,16 +22,14 @@ export default { ...@@ -22,16 +22,14 @@ export default {
BizTable BizTable
}, },
methods: { methods: {
onexec(k,row){ onexec(k, row) {},
validmethod(rule, value, callback) {
}, if (rule.field == "functionJSON") {
validatemethod(rule, value, callback) { try {
if(rule.field=="functionJSON"){ let j = JSON.parse(value);
try{ console.log(j);
let j= JSON.parse(value) } catch (e) {
console.log(j) return callback(new Error(e));
}catch(e){
return callback(new Error(e))
} }
} }
if (rule.field == "hosts") { if (rule.field == "hosts") {
...@@ -44,16 +42,17 @@ export default { ...@@ -44,16 +42,17 @@ export default {
let attrpaths = value.split(","); let attrpaths = value.split(",");
if (attrpaths.length == 0) { if (attrpaths.length == 0) {
callback(new Error("多个路径需要以逗号分隔")); callback(new Error("多个路径需要以逗号分隔"));
}else{ } else {
attrpaths.forEach(p=>{ attrpaths.forEach(p => {
if(!p.startsWith("/")){ if (!p.startsWith("/")) {
return callback(new Error("路径必须以/开始")) return callback(new Error("路径必须以/开始"));
} }
}) });
} }
} }
return callback(); return callback();
}, },
// onnew() { // onnew() {
// this.$refs.bt.setFormCtlVisable("userName", true); // this.$refs.bt.setFormCtlVisable("userName", true);
// }, // },
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
metaName="app_info" metaName="app_info"
packageName="common" packageName="common"
isMulti isMulti
:refvalidatemethod="validmethod"
@onexec="onexec" @onexec="onexec"
></BizTable> ></BizTable>
</div> </div>
...@@ -21,12 +22,39 @@ export default { ...@@ -21,12 +22,39 @@ export default {
BizTable BizTable
}, },
methods: { methods: {
onexec(k,row){ onexec(k, row) {
if(k=="func"){ if (k == "func") {
} }
}, },
validmethod(rule, value, callback) {
if (rule.field == "functionJSON") {
try {
let j = JSON.parse(value);
console.log(j);
} catch (e) {
return callback(new Error(e));
}
}
if (rule.field == "hosts") {
let attrhosts = value.split(",");
if (attrhosts.length == 0) {
callback(new Error("多个域名需要以逗号分隔"));
}
}
if (rule.field == "paths") {
let attrpaths = value.split(",");
if (attrpaths.length == 0) {
callback(new Error("多个路径需要以逗号分隔"));
} else {
attrpaths.forEach(p => {
if (!p.startsWith("/")) {
return callback(new Error("路径必须以/开始"));
}
});
}
}
return callback();
},
// onnew() { // onnew() {
// this.$refs.bt.setFormCtlVisable("userName", true); // this.$refs.bt.setFormCtlVisable("userName", true);
// }, // },
......
...@@ -74,7 +74,8 @@ ...@@ -74,7 +74,8 @@
ref="edform" ref="edform"
:fminfo="forminfo" :fminfo="forminfo"
style="height:100%" style="height:100%"
:refvalidatemethod="refvalidatemethod2" :refvalidatemethod="refvalidatemethod"
v-if="showedform"
> >
<template v-slot:default="slotProps"> <template v-slot:default="slotProps">
<Button <Button
...@@ -120,12 +121,12 @@ export default { ...@@ -120,12 +121,12 @@ export default {
Forms Forms
}, },
props: { props: {
isLazy:Boolean, isLazy: Boolean,
isChildList:Boolean, isChildList: Boolean,
initWhere: { initWhere: {
type: Object, type: Object,
default(){ default() {
return {} return {};
} }
}, },
initPropZIndex: { initPropZIndex: {
...@@ -163,8 +164,8 @@ export default { ...@@ -163,8 +164,8 @@ export default {
return (row, key, index) => row[key]; return (row, key, index) => row[key];
} }
}, },
refvalidatemethod2: { refvalidatemethod: {
type: Function, type: Function
// default() { // default() {
// return (rule, value, callback) => { // return (rule, value, callback) => {
// return callback(); // return callback();
...@@ -205,11 +206,11 @@ export default { ...@@ -205,11 +206,11 @@ export default {
}, },
methods: { methods: {
ondrawvisable(v) { ondrawvisable(v) {
if(v){ if (v) {
this.initZIndex = this.initZIndex; this.initZIndex = this.initZIndex;
$("div.ivu-drawer-wrap:even").map((index,item)=>{ $("div.ivu-drawer-wrap:even").map((index, item) => {
$(item).css("z-index",""+(this.initZIndex++)) $(item).css("z-index", "" + this.initZIndex++);
}) });
} }
}, },
setFormCtlVisable(prop, isShow) { setFormCtlVisable(prop, isShow) {
...@@ -229,10 +230,10 @@ export default { ...@@ -229,10 +230,10 @@ export default {
} else { } else {
rtn.search = this.$refs.searchform.formModel; rtn.search = this.$refs.searchform.formModel;
} }
if(this.initWhere){ if (this.initWhere) {
rtn.search=Object.assign(rtn.search,this.initWhere) rtn.search = Object.assign(rtn.search, this.initWhere);
} }
console.log("..................rtn.search", rtn.search) console.log("..................rtn.search", rtn.search);
rtn.aggsinfo = { sum: this.sum_fields, avg: this.avg_fields }; rtn.aggsinfo = { sum: this.sum_fields, avg: this.avg_fields };
rtn.pageInfo = { rtn.pageInfo = {
pageSize: this.pageInfo.pageSize, pageSize: this.pageInfo.pageSize,
...@@ -257,7 +258,7 @@ export default { ...@@ -257,7 +258,7 @@ export default {
let url = this.buildUrl("delete"); let url = this.buildUrl("delete");
let data = { id: this.currentRow.id }; let data = { id: this.currentRow.id };
deleteData(url, data).then(res => { deleteData(url, data).then(res => {
let rtn=res.data let rtn = res.data;
if (rtn.status == 0) { if (rtn.status == 0) {
this.$Message.success("当前记录已经成功删除."); this.$Message.success("当前记录已经成功删除.");
this.fetchData(); this.fetchData();
...@@ -289,7 +290,6 @@ export default { ...@@ -289,7 +290,6 @@ export default {
}, 500); }, 500);
}, },
doexec(key, row, btninfo) { doexec(key, row, btninfo) {
if (key == "delete") { if (key == "delete") {
this.currentRow = row; this.currentRow = row;
this.isdel = true; this.isdel = true;
...@@ -306,10 +306,10 @@ export default { ...@@ -306,10 +306,10 @@ export default {
this.fm_status = "edit"; this.fm_status = "edit";
this.showedform = true; this.showedform = true;
this.$emit("onedit"); this.$emit("onedit");
setTimeout(() => { this.$nextTick(() => {
this.$refs.edform.formModel = this.deepclone(row); this.$refs.edform.formModel = this.deepclone(row);
this.$refs.edform.activeChildTables(false); this.$refs.edform.activeChildTables(false);
}, 100); });
} }
if (key == "create") { if (key == "create") {
this.fm_status = "create"; this.fm_status = "create";
...@@ -318,12 +318,12 @@ export default { ...@@ -318,12 +318,12 @@ export default {
this.$emit("onnew"); this.$emit("onnew");
} }
if (key == "save") { if (key == "save") {
console.log("beforevalid.........................") console.log("beforevalid.........................");
this.$refs.edform.validate(valid => { this.$refs.edform.validate(valid => {
console.log("valid.........................",valid) console.log("valid.........................", valid);
if (valid) { if (valid) {
if (this.clickcount["save"] == 0) { if (this.clickcount["save"] == 0) {
console.log("before.......savbeformdata...............1") console.log("before.......savbeformdata...............1");
this.clickcount["save"] = this.clickcount["save"] + 1; this.clickcount["save"] = this.clickcount["save"] + 1;
let url = ""; let url = "";
let msg = ""; let msg = "";
...@@ -334,12 +334,12 @@ export default { ...@@ -334,12 +334,12 @@ export default {
if (this.fm_status == "create") { if (this.fm_status == "create") {
url = this.buildUrl("create"); url = this.buildUrl("create");
msg = "当前的新增操作已成功."; msg = "当前的新增操作已成功.";
if(this.isChildList){ if (this.isChildList) {
//如果当前列表是作为表单子列表,那么需要设置当前新增对象的所属表单id //如果当前列表是作为表单子列表,那么需要设置当前新增对象的所属表单id
row=Object.assign(row,this.initWhere) row = Object.assign(row, this.initWhere);
} }
} }
console.log("before.......savbeformdata...............2") console.log("before.......savbeformdata...............2");
saveFormData(url, row).then(res => { saveFormData(url, row).then(res => {
let rtn = res.data; let rtn = res.data;
console.log(rtn); console.log(rtn);
...@@ -381,10 +381,9 @@ export default { ...@@ -381,10 +381,9 @@ export default {
this.advsearch(); this.advsearch();
} }
this.$emit("onexec", key, row, btninfo); this.$emit("onexec", key, row, btninfo);
console.log(key, row,"ddddddddddddddddddddddddddddddd"); console.log(key, row, "ddddddddddddddddddddddddddddddd");
}, },
doquery(q, k) { doquery(q, k) {
alert("dd")
if (k == "cancel-search") { if (k == "cancel-search") {
this.$refs.searchform.resetForm(); this.$refs.searchform.resetForm();
this.showsearch = false; this.showsearch = false;
...@@ -429,10 +428,9 @@ export default { ...@@ -429,10 +428,9 @@ export default {
}, },
mounted() { mounted() {
//从缓存中恢复查询条件 //从缓存中恢复查询条件
if(!this.isLazy){ if (!this.isLazy) {
this.fetchData(); this.fetchData();
} }
}, },
created() {}, created() {},
computed: { computed: {
......
...@@ -274,8 +274,7 @@ export default { ...@@ -274,8 +274,7 @@ export default {
metaRules: {}, metaRules: {},
btninfos: [], btninfos: [],
ctlVisable: {}, ctlVisable: {},
tabDisabled: {}, tabDisabled: {}
refvalidatemethod2: this.refvalidatemethod
}; };
}, },
watch: { watch: {
...@@ -323,20 +322,11 @@ export default { ...@@ -323,20 +322,11 @@ export default {
this.$refs.ofm.resetFields(); this.$refs.ofm.resetFields();
}, },
validatex(rule, value, callback) { validatex(rule, value, callback) {
alert(this.refvalidatemethod2); if (this.refvalidatemethod) {
// if (this.refvalidatemethod2) { return this.refvalidatemethod(rule, value, callback);
// return this.refvalidatemethod2(rule, value, callback);
// } else {
// return callback();
// }
setTimeout(() => {
if (this.refvalidatemethod2) {
return this.refvalidatemethod2(rule, value, callback);
} else { } else {
return callback(); return callback();
} }
}, 3000);
}, },
testclick() { testclick() {
console.log(JSON.stringify(this.formModel)); console.log(JSON.stringify(this.formModel));
...@@ -354,10 +344,13 @@ export default { ...@@ -354,10 +344,13 @@ export default {
} }
m.ctls.forEach(ctl => { m.ctls.forEach(ctl => {
this.$set(this.ctlVisable, ctl.prop, true); this.$set(this.ctlVisable, ctl.prop, true);
if (ctl.rules) {
if (ctl.rules && ctl.rules.length>=0) {
console.log("ctl.rules========================",ctl.prop,ctl.rules)
ctl.rules.forEach(r => { ctl.rules.forEach(r => {
if (r.validator) { if (r.iscustom) {
r.validator = this[r.validator]; console.log("validate................");
r.validator = this['validatex'];
} }
}); });
this.metaRules[ctl.prop] = ctl.rules; this.metaRules[ctl.prop] = ctl.rules;
...@@ -375,6 +368,7 @@ export default { ...@@ -375,6 +368,7 @@ export default {
this.$set(this.formModel, ctl.prop, 0); this.$set(this.formModel, ctl.prop, 0);
} else { } else {
console.log("============="); console.log("=============");
console.log("=============", ctl.prop);
this.$set(this.formModel, ctl.prop, ""); this.$set(this.formModel, ctl.prop, "");
} }
} }
......
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
style: "", style: "",
rules: [ rules: [
{ required: true, message: " ", trigger: "blur" }, { required: true, message: " ", trigger: "blur" },
{ validator: "validatex", trigger: "blur" } { validator: "validatex", trigger: "blur",iscustom:true }
] ]
}, },
{ {
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
style: "", style: "",
rules: [ rules: [
{ required: true, message: " ", trigger: "blur" }, { required: true, message: " ", trigger: "blur" },
{ validator: "validatex", trigger: "blur" } { validator: "validatex", trigger: "blur",iscustom:true}
] ]
} }
] ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment