first commit
This commit is contained in:
@@ -0,0 +1,630 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch()">
|
||||
<search-item label="">
|
||||
<el-checkbox-group @change="doSearch" v-model="pageForm.isMenWomen">
|
||||
<el-checkbox-button :key="2" :label="2">男子</el-checkbox-button>
|
||||
<el-checkbox-button :key="3" :label="3">女子</el-checkbox-button>
|
||||
<el-checkbox-button :key="4" :label="4">个人</el-checkbox-button>
|
||||
<el-checkbox-button :key="5" :label="5">团体</el-checkbox-button>
|
||||
</el-checkbox-group>
|
||||
</search-item>
|
||||
|
||||
<search-item label="比赛组别">
|
||||
<el-select @focus="focusGroup" clearable placeholder="请选择比赛组别"
|
||||
style="width: 100%" v-model="pageForm.group">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id"
|
||||
v-for="item in groupList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
|
||||
<search-item label="运动类型">
|
||||
<el-select
|
||||
@focus="exerciseType"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择运动类型"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.events"
|
||||
>
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id"
|
||||
v-for="item in exerciseTypeList"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool label="比赛项目列表">
|
||||
<el-input @input="ageInput" placeholder="输入年龄算出身年" size="small"
|
||||
style="width: auto" type="number" v-model="pageForm.age">
|
||||
<template slot="prepend">年龄计算器</template>
|
||||
</el-input>
|
||||
<el-tag class="ml10">{{ pageForm.ageYear }}</el-tag>
|
||||
<el-date-picker
|
||||
class="ml10"
|
||||
end-placeholder="结束日期"
|
||||
format="yyyy 年 MM 月 dd 日"
|
||||
range-separator="-"
|
||||
size="small"
|
||||
start-placeholder="开始日期"
|
||||
type="daterange"
|
||||
v-model="pageForm.ageDate"
|
||||
value-format="yyyy-MM-dd"
|
||||
></el-date-picker>
|
||||
<el-button @click="doAssignmentDate" class="ml10" icon="el-icon-check"
|
||||
size="small" type="primary">统赋年龄限制
|
||||
</el-button>
|
||||
<el-button @click="openAdd" icon="el-icon-edit-outline" size="small"
|
||||
type="primary">创建比赛项目
|
||||
</el-button>
|
||||
</table-tool>
|
||||
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:size="tableSize"
|
||||
@selection-change="handleSelectionChange"
|
||||
@sort-change="pageOrder"
|
||||
class="vi-table"
|
||||
ref="multipleTable"
|
||||
row-key="id"
|
||||
style="width: 100%; margin-bottom: 20px"
|
||||
v-loading="tableLoading"
|
||||
>
|
||||
<el-table-column :reserve-selection="true" type="selection"
|
||||
width="55"></el-table-column>
|
||||
<el-table-column
|
||||
:index="indexMethod"
|
||||
align="center"
|
||||
header-align="center"
|
||||
label="序号"
|
||||
type="index"
|
||||
width="80px"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
:key="column.prop"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template scope="{row}" v-if="column.prop=='baname'">
|
||||
<span>{{row.baname!=null?row.baname:'暂无'}}</span>
|
||||
</template>
|
||||
<template scope="{row}" v-else-if="column.prop=='diname'">
|
||||
<span>{{row.diname!=null?row.diname:'暂无'}}</span>
|
||||
</template>
|
||||
|
||||
<template scope="{row}" v-else-if="column.prop=='isMenWomen'">
|
||||
<span v-if="row.isMenWomen==1">男子</span>
|
||||
<span v-if="row.isMenWomen==2">女子</span>
|
||||
</template>
|
||||
|
||||
<template scope="{row}" v-else-if="column.prop=='spname'">
|
||||
<span>{{row.spname!=null?row.spname:''}}</span>
|
||||
</template>
|
||||
|
||||
<template scope="{row}" v-else-if="column.prop=='projectType'">
|
||||
<span>{{row.projectType=='1'?'个人':'团体'}}</span>
|
||||
</template>
|
||||
|
||||
<template scope="{row}" v-else-if="column.prop=='note'">
|
||||
<span>{{row.note!=''?row.note:'暂无'}}</span>
|
||||
</template>
|
||||
|
||||
<template scope="{row}" v-else-if="column.prop=='whetherEnable'">
|
||||
<el-switch
|
||||
@change="switchChange(row)"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
v-model="row.whetherEnable"
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" header-align="center" label="操作"
|
||||
prop="userOnline" width="150px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="openEdit(row)" size="mini" type="primary">编辑
|
||||
</el-button>
|
||||
<el-button @click="doDelete(row)" size="mini" type="danger">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<template #edit>
|
||||
<table-tool label="填写比赛项目信息"></table-tool>
|
||||
|
||||
<el-form :model="formData" :rules="formRules" label-suffix=":" label-width="120px"
|
||||
ref="form">
|
||||
<el-row :gutter="40">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="是否趣味项目" prop="isInterest">
|
||||
<el-checkbox v-model="formData.isInterest">
|
||||
{{formData.isInterest?'是趣味':'不是趣味'}}
|
||||
</el-checkbox>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="比赛项目编号" prop="projectCode">
|
||||
<el-input placeholder="请填写比赛项目编号"
|
||||
v-model="formData.projectCode"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="性别" prop="isMenWomen">
|
||||
<el-select
|
||||
allow-create
|
||||
clearable
|
||||
default-first-option
|
||||
filterable
|
||||
placeholder="请选择男女分组"
|
||||
style="width: 100%"
|
||||
v-model="formData.isMenWomen"
|
||||
>
|
||||
<el-option :key="item.id" :label="item.name"
|
||||
:value="item.id" v-for="item in menWomenList"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="比赛组别" prop="competitionCategory">
|
||||
<el-select
|
||||
@focus="focusGroup"
|
||||
clearable
|
||||
placeholder="请选择比赛组别"
|
||||
style="width: 100%"
|
||||
v-model="formData.competitionCategory"
|
||||
>
|
||||
<el-option
|
||||
:key="item.id"
|
||||
:label="item.name+'('+item.code+')'"
|
||||
:value="item.id"
|
||||
v-for="item in groupList"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="距离" prop="distance">
|
||||
<el-select @focus="focusDistance" clearable
|
||||
placeholder="请选择距离" style="width: 100%" v-model="formData.distance">
|
||||
<el-option :key="item.id" :label="item.name"
|
||||
:value="item.id" v-for="item in distanceList"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="运动类型" prop="exerciseType">
|
||||
<el-select
|
||||
@change="changeExercise_typeList"
|
||||
@focus="exerciseType"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择运动类型"
|
||||
style="width: 100%"
|
||||
v-model="formData.exerciseType"
|
||||
>
|
||||
<el-option :key="item.id" :label="item.name"
|
||||
:value="item.id" v-for="item in exerciseTypeList"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="运动项目" prop="sports">
|
||||
<el-select clearable placeholder="请选择具体运动项目" style="width: 100%"
|
||||
v-model="formData.sports">
|
||||
<el-option :key="item.id" :label="item.name"
|
||||
:value="item.id" v-for="item in exerciseTypeList2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目类型" prop="projectType">
|
||||
<el-select
|
||||
allow-create
|
||||
clearable
|
||||
default-first-option
|
||||
filterable
|
||||
placeholder="请选择具体运动项目"
|
||||
style="width: 100%"
|
||||
v-model="formData.projectType"
|
||||
>
|
||||
<el-option :key="item.id" :label="item.name"
|
||||
:value="item.id" v-for="item in projectTypeList"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="年龄限制范围" prop="ageDate" v-if="formData.projectType==1">
|
||||
<el-date-picker
|
||||
end-placeholder="结束日期"
|
||||
format="yyyy 年 MM 月 dd 日"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
style="width: 100%"
|
||||
type="daterange"
|
||||
v-model="formData.ageDate"
|
||||
value-format="yyyy-MM-dd"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div style="float: right; margin: 20px 0">
|
||||
<el-button @click="formData.id?doEdit():doAdd()" type="primary">提 交</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
age: 1,
|
||||
ageYear: null,
|
||||
activityId: null,
|
||||
ageDate: null,
|
||||
isMenWomen: []
|
||||
},
|
||||
|
||||
groupList: [],
|
||||
exerciseTypeList: [],
|
||||
distanceList: [],
|
||||
exerciseTypeList2: [],
|
||||
|
||||
tableColumns: [
|
||||
{ prop: "projectCode", label: "项目编号", sortable: true },
|
||||
{ prop: "allName", label: "全称", width: "200" },
|
||||
{ prop: "isMenWomen", label: "男子/女子", sortable: true },
|
||||
{ prop: "baname", label: "比赛组别", sortable: true },
|
||||
{ prop: "diname", label: "距离", sortable: true },
|
||||
{ prop: "exename", label: "运动类型", sortable: true },
|
||||
{ prop: "spname", label: "运动项目", sortable: true },
|
||||
{ prop: "projectType", label: "项目类型", sortable: true },
|
||||
{ prop: "whetherEnable", label: "是否启用" }
|
||||
],
|
||||
|
||||
multipleSelection: [],
|
||||
|
||||
projectTypeList: [
|
||||
{ id: "1", name: "个人" },
|
||||
{ id: "2", name: "团体" }
|
||||
],
|
||||
menWomenList: [
|
||||
{ id: 1, name: "男子" },
|
||||
{ id: 2, name: "女子" }
|
||||
],
|
||||
|
||||
formRules: {
|
||||
exerciseType: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
projectType: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
projectCode: [{ required: true, message: "必填", trigger: ["change", "blur"] }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doAdd() {
|
||||
this.$refs["form"].validate(async (valid) => {
|
||||
if (valid) {
|
||||
const { data } = await this.$axios.post(loc() + "/getProjectCodeIsExist", { projectCode: this.formData.projectCode })
|
||||
if (data) {
|
||||
this.$message.error("编号已存在")
|
||||
return
|
||||
}
|
||||
let allName = ""
|
||||
this.groupList.find((v) => {
|
||||
if (v.id === this.formData.competitionCategory) {
|
||||
allName += v.name
|
||||
}
|
||||
})
|
||||
|
||||
this.menWomenList.find((v) => {
|
||||
if (v.id === this.formData.isMenWomen) {
|
||||
allName += v.name
|
||||
}
|
||||
})
|
||||
|
||||
this.distanceList.find((v) => {
|
||||
if (v.id === this.formData.distance) {
|
||||
allName += v.name + "米"
|
||||
}
|
||||
})
|
||||
|
||||
/* this.exerciseTypeList.find(v => {
|
||||
if (v.id === this.formData.exerciseType) {
|
||||
allName += v.name
|
||||
}
|
||||
})*/
|
||||
|
||||
this.exerciseTypeList2.find((v) => {
|
||||
if (v.id === this.formData.sports) {
|
||||
allName += v.name
|
||||
}
|
||||
})
|
||||
|
||||
/* this.projectTypeList.find(v => {
|
||||
if (v.id === this.formData.projectType) {
|
||||
allName += "(" + v.name + ")"
|
||||
}
|
||||
})*/
|
||||
|
||||
this.formData.allName = allName
|
||||
if (this.formData.ageDate && this.formData.ageDate.length > 0) {
|
||||
this.formData.startAgeDate = this.formData.ageDate[0]
|
||||
this.formData.endAgeDate = this.formData.ageDate[1]
|
||||
}
|
||||
|
||||
this.loading = true
|
||||
const resp = await this.$axios.post(loc() + "/doAdd", this.formData)
|
||||
this.loading = false
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.doSearch()
|
||||
this.$refs.guava.index()
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
doEdit() {
|
||||
this.$refs["form"].validate(async (valid) => {
|
||||
if (valid) {
|
||||
if (this.formData.oldProjectCode !== this.formData.projectCode) {
|
||||
const { data } = await this.$axios.post(loc() + "/getProjectCodeIsExist", { projectCode: this.formData.projectCode })
|
||||
if (data) {
|
||||
this.$message.error("编号已存在")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
let allName = ""
|
||||
|
||||
this.groupList.find((v) => {
|
||||
if (v.id === this.formData.competitionCategory) {
|
||||
allName += v.name
|
||||
}
|
||||
})
|
||||
|
||||
this.menWomenList.find((v) => {
|
||||
if (v.id === this.formData.isMenWomen) {
|
||||
allName += v.name
|
||||
}
|
||||
})
|
||||
|
||||
this.distanceList.find((v) => {
|
||||
if (v.id === this.formData.distance) {
|
||||
allName += v.name + "米"
|
||||
}
|
||||
})
|
||||
|
||||
/* this.exerciseTypeList.find(v => {
|
||||
if (v.id === this.formData.exerciseType) {
|
||||
allName += v.name
|
||||
}
|
||||
})*/
|
||||
|
||||
this.exerciseTypeList2.find((v) => {
|
||||
if (v.id === this.formData.sports) {
|
||||
allName += v.name
|
||||
}
|
||||
})
|
||||
|
||||
/* this.projectTypeList.find(v => {
|
||||
if (v.id === this.formData.projectType) {
|
||||
allName += "(" + v.name + ")"
|
||||
}
|
||||
})*/
|
||||
|
||||
this.formData.allName = allName
|
||||
if (this.formData.ageDate && this.formData.ageDate.length > 0) {
|
||||
this.formData.startAgeDate = this.formData.ageDate[0]
|
||||
this.formData.endAgeDate = this.formData.ageDate[1]
|
||||
}
|
||||
|
||||
this.loading = true
|
||||
const resp = await this.$axios.post(loc() + "/doEdit", this.formData)
|
||||
this.loading = true
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.doSearch()
|
||||
this.$refs.guava.index()
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
openEdit(data) {
|
||||
this.focusGroup()
|
||||
this.exerciseType()
|
||||
this.focusDistance()
|
||||
this.formData = {
|
||||
id: data.id,
|
||||
isInterest: data.isInterest,
|
||||
competitionCategory: data.competitionCategory,
|
||||
distance: data.distance,
|
||||
exerciseType: data.exerciseType,
|
||||
sports: data.sports,
|
||||
projectType: data.projectType,
|
||||
note: data.note,
|
||||
isMenWomen: data.isMenWomen,
|
||||
projectCode: data.projectCode,
|
||||
oldProjectCode: data.projectCode,
|
||||
whetherEnable: data.whetherEnable
|
||||
}
|
||||
if (data.startAgeDate != null) {
|
||||
this.$set(this.formData, "ageDate", [data.startAgeDate, data.endAgeDate])
|
||||
}
|
||||
|
||||
this.changeExercise_typeList()
|
||||
this.$refs.guava.edit()
|
||||
},
|
||||
doDelete(row) {
|
||||
const { id } = row
|
||||
this.$confirm("确定要删除该项目吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
callback: async (a, b) => {
|
||||
if ("confirm" === a) {
|
||||
//确认后再执行
|
||||
this.$set(row, "loading", true)
|
||||
const resp = await this.$axios.post(loc() + "/doDelete", { id: id })
|
||||
this.$set(row, "loading", false)
|
||||
if (resp.code === 0) {
|
||||
this.doSearch()
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val
|
||||
},
|
||||
//查询比赛组别
|
||||
async focusGroup() {
|
||||
const resp = await this.$axios.post(loc() + "/focusGroup")
|
||||
if (resp.code === 0) {
|
||||
this.groupList = resp.data
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
},
|
||||
//查询运动类型
|
||||
async exerciseType() {
|
||||
const resp = await this.$axios.post(loc() + "/exerciseType")
|
||||
if (resp.code === 0) {
|
||||
this.exerciseTypeList = resp.data
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
},
|
||||
//根据运动id查询下面有哪些具体的运动项目
|
||||
async changeExercise_typeList() {
|
||||
const resp = await this.$axios.post(loc() + "/changeExercise_typeList", { exerciseType: this.formData.exerciseType })
|
||||
if (resp.code === 0) {
|
||||
this.exerciseTypeList2 = resp.data
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
},
|
||||
//查询距离
|
||||
async focusDistance() {
|
||||
const resp = await this.$axios.post(loc() + "/focusDistance")
|
||||
if (resp.code === 0) {
|
||||
this.distanceList = resp.data
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
},
|
||||
ageInput(val) {
|
||||
const year = new Date().getFullYear()
|
||||
this.$set(this.pageForm, "ageYear", year - val)
|
||||
},
|
||||
async doAssignmentDate() {
|
||||
const aa = this.multipleSelection.map((v) => {
|
||||
if (v.isInterest) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
if (aa.find((v) => v == true)) {
|
||||
this.$notify({
|
||||
title: "警告",
|
||||
message: "您勾选的列表中包含趣味项目,趣味项目暂不需要年龄限制",
|
||||
type: "warning"
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.multipleSelection.length === 0) {
|
||||
this.$notify({
|
||||
title: "警告",
|
||||
message: "请先在旁边勾选需要设置的项目",
|
||||
type: "warning"
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (this.pageForm.ageDate == null) {
|
||||
this.$notify({
|
||||
title: "警告",
|
||||
message: "请选择需要赋值的时间段",
|
||||
type: "warning"
|
||||
})
|
||||
return
|
||||
}
|
||||
const confirm = await this.$confirm("确定要勾选的项目赋年龄限制吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
if (confirm === "confirm") {
|
||||
const data = await this.$axios.post(loc() + "/doAssignmentDate", {
|
||||
startAgeDate: this.pageForm.ageDate[0],
|
||||
endAgeDate: this.pageForm.ageDate[1],
|
||||
eventIds: JSON.stringify(this.multipleSelection.map((v) => v.id))
|
||||
})
|
||||
this.$notify.success({ title: "成功", message: data.msg })
|
||||
this.$refs.multipleTable.clearSelection()
|
||||
this.doSearch()
|
||||
}
|
||||
},
|
||||
openAdd() {
|
||||
this.$refs.guava.edit()
|
||||
if (this.$refs["form"]) {
|
||||
this.$refs["form"].resetFields()
|
||||
}
|
||||
this.formData = {}
|
||||
},
|
||||
pageData() {
|
||||
this.tabLoading = true
|
||||
const pageForm = clone(this.pageForm)
|
||||
pageForm.isMenWomen = JSON.stringify(pageForm.isMenWomen)
|
||||
this.$axios.post("/platform/activity/basic/event/pageData", pageForm).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
this.ageInput(this.pageForm.age)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,243 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<el-row :gutter="10" type="flex" style="height: calc(100vh - 126px)">
|
||||
<el-col :span="5">
|
||||
<el-card shadow="never" style="height: 100%" body-style="{ height: '100%' }">
|
||||
<div style="max-height: calc(100vh - 170px); overflow-y: auto">
|
||||
<el-tree
|
||||
:data="treeData"
|
||||
:default-expanded-keys="['7e3f5fcbc24f442dbb3a6cc9412e7960']"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
:props="{
|
||||
children: 'child',
|
||||
label: 'name'
|
||||
}"
|
||||
@node-click="treeNodeClick"
|
||||
highlight-current
|
||||
node-key="id"
|
||||
ref="treeRef"
|
||||
>
|
||||
<template slot-scope="{ node, data }">
|
||||
<span class="el-tree-node__label">
|
||||
<i class="el-icon-folder-opened" v-if="node.level===1"></i>
|
||||
<i class="el-icon-folder" v-else></i>
|
||||
{{node.label}}
|
||||
</span>
|
||||
</template>
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="19">
|
||||
<el-card shadow="never" style="height: 100%">
|
||||
<table-tool>
|
||||
<el-button @click="openBasicType" size="small" type="primary">
|
||||
<i class="el-icon-plus"></i>
|
||||
新建基础类型
|
||||
</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" border size="small">
|
||||
<el-table-column label="序号" type="index" width="100px">
|
||||
<template scope="scope">
|
||||
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="名称" prop="name"></el-table-column>
|
||||
<el-table-column align="center" label="代码" prop="code"></el-table-column>
|
||||
<el-table-column align="center" label="备注" prop="note" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="操作" width="100px">
|
||||
<template slot-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}">编辑</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'delete',data:row}">删除</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
:current-page="pageForm.pageNumber"
|
||||
:page-size="pageForm.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
:total="pageForm.totalCount"
|
||||
@current-change="(val)=>{pageForm.pageNumber = val;pageData()}"
|
||||
@size-change="(val)=>{pageForm.pageSize = val;pageData()}"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
></el-pagination>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-dialog :close-on-click-modal="false" :title="formData.id?'编辑':'新增'" :visible.sync="basicTypeDialog" width="50%">
|
||||
<el-form :model="formData" :rules="rules" label-width="100px" ref="addForm">
|
||||
<el-row :gutter="30">
|
||||
<el-form-item label="上级名称" label-width="110px" prop="name">
|
||||
<el-input :value="checkData.name" disabled maxlength="100" type="text"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="基础类型名称" label-width="110px" prop="name">
|
||||
<el-input maxlength="100" placeholder="请输入基础类型名称" type="text" v-model="formData.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="基础类型代码" label-width="110px" prop="code">
|
||||
<el-input maxlength="100" placeholder="请输入基础类型名称" type="text" v-model="formData.code"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="checkData.id === 'f708d6343c9542b791d32532f860d120'" label="服装项目" label-width="110px" prop="clothing">
|
||||
<el-radio-group v-model="formData.clothing">
|
||||
<el-radio-button :label="true">是</el-radio-button>
|
||||
<el-radio-button :label="false">否</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="基础类型备注" label-width="110px" prop="note">
|
||||
<el-input maxlength="100" placeholder="请输入基础类型备注" type="textarea" v-model="formData.note"></el-input>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div style="display: flex; justify-content: flex-end; margin-top: 30px">
|
||||
<el-button @click="!formData.id?doAddType():doEditType()" type="primary">提 交</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
filterText: null,
|
||||
treeData: [],
|
||||
|
||||
currentTreeNode: null,
|
||||
currentTreeData: null,
|
||||
|
||||
checkData: {},
|
||||
tableData: [],
|
||||
|
||||
basicTypeDialog: false,
|
||||
|
||||
rules: {
|
||||
name: [{ required: true, message: "必填", trigger: ["change", "blur"] }],
|
||||
code: [{ required: true, message: "必填", trigger: ["change", "blur"] }]
|
||||
},
|
||||
|
||||
pageForm: {
|
||||
parentId: null
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
treeNodeClick(data, node) {
|
||||
this.currentTreeData = data
|
||||
this.currentTreeNode = node
|
||||
this.checkData = data
|
||||
this.pageForm.parentId = data.id
|
||||
this.doSearch()
|
||||
},
|
||||
filterNode() {},
|
||||
|
||||
getTreeData() {
|
||||
this.$axios.post(loc() + "/tree").then((res) => {
|
||||
this.treeData = res.data
|
||||
if (this.treeData) {
|
||||
this.checkData = this.treeData[0]
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
dropdownCommand: function (command) {
|
||||
const { type, data } = command
|
||||
if (type == "edit") {
|
||||
this.openEditType(data)
|
||||
} else if (type == "delete") {
|
||||
this.doDelete(data.id)
|
||||
}
|
||||
},
|
||||
|
||||
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) {
|
||||
const resp = await this.$axios.post(loc() + "/doAdd", this.formData)
|
||||
if (resp.code === 0) {
|
||||
this.basicTypeDialog = false
|
||||
this.doSearch()
|
||||
this.getTreeData()
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
doEditType() {
|
||||
this.$refs["addForm"].validate(async (valid) => {
|
||||
if (valid) {
|
||||
const resp = await this.$axios.post(loc() + "/doEditType", this.formData)
|
||||
this.basicTypeDialog = false
|
||||
if (resp.code === 0) {
|
||||
this.doSearch()
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
openEditType(row) {
|
||||
this.formData = {
|
||||
id: row.id,
|
||||
name: row.name,
|
||||
code: row.code,
|
||||
note: row.note,
|
||||
clothing: row.clothing
|
||||
}
|
||||
this.basicTypeDialog = true
|
||||
},
|
||||
doDelete(id) {
|
||||
this.$confirm("确定要删除该机构吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
callback: async (a, b) => {
|
||||
if ("confirm" == a) {
|
||||
const resp = await this.$axios.post(loc() + "/doDelete", { id: id })
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.doSearch()
|
||||
this.getTreeData()
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.pageData()
|
||||
this.getTreeData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
const ACTIVITY_BASIC_BRANCH_UNION_MANAGE = {
|
||||
template: `
|
||||
<div>
|
||||
<el-card shadow="never" style="border: 1px solid var(--border-color-lighter)">
|
||||
<div class="search">
|
||||
<div class="search-item">
|
||||
<el-input placeholder="请输入分工会名称" clearable v-model="pageForm.searchKeyword"></el-input>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card shadow="never" style="border: 1px solid var(--border-color-lighter); margin-top: 10px">
|
||||
<table-tool>
|
||||
<el-button @click="openAdd" icon="ti-plus" type="primary" style="margin-left: auto" size="small">新建临时分工会</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" border size="small" height="calc(100vh - 375px)">
|
||||
<el-table-column label="序号" type="index" :index="indexMethod" width="100px"></el-table-column>
|
||||
<el-table-column prop="name" label="工会名称"></el-table-column>
|
||||
<el-table-column prop="unionCode" label="工会编码"></el-table-column>
|
||||
<el-table-column prop="userNames" label="管理员"></el-table-column>
|
||||
<el-table-column label="操作" width="290">
|
||||
<template slot-scope="{row}">
|
||||
<el-button size="mini" @click="openAdmin(row.id)">设置管理员</el-button>
|
||||
<el-button type="primary" size="mini" @click="openEdit(row.id)">编辑</el-button>
|
||||
<el-button type="danger" size="mini" @click="doDeleteUnion(row.id,true)" v-if="row.unitnum===0">删除</el-button>
|
||||
<el-button type="danger" size="mini"
|
||||
v-if="row.unitnum>0&&row.source==='activity'"
|
||||
@click="doDeleteUnion(row.id,false)">还原单位
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
<el-dialog :title="formData.id ? '编辑分工会' : '新增分工会'" :visible.sync="dialogFormVisible" width="600px">
|
||||
<el-form :model="formData" ref="form" size="small" label-width="80px">
|
||||
<el-form-item label="工会名称">
|
||||
<el-input v-model="formData.name" maxlength="100" placeholder="工会名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="工会编码">
|
||||
<el-input v-model="formData.unionCode" maxlength="100" placeholder="工会编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话">
|
||||
<el-input v-model="formData.telephone" maxlength="100" placeholder="联系电话"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="校区" prop="campus">
|
||||
<el-select v-model="formData.campus" maxlength="20" placeholder="校区"></el-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>
|
||||
<el-dialog title="设置管理员" :visible.sync="dialogGlyFormVisible" width="50%">
|
||||
<div style="width: 100%;">
|
||||
<el-transfer
|
||||
:titles="['单位成员', '管理员']"
|
||||
filterable
|
||||
:props="{
|
||||
key: 'id',
|
||||
label: 'name'
|
||||
}"
|
||||
:filter-method="adminFilterMethod"
|
||||
v-model="userAdminIds"
|
||||
:data="userData">
|
||||
</el-transfer>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogGlyFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="doSubmitAdmin">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
`,
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
dialogFormVisible: false,
|
||||
dialogGlyFormVisible: false,
|
||||
formData: {},
|
||||
userData: [],
|
||||
userAdminIds: [],
|
||||
unionId: ""
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
pageData() {
|
||||
this.$axios.post("/platform/activity/basic/union/pageData", this.pageForm).then((res) => {
|
||||
this.tableData = res.data.list
|
||||
this.pageForm.totalCount = res.data.totalCount
|
||||
})
|
||||
},
|
||||
openAdd() {
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.formData = {}
|
||||
})
|
||||
},
|
||||
openEdit(id) {
|
||||
this.dialogFormVisible = true
|
||||
this.$axios.post("/platform/activity/basic/union/findOne", { id }).then((res) => {
|
||||
this.formData = res.data
|
||||
})
|
||||
},
|
||||
doSubmit() {
|
||||
this.$axios.post("/platform/activity/basic/union/" + (this.formData.id ? "update" : "insert"), this.formData).then((res) => {
|
||||
this.dialogFormVisible = false
|
||||
this.$message.success(res.msg)
|
||||
this.doSearch()
|
||||
this.$emit("refresh", null)
|
||||
})
|
||||
},
|
||||
doDeleteUnion(id, flag) {
|
||||
let msg = flag ? "请确认是否要删除本联合工会,一旦删除相关数据将无法查询!!!" : "选择后系统将组成单位还原到所在分工会!!!"
|
||||
|
||||
this.$confirm(msg, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "info"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/activity/basic/union/doDeleteUnion", { id, flag }).then((res) => {
|
||||
this.$message.success(res.msg)
|
||||
this.doSearch()
|
||||
this.$emit("refresh", null)
|
||||
})
|
||||
})
|
||||
},
|
||||
adminFilterMethod(query, item) {
|
||||
return item.name.indexOf(query) > -1
|
||||
},
|
||||
openAdmin(id) {
|
||||
this.unionId = id
|
||||
this.$axios.post("/platform/activity/basic/union/getUnionAdminAndUser", { id: id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.userData = res.data.userData
|
||||
this.userAdminIds = res.data.userAdminIds
|
||||
}
|
||||
})
|
||||
this.dialogGlyFormVisible = true
|
||||
},
|
||||
doSubmitAdmin() {
|
||||
this.$axios
|
||||
.post("/platform/activity/basic/union/doSubmitAdmin", {
|
||||
unionId: this.unionId,
|
||||
userIds: JSON.stringify(this.userAdminIds)
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.doSearch()
|
||||
this.$message.success(res.msg)
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
this.dialogGlyFormVisible = false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.pageData()
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
const ACTIVITY_BASIC_BRANCH_UNION_PART_UNIT_MANAGE = {
|
||||
template: `
|
||||
<div>
|
||||
<el-card shadow="never" style="border: 1px solid var(--border-color-lighter); margin-top: 10px">
|
||||
<el-row type="flex" style="column-gap: 10px">
|
||||
<el-input
|
||||
placeholder="请输入内容"
|
||||
size="small"
|
||||
style="width: 400px"
|
||||
clearable
|
||||
v-model="pageForm.searchKeyword"
|
||||
@keyup.enter.native="doSearch"
|
||||
></el-input>
|
||||
<el-button type="primary" size="small" icon="el-icon-search" @click="doSearch"></el-button>
|
||||
<el-button type="primary" size="small" icon="el-icon-setting" style="margin-left: auto" @click="openAdd">设置组成单位</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 size="small">
|
||||
<el-table-column type="index" label="序号"></el-table-column>
|
||||
<el-table-column prop="unitcode" label="单位编码"></el-table-column>
|
||||
<el-table-column prop="name" label="单位名称"></el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<el-dialog title="设置组成单位" :visible.sync="dialogFormVisible" width="1000px" :close-on-click-modal="false">
|
||||
<el-transfer
|
||||
ref="transferRef"
|
||||
:titles="['可选二级单位', '当前成员单位']"
|
||||
filterable
|
||||
:props="{
|
||||
key: 'id',
|
||||
label: 'name'
|
||||
}"
|
||||
:filter-method="filterUnit"
|
||||
v-model="selectUnitsIds"
|
||||
:data="allUnits"
|
||||
></el-transfer>
|
||||
<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,
|
||||
selectUnitsIds: [],
|
||||
allUnits: [],
|
||||
unionId: ""
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openAdd() {
|
||||
this.dialogFormVisible = true
|
||||
if (this.$refs.transferRef) {
|
||||
this.$refs.transferRef.clearQuery("left")
|
||||
this.$refs.transferRef.clearQuery("right")
|
||||
}
|
||||
this.$axios.post("/platform/activity/basic/union/branchUnionPartUnitTransferData", { unionId: this.unionId }).then((res) => {
|
||||
this.selectUnitsIds = res.data.selectUnitIds
|
||||
this.allUnits = res.data.allUnits
|
||||
})
|
||||
},
|
||||
|
||||
filterUnit(query, item) {
|
||||
return item.name.indexOf(query) > -1
|
||||
},
|
||||
|
||||
doSubmit() {
|
||||
this.$axios
|
||||
.post("/platform/activity/basic/union/branchUnionPartUnitSet", {
|
||||
unitIds: JSON.stringify(this.selectUnitsIds),
|
||||
unionId: this.unionId
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.dialogFormVisible = false
|
||||
this.$message.success(res.msg)
|
||||
this.doSearch()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
pageData(unionId) {
|
||||
if (unionId) {
|
||||
this.unionId = unionId
|
||||
}
|
||||
this.$axios
|
||||
.post("/platform/activity/basic/union/branchUnionPartUnitPageData", {
|
||||
...this.pageForm,
|
||||
unionId: this.unionId
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<el-row :gutter="10" type="flex" style="height: calc(100vh - 126px)">
|
||||
<el-col :span="5">
|
||||
<el-card shadow="never" style="height: 100%" body-style="{ height: '100%' }">
|
||||
<div style="max-height: calc(100vh - 160px); overflow-y: auto">
|
||||
<el-tree
|
||||
:data="treeData"
|
||||
:expand-on-click-node="false"
|
||||
:props="{
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
}"
|
||||
@node-click="treeNodeClick"
|
||||
default-expand-all
|
||||
highlight-current
|
||||
ref="treeRef"
|
||||
>
|
||||
<template slot-scope="{ node, data }">
|
||||
<span class="el-tree-node__label">
|
||||
<i class="el-icon-folder-opened" v-if="node.level===1"></i>
|
||||
<i class="el-icon-folder" v-else></i>
|
||||
{{node.label}}
|
||||
</span>
|
||||
</template>
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="19">
|
||||
<el-card style="height: 100%" shadow="never">
|
||||
<template v-if="currentTreeNode==null || currentTreeNode.level===1">
|
||||
<activity-basic-branch-union-manage @refresh="getTreeData()"></activity-basic-branch-union-manage>
|
||||
</template>
|
||||
<template v-if="currentTreeNode && currentTreeNode.level===2">
|
||||
<activity-basic-branch-union-part-unit-manage ref="unitManage"></activity-basic-branch-union-part-unit-manage>
|
||||
</template>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
<!--#include("activityBasicBranchUnionManage.js"){}#-->
|
||||
<!--#include("activityBasicBranchUnionPartUnitManage.js"){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
treeData: [],
|
||||
currentTreeNode: null,
|
||||
currentTreeData: null
|
||||
}
|
||||
},
|
||||
components: {
|
||||
"activity-basic-branch-union-manage": ACTIVITY_BASIC_BRANCH_UNION_MANAGE,
|
||||
"activity-basic-branch-union-part-unit-manage": ACTIVITY_BASIC_BRANCH_UNION_PART_UNIT_MANAGE
|
||||
},
|
||||
methods: {
|
||||
treeNodeClick(data, node) {
|
||||
this.currentTreeData = data
|
||||
this.currentTreeNode = node
|
||||
if (node.level === 2) {
|
||||
setTimeout(() => {
|
||||
this.$refs.unitManage.pageData(data.id)
|
||||
}, 300)
|
||||
}
|
||||
},
|
||||
getTreeData() {
|
||||
this.$axios.post(loc() + "/tree").then((res) => {
|
||||
this.treeData = res.data
|
||||
if (this.treeData) {
|
||||
this.checkData = this.treeData[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.pageData()
|
||||
this.getTreeData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,149 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<el-row :gutter="10" type="flex" style="height: calc(100vh - 126px)">
|
||||
<el-col :span="5">
|
||||
<el-card shadow="never" style="height: 100%" body-style="{ height: '100%' }">
|
||||
<div style="max-height: calc(100vh - 160px); overflow-y: auto">
|
||||
<el-tree
|
||||
:data="treeData"
|
||||
:default-expanded-keys="['1']"
|
||||
:expand-on-click-node="false"
|
||||
:props="{
|
||||
children: 'child',
|
||||
label: 'name'
|
||||
}"
|
||||
@node-click="treeNodeClick"
|
||||
highlight-current
|
||||
node-key="id"
|
||||
ref="treeRef"
|
||||
>
|
||||
<template slot-scope="{ node, data }">
|
||||
<span class="el-tree-node__label">
|
||||
<i class="el-icon-folder-opened" v-if="node.level===1"></i>
|
||||
<i class="el-icon-folder" v-else></i>
|
||||
{{node.label}}
|
||||
</span>
|
||||
</template>
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="19">
|
||||
<el-card shadow="never" style="height: 100%">
|
||||
<el-card shadow="never" style="border: 1px solid var(--border-color-lighter)">
|
||||
<div class="search">
|
||||
<div class="search-item" style="width: 25%">
|
||||
<el-input
|
||||
@keyup.enter.native="doSearch"
|
||||
clearable
|
||||
placeholder="请输入内容"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.searchKeyword"
|
||||
>
|
||||
<el-select placeholder="查询类型" slot="prepend" style="width: 110px" v-model="pageForm.searchName">
|
||||
<el-option label="单位名称" value="name"></el-option>
|
||||
<el-option label="单位代码" value="unitcode"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card shadow="never" style="border: 1px solid var(--border-color-lighter)">
|
||||
<table-tool></table-tool>
|
||||
<el-table :data="tableData" height="calc(100vh - 380px)" border size="small">
|
||||
<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 align="center" label="单位名称" prop="name"></el-table-column>
|
||||
<el-table-column align="center" label="单位代码" prop="unitcode"></el-table-column>
|
||||
<el-table-column align="center" label="单位等级" prop="unitLevel">
|
||||
<template slot-scope="{row}">
|
||||
<el-button round size="mini" style="vertical-align: middle" type="success" v-if="row.unitLevel==1">1级</el-button>
|
||||
<el-button round size="mini" style="vertical-align: middle" type="warning" v-if="row.unitLevel==2">2级</el-button>
|
||||
<el-button round size="mini" style="vertical-align: middle" type="danger" v-if="row.unitLevel==3">3级</el-button>
|
||||
<el-button round size="mini" style="vertical-align: middle" type="info" v-if="row.unitLevel>3">
|
||||
{{row.unitlevel}}级
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="操作" width="100px">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
searchName: "name"
|
||||
},
|
||||
treeData: [],
|
||||
currentTreeNode: null,
|
||||
currentTreeData: null
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
methods: {
|
||||
async doDelete(id) {
|
||||
const confirm = await this.$confirm("确定要删除该单位吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
if (confirm === "confirm") {
|
||||
const resp = await this.$axios.post(loc() + "/doDelete", { id })
|
||||
if (resp.code === 0) {
|
||||
this.getTreeData()
|
||||
this.doSearch()
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
treeNodeClick(data, node) {
|
||||
this.currentTreeData = data
|
||||
this.currentTreeNode = node
|
||||
this.pageForm.parentId = data.id
|
||||
this.doSearch()
|
||||
},
|
||||
getTreeData() {
|
||||
this.$axios.post(loc() + "/tree").then((res) => {
|
||||
this.treeData = res.data
|
||||
if (this.treeData) {
|
||||
this.currentTreeData = this.treeData[0]
|
||||
}
|
||||
})
|
||||
},
|
||||
openUnit() {}
|
||||
},
|
||||
created() {
|
||||
this.pageData()
|
||||
this.getTreeData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,26 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<user-scope ref="userScope"></user-scope>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
components: {
|
||||
"user-scope": httpVueLoader("/components/module/activity/UserScope.vue?v=" + new Date().getDate())
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -0,0 +1,26 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<user-scope-data ref="userDataScope"></user-scope-data>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
components: {
|
||||
"user-scope-data": httpVueLoader("/components/module/activity/UserDataScope.vue?v=" + new Date().getDate())
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user