Files
UNION_NJUST/target/classes/views/platform/activity/basic/ActivityBasic.html
T
2026-09-23 09:38:39 +08:00

380 lines
15 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<style>
.dialog-footer .el-button {
padding: 12px 30px;
}
.el-transfer {
text-align: center;
}
.el-transfer-panel {
text-align: left;
width: 35%;
height: 400px;
}
.el-transfer-panel__list.is-filterable {
height: 300px;
}
.v-box .el-card__header {
padding: 5px 15px;
}
.v-tree-layout-left .v-tree {
width: 100%;
}
.v-tree-layout-left .custom-tree-node {
width: 90%;
position: relative;
}
.v-tree-layout-left .v-tree .v-node {
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.v-tree-layout-left .v-tree {
width: 100%;
}
.v-tree-layout-left .custom-tree-node {
width: 90%;
position: relative;
}
.v-tree-layout-left .v-tree .v-node {
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<tree-layout style="height: calc(100vh - 50px)">
<template #tree>
<div style="border-right: 2px solid rgb(240,240,240);padding: 20px;">
<el-input
placeholder="输入关键字进行查找"
v-model="filterText">
</el-input>
</div>
<el-tree ref="tree" :data="treeData" class="v-tree" v-loading="treeLoading" node-key="id"
:props="defaultProps"
:default-expanded-keys="['7e3f5fcbc24f442dbb3a6cc9412e7960']"
:expand-on-click-node="false"
@node-click="handleNodeClick" accordion
highlight-current :filter-node-method="filterNode">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="node.level==1" style="font-size: 16px;" class="v-node"><i
class="el-icon-s-home"></i>&nbsp;
{{ data.name }}
</div>
<div v-if="node.level==2"
style="font-size: 15px" :title="data.name" class="v-node">
<i class="el-icon-star-on" v-if="checkData.name==data.name"></i>
<i class="el-icon-star-off" v-else></i>
&nbsp; {{ data.name }}
</div>
<div v-if="node.level==3"
style="font-size: 14px" :title="data.name" class="v-node">
<i class="fa fa-dot-circle-o" v-if="checkData.name==data.name"></i>
<i class="fa fa-circle-o" v-else></i>
&nbsp; {{ data.name }}
</div>
<div v-if="node.level>3"
style="font-size: 14px" :title="data.name" class="v-node">
<i class="fa fa-dot-circle-o" v-if="checkData.name==data.name"></i>
<i class="fa fa-circle-o" v-else></i>
&nbsp; {{ data.name }}
</div>
</div>
</el-tree>
</template>
<template v-if="node.level==1">
<div v-if="node.level==1" style="padding: 5px 10px">
<el-table :data="basicTypeData">
<el-table-column label="序号" type="index">
<template scope="scope">
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column prop="name" align="center" label="名称"></el-table-column>
<el-table-column prop="code" align="center" label="代码"></el-table-column>
<el-table-column prop="note" align="center" show-overflow-tooltip
label="备注"></el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template scope="{row}">
<el-dropdown @command="dropdownCommand">
<el-button plain size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'edit',data:row}"
:disabled="checkData.code==50000||checkData.code==40000">
编辑
</el-dropdown-item>
<el-dropdown-item :command="{type:'delete',data:row}"
:disabled="checkData.code==50000||checkData.code==40000||checkData.code=='jcsjgl'">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<el-card class="mt20 text-right" shadow="never">
<span style="color: red">新建基础类型</span>
<el-button size="medium" type="primary" circle
@click="openBasicType()">
<i class="el-icon-plus"></i>
</el-button>
</el-card>
</div>
</template>
</tree-layout>
</template>
</guava>
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="basicTypeDialog" width="50%">
<el-form :model="formData" ref="addForm" :rules="rules" label-width="100px">
<el-row gutter="30">
<el-form-item label="上级名称" prop="name" label-width="110px">
<el-input maxlength="100" disabled :value="checkData.name"
type="text"></el-input>
</el-form-item>
<el-form-item label="基础类型名称" prop="name" label-width="110px">
<el-input maxlength="100" placeholder="请输入基础类型名称" v-model="formData.name"
type="text"></el-input>
</el-form-item>
<el-form-item label="基础类型代码" prop="code" label-width="110px">
<el-input maxlength="100" placeholder="请输入基础类型名称" v-model="formData.code"
type="text"
:disabled="checkData.code==50000||checkData.code==40000||checkData.code=='jcsjgl'"></el-input>
</el-form-item>
<el-form-item label="基础类型备注" prop="note" label-width="110px">
<el-input maxlength="100" placeholder="请输入基础类型备注" v-model="formData.note"
type="textarea"></el-input>
</el-form-item>
</el-row>
</el-form>
<div style="display: flex;justify-content:flex-end;margin-top: 30px">
<el-button type="primary" :loading="loading" @click="!formData.id?doAddType():doEditType()">提 交
</el-button>
</div>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
title: '',
checkData: {},
filterText: '',
treeData: [],
basicTypeData: [],
tableData: [],
treeLoading: true,
basicTypeDialog: false,
loading: false,
defaultProps: {
children: 'child',
label: 'name',
},
node: {
level: 1
},
options: [{
value: 'ziyuan',
label: '资源',
children: [{
value: 'axure',
label: 'Axure Components'
}]
}],
rules: {
name: [{required: true, message: '必填', trigger: ['change', 'blur']}],
code: [{required: true, message: '必填', trigger: ['change', 'blur']}],
},
pageForm: {
searchName: "",
searchKeyword: "",
pageNumber: 1,
pageSize: 50,
totalCount: 0,
pageOrderName: "",
pageOrderBy: ""
}
}
},
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue'),
'guava': httpVueLoader('/components/plugins/Guava.vue'),
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
},
methods: {
dropdownCommand: function (command) {
const {type, data} = command
if (type == 'edit') {
this.openEditType(data)
} else if (type == 'delete') {
this.doDelete(data.id)
}
},
pageData() {//加载机构数据
sublime.showLoadingbar();//显示loading
this.tabLoading = true
this.pageForm.parentId = this.checkData.id
$.post(loc() + "/pageData", this.pageForm, (data) => {
sublime.closeLoadingbar();//关闭loading
this.tabLoading = false
if (data.code == 0) {
this.basicTypeData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
},
filterNode(value, data, node) {
if (!value) return true;
return data.name.indexOf(value) !== -1
return false
},
async handleNodeClick(data, node) {
this.checkData = data
this.checkNode = node
console.log(this.checkData)
this.pageData()
},
async loadTree(flush) {
this.treeLoading = true
const resp = await $.post(loc() + "/getTreeData")
requestLaterFun(resp, () => {
this.treeLoading = false
this.treeData = resp.data
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
}, () => {
this.treeLoading = false
})
if (flush && resp.code == 0) {
this.checkData = resp.data[0]
this.pageData();
}
},
async openBasicType() {
const {id} = this.checkData
this.formData = {
parentId: id
}
this.basicTypeDialog = true
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
},
doAddType() {
this.$refs["addForm"].validate(async (valid) => {
if (valid) {
this.loading = true
const resp = await $.post(loc() + "/doAdd", this.formData)
requestLaterMsgFun(this, resp, () => {
this.basicTypeDialog = false
this.pageData();
this.loadTree(true)
}, null, () => {
this.loading = false
})
}
})
},
doEditType() {
this.$refs["addForm"].validate(async (valid) => {
if (valid) {
this.loading = true
const resp = await $.post(loc() + "/doEditType", this.formData)
requestLaterMsgFun(this, resp, () => {
this.pageData();
/* this.loadTree(true)*/
}, null, () => {
this.loading = false
this.basicTypeDialog = false
})
}
});
},
openEditType(row) {
this.formData = {
id: row.id,
name: row.name,
code: row.code,
note: row.note
}
this.basicTypeDialog = true
},
doDelete(id) {
this.$confirm('确定要删除该机构吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/doDelete", {id: id})
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg});
this.pageData()
this.loadTree(true)
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
}
}
});
}
},
async created() {
this.loadTree(true)
}
})
</script>
<!--#
}
#-->