Lihong@123456 5 years ago
parent
commit
c9db38144f
  1. 169
      src/views/firstPages/typemanage.vue

169
src/views/firstPages/typemanage.vue

@ -5,21 +5,22 @@
<div class="filter-container"> <div class="filter-container">
<el-input <el-input
v-model="ipt" v-model="searchCategory.name"
placeholder="名字" placeholder="名字"
class="filter-item" class="filter-item"
style="width: 190px;margin-left:10px" style="width: 190px;margin-left:10px"
clearable clearable
/> />
<el-select <el-select
v-model="policyStatus" v-model="searchCategory.type"
placeholder="类型" placeholder="类型"
clearable clearable
class="filter-item" class="filter-item"
style="width: 190px;margin-left:10px" style="width: 190px;margin-left:10px"
value="1" value="1"
> >
<el-option v-for="(item,index) in status" :key="index" :value="index" /> <el-option label="项目类别" value="0" />
<el-option label="产业类别 " value="1" />
</el-select> </el-select>
<el-button <el-button
class="filter-item" class="filter-item"
@ -33,26 +34,26 @@
style="margin-left: 10px;" style="margin-left: 10px;"
type="primary" type="primary"
icon="el-icon-edit" icon="el-icon-edit"
@click="policyAdd" @click="AddCategory"
>添加</el-button> >添加</el-button>
</div> </div>
<!-- 类型列表 --> <!-- 类型列表 -->
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
:data="polictList" :data="typemanage"
border border
fit fit
highlight-current-row highlight-current-row
style="width: 100%;" style="width: 100%;"
> >
<el-table-column label="项目类型" prop="id" align="center" width="500"> <el-table-column label="名字" prop="id" align="center" width="500">
<template slot-scope="{row}"> <template slot-scope="{row}">
<span>{{ row.id }}</span> <span>{{ row.name }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="产业类型" prop="title" align="center" width="500"> <el-table-column label="产业类型" prop="title" align="center" width="500">
<template slot-scope="{row}"> <template slot-scope="{row}">
<span>{{ row.title }}</span> <span>{{ row.type }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width">
@ -62,27 +63,55 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 添加表格 --> <!-- 修改界面 -->
<el-dialog title="修改" :visible.sync="dialogFormVisible1">
<el-form ref="dataForm" :model="temp" label-position="left" label-width="70px" style="width: 400px; margin-left:50px;">
<el-form-item label="名字" prop="name" style="width: 180%">
<el-input v-model="temp.name" />
</el-form-item>
<el-form-item label="类型">
<el-select
v-model="temp.type"
placeholder="请选类型"
style="width: 400px;"
>
<el-option label="项目类别" value="0" />
<el-option label="产业类别 " value="1" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1 = false">
取消
</el-button>
<el-button type="primary" @click="Commitupdate(temp.id)">
提交
</el-button>
</div>
</el-dialog>
<!-- 添加表格 -->
<el-dialog title="添加表格" :visible.sync="dialogFormVisible"> <el-dialog title="添加表格" :visible.sync="dialogFormVisible">
<el-form <el-form
ref="dataForm" ref="dataForm"
:model="temp" :model="addCategory"
label-position="left" label-position="left"
label-width="70px" label-width="70px"
style="width: 400px; margin-left:50px;" style="width: 400px; margin-left:50px;"
> >
<el-form-item label="名字" prop="title" style="width: 100%"> <el-form-item label="名字" prop="name" style="width: 100%">
<el-input v-model="ipt2" clearable /> <el-input v-model="addCategory.name" clearable />
</el-form-item> </el-form-item>
<el-form-item label="类型"> <el-form-item label="类型">
<el-select <el-select
v-model="form.region" v-model="addCategory.type"
placeholder="请选类型" placeholder="请选类型"
style="width: 400px;" style="width: 400px;"
> >
<el-option label="类型一" value="shanghai" /> <el-option label="项目类别" value="0" />
<el-option label="类型二 " value="beijing" /> <el-option label="产业类别 " value="1" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -91,37 +120,49 @@
<el-button type="primary" @click="CommitAdd"> </el-button> <el-button type="primary" @click="CommitAdd"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-pagination <pagination v-show="total>0" :total="total" :page.sync="data.pageNum" :limit.sync="data.pageSize" @pagination="getList" />
:current-page="currentPage4"
:page-sizes="[10, 20, 30, 50]"
:page-size="100"
layout="total, sizes, prev, pager, next, jumper"
:total="400"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import * as api from '@/api/policy' import * as api from '@/api/typemanage'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
export default { export default {
name: 'Typemanage', name: 'Typemanage',
components: { Pagination },
data() { data() {
return { return {
dialogFormVisible: false, dialogFormVisible: false,
dialogFormVisible1: false,
form: { form: {
name: '', name: '',
region: '' region: ''
}, },
total: 0,
typemanage: [],
data: {
name: '',
pageNum: 1,
pageSize: 20,
type: ''
},
temp: {},
addCategory: {
name: '',
type: ''
},
updateCategory: {
name: '',
type: ''
},
searchCategory: {
name: '',
type: ''
},
formLabelWidth: '120px', formLabelWidth: '120px',
ipt: '',
ipt2: '',
policyStatus: '类型', policyStatus: '类型',
status: { 刚入库: 0, 审核通过: 1, 审核不通过: 2 }, status: { 类型一: 0, 类型二: 1 }
pageNum: 1,
pageSize: 20
} }
}, },
computed: { computed: {
@ -134,8 +175,8 @@ export default {
async getList() { async getList() {
const that = this const that = this
that.listLoading = false that.listLoading = false
await api.PolicyDetail(that.data).then((res) => { await api.TypeManage(that.data).then((res) => {
that.polictList = res.list that.typemanage = res.list
that.total = res.total - 0 that.total = res.total - 0
setTimeout(() => { setTimeout(() => {
@ -143,39 +184,69 @@ export default {
}, 1000) }, 1000)
}) })
}, },
Search() {},
handleUpdate() {},
handleDelete() {},
policyAdd() { async Search() {
const that = this
await api.CategoryDetail(that.searchCategory).then((res) => {
that.typemanage = res.list
that.total = res.total - 0
that.listLoading = false
})
},
handleUpdate(row) {
const that = this const that = this
// for (const key in that.addPolicy) { that.temp = Object.assign({}, row)
// that.addPolicy[key] = '' that.dialogFormVisible1 = true
// } },
async handleDelete(id) {
const that = this
await api.CategoryDelete(id).then((res) => {
that.getList()
})
},
AddCategory() {
const that = this
for (const key in that.addCategory) {
that.addCategory[key] = ''
}
that.dialogFormVisible = true that.dialogFormVisible = true
}, },
async CommitAdd() { async CommitAdd() {
const that = this const that = this
var Content = document.getElementById('Content') for (const key in that.addCategory) {
var Time = document.getElementById('Time').value if (that.addCategory[key] === '') {
that.addPolicy.content = Content.innerHTML
var str = Time.replace(/-/g, '/')
that.addPolicy.publishTime = str
for (const key in that.addPolicy) {
if (that.addPolicy[key] === '') {
alert(key + '不能为空') alert(key + '不能为空')
} else { return
api.PolicyAdd(that.addPolicy).then((res) => { }
}
await api.addCategory(that.addCategory).then((res) => {
that.dialogFormVisible = false that.dialogFormVisible = false
that.getList()
}) })
},
async Commitupdate() {
const that = this
for (const key in that.temp) {
if (that.temp[key] === '') {
alert(key + '不能为空')
return
} }
} }
await api.CategoryUpdate(that.temp).then((res) => {
that.dialogFormVisible1 = false
that.getList()
})
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dashboard { .dashboard {
&-container { &-container {

Loading…
Cancel
Save