242 lines
9.9 KiB
HTML
242 lines
9.9 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
<div id="app" v-cloak>
|
|
<guava ref="guava">
|
|
<el-card shadow="never">
|
|
<div class="btn-group tool-button mt5">
|
|
<el-input clearable placeholder="请输入姓名或工号查询"
|
|
@keyup.enter.native="doSearch" v-model="pageForm.keyword">
|
|
</el-input>
|
|
</div>
|
|
<div class="btn-group tool-button mt5">
|
|
<el-select
|
|
clearable
|
|
@change="doSearch"
|
|
placeholder="请选择分组"
|
|
style="width: 100%"
|
|
v-model="pageForm.groupName">
|
|
<el-option
|
|
:key="item"
|
|
:label="item"
|
|
:value="item"
|
|
v-for="item in groupNameOptions">
|
|
</el-option>
|
|
</el-select>
|
|
</div>
|
|
<div class="btn-group tool-button mt5">
|
|
<el-button type="primary" @click="doSearch" icon="el-icon-search"></el-button>
|
|
</div>
|
|
<div class="pull-right offscreen-right mt5">
|
|
<el-button @click="openAdd" size="medium" type="primary"><i class="ti-plus"></i>新增评委</el-button>
|
|
</div>
|
|
</el-card>
|
|
<el-card shadow="never" class="mt10">
|
|
<el-table :data="tableData" @sort-change='pageOrder'>
|
|
<el-table-column align="center" header-align="center" label="序号" type="index">
|
|
<template scope="scope">
|
|
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="评委姓名" prop="username"></el-table-column>
|
|
<el-table-column label="评委工号" prop="loginname"></el-table-column>
|
|
<el-table-column label="职务" prop="zw" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="职称" prop="zc" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="所在单位" prop="dwname" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="负责选题数" prop="xxnum"></el-table-column>
|
|
<el-table-column label="期数" prop="period" sortable></el-table-column>
|
|
<el-table-column label="组别" prop="groupName" sortable></el-table-column>
|
|
<el-table-column label="操作" width="200px">
|
|
<template slot-scope="scope">
|
|
<el-button @click="openEdit(scope.row)" size="mini" type="primary">编辑</el-button>
|
|
<el-button @click="doDelete(scope.row)" size="mini" type="danger">删除</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<el-row class="el-pagination-container">
|
|
<el-pagination
|
|
@current-change="pageNumberChange"
|
|
:current-page="pageForm.pageNumber"
|
|
:page-size="pageForm.pageSize"
|
|
layout="total, prev, pager, next, jumper"
|
|
:total="pageForm.totalCount">
|
|
</el-pagination>
|
|
</el-row>
|
|
</el-card>
|
|
</guava>
|
|
|
|
<el-dialog :title="userDialogTitle" :visible.sync="userDialogVisible" width="30%">
|
|
<el-form :model="formData" label-width="100px" ref="userForm">
|
|
<el-form-item :rules="[{required: true, message: '请选择期数或输入一个新期数', trigger: ['blur', 'change']}]" label="期数"
|
|
prop="period">
|
|
<el-select
|
|
allow-create
|
|
default-first-option
|
|
filterable
|
|
placeholder="请选择期数或输入一个新期数"
|
|
style="width: 100%"
|
|
v-model="formData.period">
|
|
<el-option
|
|
:key="item"
|
|
:label="item"
|
|
:value="item"
|
|
v-for="item in periodOptions">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :rules="[{required: true, message: '请先搜素并选择要新增的评委', trigger: ['blur', 'change']}]" label="姓名"
|
|
prop="userid">
|
|
<el-select
|
|
:disabled="formData.id"
|
|
v-model="formData.userid"
|
|
clearable
|
|
filterable
|
|
remote
|
|
placeholder="请输入姓名或者工号查询"
|
|
style="width: 100%"
|
|
:remote-method="queryUser">
|
|
<el-option
|
|
v-for="u in userOptions"
|
|
:key="u.id"
|
|
:label="u.username + '-' +u.loginname"
|
|
:value="u.id">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :rules="[{required: true, message: '请选择分组或输入一个新分组', trigger: ['blur', 'change']}]" label="组别"
|
|
prop="groupName">
|
|
<el-select
|
|
allow-create
|
|
default-first-option
|
|
filterable
|
|
placeholder="请选择分组或输入一个新分组"
|
|
style="width: 100%"
|
|
v-model="formData.groupName">
|
|
<el-option
|
|
:key="item"
|
|
:label="item"
|
|
:value="item"
|
|
v-for="item in groupNameOptions">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-row slot="footer">
|
|
<el-button @click="userDialogVisible = false">取消</el-button>
|
|
<el-button @click="doSubmit" type="primary">确定</el-button>
|
|
</el-row>
|
|
</el-dialog>
|
|
|
|
</div>
|
|
<script>
|
|
let vue = new Vue({
|
|
el: '#app',
|
|
mixins: [initTableMixins],
|
|
data() {
|
|
return {
|
|
tableData: [],
|
|
userDialogVisible: false,
|
|
userOptions: [],
|
|
formData: {
|
|
id: null,
|
|
userid: null,
|
|
groupName: null
|
|
},
|
|
groupNameOptions: [],
|
|
periodOptions:[],
|
|
}
|
|
},
|
|
computed: {
|
|
userDialogTitle() {
|
|
return this.formData.id ? '编辑评委' : '新增评委'
|
|
}
|
|
},
|
|
methods: {
|
|
async queryUser(val) {
|
|
if (val) {
|
|
const resp = await $.get(loc() + '/queryUser/' + val)
|
|
if (resp.code === 0) {
|
|
this.userOptions = resp.data
|
|
} else {
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
}
|
|
},
|
|
openAdd() {
|
|
this.userDialogVisible = true
|
|
this.userOptions = []
|
|
if (this.$refs['userForm']) {
|
|
this.$refs['userForm'].resetFields()
|
|
}
|
|
this.formData.id = null
|
|
},
|
|
async doSubmit() {
|
|
const valid = await this.$refs['userForm'].validate()
|
|
if (!valid) return
|
|
const methodName = this.formData.id ? '/doEdit' : '/doAdd'
|
|
const resp = await $.post(loc() + methodName, this.formData)
|
|
if (resp.code === 0) {
|
|
this.notifySuccess(resp.msg)
|
|
this.userDialogVisible = false
|
|
this.doSearch()
|
|
this.getGroupNameOptions()
|
|
} else {
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
},
|
|
openEdit(row) {
|
|
this.userDialogVisible = true
|
|
this.userOptions = [{
|
|
id: row.userid,
|
|
username: row.username,
|
|
loginname: row.loginname
|
|
}]
|
|
this.$nextTick(() => {
|
|
this.formData = {...row}
|
|
})
|
|
},
|
|
|
|
async doDelete(row) {
|
|
const confirm = await this.$confirm('确定删除该评委, 是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
})
|
|
if ('confirm' !== confirm) return
|
|
const resp = await $.post(loc() + '/doDelete/' + row.id)
|
|
if (resp.code === 0) {
|
|
this.notifySuccess(resp.msg)
|
|
this.doSearch()
|
|
} else {
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
},
|
|
async getGroupNameOptions() {
|
|
const resp = await $.get(loc() + '/getGroupNameOptions')
|
|
if (resp.code === 0) {
|
|
this.groupNameOptions = resp.data
|
|
} else {
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
},
|
|
async getPeriodOptions() {
|
|
const resp = await $.get('/platform/syr/basic/pwgl/getPeriodOptions')
|
|
if (resp.code === 0) {
|
|
this.periodOptions = resp.data
|
|
} else {
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
this.pageData()
|
|
this.getGroupNameOptions()
|
|
this.getPeriodOptions();
|
|
}
|
|
})
|
|
</script>
|
|
<!--#
|
|
}
|
|
#-->
|