政策申办统计导入

This commit is contained in:
liuye
2022-04-25 11:57:02 +08:00
parent 3ce7f47a6b
commit ac99e83459
3 changed files with 63 additions and 37 deletions

View File

@@ -10,7 +10,7 @@
<el-input v-model="form.title" placeholder="请输入标题" :maxlength="50" /> <el-input v-model="form.title" placeholder="请输入标题" :maxlength="50" />
</el-form-item> </el-form-item>
<el-form-item label="发布地区" prop="areaId"> <el-form-item label="发布地区" prop="areaId">
<ai-area-get :instance="instance" v-model="form.areaId" :root="rootArea" valueLevel="5"/> <ai-area-get :instance="instance" v-model="form.areaId" :root="rootArea" />
</el-form-item> </el-form-item>
<el-form-item label="文章类型" prop="moduleId" style="width:50%;"> <el-form-item label="文章类型" prop="moduleId" style="width:50%;">
<ai-select v-model="form.moduleId" :selectList="miniTypeList" @change="getNewTypeList"/> <ai-select v-model="form.moduleId" :selectList="miniTypeList" @change="getNewTypeList"/>
@@ -21,7 +21,7 @@
<el-form-item label="正文" prop="content" style="width: 100%;"> <el-form-item label="正文" prop="content" style="width: 100%;">
<ai-editor v-model="form.content" :instance="instance"/> <ai-editor v-model="form.content" :instance="instance"/>
</el-form-item> </el-form-item>
<el-form-item label="封面图片最多1张" > <el-form-item label="封面图片" >
<ai-uploader <ai-uploader
:isShowTip="true" :isShowTip="true"
:instance="instance" :instance="instance"
@@ -32,7 +32,7 @@
<template slot="tips">最多上传1张图片,单张图片最大10MB<br/>支持.png,.jpg,.jpeg格式</template> <template slot="tips">最多上传1张图片,单张图片最大10MB<br/>支持.png,.jpg,.jpeg格式</template>
</ai-uploader> </ai-uploader>
</el-form-item> </el-form-item>
<el-form-item label="附件附件" prop="fileList"> <el-form-item label="附件附件" prop="files">
<el-upload <el-upload
class="upload-demo" class="upload-demo"
action action
@@ -86,7 +86,10 @@ export default {
rules() { rules() {
return { return {
title: [{required: true, message: "请输入标题"}], title: [{required: true, message: "请输入标题"}],
areaId: [{required: true, message: "请选择发布地区"}], areaId: [
{message: "请选择发布地区", required: true, trigger: "blur"},
{validator: (r, v, cb) => v && /0{3}$/g.test(v) ? cb('发布地区必须选到村级') : cb(), trigger: "blur"}
],
moduleId: [{required: true, message: "请选择文章类型"}], moduleId: [{required: true, message: "请选择文章类型"}],
categoryId: [{required: true, message: "选择分类"}], categoryId: [{required: true, message: "选择分类"}],
} }
@@ -100,7 +103,7 @@ export default {
form: { form: {
pictureUrlList: [], pictureUrlList: [],
pictureUrl: '', pictureUrl: '',
file: [] files: []
}, },
miniTypeList: [], miniTypeList: [],
newTypeList: [] newTypeList: []
@@ -112,9 +115,9 @@ export default {
const isLt10M = file.file.size / 1024 / 1024 < 10; const isLt10M = file.file.size / 1024 / 1024 < 10;
if (!isLt10M) { if (!isLt10M) {
this.$message.error("附件大小不超过10mb!"); this.$message.error("附件大小不超过10mb!");
for (let i = 0; i < this.fileList.length; i++) { for (let i = 0; i < this.form.files.length; i++) {
if (this.fileList[i].uid == file.file.uid) { if (this.form.files[i].uid == file.file.uid) {
this.fileList.splice(i, 1); this.form.files.splice(i, 1);
} }
} }
return; return;
@@ -124,33 +127,23 @@ export default {
this.instance.post(`/admin/file/add`, formData, {withCredentials: false}).then(res => { this.instance.post(`/admin/file/add`, formData, {withCredentials: false}).then(res => {
if (res && res.code == 0) { if (res && res.code == 0) {
let img = res.data[0].split(';'); let img = res.data[0].split(';');
this.fileList.forEach((item, index) => { this.form.files.forEach((item, index) => {
if (item.uid == file.file.uid) { if (item.uid == file.file.uid) {
this.fileList[index].id = img[1]; this.form.files[index].id = img[1];
} }
}) })
} }
}); });
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
this.fileList = fileList; this.form.files = fileList;
}, },
handleChange(file, fileList) { handleChange(file, fileList) {
this.fileList = fileList; this.form.files = fileList;
}, },
back() { back() {
this.$router.push({}) this.$router.push({})
}, },
getDetail() {
let {id} = this.$route.query
id && this.instance.post("/app/apppreventionreturntopoverty/queryDetailById", null, {
params: {id}
}).then(res => {
if (res?.data) {
this.form = res.data
}
})
},
submit() { submit() {
this.$refs.ruleForm.validate(v => { this.$refs.ruleForm.validate(v => {
if (v) { if (v) {
@@ -166,6 +159,23 @@ export default {
} }
}) })
}, },
getDetail() {
let {id} = this.$route.query
if(!id) {
return
}
id && this.instance.post("/app/apppreventionreturntopoverty/queryDetailById", null, {
params: {id}
}).then(res => {
if (res?.data) {
if(res.data.pictureUrl) {
res.data.pictureUrlList = [{url: res.data.pictureUrl}]
}
this.form = res.data
this.getNewTypeList()
}
})
},
getTypeList() { getTypeList() {
let {parentId} = this.$route.query let {parentId} = this.$route.query
this.instance.post(`/app/apppublicitycategory/list?categoryType=1&size=100&parentId=${parentId}`).then(res => { this.instance.post(`/app/apppublicitycategory/list?categoryType=1&size=100&parentId=${parentId}`).then(res => {
@@ -192,7 +202,7 @@ export default {
}, },
created() { created() {
this.getTypeList() this.getTypeList()
// this.getDetail() this.getDetail()
} }
} }
</script> </script>

View File

@@ -32,7 +32,7 @@
<div class="content"> <div class="content">
<ai-search-bar> <ai-search-bar>
<template #right> <template #right>
<el-input size="small" placeholder="请输入标题" v-model="search.con" clearable @change="page.current=1,getTableData()"/> <el-input size="small" placeholder="请输入标题" v-model="search.title" clearable @change="page.current=1,getTableData()"/>
</template> </template>
</ai-search-bar> </ai-search-bar>
<ai-search-bar> <ai-search-bar>
@@ -44,7 +44,7 @@
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size" <ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size"
@getList="getTableData" :col-configs="colConfigs" :dict="dict" @getList="getTableData" :col-configs="colConfigs" :dict="dict"
@selection-change="v=>ids=v.map(e=>e.id)"> @selection-change="v=>ids=v.map(e=>e.id)">
<el-table-column slot="options" label="操作" fixed="right" align="center"> <el-table-column slot="options" label="操作" fixed="right" align="center" width='150px'>
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-button type="text" @click="showDetail(row.id)">编辑</el-button> <el-button type="text" @click="showDetail(row.id)">编辑</el-button>
<el-button type="text" @click="handleDelete(row.id)">删除</el-button> <el-button type="text" @click="handleDelete(row.id)">删除</el-button>
@@ -93,16 +93,16 @@ export default {
}, },
data() { data() {
return { return {
search: {name: ""}, search: {title: ""},
page: {current: 1, size: 10, total: 0}, page: {current: 1, size: 10, total: 0},
newPage: {current: 1, size: 10, total: 0}, newPage: {current: 1, size: 10, total: 0},
tableData: [], tableData: [],
colConfigs: [ colConfigs: [
{label: "标题", prop: "name", align: "center"}, {label: "标题", prop: "title", align: "center"},
{label: "地区", prop: "sex", dict: 'sex', align: "center"}, {label: "地区", prop: "areaName", align: "center", width: '150px'},
{label: "浏览次数", prop: "age", align: "center"}, {label: "浏览次数", prop: "viewCount", align: "center", width: '100px'},
{label: "发布人", prop: "nation", align: "center", dict: "fpNation"}, {label: "发布人", prop: "createUserName", align: "center", width: '100px'},
{label: "发布时间", prop: "education", align: "center", dict: "fpEducation"}, {label: "发布时间", prop: "createTime", align: "center", width: '100px'},
{slot: "options"} {slot: "options"}
], ],
colConfigsNew: [ colConfigsNew: [
@@ -113,9 +113,6 @@ export default {
dialog: false, dialog: false,
form: {}, form: {},
rules: { rules: {
// type0: [{required: true, message: "请输入板块名称", trigger: "change"}],
// type1: [{required: true, message: "请输入模块名称", trigger: "change"}],
// type2: [{required: true, message: "请输入分类名称", trigger: "change"}],
categoryName: '', categoryName: '',
showIndex: [{required: true, message: "请输入排序", trigger: "change"}], showIndex: [{required: true, message: "请输入排序", trigger: "change"}],
}, },
@@ -132,7 +129,7 @@ export default {
}, },
methods: { methods: {
getTableData() { getTableData() {
this.instance.post("/app/apppreventionreturntopoverty/list", null, { this.instance.post("/app/apppublicityinfo/list", null, {
params: {...this.page, ...this.search} params: {...this.page, ...this.search}
}).then(res => { }).then(res => {
if (res?.data) { if (res?.data) {
@@ -145,8 +142,8 @@ export default {
this.$router.push({query: {id: id, parentId: this.typeList[this.typeIndex].id}, hash: "#add"}) this.$router.push({query: {id: id, parentId: this.typeList[this.typeIndex].id}, hash: "#add"})
}, },
handleDelete(ids) { handleDelete(ids) {
this.$confirm("是否删除监测对象").then(() => { this.$confirm("是否删除该条宣传资讯信息").then(() => {
this.instance.post("/app/apppreventionreturntopoverty/delete", null, { this.instance.post("/app/apppublicityinfo/delete", null, {
params: {ids: ids?.toString()} params: {ids: ids?.toString()}
}).then(res => { }).then(res => {
if (res?.code == 0) { if (res?.code == 0) {

View File

@@ -10,6 +10,25 @@
</template> </template>
<template #right> <template #right>
<el-input size="small" placeholder="申请人/申请主体/事项名称" v-model="search.name" clearable @change="page.current=1,getTableData()"/> <el-input size="small" placeholder="申请人/申请主体/事项名称" v-model="search.name" clearable @change="page.current=1,getTableData()"/>
<ai-import
ref="import"
title="导入"
name="政策申办数据统计"
url="/appzwspstatistics/downloadTemplate"
importUrl="/appzwspstatistics/import"
suffixName="xlsx"
:customCliker="true"
:instance="instance"
>
<template slot="tips">
<p>
如果表格中已经存在数据则会被本次导入的数据覆盖不存在数据系统将生成新的标准记录
</p>
</template>
<el-button size="small" icon="iconfont iconImport"
>导入</el-button
>
</ai-import>
<ai-download :instance="instance" url="/appzwspstatistics/export" :params="search" fileName="政策申办数据统计" :disabled="tableData.length == 0"> <ai-download :instance="instance" url="/appzwspstatistics/export" :params="search" fileName="政策申办数据统计" :disabled="tableData.length == 0">
<el-button icon="iconfont iconExported" :disabled="tableData.length == 0">导出</el-button> <el-button icon="iconfont iconExported" :disabled="tableData.length == 0">导出</el-button>
</ai-download> </ai-download>