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">
<el-input
v-model="ipt"
v-model="searchCategory.name"
placeholder="名字"
class="filter-item"
style="width: 190px;margin-left:10px"
clearable
/>
<el-select
v-model="policyStatus"
v-model="searchCategory.type"
placeholder="类型"
clearable
class="filter-item"
style="width: 190px;margin-left:10px"
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-button
class="filter-item"
@ -33,26 +34,26 @@
style="margin-left: 10px;"
type="primary"
icon="el-icon-edit"
@click="policyAdd"
@click="AddCategory"
>添加</el-button>
</div>
<!-- 类型列表 -->
<el-table
v-loading="listLoading"
:data="polictList"
:data="typemanage"
border
fit
highlight-current-row
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}">
<span>{{ row.id }}</span>
<span>{{ row.name }}</span>
</template>
</el-table-column>
<el-table-column label="产业类型" prop="title" align="center" width="500">
<template slot-scope="{row}">
<span>{{ row.title }}</span>
<span>{{ row.type }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width">
@ -62,27 +63,55 @@
</template>
</el-table-column>
</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-form
ref="dataForm"
:model="temp"
:model="addCategory"
label-position="left"
label-width="70px"
style="width: 400px; margin-left:50px;"
>
<el-form-item label="名字" prop="title" style="width: 100%">
<el-input v-model="ipt2" clearable />
<el-form-item label="名字" prop="name" style="width: 100%">
<el-input v-model="addCategory.name" clearable />
</el-form-item>
<el-form-item label="类型">
<el-select
v-model="form.region"
v-model="addCategory.type"
placeholder="请选类型"
style="width: 400px;"
>
<el-option label="类型一" value="shanghai" />
<el-option label="类型二 " value="beijing" />
<el-option label="项目类别" value="0" />
<el-option label="产业类别 " value="1" />
</el-select>
</el-form-item>
</el-form>
@ -91,37 +120,49 @@
<el-button type="primary" @click="CommitAdd"> </el-button>
</div>
</el-dialog>
<el-pagination
: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"
/>
<pagination v-show="total>0" :total="total" :page.sync="data.pageNum" :limit.sync="data.pageSize" @pagination="getList" />
</div>
</template>
<script>
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 {
name: 'Typemanage',
components: { Pagination },
data() {
return {
dialogFormVisible: false,
dialogFormVisible1: false,
form: {
name: '',
region: ''
},
total: 0,
typemanage: [],
data: {
name: '',
pageNum: 1,
pageSize: 20,
type: ''
},
temp: {},
addCategory: {
name: '',
type: ''
},
updateCategory: {
name: '',
type: ''
},
searchCategory: {
name: '',
type: ''
},
formLabelWidth: '120px',
ipt: '',
ipt2: '',
policyStatus: '类型',
status: { 刚入库: 0, 审核通过: 1, 审核不通过: 2 },
pageNum: 1,
pageSize: 20
status: { 类型一: 0, 类型二: 1 }
}
},
computed: {
@ -134,8 +175,8 @@ export default {
async getList() {
const that = this
that.listLoading = false
await api.PolicyDetail(that.data).then((res) => {
that.polictList = res.list
await api.TypeManage(that.data).then((res) => {
that.typemanage = res.list
that.total = res.total - 0
setTimeout(() => {
@ -143,39 +184,69 @@ export default {
}, 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
// for (const key in that.addPolicy) {
// that.addPolicy[key] = ''
// }
that.temp = Object.assign({}, row)
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
},
async CommitAdd() {
const that = this
var Content = document.getElementById('Content')
var Time = document.getElementById('Time').value
that.addPolicy.content = Content.innerHTML
var str = Time.replace(/-/g, '/')
that.addPolicy.publishTime = str
for (const key in that.addPolicy) {
if (that.addPolicy[key] === '') {
for (const key in that.addCategory) {
if (that.addCategory[key] === '') {
alert(key + '不能为空')
} else {
api.PolicyAdd(that.addPolicy).then((res) => {
return
}
}
await api.addCategory(that.addCategory).then((res) => {
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>
<style lang="scss" scoped>
.dashboard {
&-container {

Loading…
Cancel
Save