Files
zhgh_whcp/target/classes/views/platform/sys/union/branchUnionManage.js
T
2026-01-08 14:58:16 +08:00

123 lines
6.2 KiB
JavaScript

const branchUnionManage = {
template: `
<div>
<el-card shadow="never" style="border: 1px solid var(--border-color-lighter); margin-top: 10px">
<el-row :gutter="10" type="flex">
<el-input placeholder="请输入分工会名称" clearable size="small" style="width: 300px" v-model="pageForm.searchKeyword"></el-input>
<el-button type="primary" class="ml5" size="small" icon="el-icon-search" @click="doSearch"></el-button>
<el-button @click="openAudit" icon="el-icon-s-check" type="primary" style="margin-left: auto" size="small">基层干部审核</el-button>
<el-button @click="openAdd" icon="ti-plus" type="primary" size="small" v-if="$auth.hasPermission('sys.manager.union.add')">新建分工会</el-button>
</el-row>
</el-card>
<el-card shadow="never" style="border: 1px solid var(--border-color-lighter); margin-top: 10px">
<el-table :data="tableData" border>
<el-table-column label="序号" type="index" width="50" :index="indexMethod"></el-table-column>
<el-table-column prop="name" label="工会名称" show-overflow-tooltip></el-table-column>
<el-table-column prop="unionCode" label="工会编码"></el-table-column>
<el-table-column prop="campus" label="校区"></el-table-column>
<el-table-column prop="chairman" label="分工会主席" show-overflow-tooltip></el-table-column>
<el-table-column label="操作" width="250" v-if="$auth.hasPermissionOr(['sys.manager.union.edit','sys.manager.union.delete'])">
<template scope="scope">
<!-- <el-button v-if="$auth.hasPermission('sys.manager.union.branchOfficer')" type="primary" size="mini">设置干部</el-button>-->
<el-button v-if="$auth.hasPermission('sys.manager.union.edit')" type="primary" size="mini" @click="openEdit(scope.row.id)">编辑</el-button>
<el-button v-if="$auth.hasPermission('sys.manager.union.delete')" type="danger" size="mini" @click="doDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-row class="el-pagination-container mt20">
<el-pagination
@size-change="pageSizeChange"
@current-change="pageNumberChange"
:current-page="pageForm.pageNumber"
:page-sizes="[10, 20, 30, 50]"
:page-size="pageForm.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pageForm.totalCount"
></el-pagination>
</el-row>
</el-card>
<el-dialog :title="formData.id ? '编辑分工会' : '新增分工会'" :visible.sync="dialogFormVisible" width="600px">
<el-form :model="formData" ref="formRef" :rules="formRules" size="small" label-width="80px">
<el-form-item label="工会名称" prop="name">
<el-input v-model="formData.name" maxlength="100" placeholder="工会名称"></el-input>
</el-form-item>
<el-form-item label="工会编码" prop="unionCode">
<el-input v-model="formData.unionCode" maxlength="100" placeholder="工会编码"></el-input>
</el-form-item>
<el-form-item label="校区" prop="campus">
<dict-select v-model="formData.campus" code="USER_CAMPUS"></dict-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="doSubmit">确 定</el-button>
</div>
</el-dialog>
</div>
`,
mixins: [initTableMixins],
data() {
return {
dialogFormVisible: false,
formData: {},
formRules: {
name: [{ required: true, message: "请输入工会名称", trigger: ["change", "blur"] }],
unionCode: [{ required: true, message: "请输入工会编码", trigger: ["change", "blur"] }],
campus: [{ required: false, message: "请选择校区", trigger: ["change", "blur"] }]
}
}
},
methods: {
pageData() {
$.get("/platform/sys/union/pageData", this.pageForm).then((res) => {
this.tableData = res.data.list
this.pageForm.totalCount = res.data.totalCount
})
},
// 基层干部审核
openAudit() {
this.$emit('union-cadre')
},
openAdd() {
this.dialogFormVisible = true
this.$nextTick(() => {
this.formData = {}
})
},
openEdit(id) {
this.dialogFormVisible = true
$.get("/platform/sys/union/findOne", { id }).then((res) => {
this.formData = res.data
})
},
doSubmit() {
this.$refs.formRef.validate((valid) => {
if (!valid) return
$.post("/platform/sys/union/" + (this.formData.id ? "update" : "insert"), this.formData).then((res) => {
this.dialogFormVisible = false
this.$message.success(res.msg)
this.pageData()
this.$emit("refresh", null)
})
})
},
doDelete(id) {
this.$confirm("您确定要删除吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "info"
}).then(() => {
$.post("/platform/sys/union/doDelete", { id }).then((res) => {
this.$message.success(res.msg)
this.pageData()
this.$emit("refresh", null)
})
})
}
},
created() {
this.pageData()
}
}