356 lines
15 KiB
HTML
356 lines
15 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
|
|
|
|
<style>
|
|
.el-row--flex .el-form-item {
|
|
flex: 1;
|
|
}
|
|
|
|
.w-e-toolbar, .w-e-text-container {
|
|
z-index: 1 !important;
|
|
}
|
|
</style>
|
|
|
|
<div id="app" v-cloak>
|
|
<guava ref="guava">
|
|
<template>
|
|
<el-card shadow="never">
|
|
|
|
<div class="btn-group tool-button">
|
|
<el-date-picker
|
|
v-model="pageForm.year"
|
|
value-format="yyyy"
|
|
type="year"
|
|
placeholder="选择年度">
|
|
</el-date-picker>
|
|
</div>
|
|
|
|
<div class="btn-group tool-button">
|
|
<el-input v-model="pageForm.suggestionName" clearable placeholder="请输入名称"></el-input>
|
|
</div>
|
|
|
|
|
|
<div class="btn-group tool-button">
|
|
<el-button icon="el-icon-search" type="primary" @click="doSearch"></el-button>
|
|
</div>
|
|
|
|
<div class="offscreen-right pull-right">
|
|
<el-button @click="openAdd">新建工作建议</el-button>
|
|
</div>
|
|
</el-card>
|
|
<el-card shadow="never" class="mt20">
|
|
<el-table :data="tableData" @sort-change="pageOrder">
|
|
<el-table-column type="index" width="50" label="序号"></el-table-column>
|
|
<el-table-column v-for="i in tableColumns" :prop="i.prop" :label="i.label" :sortable="i.sortable"
|
|
show-overflow-tooltip>
|
|
<template scope="{row}" v-if="i.prop=='state'">
|
|
<span :style="{color:x.color}" v-for="x in suggestionApi.suggestionState" :key="x.state"
|
|
v-if="x.state===row.state">
|
|
{{x.name}}
|
|
</span>
|
|
</template>
|
|
<template scope="{row}" v-else-if="i.prop=='adopt'">
|
|
<el-tag v-if="row.proposalId" type="success">提案采纳</el-tag>
|
|
<el-tag v-else type="warning">暂无</el-tag>
|
|
</template>
|
|
|
|
</el-table-column>
|
|
<el-table-column label="操作" width="300">
|
|
<template slot-scope="{row}">
|
|
<el-button size="mini" type="primary" @click="openView(row)">查看</el-button>
|
|
<el-button v-if="row.state===1" size="mini" type="primary" @click="openEdit(row)">编辑
|
|
</el-button>
|
|
<el-button v-if="row.state===1" size="mini" type="primary" @click="openSubmit(row.id)">提交
|
|
</el-button>
|
|
<el-button v-if="row.state===1" size="mini" type="danger" @click="doDelete(row.id)">删除
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!--#include("/layouts/pagination.html"){}#-->
|
|
</el-card>
|
|
</template>
|
|
|
|
<template #edit>
|
|
<el-form :model="formData" ref="Form" :rules="formRules" label-width="120px">
|
|
<el-row type="flex">
|
|
<el-form-item label="姓名">
|
|
<el-input readonly v-model="formData.createUserName"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="撰写时间">
|
|
<el-input readonly v-model="formData.applyTime"></el-input>
|
|
</el-form-item>
|
|
</el-row>
|
|
<el-form-item label="名称" prop="suggestionName">
|
|
<el-input v-model="formData.suggestionName" maxlength="45"></el-input>
|
|
</el-form-item>
|
|
<el-row type="flex">
|
|
<el-form-item label="所属工会">
|
|
<el-input readonly v-model="formData.createUserUnionName"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="意见类型" prop="suggestionType">
|
|
<el-select v-model="formData.suggestionType" filterable clearable
|
|
placeholder="工作建议类型" style="width: 100%">
|
|
<el-option
|
|
v-for="item in typeOptions"
|
|
:key="item.id"
|
|
:label="item.typeName"
|
|
:value="item.id">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-row>
|
|
<el-form-item prop="suggestionContent" label="工作建议内容" class="is-required">
|
|
<div id="suggestionContentEditor"></div>
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<el-row type="flex" justify="end">
|
|
<el-button type="primary" @click="doSave">提交</el-button>
|
|
</el-row>
|
|
|
|
</template>
|
|
|
|
<template #view>
|
|
<suggestion-info ref="info"></suggestion-info>
|
|
</template>
|
|
|
|
</guava>
|
|
|
|
<el-dialog :title="title"
|
|
:visible.sync="submitDialog" custom-class="ViewDialogClass" v-loading="true"
|
|
:close-on-click-modal="false" width="50%">
|
|
|
|
<el-row>
|
|
<div class="btn-group tool-button mt5">
|
|
<el-select
|
|
v-model="formData.levelTwoJdhUser"
|
|
@change="userChange"
|
|
filterable
|
|
remote
|
|
reserve-keyword
|
|
placeholder="请输入工号或者姓名查询"
|
|
:remote-method="searchUser"
|
|
style="width: 100%">
|
|
<el-option
|
|
v-for="item in userList"
|
|
:key="item.id"
|
|
:label="item.username+'-'+item.loginname"
|
|
:value="item.id">
|
|
</el-option>
|
|
</el-select>
|
|
</div>
|
|
<div class="btn-group tool-button mt5">
|
|
<el-button size="medium" type="primary" icon="el-icon-s-promotion" @click="xzDb">
|
|
选择
|
|
</el-button>
|
|
</div>
|
|
</el-row>
|
|
|
|
<el-table :data="dbTableData" size="medium" style="width: 100%">
|
|
<el-table-column align="center" header-align="center" type="index" label="序号"></el-table-column>
|
|
<el-table-column align="center" header-align="center" prop="loginname" label="工号"></el-table-column>
|
|
<el-table-column align="center" header-align="center" prop="username" label="姓名"></el-table-column>
|
|
<el-table-column align="center" header-align="center" prop="sex" label="性别"></el-table-column>
|
|
<el-table-column align="center" header-align="center" prop="mobile" label="电话"></el-table-column>
|
|
<el-table-column align="center" header-align="center" prop="unitname" label="单位"></el-table-column>
|
|
<el-table-column align="center" header-align="center" prop="is_agree" label="操作">
|
|
<template scope="{row}">
|
|
<el-button type="danger" icon="el-icon-delete" circle @click="clickDb"></el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<el-row type="flex" justify="end" class="mt10">
|
|
<el-button @click="submitDialog=false">取消</el-button>
|
|
<el-button @click="doSubmit" class="ml10" type="primary">提交</el-button>
|
|
</el-row>
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
let E = window.wangEditor
|
|
let suggestionContentEditor = null
|
|
|
|
var vue = new Vue({
|
|
el: '#app',
|
|
mixins: [initTableMixins],
|
|
components: {
|
|
'suggestion-info': httpVueLoader('/components/suggestion/SuggestionInfo.vue')
|
|
},
|
|
data() {
|
|
const validAy = (rule, value, callback) => {
|
|
if (!this.formData.suggestionContent || !dd3s.html2txt(this.formData.suggestionContent)) {
|
|
callback(new Error('请填写工作建议内容、案由和案据'));
|
|
} else {
|
|
callback();
|
|
}
|
|
};
|
|
return {
|
|
pageForm: {
|
|
year: moment().format('YYYY')
|
|
},
|
|
title: "选择二级教代会代表",
|
|
typeOptions: [],
|
|
dbTableData: [],
|
|
formRules: {
|
|
suggestionType: [{required: true, message: '请选择工作建议类型', trigger: ['blur', 'change']}],
|
|
suggestionName: [{required: true, message: '请填写工作建议名称', trigger: ['blur', 'change']}],
|
|
suggestionContent: [{validator: validAy, trigger: ['blur', 'change']}],
|
|
},
|
|
tableColumns: suggestionApi.tableColums,
|
|
formData: {
|
|
suggestionName: null,
|
|
suggestionType: null
|
|
},
|
|
submitDialog: false,
|
|
userList: [],
|
|
isStartJdh: false
|
|
}
|
|
},
|
|
methods: {
|
|
clickDb() {
|
|
this.dbTableData.splice(0, 1)
|
|
},
|
|
async xzDb() {
|
|
if (this.dbTableData.length > 0) {
|
|
this.$notify({
|
|
title: '警告',
|
|
message: '二级教代会代表只能选择一人,请先删除之后在添加',
|
|
type: 'warning'
|
|
});
|
|
return
|
|
}
|
|
const userData = await queryUserById(this.formData.levelTwoJdhUser)
|
|
if (userData && userData.length > 0) {
|
|
this.dbTableData.push({
|
|
loginname: userData[0].loginname,
|
|
username: userData[0].username,
|
|
sex: userData[0].sex,
|
|
mobile: userData[0].mobile,
|
|
unitname: userData[0].unitname,
|
|
id: userData[0].id
|
|
})
|
|
}
|
|
|
|
},
|
|
async userChange() {
|
|
|
|
const userData = await queryUserById(this.formData.levelTwoJdhUser)
|
|
this.$set(this.formData, "sex", userData.sex)
|
|
this.$set(this.formData, "unionname", userData.unionname)
|
|
},
|
|
openView(row) {
|
|
this.$refs.guava.view()
|
|
this.$refs.info.getData(row.id)
|
|
},
|
|
openAdd() {
|
|
this.$refs.guava.edit()
|
|
this.formData.createUserName = "${@shiro.getPrincipalProperty('username')}"
|
|
this.formData.createUserUnionName = "${@shiro.getPrincipalProperty('union').getUnionname()}"
|
|
this.formData.applyTime = moment().format('YYYY-MM-DD')
|
|
this.formData.id = undefined
|
|
this.formData.suggestionName = null
|
|
this.formData.suggestionType = null
|
|
this.$nextTick(() => {
|
|
$("#suggestionContentEditor").html("")
|
|
suggestionContentEditor = new E("#suggestionContentEditor")
|
|
suggestionContentEditor.config.onchange = (html) => {
|
|
this.formData.suggestionContent = html
|
|
}
|
|
suggestionContentEditor.create()
|
|
})
|
|
},
|
|
doSave() {
|
|
this.$refs["Form"].validate(async (valid) => {
|
|
if (valid) {
|
|
const resp_data = await $.post('/platform/suggestions/apply/doSave', this.formData)
|
|
if (resp_data.code === 0) {
|
|
this.$refs.guava.index()
|
|
this.$notify({
|
|
title: '成功',
|
|
message: resp_data.msg,
|
|
type: 'success'
|
|
});
|
|
this.doSearch()
|
|
}
|
|
}
|
|
})
|
|
},
|
|
async openSubmit(id) {
|
|
this.formData = {}
|
|
this.formData.id = id
|
|
const {data} = await $.get('/platform/suggestions/apply/isStartJdh')
|
|
this.title = data > 0 ? "选择二级教代会代表" : "选择校工会代表"
|
|
this.isStartJdh = data > 0
|
|
this.submitDialog = true
|
|
},
|
|
async searchUser(key) {
|
|
if (key) {
|
|
const resp_data = await $.post(this.isStartJdh > 0 ? '/platform/suggestions/apply/searchUser' : '/platform/suggestions/depExamine/searchUser', {key})
|
|
if (resp_data.code === 0) {
|
|
this.userList = resp_data.data.list
|
|
}
|
|
}
|
|
},
|
|
async doSubmit() {
|
|
if (this.dbTableData.length === 0) {
|
|
this.notifyWarning(this.isStartJdh > 0 ? "请搜索并选择本单位的二级教代会代表" : "请搜索并选择校工会代表")
|
|
return
|
|
}
|
|
const params = {
|
|
id: this.formData.id,
|
|
levelTwoJdhUser: this.dbTableData[0].id,
|
|
isStartJdh: this.isStartJdh
|
|
}
|
|
const resp_data = await $.post('/platform/suggestions/apply/doSave', params)
|
|
if (resp_data.code === 0) {
|
|
this.submitDialog = false
|
|
this.notifySuccess(resp_data.msg)
|
|
this.doSearch()
|
|
}
|
|
},
|
|
openEdit(row) {
|
|
this.formData = row
|
|
this.$refs.guava.edit()
|
|
this.$nextTick(() => {
|
|
$("#suggestionContentEditor").html("")
|
|
suggestionContentEditor = new E("#suggestionContentEditor")
|
|
suggestionContentEditor.config.onchange = (html) => {
|
|
this.formData.suggestionContent = html
|
|
}
|
|
suggestionContentEditor.create()
|
|
suggestionContentEditor.txt.html(this.formData.suggestionContent)
|
|
})
|
|
},
|
|
doDelete(id) {
|
|
this.$confirm('确定要删除此条建议吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(async () => {
|
|
const resp_data = await $.post('/platform/suggestions/apply/doDelete', {id})
|
|
if (resp_data.code === 0) {
|
|
this.notifySuccess(resp_data.msg)
|
|
this.doSearch()
|
|
}
|
|
}).catch(() => {
|
|
|
|
});
|
|
}
|
|
},
|
|
async created() {
|
|
this.pageData()
|
|
this.typeOptions = await getProposalType()
|
|
}
|
|
})
|
|
</script>
|
|
<!--#
|
|
}
|
|
#-->
|