123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546 |
- <template>
- <view >
- <view class="bgtop"></view>
- <uni-forms :modelValue="datainfo">
- <view class="addbox">
- <view class="boxs">
- <view class="tips">
- <image :src="tipimg"></image>
- <view>请于填写信息前认真核对提案者信息是否有误</view>
- </view>
- <view class="pdbox">
- <view class="titbox mb14">
- <view class="tit flexc">
- <image :src="titimg"></image>
- <view>提案者信息</view>
- </view>
- </view>
- <view class="titinf">
- <view class="txt"><text>上报者:</text>{{datainfo.sqmyName}}</view>
- <view class="txt"><text>联系方式:</text>{{datainfo.sqmyPhone}}</view>
- <view class="txt"><text>联系地址:</text>{{datainfo.unit}}</view>
- </view>
- <image :src="infobg" class="infobg"></image>
- </view>
- </view>
- <view class="boxs pdbox" style="padding-bottom: 2rpx;">
- <view class="titbox mb14">
- <view class="tit flexc">
- <image :src="titimg"></image>
- <view>基本详情</view>
- </view>
- </view>
- <view class="pb8">
- <uni-forms-item label="题目" name="title" required>
- <uni-easyinput :inputBorder="false" type="text" v-model="datainfo.title" placeholder="请输入标题" />
- <view class="edtip pa">* 标题前无须加关于,标题后无须加的建议,系统将自动填写</view>
- </uni-forms-item>
- </view>
- <!-- <uni-forms-item label="主题类型" name="categoryName" required>
- <view class="openbox" :class="datainfo.categoryName?'':'coa'" @click="gettalbFn">{{datainfo.categoryName||"请选择主题类型"}}</view>
- </uni-forms-item> -->
- <picker range-key='label' :value="ztlxidx" :range="ztlxlist" @change='bindDateChangea'>
- <uni-forms-item label="主题类型" name="topicType" required>
- <view class="lbtabp">
- <view v-if="datainfo.topicType&&!ztlxtxt">{{statusFormat(datainfo.topicType,ztlxlist,'ztlx')}}</view>
- <view v-else :class="ztlxtxt?'':'coa'">{{ztlxtxt||"请选择主题类型"}}</view>
- </view>
- </uni-forms-item>
- </picker>
- <uni-forms-item label="联系人" name="lxrName" >
- <uni-easyinput :inputBorder="false" type="text" v-model="datainfo.lxrName" placeholder="请输入联系人" />
- </uni-forms-item>
- <uni-forms-item label="联系人联系方式" name="lxrPhone" >
- <uni-easyinput :inputBorder="false" type="number" v-model="datainfo.lxrPhone" placeholder="请输入联系人联系方式" />
- </uni-forms-item>
- </view>
- <view class="boxs pdbox">
- <view class="titbox mb14 flexc">
- <view class="tit flexc flex1">
- <image :src="titimg"></image>
- <view>信息内容</view>
- </view>
- <view class="titr" @click="getPaiFn">一键排版</view>
- </view>
- <editor id="editor" :class="pbFlag?'pbbox':''" class="ql-container" placeholder="请输入提案内容" show-img-size show-img-toolbar
- show-img-resize @statuschange="onStatusChange" :read-only="readOnly" @ready="onEditorReady">
- </editor>
- <view class="edtip flext mb24 mt14"><text>*</text>信息内容输入完毕后,可点击右上角“一键排版”按钮进行快速排版</view>
- </view>
- <view class="boxs pdbox">
- <view class="titbox mb14">
- <view class="tit flexc">
- <image :src="titimg"></image>
- <view>附件内容</view>
- </view>
- </view>
- <view class="flexcj mb10">
- <view class="fw f15 co34">添加附件</view>
- <view class="fjadd"><lsj-upload
- ref="lsjUpload"
- childId="upload1"
- :width="width"
- :height="height"
- :option="option"
- :size="size"
- :formats="formats"
- :debug="debug"
- :instantly="instantly"
- @progress=""
- @uploadEnd="onuploadEnd" >
- <view class="btn" :style="{width: width,height: height}">上传附件</view>
- </lsj-upload>
- </view>
- </view>
- <view class="ptb12" v-if="filelist&&filelist.length">
- <view class="fjlists" v-for="(ite,idx) in filelist" :key='idx'>
- <view class="flext" @click="getDown(ite.url)">
- <view class="imgl"><image :src="fjimg" ></image></view>
- <view class="tit">{{ite.name}}</view>
- </view>
- <!-- 删除 -->
- <view class="delimg flex0" @click.stop="getDelFj(idx)">
- <image :src="delimg"></image>
- </view>
- </view>
- </view>
- </view>
- <view class="boxs pdbox" style="padding-bottom: 2rpx;">
- <view class="titbox mb14">
- <view class="tit flexc">
- <image :src="titimg"></image>
- <view>更多信息</view>
- </view>
- </view>
- <uni-forms-item label="是否公开" name="isPublicity">
- <view class="checkbox">
- <uni-data-checkbox v-model="datainfo.isPublicity" :localdata="sfList" />
- </view>
- </uni-forms-item>
- <uni-forms-item label="是否涉密" name="isSecret">
- <view class="checkbox">
- <uni-data-checkbox v-model="datainfo.isSecret" :localdata="sfList" />
- </view>
- </uni-forms-item>
- </view>
- <view class="addbtn">
- <view class="btn btn1" @click="getZanFnt">暂存</view>
- <view class="btn btn2" @click="getSubmit">提交</view>
- </view>
- </view>
- </uni-forms>
- </view>
- </template>
- <script>
- import config from '@/config'
- const baseUrl = config.baseUrl
- import { getToken } from '@/utils/auth'
- import { selectValue,selectValueKey } from '@/utils/common.js';
- import {getsqmyInfoAddFn,getsqmyInfoDetailFn,getsqmyInfoEditFn} from "@/api/mine/sqmyInfo.js"
- import {getDictionaryFn} from "@/api/mine/register.js"
- export default{
- data(){
- return{
- //附件
- option: {
- // 上传服务器地址,需要替换为你的接口地址
- url: baseUrl+'/common/upload', // 该地址非真实路径,需替换为你项目自己的接口地址
- // 上传附件的key
- name: 'file',
- // 根据你接口需求自定义请求头,默认不要写content-type,让浏览器自适配
- header: {
- // 示例参数可删除
- 'Authorization': 'Bearer ' + getToken(),
- },
- // 根据你接口需求自定义body参数
- formData: {}
- },
- // 选择文件后是否立即自动上传,true=选择后立即上传
- instantly: true,
- // 必传宽高且宽高应与slot宽高保持一致
- width: '',
- height: '48rpx',
- // 限制允许上传的格式,空串=不限制,默认为空
- formats: 'doc,docx,xls,xlsx,ppt,txt,pdf,zip,rar,word',
- // 文件上传大小限制
- size: 100,
- // 文件数量限制 默认10
- count: 5,
- // 文件回显列表
- files: new Map(),
- // 微信小程序Map对象for循环不显示,所以转成普通数组,不要问为什么,我也不知道
- wxFiles: [],
- // 是否打印日志
- debug: false,
- filelist:[],
-
- pbFlag:false,
- readOnly:false,
- fjimg:require("@/work/static/images/fjimg.png"),
- delimg:require("@/work/static/images/delimg.png"),
- tipimg:require("@/work/static/images/tip.png"),
- titimg:require("@/work/static/images/titbg.png"),
- infobg:require("@/work/static/images/infobg.png"),
- datainfo:{
- "sqmyUserId":this.$store.state.user.userId,//提案人ID
- "title":"",//标题
- "topicType":"",//主题类型1:经济建设类,2:政治建设类,3:文化建设类,4:社会建设类,5:生态文明建设类,6:其他
- "sqmyName":this.$store.state.user.memberInfo.name,//
- "sqmyPhone":this.$store.state.user.memberInfo.phonenumber,//
- "unit":this.$store.state.user.memberInfo.unit,//
- "lxrName":"",//
- "lxrPhone":"",//
- "sqmyContent":"",//内容
- "isPublicity":"0",//同意公开(0是 1否)
- "isSecret":"1",//是否涉密(0是 1否)
- "zxFjList":[]
- },
- ztlxidx:'',
- ztlxtxt:'',
- sfList:[{text: '是',value: '0'},{text: '否',value: '1'}],
- ztlxlist:[],
- editorCtx:'',
- tary:'',
- id:"",
- pagetype:'add',
- editinfo:'',
- }
- },
- onUnload(){
- uni.$off('refreshtalb')
- uni.$off('refreshtary')
- },
- onLoad(e) {
- uni.$on('refreshtalb', (e) => {
- this.datainfo.categoryName=e.categoryName
- this.datainfo.categoryId=e.categoryId
- })
- uni.$on('refreshtary', (e) => {
- this.datainfo.proposalUserList=e.proposalUserList;
- this.tary=e.namelist.join('/')
- })
- this.init()
- if(e.type=='edit'){
- this.id=e.id;
- this.pagetype='edit'
- this.getDetail()
- }
- if(e.type=='old'&&uni.getStorageSync('sqmyList')){
- var newObj=JSON.parse(JSON.stringify(uni.getStorageSync('sqmyList')))
- var params=newObj.params;
- this.datainfo=params;
- this.editinfo=params.sqmyContent;
- if(params.zxFjList&¶ms.zxFjList.length){
- this.filelist=JSON.parse(JSON.stringify(params.zxFjList))
- }
- }
- },
- methods:{
- kayType(ite,list){
- return selectValue(list, ite);
- },
- statusFormat(ite,list,type) {
- var aite=selectValueKey(list, ite);
- if(type=='ztlx'){
- this.ztlxidx=aite.key
- }
- return aite.actions;
- },
- init(){
- // 主题类型
- getDictionaryFn('sqmy_topic_type').then(res=>{
- if(res.code==200&&res.data.length){
- this.ztlxlist = res.data.map(v => {
- return {
- label: v.dictLabel,
- value: v.dictValue
- }
- })
- }
- })
- // 界别circles
- // getDictionaryFn('circles').then(res=>{
- // if(res.code==200&&res.data.length){
- // this.jblist = res.data.map(v => {
- // return {
- // label: v.dictLabel,
- // value: v.dictValue
- // }
- // })
- // }
- // })
- // 党派
- // getDictionaryFn('political_parties').then(res=>{
- // if(res.code==200&&res.data.length){
- // this.dplist = res.data.map(v => {
- // return {
- // label: v.dictLabel,
- // value: v.dictValue
- // }
- // })
- // }
- // })
- },
- bindDateChangea(e){
- var val=e.detail.value;
- this.ztlxtxt=this.ztlxlist[val].label;
- this.datainfo.topicType=this.ztlxlist[val].value;
- },
- getDetail(){
- var that=this;
- getsqmyInfoDetailFn(this.id).then(res=>{
- if(res.code==200){
- var data=res.data;
- this.datainfo=res.data;
- if(data.zxFjList&&data.zxFjList.length){
- this.filelist=JSON.parse(JSON.stringify(data.zxFjList))
- }
- this.editinfo=data.sqmyContent;
- var taryList=data.proposalUserList;
- if(taryList&&taryList.length){
- var newArr=[]
- taryList.forEach(ite=>{
- newArr.push(ite.name)
- })
- this.tary=newArr.join('/')
- }
- that.checkidx=data.negotiateType.split(',')
- // this.dwdetList=res.data.proposalUnitReplyList;
- }
- })
- },
- getCheck(id){
- var idx=this.checkidx.indexOf(id)
- if(idx!=-1){
- this.checkidx.splice(idx,1)
- }else{
- this.checkidx.push(id)
- }
- },
- getPaiFn(){
- this.pbFlag=true;
- },
- gettalbFn(){
- var obj={
- id:this.datainfo.categoryId,
- name:this.datainfo.categoryName,
- }
- this.$tab.navigateTo('/work/pages/case/talbclass?data='+encodeURIComponent(JSON.stringify(obj)))
- },
- getlmtaFn(){
- var obj={
- list:this.datainfo.proposalUserList
- }
- this.$tab.navigateTo('/work/pages/case/lmtapeople?data='+encodeURIComponent(JSON.stringify(obj)))
- },
- // 暂存
- getZanFnt(){
- var that=this;
- that.editorCtx.getContents({
- success: function(data) {
- var params=that.datainfo;
- params.sqmyContent=data.html;
- var obj={
- params:params,
- }
- uni.setStorageSync('sqmyList', JSON.parse(JSON.stringify(obj)))
- that.$toast("暂存成功")
- }
- })
- },
- getSubmit(){
- var that=this;
- if(!this.datainfo.title){
- this.$toast("请输入标题")
- return
- }
- if(!this.datainfo.topicType){
- this.$toast("请选择提案类别")
- return
- }
- // if(!this.datainfo.lxrName){
- // this.$toast("请输入联系人姓名")
- // return
- // }
- // if(!this.datainfo.lxrPhone){
- // this.$toast("请输入联系人手机号")
-
- // return
- // }
- if(this.datainfo.lxrPhone){
- let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
- if (this.datainfo.lxrPhone && !regphone.test(this.datainfo.lxrPhone)) {
- that.$toast("请输入正确的手机号")
- return
- }
- }
- var sqmyContent='';
- that.editorCtx.getContents({
- success: function(data) {
- var params=that.datainfo;
- params.sqmyContent=data.html;
- if(that.pagetype=='add'){
- getsqmyInfoAddFn(params).then(res=>{
- if(res.code==200){
- uni.removeStorageSync('sqmyList')
- that.$toast("提交成功")
- uni.$emit("refreshlist")
- setTimeout(function(){
- uni.navigateBack({
- delta: 1 //返回层数,2则上上页
- });
- },1200)
- }
- })
- }else{
- getsqmyInfoEditFn(params).then(res=>{
- if(res.code==200){
- that.$toast("修改成功")
- uni.$emit("refreshdetail")
- setTimeout(function(){
- uni.navigateBack({
- delta: 1 //返回层数,2则上上页
- });
- },1200)
-
- }
- })
-
- }
-
- }
- })
- },
- onuploadEnd(item) {
- var newobj={}
- var responseText=JSON.parse(item.responseText)
- newobj.name=responseText.originalFilename;
- newobj.url=responseText.fileName;
- this.filelist.push(newobj)
- this.datainfo.zxFjList=JSON.parse(JSON.stringify(this.filelist))
- },
- getDelFj(idx){
- var that=this;
- uni.showModal({
- title: '确认删除',
- content: "是否确认删除",
- cancelText: '取消',
- confirmText: '确认',
- success: function(res) {
- if (res.confirm) {
- that.filelist.splice(idx,1)
- that.datainfo.zxFjList=JSON.parse(JSON.stringify(that.filelist))
- } else if (res.cancel) {
- }
- }
- });
- },
- getDown(e){
- uni.showLoading({
- title: '加载中'
- });
- var url=baseUrl+e;
- uni.downloadFile({
- url: url,//文件的下载路径
- success(result) {
- uni.hideLoading()
- var filePath = result.tempFilePath;
- uni.openDocument({
- filePath: filePath,
- showMenu: true,
- success: function (res) {
- // console.log('打开文档成功');
- }
- });
- },
- fail(res) {uni.hideLoading()}
- })
- },
- onStatusChange(){
-
- },
- onEditorReady(){
- var that=this;
- uni.createSelectorQuery().select('#editor').context(function(res) {
- that.editorCtx = res.context;
- that.editorCtx.setContents({
- html:that.editinfo
- })
- }).exec();
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .bgtop{height: 150rpx;background-color: $com-cd3;width: 100%;}
- .pdbox{padding: 34rpx 24rpx 16rpx;}
- .addbox /deep/ .uni-forms-item{margin-bottom:36rpx;}
- .addbox /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 30rpx;}
- .addbox /deep/ .uni-forms-item__label{font-weight: bold;font-size: 30rpx;color: #343434;width: 198rpx !important;padding-left:20rpx;}
- .addbox /deep/ .is-required{position: absolute;left: 0;top: 50%;margin-top: -10rpx;}
- .addbox /deep/ .uni-data-checklist{display: flex;align-items: center;justify-content: flex-end;}
- .addbox /deep/ .uni-easyinput__placeholder-class{font-weight: 500;font-size: 30rpx;color: #AAAAAA;}
- .addbox /deep/ .checklist-box{margin-right: 0 !important;margin-left: 40rpx !important;}
- .fjadd{
- .btn{font-weight: bold;font-size: 30rpx;color: #1D64E2;margin: 0;display: flex;align-items: center;}
- }
- .addbox{margin-top: -120rpx;
- padding: 0 24rpx 50rpx;
- .boxs{background: #FFFFFF;border-radius: 30rpx;margin-bottom: 24rpx;overflow: hidden;position: relative;
- .infobg{width: 102rpx;height: 106rpx;position: absolute;right: 26rpx;bottom: 22rpx;}
- .tips{background: #F1F6FF;padding: 18rpx 38rpx;display: flex;align-items: flex-start;
- image{width: 20rpx;height: 26rpx;margin-right: 16rpx;flex:0 0 auto;margin-top: 4rpx;}
- view{font-weight: 500;font-size: 26rpx;color: #1D64E2;}
- }
- .titbox{
- .tit{
- image{width: 32rpx;height: 18rpx;margin-right: 10rpx;}
- view{font-weight: bold;font-size: 32rpx;color: #222327;}
- }
- .titr{width: 146rpx;height: 50rpx;background: #E4EEFF;border-radius: 26rpx;font-weight: 500;font-size: 24rpx;color: #1D64E2;text-align: center;line-height: 50rpx;}
- }
- .titinf{display: flex;flex-wrap: wrap;
- .txt{font-weight: 500;font-size: 28rpx;margin-bottom: 18rpx;flex:0 1 auto;min-width: 50%;display: flex;align-items: flex-start;color: #222327;
- text{flex: 0 0 auto;color: #9F9F9F;}
- }
- }
-
- .openbox{display: flex;align-items: center;justify-content: flex-end;font-weight: 500;
- font-size: 30rpx;height: 100%;color: #222327;
-
- }
- .edtip{font-weight: 500;font-size: 22rpx;color: #FF0000;
- text{margin: 4rpx 8rpx 0 0;}
- &.pa{position: absolute;right: 0;bottom: -15px;text-align: right;width: 702rpx;}
- }
- }
-
- }
- .matab{display: flex;align-items: center;flex-wrap: nowrap;overflow: auto;position: absolute;left: 0;right: -48rpx;
- .list{min-width:112rpx;height: 50rpx;background: #ffffff;border-radius: 25rpx;font-size: 30rpx;font-weight: 500;box-sizing: border-box;
- color: #AAAAAA;padding: 0 24rpx;box-sizing: border-box;margin-left:24rpx;flex: 0 0 auto;border: 2rpx solid #C1C1C1;display: flex;align-items: center;justify-content: center;
- &.act{background: #E4EEFF;color: #1D64E2;border: none;}
- }
- }
- // 附件
- .fjlists {display: flex;align-items: flex-start;justify-content: space-between;margin-bottom: 12rpx;
- image{margin-right: 18rpx;flex: 0 0 auto;}
- .imgl{width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;margin-right: 16rpx;
- image{width: 26rpx;height: 24rpx;}
- }
- .tit{font-size: 26rpx;color: #343434;font-weight: 500;margin-top: 4rpx;}
- .delimg{width: 40rpx;height:40rpx;margin-left: 16rpx;display: flex;align-items: center;justify-content: center;
- image{width: 26rpx;height: 26rpx;}
- }
- }
- // 按钮
- .addbtn{display: flex;align-items: center;justify-content: space-between;padding-top: 26rpx;
- .btn{width: 336rpx;height: 80rpx;font-weight: bold;font-size: 30rpx;box-sizing: border-box;border-radius: 40rpx;display: flex;align-items: center;justify-content: center;
- &.btn1{border: 2rpx solid #1D64E2;background: #ffffff;color: #1D64E2;}
- &.btn2{background: #1D64E2;color: #ffffff;}
- }
- }
- .addbox /deep/ .pbbox .ql-editor p{text-indent: 2rem;}
- </style>
|