Browse Source

加复选

master
unknown 1 week ago
parent
commit
f1f12fcbce
  1. 1
      src/api/business/vote.js
  2. 14
      src/components/Editor/index.vue
  3. 12
      src/components/FileUpload/index.vue
  4. 10
      src/views/business/Information/index.vue
  5. 142
      src/views/business/vote/index.vue
  6. BIN
      新疆后台.zip

1
src/api/business/vote.js

@ -75,3 +75,4 @@ export function exportVoteResults(query) {
}

14
src/components/Editor/index.vue

@ -80,7 +80,7 @@ export default {
[{ color: [] }, { background: [] }], //
[{ align: [] }], //
["clean"], //
[ "image", "video"] // "link"
["link", "image", "video"] //
],
},
placeholder: "请输入内容",
@ -141,14 +141,6 @@ export default {
this.quill.format("image", false);
}
});
toolbar.addHandler("link", (value) => {
this.uploadType = "link";
if (value) {
this.$refs.upload.$children[0].$refs.input.click();
} else {
this.quill.format("link", false);
}
});
}
this.Quill.pasteHTML(this.currentValue);
this.Quill.on("text-change", (delta, oldDelta, source) => {
@ -191,9 +183,7 @@ export default {
let length = quill.getSelection().index;
// res.url
// edit by
console.log(res)
quill.insertEmbed(length, "a", res.data);
quill.insertEmbed(length, "image", res.data);
//
quill.setSelection(length + 1);
} else {

12
src/components/FileUpload/index.vue

@ -29,10 +29,10 @@
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
<li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
<el-link :href="`${file.url}`" :underline="false" target="_blank">
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
<span class="el-icon-document oneRowText"> {{ getFileName(file.name) }} </span>
</el-link>
<div class="ele-upload-list__item-content-action">
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
<div class="ele-upload-list__item-content-action ">
<el-link :underline="false" @click="handleDelete(index)" type="danger" class="oneRowText">删除</el-link>
</div>
</li>
</transition-group>
@ -111,6 +111,7 @@ export default {
methods: {
//
handleBeforeUpload(file) {
console.log(file)
//
if (this.fileType) {
let fileExtension = "";
@ -199,6 +200,11 @@ export default {
</script>
<style scoped lang="scss">
.oneRowText {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.upload-file-uploader {
margin-bottom: 5px;
}

10
src/views/business/Information/index.vue

@ -83,6 +83,10 @@
<ImageUpload v-model="form.picture" :ownerId="form.id"></ImageUpload>
<!-- <el-input v-model="form.picture" placeholder="请输入图片" />-->
</el-form-item>
<el-form-item label="上传附件" prop="det">
<FileUpload @input="inputFn" :value="form.attachmentList" />
</el-form-item>
<el-form-item label="首页推荐位" prop="recommendedType">
<el-switch v-model="form.recommendedType"
:active-value="1"
@ -100,11 +104,14 @@
<script>
import { createArticleManagement, updateArticleManagement, deleteArticleManagement, getArticleManagement, getArticleManagementPage, exportArticleManagementExcel } from "@/api/business/articleManagement";
import Editor from '@/components/Editor';
import FileUpload from '@/components/FileUpload'
// import {getArticleTypeList} from '@/api/business/articleType';
export default {
name: "ArticleManagement",
components: {
Editor,
FileUpload
},
data() {
return {
@ -152,6 +159,9 @@ export default {
this.getList();
},
methods: {
inputFn(val) {
this.form.attachmentList = val.split(',')
},
/** 查询列表 */
getList() {
this.loading = true;

142
src/views/business/vote/index.vue

@ -100,13 +100,13 @@
</el-col>
</el-row>
<el-row>
<!-- <el-row>
<el-col :span="12" v-if="form.voteType == 2">
<el-form-item label="多选选几项" prop="itemLimit">
<el-input-number v-model="form.itemLimit" :min="1" />
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-row>
@ -126,7 +126,37 @@
</el-col>
</el-row>
<el-row v-for="(item, index) in options" :key="index">
<div class="ul" v-if="form.voteType == 3">
<div v-for="(item, index) in form.voteMultipleInfoList" :key="index" class="li">
<el-form-item label="议题" prop="startTime">
<el-input v-model="item.voteName" placeholder="请填议题内容" />
<el-button size="mini" type="text" icon="el-icon-plus" @click="handleItemAddVoteType3(1, item, index)"
v-if="index == form.voteMultipleInfoList.length - 1">增加议题</el-button>
<el-button size="mini" type="text" icon="el-icon-minus" @click="handleItemAddVoteType3(0, item, index)"
v-else>删除议题</el-button>
</el-form-item>
<el-form-item>
<div class="flex subOptions" v-for="(item2, index2) in item.voteItemList" :key="index2">
<div class="selectIndex">投票选项 {{ index2 + 1 }}</div>
<div class="item_row flex">
<el-input v-model="form.voteMultipleInfoList[index].voteItemList[index2]" placeholder="请填议题内容"
style="margin: 0 10px;" :key="index2" />
<!-- <el-input v-model="item2" placeholder="请填议题内容" style="margin: 0 10px;" /> -->
<el-button size="mini" type="text" icon="el-icon-plus"
@click="handleItemNameVoteType3(1, item.voteItemList, index2)"
v-if="index2 == item.voteItemList.length - 1">增加选项</el-button>
<el-button size="mini" type="text" icon="el-icon-minus"
@click="handleItemNameVoteType3(0, item.voteItemList, index2)" v-else>删除选项</el-button>
</div>
</div>
</el-form-item>
</div>
</div>
<el-row v-for="(item, index) in options" :key="index" v-else>
<el-form-item :label="'选项' + (parseInt(index) + 1)" prop="itemName">
<el-col :span="12">
<el-input v-model="options[index].value" placeholder="请填写选项内容" />
@ -182,7 +212,7 @@
<div class="btndaocho"> <el-button type="primary" @click="handleExport" size="mini">导出</el-button></div>
<el-form ref="form" :model="form" label-width="90px">
<el-divider content-position="left">投票说明</el-divider>
<div style="background-color: #e5e9f2;height: 300px">
<div style="background-color: #e5e9f2;height: 300px; overflow-y: auto;">
<el-row>
<el-col :span="8">
<h2><span>{{ form.voteName }}</span></h2>
@ -207,7 +237,21 @@
<el-divider content-position="left">投票结果</el-divider>
<el-row :gutter="20" v-for="(item, index) in form.voteResultVO" :key="index">
<div class="type3" v-if="form.voteType == 3">
<div class="ul2">
<div class="li2" v-for="(item, index) in form.voteMultipleItemInfoRespList" :key="index">
<div class="name" style="font-size: 18px;color: #333;font-weight: 600;margin-left: 30px;"> {{ item.voteName }} </div>
<div class="flex row" v-for="(item2,index2) in item.voteMultipleResultList" :key="index2">
<div class="lab" style="width: 100px; text-align: right;"> {{ item2.itemName }}</div>
<el-progress :percentage="item2.itemRate" style="width: 400px; margin: 0 20px;"/>
<!-- <el-progress :text-inside="true" :stroke-width="24" :percentage="item2.itemRate * 100" text-color="white"></el-progress> -->
<h3>{{ item2.itemCount }}</h3>
</div>
</div>
</div>
</div>
<el-row :gutter="20" v-for="(item, index) in form.voteResultVO" :key="index" v-else>
<el-form-item :label="index + 1 + ''" prop="itemName">
<el-col :span="16">
{{ item.itemName }} <span v-if="item.itemCount * 1 > 0">(已投)</span>
@ -228,7 +272,7 @@
<el-table-column prop="name" :label="item.name" min-width="180" v-for="(item, index1) in tableData2"
:key="index1">
<template #default="scope">
<div class="a" v-for="(item2, index) in item.arr" :key="index">{{ item2.userName + ' |'+parseTime(item2.createTime)}}</div>
<div class="a" v-for="(item2, index) in item.arr" :key="index">{{ item2.userName + ' | '+parseTime(item2.createTime)}}</div>
</template>
</el-table-column>
</el-table>
@ -284,6 +328,22 @@ export default {
return {
testArr: [
{
name: '测试标题', subOption: [
{ name: '选项一', isCheck: 1 },
{ name: '选项一', isCheck: 0 },
{ name: '选项一', isCheck: 0 },
]
},
{
name: '测试标题二', subOption: [
{ name: '选项二', isCheck: 1 },
{ name: '选项二', isCheck: 0 },
{ name: '选项二', isCheck: 0 },
]
}
],
tableData: [{
date: '投票人员',
name: 'Tom',
@ -314,7 +374,7 @@ export default {
voteName: undefined,
},
//
form: { attachmentList: [] },
form: { attachmentList: [], voteMultipleInfoList: [] },
//
title: null,
//
@ -367,11 +427,11 @@ export default {
//
this.$modal.confirm('是否确认导出投票结果数据项?').then(() => {
this.exportLoading = true;
return exportVoteResults({id: this.form.id});
return exportVoteResults({ id: this.form.id });
}).then(response => {
this.$download.excel(response, '投票结果.xls');
this.$download.excel(response, '投票结果.pdf');
this.exportLoading = false;
}).catch(() => {});
}).catch(() => { });
},
/**
* 获取业主信息集合
@ -424,6 +484,15 @@ export default {
this.title = "添加投票"
//
this.loadingTextVote = true;
this.form = {
voteMultipleInfoList: [
{
"voteName": "",
"voteItemList": ['']
}
]
}
this.getDataChangTree();
},
@ -463,7 +532,27 @@ export default {
})
},
//
handleItemAddVoteType3(type, item, index) {
if (type) {
let obj = Object.assign({}, item)
obj.name = ''
this.form.voteMultipleInfoList.push(obj)
} else {
this.form.voteMultipleInfoList.splice(index, 1)
// this.testArr = this.testArr.filter(item => item !== id);
}
},
//
handleItemNameVoteType3(type, list, index) {
if (type) {
list.push('')
} else {
list.splice(index, 1)
}
},
/**
* 增加选项
*/
@ -480,8 +569,29 @@ export default {
this.textVote = false;
this.addVoteOpend = true;
getVoteItem(row.id).then(res => {
if (!res.data.voteMultipleItemInfoRespList) {
res.data.voteMultipleInfoList = [
{
"voteName": "",
"voteItemList": ['']
}
]
}else {
res.data.voteMultipleInfoList = res.data.voteMultipleItemInfoRespList.map(item=>{
let obj = {
"voteName": item.voteName,
voteItemList: item.voteMultipleResultList?item.voteMultipleResultList.map(item2=>item2.itemName):['']
}
return obj
})
console.log(res.data.voteMultipleInfoList)
}
this.form = res.data;
res.data.voteItemVO.forEach(item => {
console.log(this.form)
res.data.voteItemVO?.forEach(item => {
this.options.push({ id: item.id, value: item.itemName })
})
})
@ -566,6 +676,16 @@ export default {
margin-bottom: 0;
}
}
.flex {
display: flex;
align-items: center;
}
.subOptions {
padding: 5px 0;
}
.btndaocho {
display: flex;
justify-content: flex-end;

BIN
新疆加了导出.zip → 新疆后台.zip

Loading…
Cancel
Save