|
|
|
@ -1,9 +1,5 @@
|
|
|
|
|
<div id="app" v-cloak>
|
|
|
|
|
<el-card class="box-card">
|
|
|
|
|
<el-tabs :value="'list'">
|
|
|
|
|
<el-tab-pane label="列表展示" name="list">
|
|
|
|
|
<span slot="label"><i class="el-icon-s-operation"></i>列表展示</span>
|
|
|
|
|
|
|
|
|
|
<el-form class="search" :inline="true" :model="vm" ref="vm" label-position="right" label-width="90px">
|
|
|
|
|
<el-form-item label="资源代码" prop="resCode">
|
|
|
|
|
<el-input v-model="vm.resCode" clearable size="mini" placeholder="请输入资源代码"></el-input>
|
|
|
|
@ -33,10 +29,12 @@
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="开始日期" prop="startDate">
|
|
|
|
|
<el-date-picker v-model="vm.startDate" clearable size="mini" placeholder="请输入开始日期" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
|
|
|
|
|
<el-date-picker v-model="vm.startDate" clearable size="mini" placeholder="请输入开始日期" type="datetime"
|
|
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="结束日期" prop="endDate">
|
|
|
|
|
<el-date-picker v-model="vm.endDate" clearable size="mini" placeholder="请输入结束日期" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
|
|
|
|
|
<el-date-picker v-model="vm.endDate" clearable size="mini" placeholder="请输入结束日期" type="datetime"
|
|
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" size="mini" icon="el-icon-search" @click="onSearch">搜索</el-button>
|
|
|
|
@ -44,14 +42,15 @@
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<el-divider><i class="el-icon-search"></i></el-divider>
|
|
|
|
|
|
|
|
|
|
</el-card>
|
|
|
|
|
<el-card class="box-card">
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-button type="success" size="mini" icon="el-icon-plus" @click="onCreate">新增</el-button>
|
|
|
|
|
|
|
|
|
|
<el-button type="warning" size="mini" icon="el-icon-download" @click="onExport">导出</el-button>
|
|
|
|
|
|
|
|
|
|
<el-button type="warning" size="mini" icon="el-icon-share" @click="treeShow = true">树状</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
<el-col :span="12">
|
|
|
|
@ -76,6 +75,7 @@
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-table
|
|
|
|
|
class="data"
|
|
|
|
|
@selection-change="onSelectionChange"
|
|
|
|
|
empty-text="无数据"
|
|
|
|
|
:stripe="true"
|
|
|
|
@ -167,51 +167,6 @@
|
|
|
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
:total="vm.totalCount">
|
|
|
|
|
</el-pagination>
|
|
|
|
|
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
<el-tab-pane label="树状展示" name="tree">
|
|
|
|
|
<span slot="label"><i class="el-icon-share"></i>树状展示</span>
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-button type="success" size="mini" icon="el-icon-plus" @click="onCreate">新增</el-button>
|
|
|
|
|
|
|
|
|
|
<el-button type="warning" size="mini" icon="el-icon-edit" @click="onCreate">前缀修改</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-button-group style="float: right;">
|
|
|
|
|
<el-tooltip effect="dark" content="批量删除" placement="bottom">
|
|
|
|
|
<el-button size="mini" icon="el-icon-delete" @click="onBitchDelete"></el-button>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
|
|
|
|
|
<el-tooltip effect="dark" content="刷新" placement="bottom">
|
|
|
|
|
<el-button size="mini" icon="el-icon-refresh" @click="onLoadTree"></el-button>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
</el-button-group>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-tree
|
|
|
|
|
style="margin-top: 10px"
|
|
|
|
|
:data="treeData"
|
|
|
|
|
node-key="resCode"
|
|
|
|
|
ref="tree"
|
|
|
|
|
show-checkbox
|
|
|
|
|
default-expand-all
|
|
|
|
|
:filter-node-method="filterTree"
|
|
|
|
|
:expand-on-click-node="false">
|
|
|
|
|
<div class="tree" slot-scope="{ node, data }">
|
|
|
|
|
<span>
|
|
|
|
|
<el-link type="success" @click="onTreeCreate(data)">新增</el-link>
|
|
|
|
|
<el-link type="danger" @click="onDelete(data)">删除</el-link>
|
|
|
|
|
{{ data.resName }}
|
|
|
|
|
<span style="color: #409EFF" @click="onTreeEdit(data)">[{{data.resCode}}]</span>
|
|
|
|
|
<span style="color: #ff0000" v-if="data.free">[免费]</span>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</el-tree>
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
</el-tabs>
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
|
<el-dialog
|
|
|
|
@ -260,6 +215,53 @@
|
|
|
|
|
<el-button size="mini" type="primary" @click="onSave">保存</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<el-drawer
|
|
|
|
|
direction="ltr"
|
|
|
|
|
:visible.sync="treeShow"
|
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
|
:close-on-press-escape="true"
|
|
|
|
|
:modal-append-to-body="true"
|
|
|
|
|
:append-to-body="true"
|
|
|
|
|
@opened="onTreeOpened"
|
|
|
|
|
size="600px">
|
|
|
|
|
|
|
|
|
|
<el-page-header slot="title" @back="treeShow = false" content="资源树状展示"></el-page-header>
|
|
|
|
|
|
|
|
|
|
<el-container style="height:100%">
|
|
|
|
|
<el-header>
|
|
|
|
|
<el-input
|
|
|
|
|
size="mini"
|
|
|
|
|
placeholder="输入资源名称、资源代码或资源值"
|
|
|
|
|
prefix-icon="el-icon-search"
|
|
|
|
|
v-model="treeFilter">
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-header>
|
|
|
|
|
|
|
|
|
|
<el-main style="height:100%;padding: 0 20px 20px 20px;">
|
|
|
|
|
<el-tree
|
|
|
|
|
:data="treeData"
|
|
|
|
|
node-key="resCode"
|
|
|
|
|
ref="tree"
|
|
|
|
|
show-checkbox
|
|
|
|
|
default-expand-all
|
|
|
|
|
:filter-node-method="onTreeFilter"
|
|
|
|
|
:expand-on-click-node="false">
|
|
|
|
|
<div class="tree" slot-scope="{ node, data }">
|
|
|
|
|
<span>
|
|
|
|
|
{{ data.resName }}
|
|
|
|
|
<span style="color: #409EFF" @click="onTreeEdit(data)">[{{data.resCode}}]</span>
|
|
|
|
|
<span style="color: #ff0000" v-if="data.free">[免费]</span>
|
|
|
|
|
</span>
|
|
|
|
|
<span>
|
|
|
|
|
<el-link type="success" @click="onTreeCreate(data)">新增</el-link>
|
|
|
|
|
<el-link type="danger" @click="onDelete(data)">删除</el-link>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</el-tree>
|
|
|
|
|
</el-main>
|
|
|
|
|
</el-container>
|
|
|
|
|
</el-drawer>
|
|
|
|
|
</div>
|
|
|
|
|
<style>
|
|
|
|
|
.tree {
|
|
|
|
@ -327,6 +329,8 @@
|
|
|
|
|
{required: true, message: '是否有效不能为空', trigger: 'blur'},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
treeShow: false,
|
|
|
|
|
treeFilter: '',
|
|
|
|
|
treeData: []
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
@ -394,15 +398,16 @@
|
|
|
|
|
this.form.valid = pItem.valid;
|
|
|
|
|
this.form.rowVersion = pItem.rowVersion;
|
|
|
|
|
},
|
|
|
|
|
onChange: function (value) {
|
|
|
|
|
this.$refs.tree.filter(value);
|
|
|
|
|
},
|
|
|
|
|
filterTree: function (value, data) {
|
|
|
|
|
onTreeFilter: function (value, data) {
|
|
|
|
|
if (!value) return true;
|
|
|
|
|
return data.comment.indexOf(value) !== -1;
|
|
|
|
|
return data.resName.indexOf(value) !== -1
|
|
|
|
|
|| data.resCode.indexOf(value) !== -1
|
|
|
|
|
|| data.resValue.indexOf(value) !== -1;
|
|
|
|
|
},
|
|
|
|
|
onLoadTree: function () {
|
|
|
|
|
new Ajax("wsys", "res").method("tree").post({}, function (response) {
|
|
|
|
|
onTreeLoad: function () {
|
|
|
|
|
var vm_ = utils.copy(this.vm);
|
|
|
|
|
vm_.pageSize = 0;
|
|
|
|
|
new Ajax("wsys", "res", "tree").post(vm_, function (response) {
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
} else {
|
|
|
|
@ -410,90 +415,17 @@
|
|
|
|
|
}
|
|
|
|
|
}.bind(this))
|
|
|
|
|
},
|
|
|
|
|
onSave: function () {
|
|
|
|
|
this.$refs['form'].validate(function (valid) {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (this.form.id) {
|
|
|
|
|
new Ajax("wsys", "res").update(this.form, function (response) {
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
} else {
|
|
|
|
|
this.onFind();
|
|
|
|
|
this.onLoadTree();
|
|
|
|
|
this.$refs['form'].resetFields();
|
|
|
|
|
this.form.formShow = false;
|
|
|
|
|
}
|
|
|
|
|
}.bind(this))
|
|
|
|
|
} else {
|
|
|
|
|
new Ajax("wsys", "res").create(this.form, function (response) {
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
} else {
|
|
|
|
|
this.onFind();
|
|
|
|
|
this.onLoadTree();
|
|
|
|
|
this.$refs['form'].resetFields();
|
|
|
|
|
this.form.formShow = false;
|
|
|
|
|
}
|
|
|
|
|
}.bind(this))
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}.bind(this));
|
|
|
|
|
},
|
|
|
|
|
onDelete: function (item) {
|
|
|
|
|
this.$confirm('将删除该项, 是否继续?', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(function () {
|
|
|
|
|
new Ajax(this.module, this.target).delete({id: item.id}, function (response) {
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
} else {
|
|
|
|
|
nav.s("删除成功");
|
|
|
|
|
this.onFind();
|
|
|
|
|
this.onLoadTree();
|
|
|
|
|
onTreeOpened: function () {
|
|
|
|
|
this.onTreeLoad();
|
|
|
|
|
}
|
|
|
|
|
}.bind(this))
|
|
|
|
|
}.bind(this)).catch(function (action) {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onBitchDelete: function () {
|
|
|
|
|
if (this.select.length == 0) {
|
|
|
|
|
nav.w("至少选中一项");
|
|
|
|
|
} else {
|
|
|
|
|
this.$confirm('将删除已选择的项, 是否继续?', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(function () {
|
|
|
|
|
nav.tipShow("删除中...");
|
|
|
|
|
this.select.forAsync(function (item, next) {
|
|
|
|
|
new Ajax(this.module, this.target).delete({id: item.id}, function (response) {
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
} else {
|
|
|
|
|
this.result.remove(item)
|
|
|
|
|
}
|
|
|
|
|
next();
|
|
|
|
|
}.bind(this))
|
|
|
|
|
}.bind(this), function () {
|
|
|
|
|
nav.tipClose();
|
|
|
|
|
nav.s("批量删除成功.")
|
|
|
|
|
this.onFind();
|
|
|
|
|
this.onLoadTree();
|
|
|
|
|
}.bind(this))
|
|
|
|
|
}.bind(this)).catch(function (action) {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
watch: {
|
|
|
|
|
treeFilter: function (val) {
|
|
|
|
|
this.$refs.tree.filter(val);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted: function () {
|
|
|
|
|
this.onFind();
|
|
|
|
|
this.onLoadTree();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|