Former-commit-id: cb1ee1e363ad68e14f40151485aa76868daa6aa8
master
王兵 5 years ago
parent 7fbcc6e7fb
commit 6011c721a3

@ -731,5 +731,62 @@
' filterable ' + ' filterable ' +
' :placeholder="placeholder">' + ' :placeholder="placeholder">' +
'</el-cascader>' '</el-cascader>'
});
//下拉按钮
Vue.component('wb-dropdown', {
data: function () {
return {
items: []
}
},
props: {
size: {
type: String,
default: 'small'
},
type: {
type: String,
default: 'primary'
},
splitButton: {
type: Boolean,
default: true
},
},
methods: {
input: function (value) {
this.$emit('input', value[value.length - 1]);
},
onCommand: function (index) {
if (this.items[index].click) {
this.items[index].click();
}
}
},
created: function () {
for (var i = 0; i < this.$slots.default.length; i++) {
var tag = this.$slots.default[i];
if (tag.tag === 'wb-dropdown-item') {
this.items.push({
value: tag.data.attrs ? tag.data.attrs['value'] : "",
icon: tag.data.attrs ? tag.data.attrs['icon'] : "",
click: tag.data.on ? tag.data.on['click'] : undefined
}) })
}
}
},
template: '' +
'<el-dropdown ' +
' :size="size" ' +
' :type="type" ' +
' :split-button="splitButton" ' +
' @click="onCommand(0)" ' +
' @command="onCommand"><i :class="items[0].icon"></i>{{items[0].value}}' +
' <el-dropdown-menu slot="dropdown">' +
' <el-dropdown-item v-for="(item,index) in items" :key="index" v-if="index != 0" :command="index" :icon="item.icon">' +
' {{item.value}}' +
' </el-dropdown-item>' +
' </el-dropdown-menu>' +
'</el-dropdown>'
});
</script> </script>

