先提交一波整理的代码
This commit is contained in:
@@ -1,30 +1,27 @@
|
||||
<template>
|
||||
<section class="addChange">
|
||||
<ai-detail>
|
||||
<ai-title slot="title" title="新增换届" isShowBottomBorder isShowBack @onBackClick="cancel(false)" />
|
||||
<ai-title slot="title" title="新增换届" isShowBottomBorder isShowBack @onBackClick="cancel(false)"/>
|
||||
<template #content>
|
||||
<ai-card title="基本信息">
|
||||
<template #content>
|
||||
<div class="Form">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px" label-position="right">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px" label-position="right" size="small">
|
||||
<el-row type="flex">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="换届时间" prop="changeTime">
|
||||
<el-date-picker v-model="form.changeTime" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" style="width:338px">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="届次" prop="sessionTime">
|
||||
<el-input size="small" :maxlength="30" placeholder="请输入届次" v-model="form.sessionTime"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item class="fill" label="换届时间" prop="changeTime">
|
||||
<el-date-picker v-model="form.changeTime" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" style="width:338px">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item class="fill" label="届次" prop="sessionTime">
|
||||
<el-input size="small" :maxlength="30" placeholder="请输入届次" v-model="form.sessionTime"></el-input>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<ai-bar title="本届任职(必填)">
|
||||
<template slot="right">
|
||||
<el-button size="small" type="text" icon="iconfont iconAdd" @click="form.serveList.push({name:null,position:null,type:0})" >添加任职人员</el-button>
|
||||
<ai-title title="本届任职(必填)">
|
||||
<template slot="rightBtn">
|
||||
<el-button size="small" type="text" icon="iconfont iconAdd" @click="form.serveList.push({name:null,position:null,type:0})">添加任职人员
|
||||
</el-button>
|
||||
</template>
|
||||
</ai-bar>
|
||||
</ai-title>
|
||||
<el-table :data="form.serveList" size="mini" border stripe>
|
||||
<el-table-column label="职位" align="center">
|
||||
<template slot-scope="{row}">
|
||||
@@ -33,7 +30,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="姓名" align="center">
|
||||
<template slot-scope="{row}">
|
||||
<el-input class="tableInput" v-model="row.name" clearable placeholder="请输入姓名" />
|
||||
<el-input class="tableInput" v-model="row.name" clearable placeholder="请输入姓名"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
@@ -43,11 +40,12 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<ai-bar title="本届候选人">
|
||||
<template slot="right">
|
||||
<el-button size="small" type="text" icon="iconfont iconAdd" @click="form.candidateList.push({name:null,position:null,type: 1})" >添加候选人</el-button>
|
||||
<ai-title class="mar-t8" title="本届候选人">
|
||||
<template slot="rightBtn">
|
||||
<el-button size="small" type="text" icon="iconfont iconAdd" @click="form.candidateList.push({name:null,position:null,type: 1})">添加候选人
|
||||
</el-button>
|
||||
</template>
|
||||
</ai-bar>
|
||||
</ai-title>
|
||||
<el-table :data="form.candidateList" size="mini" border stripe>
|
||||
<el-table-column label="职位" align="center">
|
||||
<template slot-scope="{row}">
|
||||
@@ -56,7 +54,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="候选人" align="center">
|
||||
<template slot-scope="{row}">
|
||||
<el-input class="tableInput" v-model="row.name" clearable placeholder="请输入姓名" />
|
||||
<el-input class="tableInput" v-model="row.name" clearable placeholder="请输入姓名"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
@@ -95,34 +93,31 @@ export default {
|
||||
candidateList: [], // 候选人员列表
|
||||
},
|
||||
rules: {
|
||||
changeTime: [{ required: true, message: '请选择换届时间', trigger: 'blur' }],
|
||||
sessionTime: [{ required: true, message: '请输入届次', trigger: 'blur' }],
|
||||
changeTime: [{required: true, message: '请选择换届时间', trigger: 'blur'}],
|
||||
sessionTime: [{required: true, message: '请输入届次', trigger: 'blur'}],
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancel (isRefresh) {
|
||||
this.$emit('change', {
|
||||
type: 'List',
|
||||
isRefresh: !!isRefresh
|
||||
})
|
||||
cancel() {
|
||||
this.$router.push({})
|
||||
},
|
||||
handleDelete(i, type) {
|
||||
this.$confirm("确定要删除该数据?").then(() => {
|
||||
if(type == 'candidateList') {
|
||||
if (type == 'candidateList') {
|
||||
this.form.candidateList.splice(i, 1)
|
||||
} else if(type == 'serveList') {
|
||||
} else if (type == 'serveList') {
|
||||
this.form.serveList.splice(i, 1)
|
||||
}
|
||||
}).catch(() => 0)
|
||||
},
|
||||
confirm() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if(valid) {
|
||||
if (valid) {
|
||||
this.instance.post(`/app/apporganizationgeneralelection/add`, {
|
||||
...this.form
|
||||
}).then(res=>{
|
||||
if(res.code == 0) {
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('提交成功')
|
||||
this.cancel(true)
|
||||
}
|
||||
@@ -138,4 +133,4 @@ export default {
|
||||
.addChange {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user