<template>
|
<div>
|
<el-dialog
|
class="dialogContent"
|
title="项目选择"
|
:visible.sync="show"
|
:close-on-click-modal="false"
|
center
|
top="45px"
|
width="850px">
|
<el-form ref="form" :model="form" id="search-form">
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="项目名称" prop="cname">
|
<el-input v-model="form.cname"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="项目城市" prop="citycd">
|
<el-input v-model="form.citycd"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="项目负责人" prop="managername">
|
<el-input v-model="form.managername"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item class="box-search">
|
<el-button @click="restForm('form')" size="mini">重置</el-button>
|
<el-button type="primary" size="mini" @click="handleSearch">搜索</el-button>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<el-table
|
:data="tableData"
|
v-loading="loading"
|
highlight-current-row
|
border
|
height="300"
|
@current-change="handleCheckbox"
|
style="width: 100%">
|
<!-- <el-table-column label=" " width="40">
|
<template slot-scope="scope">
|
<el-checkbox v-model="scope.row.checked"></el-checkbox>
|
</template>
|
</el-table-column> -->
|
<el-table-column
|
type="index"
|
label=" ">
|
</el-table-column>
|
<el-table-column
|
prop="projectid"
|
label="项目编号">
|
</el-table-column>
|
<el-table-column
|
prop="cname"
|
label="项目名称">
|
</el-table-column>
|
<el-table-column
|
prop="citycd"
|
label="项目城市">
|
</el-table-column>
|
<el-table-column
|
prop="managername"
|
label="项目负责人">
|
</el-table-column>
|
</el-table>
|
<pagination
|
v-show="total > 0"
|
:total="total"
|
:page.sync="listQuery.currentPage"
|
:limit.sync="listQuery.pageSize"
|
@pagination="tableList"
|
/>
|
<span slot="footer" class="dialog-footer">
|
<el-button class="blankBtn" @click="show = false" size="mini">返回</el-button>
|
<el-button type="primary" size="mini" @click="handleSubmit" :disabled="commitData" class="blueBtn" >确定</el-button>
|
<!-- <el-button type="primary" size="mini" @click="handleSubmit" :disabled="commitData"
|
class="blueBtn"
|
v-no-more-click v-loading="commitData" element-loading-spinner="el-icon-loading" element-loading-background="rgba(64, 158, 255,.3)" >确定</el-button> -->
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import Pagination from '@/components/Pagination'
|
import { qryZYProjectInfo, saveProjectAdmit } from '@/api/area'
|
export default {
|
components: { Pagination },
|
props: ['showDialog', 'projectFlag'],
|
data: function () {
|
return {
|
tableData: [],
|
// 分页
|
total: '0',
|
listQuery: {
|
currentPage: 1,
|
pageSize: 10
|
},
|
form: {
|
cname: '',
|
citycd: '',
|
managername: ''
|
},
|
tempForm: {
|
projectname: '',
|
projectId: '',
|
projectcode: ''
|
},
|
checking: '',
|
commitData: false,
|
loading: true
|
}
|
},
|
computed: {
|
show: {
|
get() {
|
return this.showDialog
|
},
|
set() {
|
this.$refs['form'].resetFields()
|
this.tableList()
|
this.$emit('update:showDialog', false)
|
}
|
}
|
},
|
created () {
|
this.tableList()
|
},
|
methods: {
|
// 重置表单
|
restForm (refname) {
|
this.$refs[refname].resetFields()
|
},
|
tableList () {
|
// 初始化表格
|
let params = Object.assign(this.listQuery, this.form)
|
qryZYProjectInfo(params).then(res => {
|
if (res.code === '00') {
|
this.tableData = res.result.records
|
this.total = res.result.total
|
this.tableData.forEach((item, index) => {
|
item.checked = false
|
// this.$set(this.tableData[index], 'checked', false)
|
})
|
this.loading = false
|
}
|
})
|
},
|
handleSearch () {
|
this.tableList()
|
},
|
handleCheckbox (row) {
|
if (row !== null) {
|
this.tableData.forEach((item, index) => {
|
if (item.projectid !== row.projectid) {
|
this.$set(this.tableData[index], 'checked', false)
|
this.$set(this.tableData[index], 'ischecked', false)
|
} else {
|
this.$set(this.tableData[index], 'checked', true)
|
this.$set(this.tableData[index], 'ischecked', true)
|
this.tempForm.projectname = item.cname
|
this.tempForm.projectId = item.projectid
|
this.tempForm.projectcode = item.ccode
|
}
|
})
|
}
|
},
|
handleSubmit () {
|
this.commitData = true
|
this.loading = true
|
let params = {
|
projectFlag: this.projectFlag, // 0 - 审批准入 1- 项目立项
|
projecttype: '1'// 自营为1 社会化为2
|
}
|
this.checking = this.tableData.filter(item => item.ischecked === true );
|
Object.assign(params, this.tempForm)
|
if (this.checking.length === 1) {
|
saveProjectAdmit(params).then(res => {
|
if (res.code === '00') {
|
this.$message.success('添加成功')
|
let detailsParams = {
|
dataType: res.result.dataType,
|
objectNo: res.result.serialno,
|
objectType: res.result.objectType,
|
projectFlag: res.result.projectFlag,
|
projectType: res.result.projectType,
|
opertion: '01', // 控制提交按钮是否显示 01 显示 02 不显示
|
applyMsg: '01'
|
}
|
this.$store.commit('SET_detailsParams', detailsParams)
|
this.$router.push({ path: '/area/projectManagement/add/projectBasicInformation' })
|
} else {
|
this.loading = false
|
setTimeout(() => {
|
this.commitData = false
|
this.loading = false
|
}, 6000)
|
}
|
})
|
} else {
|
this.loading = false
|
this.commitData = false
|
this.$message.warning('请选择申请项目')
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="stylus" scoped>
|
.box-search{
|
margin-left 50px
|
}
|
>>> .el-loading-spinner
|
top 30px
|
.dialogContent
|
max-height 800px
|
>>> .el-dialog__header
|
padding-top 40px
|
>>> .el-dialog__title
|
font-size 18px
|
// font-family PingFangSC-Medium,PingFangSC
|
font-weight bold
|
color #222222
|
line-height 25px
|
>>> .el-dialog__body
|
padding-bottom 0px
|
>>> .el-dialog__footer
|
padding-bottom 40px
|
padding-top 8px
|
.dialog-footer
|
.blankBtn
|
border-radius 4px
|
border 1px solid rgba(204,204,204,1)
|
color rgba(85,85,85,1)
|
.blueBtn
|
margin-left 40px
|
background-color rgba(0,129,240,1)
|
border-radius 4px
|
color rgba(255,255,255,1)
|
.blankBtn,.blueBtn
|
padding 0
|
width 120px
|
height 30px
|
span
|
font-size 14px
|
height 20px
|
font-weight 400
|
line-height 20px
|
</style>
|