@ -144,14 +144,10 @@
width="120" width="120"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])" <wb-dropdown>
@command="onCommand"> <wb-dropdown-item value="编辑" icon="el-icon-edit" @click="onEdit(scope.row)"></wb-dropdown-item>
<i class="el-icon-edit"></i>编辑 <wb-dropdown-item value="删除" icon="el-icon-delete" @click="onDelete(scope.row)"></wb-dropdown-item>
<el-dropdown-menu slot="dropdown"> </wb-dropdown>
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -300,11 +296,7 @@
</#if> </#if>
</#list> </#list>
}, },
onCommand: function (arg) { onEdit: function (item) {
const cmd = arg[0];
const item = arg[1];
switch (cmd) {
case "edit":
this.form.title = "${table.tableComment?default("")}编辑"; this.form.title = "${table.tableComment?default("")}编辑";
this.form.dialog = true; this.form.dialog = true;
this.form.id = item.id; this.form.id = item.id;
@ -314,15 +306,29 @@
</#if> </#if>
</#list> </#list>
this.form.rowVersion = item.rowVersion; this.form.rowVersion = item.rowVersion;
break;
case "delete":
this.onDelete(item);
break;
default:
nav.w("未找到对应的命令");
break;
}
}, },
onDelete: function (item) {
this.$confirm('将删除该项, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
new Ajax()
.module(this.module)
.target(this.target)
.data({id: item.id})
.delete(function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.s("删除成功");
this.onFind();
}
}.bind(this))
}.bind(this)).catch(function (action) {
});
}
}, },
mounted: function () { mounted: function () {
this.onFind(); this.onFind();

@ -85,8 +85,8 @@
width="80" width="80"
label="是否有效"> label="是否有效">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag size="mini" type="success" v-if="scope.row.valid">有效</el-tag> <el-tag size="mini" effect="dark" type="success" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="danger" v-if="!scope.row.valid">无效</el-tag> <el-tag size="mini" effect="dark" type="danger" v-if="!scope.row.valid">无效</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -126,14 +126,10 @@
width="120" width="120"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])" <wb-dropdown>
@command="onCommand"> <wb-dropdown-item value="编辑" icon="el-icon-edit" @click="onEdit(scope.row)"></wb-dropdown-item>
<i class="el-icon-edit"></i>编辑 <wb-dropdown-item value="删除" icon="el-icon-delete" @click="onDelete(scope.row)"></wb-dropdown-item>
<el-dropdown-menu slot="dropdown"> </wb-dropdown>
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -301,6 +297,38 @@
this.form.deptAlias = ""; this.form.deptAlias = "";
this.form.valid = true; this.form.valid = true;
}, },
onEdit: function (item) {
this.form.title = "部门编辑";
this.form.dialog = true;
this.form.id = item.id;
this.form.deptCode = item.deptCode;
this.form.deptName = item.deptName;
this.form.deptAlias = item.deptAlias;
this.form.valid = item.valid;
this.form.rowVersion = item.rowVersion;
},
onDelete: function (item) {
this.$confirm('将删除该项, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
new Ajax()
.module(this.module)
.target(this.target)
.data({id: item.id})
.delete(function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.s("删除成功");
this.onFind();
}
}.bind(this))
}.bind(this)).catch(function (action) {
});
},
onTreeCreate: function (pItem) { onTreeCreate: function (pItem) {
this.form.title = "部门新增"; this.form.title = "部门新增";
this.form.dialog = true; this.form.dialog = true;
@ -327,28 +355,6 @@
if (!value) return true; if (!value) return true;
return data.deptName.indexOf(value) !== -1; return data.deptName.indexOf(value) !== -1;
}, },
onCommand: function (arg) {
const cmd = arg[0];
const item = arg[1];
switch (cmd) {
case "edit":
this.form.title = "部门编辑";
this.form.dialog = true;
this.form.id = item.id;
this.form.deptCode = item.deptCode;
this.form.deptName = item.deptName;
this.form.deptAlias = item.deptAlias;
this.form.valid = item.valid;
this.form.rowVersion = item.rowVersion;
break;
case "delete":
this.onDelete(item);
break;
default:
nav.w("未找到对应的命令");
break;
}
},
onLoadTree: function () { onLoadTree: function () {
new Ajax() new Ajax()
.module("system") .module("system")

@ -72,8 +72,8 @@
width="80" width="80"
label="是否有效"> label="是否有效">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag size="mini" type="success" v-if="scope.row.valid">有效</el-tag> <el-tag size="mini" effect="dark" type="success" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="danger" v-if="!scope.row.valid">无效</el-tag> <el-tag size="mini" effect="dark" type="danger" v-if="!scope.row.valid">无效</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -102,15 +102,11 @@
width="120" width="120"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown size="mini" type="primary" split-button @click="onCommand(['view',scope.row])" <wb-dropdown>
@command="onCommand"> <wb-dropdown-item value="查看" icon="el-icon-tickets" @click="onView(scope.row)"></wb-dropdown-item>
<i class="el-icon-tickets"></i>查看 <wb-dropdown-item value="编辑" icon="el-icon-edit" @click="onEdit(scope.row)"></wb-dropdown-item>
<el-dropdown-menu slot="dropdown"> <wb-dropdown-item value="删除" icon="el-icon-delete" @click="onDelete(scope.row)"></wb-dropdown-item>
<el-dropdown-item :command="['edit',scope.row]" icon="el-icon-edit">编辑</el-dropdown-item> </wb-dropdown>
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -222,11 +218,7 @@
this.form.version = ''; this.form.version = '';
this.form.valid = true; this.form.valid = true;
}, },
onCommand: function (args) { onEdit: function (item) {
const cmd = args[0];
const item = args[1];
switch (cmd) {
case "edit":
this.form.title = '字典编辑'; this.form.title = '字典编辑';
this.form.dialog = true; this.form.dialog = true;
this.form.id = item.id; this.form.id = item.id;
@ -235,11 +227,30 @@
this.form.version = item.version; this.form.version = item.version;
this.form.valid = item.valid; this.form.valid = item.valid;
this.form.rowVersion = item.rowVersion; this.form.rowVersion = item.rowVersion;
break; },
case "delete": onDelete: function (item) {
this.onDelete(item); this.$confirm('将删除该项, 是否继续?', '提示', {
break; confirmButtonText: '确定',
case "view": cancelButtonText: '取消',
type: 'warning'
}).then(function () {
new Ajax()
.module(this.module)
.target(this.target)
.data({id: item.id})
.delete(function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.s("删除成功");
this.onFind();
}
}.bind(this))
}.bind(this)).catch(function (action) {
});
},
onView: function (item) {
if (!parent || !parent.index) { if (!parent || !parent.index) {
nav.e("找不到上级页面!"); nav.e("找不到上级页面!");
} else { } else {
@ -249,11 +260,6 @@
url: "${context}/system/dictItem.htm?dictName=" + item.dictName url: "${context}/system/dictItem.htm?dictName=" + item.dictName
}); });
} }
break;
default:
nav.w("未找到对应的命令");
break;
}
} }
}, },
mounted: function () { mounted: function () {

@ -75,8 +75,8 @@
width="80" width="80"
label="是否有效"> label="是否有效">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag size="mini" type="success" v-if="scope.row.valid">有效</el-tag> <el-tag size="mini" effect="dark" type="success" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="danger" v-if="!scope.row.valid">无效</el-tag> <el-tag size="mini" effect="dark" type="danger" v-if="!scope.row.valid">无效</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -105,14 +105,10 @@
width="120" width="120"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])" <wb-dropdown>
@command="onCommand"> <wb-dropdown-item value="编辑" icon="el-icon-edit" @click="onEdit(scope.row)"></wb-dropdown-item>
<i class="el-icon-edit"></i>编辑 <wb-dropdown-item value="删除" icon="el-icon-delete" @click="onDelete(scope.row)"></wb-dropdown-item>
<el-dropdown-menu slot="dropdown"> </wb-dropdown>
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -217,11 +213,7 @@
this.form.sort = this.vm.totalCount + 1; this.form.sort = this.vm.totalCount + 1;
this.form.valid = true; this.form.valid = true;
}, },
onCommand: function (arg) { onEdit: function (item) {
const cmd = arg[0];
const item = arg[1];
switch (cmd) {
case "edit":
this.form.title = '字典项编辑'; this.form.title = '字典项编辑';
this.form.dialog = true; this.form.dialog = true;
this.form.id = item.id; this.form.id = item.id;
@ -231,14 +223,28 @@
this.form.sort = item.sort; this.form.sort = item.sort;
this.form.valid = item.valid; this.form.valid = item.valid;
this.form.rowVersion = item.rowVersion; this.form.rowVersion = item.rowVersion;
break; },
case "delete": onDelete: function (item) {
this.onDelete(item); this.$confirm('将删除该项, 是否继续?', '提示', {
break; confirmButtonText: '确定',
default: cancelButtonText: '取消',
nav.w("未找到对应的命令"); type: 'warning'
break; }).then(function () {
new Ajax()
.module(this.module)
.target(this.target)
.data({id: item.id})
.delete(function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.s("删除成功");
this.onFind();
} }
}.bind(this))
}.bind(this)).catch(function (action) {
});
} }
}, },
mounted: function () { mounted: function () {

@ -94,14 +94,10 @@
width="120" width="120"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])" <wb-dropdown>
@command="onCommand"> <wb-dropdown-item value="编辑" icon="el-icon-edit" @click="onEdit(scope.row)"></wb-dropdown-item>
<i class="el-icon-edit"></i>编辑 <wb-dropdown-item value="删除" icon="el-icon-delete" @click="onDelete(scope.row)"></wb-dropdown-item>
<el-dropdown-menu slot="dropdown"> </wb-dropdown>
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -222,11 +218,7 @@
this.form.url = ""; this.form.url = "";
this.form.urlDownload = ""; this.form.urlDownload = "";
}, },
onCommand: function (arg) { onEdit: function (item) {
const cmd = arg[0];
const item = arg[1];
switch (cmd) {
case "edit":
this.form.title = "文件编辑"; this.form.title = "文件编辑";
this.form.dialog = true; this.form.dialog = true;
this.form.id = item.id; this.form.id = item.id;
@ -238,15 +230,29 @@
this.form.url = item.url; this.form.url = item.url;
this.form.urlDownload = item.urlDownload; this.form.urlDownload = item.urlDownload;
this.form.rowVersion = item.rowVersion; this.form.rowVersion = item.rowVersion;
break;
case "delete":
this.onDelete(item);
break;
default:
nav.w("未找到对应的命令");
break;
}
}, },
onDelete: function (item) {
this.$confirm('将删除该项, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
new Ajax()
.module(this.module)
.target(this.target)
.data({id: item.id})
.delete(function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.s("删除成功");
this.onFind();
}
}.bind(this))
}.bind(this)).catch(function (action) {
});
}
}, },
mounted: function () { mounted: function () {
this.onFind(); this.onFind();

@ -119,14 +119,10 @@
width="120" width="120"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])" <wb-dropdown>
@command="onCommand"> <wb-dropdown-item value="编辑" icon="el-icon-edit" @click="onEdit(scope.row)"></wb-dropdown-item>
<i class="el-icon-edit"></i>编辑 <wb-dropdown-item value="删除" icon="el-icon-delete" @click="onDelete(scope.row)"></wb-dropdown-item>
<el-dropdown-menu slot="dropdown"> </wb-dropdown>
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -187,7 +183,7 @@
vm: {//条件及分页参数 vm: {//条件及分页参数
logErrType: "", logErrType: "",
title: "", title: "",
logErrResult: "", logErrResult: "未处理",
attribute1: "", attribute1: "",
attribute2: "", attribute2: "",
attribute3: "", attribute3: "",
@ -246,11 +242,7 @@
this.form.attribute2 = ""; this.form.attribute2 = "";
this.form.attribute3 = ""; this.form.attribute3 = "";
}, },
onCommand: function (arg) { onEdit: function (item) {
const cmd = arg[0];
const item = arg[1];
switch (cmd) {
case "edit":
this.form.title = "错误日志编辑"; this.form.title = "错误日志编辑";
this.form.dialog = true; this.form.dialog = true;
this.form.id = item.id; this.form.id = item.id;
@ -262,15 +254,29 @@
this.form.attribute2 = item.attribute2; this.form.attribute2 = item.attribute2;
this.form.attribute3 = item.attribute3; this.form.attribute3 = item.attribute3;
this.form.rowVersion = item.rowVersion; this.form.rowVersion = item.rowVersion;
break; },
case "delete": onDelete: function (item) {
this.onDelete(item); this.$confirm('将删除该项, 是否继续?', '提示', {
break; confirmButtonText: '确定',
default: cancelButtonText: '取消',
nav.w("未找到对应的命令"); type: 'warning'
break; }).then(function () {
} new Ajax()
.module(this.module)
.target(this.target)
.data({id: item.id})
.delete(function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.s("删除成功");
this.onFind();
} }
}.bind(this))
}.bind(this)).catch(function (action) {
});
},
}, },
mounted: function () { mounted: function () {
this.onFind(); this.onFind();

@ -81,8 +81,8 @@
label="是否有效" label="是否有效"
width="80"> width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag size="mini" type="success" v-if="scope.row.valid">有效</el-tag> <el-tag size="mini" effect="dark" type="success" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="danger" v-if="!scope.row.valid">无效</el-tag> <el-tag size="mini" effect="dark" type="danger" v-if="!scope.row.valid">无效</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -119,15 +119,10 @@
width="120" width="120"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown size="mini" split-button type="primary" <wb-dropdown>
@click="onCommand(['edit',scope.row])" <wb-dropdown-item value="编辑" icon="el-icon-edit" @click="onEdit(scope.row)"></wb-dropdown-item>
@command="onCommand"> <wb-dropdown-item value="删除" icon="el-icon-delete" @click="onDelete(scope.row)"></wb-dropdown-item>
<i class="el-icon-edit"></i>编辑 </wb-dropdown>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -306,6 +301,39 @@
this.form.resValue = ""; this.form.resValue = "";
this.form.valid = true; this.form.valid = true;
}, },
onEdit: function (item) {
this.form.title = "资源编辑";
this.form.dialog = true;
this.form.id = item.id;
this.form.resCode = item.resCode;
this.form.resName = item.resName;
this.form.resType = item.resType;
this.form.resValue = item.resValue;
this.form.valid = item.valid;
this.form.rowVersion = item.rowVersion;
},
onDelete: function (item) {
this.$confirm('将删除该项, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
new Ajax()
.module(this.module)
.target(this.target)
.data({id: item.id})
.delete(function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.s("删除成功");
this.onFind();
}
}.bind(this))
}.bind(this)).catch(function (action) {
});
},
onTreeCreate: function (pItem) { onTreeCreate: function (pItem) {
this.form.title = "资源新增"; this.form.title = "资源新增";
this.form.dialog = true; this.form.dialog = true;
@ -334,29 +362,6 @@
if (!value) return true; if (!value) return true;
return data.comment.indexOf(value) !== -1; return data.comment.indexOf(value) !== -1;
}, },
onCommand: function (arg) {
const cmd = arg[0];
const item = arg[1];
switch (cmd) {
case "edit":
this.form.title = "资源编辑";
this.form.dialog = true;
this.form.id = item.id;
this.form.resCode = item.resCode;
this.form.resName = item.resName;
this.form.resType = item.resType;
this.form.resValue = item.resValue;
this.form.valid = item.valid;
this.form.rowVersion = item.rowVersion;
break;
case "delete":
this.onDelete(item);
break;
default:
nav.w("未找到对应的命令");
break;
}
},
onLoadTree: function () { onLoadTree: function () {
new Ajax() new Ajax()
.module("system") .module("system")

@ -90,13 +90,11 @@
width="120" width="120"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])" @command="onCommand"> <wb-dropdown>
<i class="el-icon-edit">编辑</i> <wb-dropdown-item value="编辑" icon="el-icon-edit" @click="onEdit(scope.row)"></wb-dropdown-item>
<el-dropdown-menu slot="dropdown"> <wb-dropdown-item value="授权" icon="el-icon-edit" @click="onResEdit(scope.row)"></wb-dropdown-item>
<el-dropdown-item :command="['resourceEdit',scope.row]" icon="el-icon-edit">分配资源</el-dropdown-item> <wb-dropdown-item value="删除" icon="el-icon-delete" @click="onDelete(scope.row)"></wb-dropdown-item>
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除</el-dropdown-item> </wb-dropdown>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -214,11 +212,7 @@
this.form.name = ""; this.form.name = "";
this.form.comment = ""; this.form.comment = "";
}, },
onCommand: function (arg) { onEdit: function (item) {
const cmd = arg[0];
const item = arg[1];
switch (cmd) {
case "edit":
this.form.title = "角色编辑"; this.form.title = "角色编辑";
this.form.dialog = true; this.form.dialog = true;
this.form.id = item.id; this.form.id = item.id;
@ -226,8 +220,30 @@
this.form.name = item.name; this.form.name = item.name;
this.form.comment = item.comment; this.form.comment = item.comment;
this.form.rowVersion = item.rowVersion; this.form.rowVersion = item.rowVersion;
break; },
case "resourceEdit": onDelete: function (item) {
this.$confirm('将删除该项, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
new Ajax()
.module(this.module)
.target(this.target)
.data({id: item.id})
.delete(function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.s("删除成功");
this.onFind();
}
}.bind(this))
}.bind(this)).catch(function (action) {
});
},
onResEdit: function (item) {
this.formResource.title = "分配资源"; this.formResource.title = "分配资源";
this.formResource.dialog = true; this.formResource.dialog = true;
this.formResource.roleId = item.id; this.formResource.roleId = item.id;
@ -248,14 +264,6 @@
this.$refs.tree.setCheckedKeys(ids); this.$refs.tree.setCheckedKeys(ids);
} }
}.bind(this)) }.bind(this))
break;
case "delete":
this.onDelete(item);
break;
default:
nav.w("未找到对应的命令");
break;
}
}, },
onCheck: function (item, status) { onCheck: function (item, status) {
new Ajax() new Ajax()

@ -86,8 +86,8 @@
prop="valid" prop="valid"
label="是否有效"> label="是否有效">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag size="mini" type="success" v-if="scope.row.valid">有效</el-tag> <el-tag size="mini" effect="dark" type="success" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="danger" v-if="!scope.row.valid">无效</el-tag> <el-tag size="mini" effect="dark" type="danger" v-if="!scope.row.valid">无效</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -147,14 +147,9 @@
width="120" width="120"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['logout',scope.row])" <wb-dropdown>
@command="onCommand"> <wb-dropdown-item value="注销" icon="el-icon-edit" @click="onLogout(scope.row)"></wb-dropdown-item>
<i class="el-icon-edit"></i>注销 </wb-dropdown>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -248,14 +243,7 @@
} }
}, },
methods: { methods: {
onCommand: function (arg) { onLogout:function (item) {
const cmd = arg[0];
const item = arg[1];
switch (cmd) {
case "delete":
this.onDelete(item);
break;
case "logout":
this.$confirm('将注销该用户的登录信息, 是否继续?', '提示', { this.$confirm('将注销该用户的登录信息, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
@ -277,13 +265,8 @@
}.bind(this)).catch(function (action) { }.bind(this)).catch(function (action) {
}); });
break;
default:
nav.w("未找到对应的命令");
break;
} }
}, },
},
mounted: function () { mounted: function () {
this.onFind(); this.onFind();
}, },

