Commit 38a54565 by 蒋勇

d

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