first commit

This commit is contained in:
2026-09-20 15:46:34 +08:00
parent 72fb5eae10
commit e558339dcc
3340 changed files with 671310 additions and 251 deletions
@@ -0,0 +1,508 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.dialog-footer .el-button {
padding: 12px 30px;
}
.el-tag {
/*border-radius: 50%;*/
height: 22px;
}
.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;
}
</style>
<div id="app" v-cloak>
<guava>
<tree-layout>
<template #tree>
<div style="padding: 15px;">
<el-input placeholder="输入单位名称进行过滤" v-model="filterText"></el-input>
</div>
<el-tree class="filter-tree" :data="treeData" :props="defaultProps"
default-expand-all :filter-node-method="filterNode" ref="tree"
highlight-current accordion @node-click="handleNodeClick">
<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-office-building"></i>&nbsp;{{ data.unitName }}
</div>
<div v-if="node.level==2" style="font-size: 14px" class="v-node">
<i class="el-icon-s-help" v-if="checkData.unitName==data.unitName"></i>
<i class="el-icon-help" v-else></i>
&emsp;{{ data.unitName }}
</div>
</div>
</el-tree>
</template>
<template>
<div v-if="node.level==1" style="width: 100%;">
<el-card shadow="never">
<div class="btn-group tool-button">
<el-input placeholder="根据承办单位名称进行查询" clearable
v-model="pageForm.unitName"
@keyup.enter.native="doSearch">
</el-input>
</div>
<div class="btn-group tool-button">
<el-button slot="append" icon="el-icon-search" type="primary"
@click="doSearch()"></el-button>
</div>
<div class="pull-right offscreen-right">
<el-button type="primary" @click="openAdd"><i class="ti-plus"></i>增补承办单位
</el-button>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<el-table ref="underTakeTable" highlight-current-row :data="tableData"
height="722">
<el-table-column label="序号" width="60px">
<template scope="scope">
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}}</span>
</template>
</el-table-column>
<el-table-column label="承办单位编码" prop="unitCode" header-align="center"
align="center"
width="120px"></el-table-column>
<el-table-column label="承办单位名称" prop="unitName" header-align="center"
align="center"
width="200px"></el-table-column>
<el-table-column label="分管校领导及联系电话" prop="leader" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="负责人及联系电话" prop="principal" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="是否启用" prop="isEnable" header-align="center"
align="center"
width="100px">
<template scope="{row}">
<el-switch @change="switchChange(row)" v-model="row.isEnable"
active-color="#13ce66" inactive-color="#ff4949">
</el-switch>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作"
fixed="right" width="120px">
<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:'leader',data:row}">
设置分管校领导
</el-dropdown-item>
<el-dropdown-item
:command="{type:'principal',data:row}">设置负责人
</el-dropdown-item>
<el-dropdown-item :command="{type:'edit',data:row}">编辑
</el-dropdown-item>
<el-dropdown-item v-if="!row.isEnable"
:command="{type:'delete',data:row}">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</div>
<div v-if="node.level==2" style="padding: 5px 10px">
<el-tabs v-model="activeName" type="card" @tab-click="handleTabClick">
<el-tab-pane label="分管校领导" name="one"></el-tab-pane>
<el-tab-pane label="负责人" name="two"></el-tab-pane>
</el-tabs>
<el-table highlight-current-row :data="adminTableData" size="small"
style="width: 100%;">
<el-table-column label="序号" width="60px">
<template scope="scope"><span>{{scope.$index+1}}</span></template>
</el-table-column>
<el-table-column label="职工号" prop="loginname"
align="center"></el-table-column>
<el-table-column label="姓名" prop="username"
align="center"></el-table-column>
<el-table-column label="性别" prop="sex" align="center"></el-table-column>
<el-table-column label="联系方式" prop="mobile"
align="center"></el-table-column>
<el-table-column label="操作" align="center">
<template scope="{row}">
<el-button plain type="danger" size="mini" icon="el-icon-delete"
circle
@click="removeAdmin(row)">
</el-button>
</template>
</el-table-column>
</el-table>
<el-row class="el-pagination-container"
style="text-align: right;margin-top: 20px">
<span style="color: red">{{butTitle}}</span>
<el-button size="medium" type="primary" circle
@click="openAdmin(adminPageForm,adminPageForm.flag)">
<i class="el-icon-plus"></i>
</el-button>
</el-row>
</div>
</template>
</tree-layout>
</guava>
<el-dialog title="增补承办单位" :visible.sync="dialogVisible" width="50%">
<el-form ref="addForm" :model="formData" :rules="formRules" label-width="120px">
<el-form-item label="承办单位编码" prop="unitCode">
<el-input v-model="formData.unitCode" placeholder="请输入承办单位编码"></el-input>
</el-form-item>
<el-form-item label="承办单位名称" prop="unitName">
<el-input v-model="formData.unitName" placeholder="请输入承办单位名称"></el-input>
</el-form-item>
<el-form-item label="是否启用" prop="isEnable">
<el-radio-group v-model="formData.isEnable">
<el-radio-button :label="true">是</el-radio-button>
<el-radio-button :label="false">否</el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="operation" :loading="subLoading">确 定</el-button>
</span>
</el-dialog>
<el-dialog :title="title" :visible.sync="adminDialogVisible" :close-on-click-modal="false"
width="55%">
<div style="width: 100%;" v-if="adminFormData.flag">
<el-transfer :titles="['单位成员', '管理员']" filterable
:props="{key: 'id',label: 'name'}"
:filter-method="adminFilterMethod"
v-model="adminFormData.adminValue"
:data="adminData">
</el-transfer>
</div>
<div v-else>
<el-select
v-model="adminFormData.adminValue"
filterable
remote
multiple
clearable
:remote-method="remoteMethod"
style="width: 100%"
placeholder="请输入工号或姓名"
>
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.username+'('+item.loginname+')'"
:value="item.id">
</el-option>
</el-select>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="adminDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doAdmin" :loading="adminSubLoading">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue')
},
data() {
return {
userOptions: [],
title: '',
butTitle: '添加分管校领导',
filterText: '',
activeName: 'one',
subLoading: false,
dialogVisible: false,
treeData: [],
node: {
level: 1
},
formData: {
isEnable: true
},
checkData: {},
adminSubLoading: false,
adminDialogVisible: false,
adminFormData: {
adminValue: [],
flag: true
},
adminData: [],
adminValue: [],
adminTableData: [],
adminPageForm: {
flag: true
},
defaultProps: {
children: 'childrens',
label: 'unitName',
disabled: 'disabled'
},
formRules: {
unitCode: [{required: true, message: '请输入承办单位编码', trigger: ['blur', 'change']}],
unitName: [{required: true, message: '请输入承办单位名称', trigger: ['blur', 'change']}],
isEnable: [{required: true, message: '请选择是否启用', trigger: ['blur', 'change']}],
},
}
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
}
},
methods: {
async remoteMethod(query) {
if (query) {
this.selectLoading = true;
const data = await searchUser(query, null, null, null, null)
const adminValues = this.adminValue.map(v => v.loginname)
this.userOptions = data.filter(v => !adminValues.includes(v.loginname))
this.selectLoading = false;
}
},
dropdownCommand(command) {
const {type, data} = command
if (type === 'leader') {
this.title = '设置分管校领导'
this.openAdmin(data, true)
} else if (type === 'principal') {
this.title = '设置负责人'
this.openAdmin(data, false)
} else if (type === 'edit') {
this.openEdit(data)
} else if (type === 'delete') {
this.doDelete(data.id)
}
},
filterNode(value, data) {
if (!value) return true;
return data.unitName.indexOf(value) !== -1
return false
},
adminFilterMethod(query, item) {
return item.username.indexOf(query) > -1;
},
handleNodeClick(data, node) {
this.node = node
this.checkData = data
this.adminPageForm.id = data.id
this.adminPageForm.unitCode = data.unitCode
this.adminPageForm.flag = this.activeName === 'one'
this.adminPageData()
},
handleTabClick(tab) {
this.butTitle = tab.name === 'one' ? '添加分管校领导' : '添加负责人'
this.adminPageForm.flag = tab.name === 'one'
this.adminPageData()
},
removeAdmin(row) {
this.$confirm('确定要移除该管理员吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" === a) {
const resp = await $.post(loc() + "/removeAdmin", {
unitId: this.adminPageForm.id,
userId: row.id,
roleId: row.roleid
})
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg});
this.adminPageData()
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
}
}
});
},
async adminPageData() {
const resp = await $.post(loc() + "/adminPageData", this.adminPageForm)
requestLaterFun(resp, () => {
this.adminTableData = resp.data;
}, () => {
console.log(resp)
this.$notify.error({title: '失败', message: resp.msg});
})
},
openAdd() {
this.formData = {}
this.$set(this.formData, "isEnable", true)
this.resetForm()
},
openEdit(data) {
this.formData = data
this.resetForm()
},
openAddUnderTake() {
this.adminFormData.flag = false
this.adminDialogVisible = true
},
async openAdmin(row, flag) {
const {id, unitCode} = row
this.adminFormData.unitId = id
this.adminFormData.flag = flag
const {data} = await $.get(loc() + "/findUserAndAdmin", {id, unitCode, flag})
if (data) {
this.adminValue = data.value
if (flag){
this.adminData = data.data
this.adminFormData.adminValue = data.value.map(v => {
return v.id
})
}
}
this.adminDialogVisible = true
},
async doAdmin() {
this.adminSubLoading = true
const data = clone(this.adminFormData)
data.adminValue = JSON.stringify(data.adminValue)
const resp = await $.post(loc() + "/setAdmin", data)
requestLaterFun(resp, () => {
this.adminDialogVisible = false
this.pageData()
this.adminPageData()
this.$notify.success({title: '成功', message: resp.msg});
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
}, () => {
this.adminSubLoading = false
})
},
resetForm() {
this.dialogVisible = true
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
},
async switchChange(data) {
this.formData = data
const resp = await $.post(loc() + "/doEdit", {"data": JSON.stringify(this.formData)})
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg});
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
}, () => {
this.undertakeUnitTree()
})
},
async operation() {
let method = this.formData.id ? "/doEdit" : "/doAdd"
this.$refs["addForm"].validate(async (valid) => {
if (valid) {
this.subLoading = true
const loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
const resp = await $.post(loc() + method, {"data": JSON.stringify(this.formData)})
requestLaterFun(resp, () => {
this.dialogVisible = false
this.pageData()
this.$notify.success({title: '成功', message: resp.msg});
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
}, () => {
loading.close()
this.subLoading = false
})
}
});
},
doDelete(id) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {
const resp = await $.post(loc() + "/doDelete", {id})
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg});
this.undertakeUnitTree()
}, () => {
this.$notify.error({title: '失败', message: resp.msg});
})
}
}
});
},
async undertakeUnitTree() {
const {data} = await $.get(loc() + "/undertakeUnitTree")
this.treeData = [data]
this.pageData()
}
},
async created() {
await this.undertakeUnitTree()
}
})
</script>
<!--#
}
#-->