@ -95,8 +95,8 @@
prop="userStatus" prop="userStatus"
label="用户状态"> label="用户状态">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag size="mini" type="success" v-if="scope.row.userStatus=='正常'">{{scope.row.userStatus}}</el-tag> <el-tag size="mini" effect="dark" type="success" v-if="scope.row.userStatus=='正常'">{{scope.row.userStatus}}</el-tag>
<el-tag size="mini" type="danger" v-if="!scope.row.userStatus=='正常'">{{scope.row.userStatus}}</el-tag> <el-tag size="mini" effect="dark" type="danger" v-if="!scope.row.userStatus=='正常'">{{scope.row.userStatus}}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -116,14 +116,10 @@
width="120" width="120"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])" <wb-dropdown>
@command="onCommand"> <wb-dropdown-item value="编辑" icon="el-icon-edit" @click="onEdit(scope.row)"></wb-dropdown-item>
<i class="el-icon-edit"></i>编辑 <wb-dropdown-item value="删除" icon="el-icon-delete" @click="onDelete(scope.row)"></wb-dropdown-item>
<el-dropdown-menu slot="dropdown"> </wb-dropdown>
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -249,11 +245,7 @@
this.form.deptCode = ""; this.form.deptCode = "";
this.form.deptName = ""; this.form.deptName = "";
}, },
onCommand: function (arg) { onEdit: function (item) {
const cmd = arg[0];
const item = arg[1];
switch (cmd) {
case "edit":
this.form.title = "用户编辑"; this.form.title = "用户编辑";
this.form.dialog = true; this.form.dialog = true;
this.form.id = item.id; this.form.id = item.id;
@ -267,14 +259,28 @@
this.form.deptName = item.deptName; this.form.deptName = item.deptName;
this.form.roleCodeList = item.roleCodes.split(",") this.form.roleCodeList = item.roleCodes.split(",")
this.form.rowVersion = item.rowVersion; this.form.rowVersion = item.rowVersion;
break; },
case "delete": onDelete: function (item) {
this.onDelete(item); this.$confirm('将删除该项, 是否继续?', '提示', {
break; confirmButtonText: '确定',
default: cancelButtonText: '取消',
nav.w("未找到对应的命令"); type: 'warning'
break; }).then(function () {
new Ajax()
.module(this.module)
.target(this.target)
.data({id: item.id})
.delete(function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.s("删除成功");
this.onFind();
} }
}.bind(this))
}.bind(this)).catch(function (action) {
});
}, },
loadRoles: function () { loadRoles: function () {
new Ajax() new Ajax()
@ -298,6 +304,6 @@
mounted: function () { mounted: function () {
this.onFind(); this.onFind();
this.loadRoles(); this.loadRoles();
}, }
}) })
</script> </script>

Loading…
Cancel
Save

Powered by TurnKey Linux.