add.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. <template>
  2. <view >
  3. <view class="bgtop"></view>
  4. <uni-forms :modelValue="datainfo">
  5. <view class="addbox">
  6. <view class="boxs">
  7. <view class="tips">
  8. <image :src="tipimg"></image>
  9. <view>请于填写信息前认真核对提案者信息是否有误</view>
  10. </view>
  11. <view class="pdbox">
  12. <view class="titbox mb14">
  13. <view class="tit flexc">
  14. <image :src="titimg"></image>
  15. <view>提案者信息</view>
  16. </view>
  17. </view>
  18. <view class="titinf">
  19. <view class="txt"><text>提案者:</text>{{datainfo.proposalName}}</view>
  20. <view class="txt"><text>联系方式:</text>{{datainfo.proposalPhone}}</view>
  21. <view class="txt"><text>界别:</text>{{datainfo.boundary}}</view>
  22. <view class="txt"><text>党派:</text>{{datainfo.partyAffiliation}}</view>
  23. <view class="txt"><text>联系地址:</text>{{datainfo.contactAddress}}</view>
  24. </view>
  25. <image :src="infobg" class="infobg"></image>
  26. </view>
  27. </view>
  28. <view class="boxs pdbox" style="padding-bottom: 2rpx;">
  29. <view class="titbox mb14">
  30. <view class="tit flexc">
  31. <image :src="titimg"></image>
  32. <view>基本详情</view>
  33. </view>
  34. </view>
  35. <view class="pb8">
  36. <uni-forms-item label="题目" name="title" required>
  37. <uni-easyinput :inputBorder="false" type="text" v-model="datainfo.title" placeholder="请输入标题" />
  38. <view class="edtip pa">* 标题前无须加关于,标题后无须加的建议,系统将自动填写</view>
  39. </uni-forms-item>
  40. </view>
  41. <uni-forms-item label="提案类别" name="categoryName" required>
  42. <view class="openbox" :class="datainfo.categoryName?'':'coa'" @click="gettalbFn">{{datainfo.categoryName||"请选择提案类别"}}</view>
  43. </uni-forms-item>
  44. <uni-forms-item label="提案类型" name="proposalType">
  45. <view class="checkbox">
  46. <uni-data-checkbox v-model="datainfo.proposalType" :localdata="typeList" />
  47. </view>
  48. </uni-forms-item>
  49. </view>
  50. <view class="boxs pdbox">
  51. <view class="titbox mb14 flexc">
  52. <view class="tit flexc flex1">
  53. <image :src="titimg"></image>
  54. <view>提案内容</view>
  55. </view>
  56. <view class="titr" @click="getPaiFn">一键排版</view>
  57. </view>
  58. <editor id="editor" :class="pbFlag?'pbbox':''" class="ql-container" placeholder="请输入提案内容" show-img-size show-img-toolbar
  59. show-img-resize @statuschange="onStatusChange" :read-only="readOnly" @ready="onEditorReady">
  60. </editor>
  61. <view class="edtip flext mb24 mt14"><text>*</text> 提案正文内容原则上不超过2000字,提案正文内容输入完毕后, 可点击右上角的“一键排版”按钮进行快速排版</view>
  62. </view>
  63. <view class="boxs pdbox">
  64. <view class="titbox mb14">
  65. <view class="tit flexc">
  66. <image :src="titimg"></image>
  67. <view>附件内容</view>
  68. </view>
  69. </view>
  70. <view class="flexcj mb10">
  71. <view class="fw f15 co34">添加附件</view>
  72. <view class="fjadd"><lsj-upload
  73. ref="lsjUpload"
  74. childId="upload1"
  75. :width="width"
  76. :height="height"
  77. :option="option"
  78. :size="size"
  79. :formats="formats"
  80. :debug="debug"
  81. :instantly="instantly"
  82. @progress=""
  83. @uploadEnd="onuploadEnd" >
  84. <view class="btn" :style="{width: width,height: height}">上传附件</view>
  85. </lsj-upload>
  86. </view>
  87. </view>
  88. <view class="ptb12" v-if="filelist&&filelist.length">
  89. <view class="fjlists" v-for="(ite,idx) in filelist" :key='idx'>
  90. <view class="flext" @click="getDown(ite.path)">
  91. <view class="imgl"><image :src="fjimg" ></image></view>
  92. <view class="tit">{{ite.name}}</view>
  93. </view>
  94. <!-- 删除 -->
  95. <view class="delimg flex0" @click.stop="getDelFj(idx)">
  96. <image :src="delimg"></image>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="boxs pdbox" style="padding-bottom: 2rpx;">
  102. <view class="titbox mb14">
  103. <view class="tit flexc">
  104. <image :src="titimg"></image>
  105. <view>更多信息</view>
  106. </view>
  107. </view>
  108. <uni-forms-item label="联名提案" name="isJointly">
  109. <view class="checkbox">
  110. <uni-data-checkbox v-model="datainfo.isJointly" :localdata="sfList" />
  111. </view>
  112. </uni-forms-item>
  113. <uni-forms-item label="联名提案人员" name="proposalUserList" v-if="datainfo.isJointly==0">
  114. <view class="openbox" @click="getlmtaFn" :class="tary?'':'coa'">{{tary||"请选择联名提案人员"}}</view>
  115. </uni-forms-item>
  116. <uni-forms-item label="同意公开" name="isPublicity">
  117. <view class="checkbox">
  118. <uni-data-checkbox v-model="datainfo.isPublicity" :localdata="sfList" />
  119. </view>
  120. </uni-forms-item>
  121. <uni-forms-item label="内容公开" name="contentPublicity">
  122. <view class="checkbox">
  123. <uni-data-checkbox v-model="datainfo.contentPublicity" :localdata="sfList" />
  124. </view>
  125. </uni-forms-item>
  126. <uni-forms-item label="经过调研" name="isSurvey">
  127. <view class="checkbox">
  128. <uni-data-checkbox v-model="datainfo.isSurvey" :localdata="sfList" />
  129. </view>
  130. </uni-forms-item>
  131. <uni-forms-item label="第一次提出" name="isFirst">
  132. <view class="checkbox">
  133. <uni-data-checkbox v-model="datainfo.isFirst" :localdata="sfList" />
  134. </view>
  135. </uni-forms-item>
  136. <uni-forms-item label="由本人撰写" name="isPerson">
  137. <view class="checkbox">
  138. <uni-data-checkbox v-model="datainfo.isPerson" :localdata="sfList" />
  139. </view>
  140. </uni-forms-item>
  141. <uni-forms-item label="需要办理的协商方式" name="negotiateType">
  142. <view class="matab">
  143. <view class="list" :class="checkidx.indexOf(ite.value)!=-1?'act':''" v-for="(ite,idx) in matterlist" :key='idx' @click="getCheck(ite.value)">{{ite.label}}</view>
  144. </view>
  145. </uni-forms-item>
  146. <uni-forms-item label="建议承办的单位" name="proposedContractor">
  147. <uni-easyinput :inputBorder="false" type="text" v-model="datainfo.proposedContractor" placeholder="请输入单位名称" />
  148. </uni-forms-item>
  149. </view>
  150. <view class="addbtn">
  151. <view class="btn btn1" @click="getZanFnt">暂存</view>
  152. <view class="btn btn2" @click="getSubmit">提交</view>
  153. </view>
  154. </view>
  155. </uni-forms>
  156. </view>
  157. </template>
  158. <script>
  159. import config from '@/config'
  160. const baseUrl = config.baseUrl
  161. import { getToken } from '@/utils/auth'
  162. import {getCaseAddFn,getCaseDetailFn,getCaseEditFn} from "@/api/mine/case.js"
  163. import {getDictionaryFn} from "@/api/mine/register.js"
  164. export default{
  165. data(){
  166. return{
  167. //附件
  168. option: {
  169. // 上传服务器地址,需要替换为你的接口地址
  170. url: baseUrl+'/common/upload', // 该地址非真实路径,需替换为你项目自己的接口地址
  171. // 上传附件的key
  172. name: 'file',
  173. // 根据你接口需求自定义请求头,默认不要写content-type,让浏览器自适配
  174. header: {
  175. // 示例参数可删除
  176. 'Authorization': 'Bearer ' + getToken(),
  177. },
  178. // 根据你接口需求自定义body参数
  179. formData: {}
  180. },
  181. // 选择文件后是否立即自动上传,true=选择后立即上传
  182. instantly: true,
  183. // 必传宽高且宽高应与slot宽高保持一致
  184. width: '',
  185. height: '48rpx',
  186. // 限制允许上传的格式,空串=不限制,默认为空
  187. formats: 'doc,docx,xls,xlsx,ppt,txt,pdf,zip,rar,word',
  188. // 文件上传大小限制
  189. size: 100,
  190. // 文件数量限制 默认10
  191. count: 5,
  192. // 文件回显列表
  193. files: new Map(),
  194. // 微信小程序Map对象for循环不显示,所以转成普通数组,不要问为什么,我也不知道
  195. wxFiles: [],
  196. // 是否打印日志
  197. debug: false,
  198. filelist:[],
  199. pbFlag:false,
  200. readOnly:false,
  201. fjimg:require("@/work/static/images/fjimg.png"),
  202. delimg:require("@/work/static/images/delimg.png"),
  203. tipimg:require("@/work/static/images/tip.png"),
  204. titimg:require("@/work/static/images/titbg.png"),
  205. infobg:require("@/work/static/images/infobg.png"),
  206. datainfo:{
  207. "proposalUserId":this.$store.state.user.userId,//提案人ID
  208. // "proposalNumber":"",//提案号
  209. "title":"",//标题
  210. "proposalName":this.$store.state.user.name,//提案人姓名
  211. "proposalPhone":this.$store.state.user.phonenumber,//提案人手机号码
  212. "boundary":"20届",//界别
  213. "partyAffiliation":"中国共产党",//党派
  214. "contactAddress":"潜山市政协委员",//联系地址
  215. "categoryId":"",//提案类别id
  216. "categoryName":"",//提案类别
  217. "proposalType":1,//提案类型(0大会提案 1平时提案)
  218. "proposalContent":"",//提案内容
  219. "isJointly":1,//联名提案(0是 1否)
  220. "isPublicity":0,//同意公开(0是 1否)
  221. "contentPublicity":0,//内容公开(0是 1否)
  222. "isSurvey":1,//经过调研(0是 1否)
  223. "isFirst":1,//第一次提出(0是 1否)
  224. "isPerson":1,//由本人撰写(0是 1否)
  225. "isRecord":1,//是否立案(0是 1否)
  226. "negotiateType":"",//需要办理的协商方式
  227. "proposedContractor":"",//建议承办单位
  228. // "proposalProgress":" ",//提案进度(0:提交提案,1:提案审查,2:提案立案,3:提案交办,4:办理提案,5:提案反馈,6:办结审核,7:已办结)
  229. // "rollingProcess":"",//滚动办理(0是 1否)
  230. // "complexType":" ",//提案答复类型(A:A类,B:B类,C:C类)
  231. // "isCasesTogether":"",//是否被并案(0是 1否)
  232. // "uniteProposalId":"",//被并案的案件id
  233. // "satisfaction":"",//委员满意程度(0:不满意,1:一般,2:满意,3:非常满意)
  234. // "membersOpinion":"",//委员意见
  235. "proposalUserList":[////提案人员
  236. // { "name":"姓名","unit":"职务","type":"地址类型 1:领衔,2:附议"},
  237. ],
  238. "zxFjList":[//提案附件
  239. // { "name":"附件名称","url":"附件地址"},
  240. ],
  241. },
  242. typeList:[{text: '大会提案',value: '0'},{text: '平时提案',value: '1'}],
  243. sfList:[{text: '是',value: '0'},{text: '否',value: '1'}],
  244. matterlist:[],
  245. checkidx:[],
  246. editorCtx:'',
  247. tary:'',
  248. id:"",
  249. pagetype:'add',
  250. editinfo:'',
  251. }
  252. },
  253. onUnload(){
  254. uni.$off('refreshtalb')
  255. uni.$off('refreshtary')
  256. },
  257. onLoad(e) {
  258. uni.$on('refreshtalb', (e) => {
  259. this.datainfo.categoryName=e.categoryName
  260. this.datainfo.categoryId=e.categoryId
  261. })
  262. uni.$on('refreshtary', (e) => {
  263. this.datainfo.proposalUserList=e.proposalUserList;
  264. this.tary=e.namelist.join('/')
  265. })
  266. this.init()
  267. if(e.type=='edit'){
  268. this.id=e.id;
  269. this.pagetype='edit'
  270. this.getDetail()
  271. }
  272. },
  273. methods:{
  274. init(){
  275. getDictionaryFn('negotiation_mode').then(res=>{
  276. if(res.code==200&&res.data.length){
  277. this.matterlist = res.data.map(v => {
  278. return {
  279. label: v.dictLabel,
  280. value: v.dictValue
  281. }
  282. })
  283. }
  284. })
  285. },
  286. getDetail(){
  287. var that=this;
  288. getCaseDetailFn(this.id).then(res=>{
  289. if(res.code==200){
  290. var data=res.data;
  291. this.datainfo=res.data;
  292. if(data.zxFjList&&data.zxFjList.length){
  293. this.filelist=JSON.parse(JSON.stringify(data.zxFjList))
  294. }
  295. this.editinfo=data.proposalContent;
  296. var taryList=data.proposalUserList;
  297. if(taryList&&taryList.length){
  298. var newArr=[]
  299. taryList.forEach(ite=>{
  300. newArr.push(ite.name)
  301. })
  302. this.tary=newArr.join('/')
  303. }
  304. that.checkidx=data.negotiateType.split(',')
  305. // this.dwdetList=res.data.proposalUnitReplyList;
  306. }
  307. })
  308. },
  309. getCheck(id){
  310. var idx=this.checkidx.indexOf(id)
  311. if(idx!=-1){
  312. this.checkidx.splice(idx,1)
  313. }else{
  314. this.checkidx.push(id)
  315. }
  316. },
  317. getPaiFn(){
  318. this.pbFlag=true;
  319. },
  320. gettalbFn(){
  321. var obj={
  322. id:this.datainfo.categoryId,
  323. name:this.datainfo.categoryName,
  324. }
  325. this.$tab.navigateTo('/work/pages/case/talbclass?data='+encodeURIComponent(JSON.stringify(obj)))
  326. },
  327. getlmtaFn(){
  328. var obj={
  329. list:this.datainfo.proposalUserList
  330. }
  331. this.$tab.navigateTo('/work/pages/case/lmtapeople?data='+encodeURIComponent(JSON.stringify(obj)))
  332. },
  333. // 暂存
  334. getZanFnt(){
  335. var that=this;
  336. that.editorCtx.getContents({
  337. success: function(data) {
  338. // proposalContent=data.html;
  339. // that.datainfo.zxFjList=JSON.parse(JSON.stringify(that.filelist));
  340. var params=that.datainfo;
  341. params.proposalContent=data.html;
  342. uni.setStorageSync('tjtaList', JSON.parse(JSON.stringify(params)))
  343. that.$toast("暂存成功")
  344. }
  345. })
  346. },
  347. getSubmit(){
  348. var that=this;
  349. if(!this.datainfo.title){
  350. this.$toast("请输入标题")
  351. return
  352. }
  353. if(!this.datainfo.categoryName){
  354. this.$toast("请选择提案类别")
  355. return
  356. }
  357. if(this.datainfo.isJointly==0&&!this.tary){
  358. this.$toast("请选择联名提案人员")
  359. return
  360. }
  361. var proposalContent='';
  362. that.editorCtx.getContents({
  363. success: function(data) {
  364. var params=that.datainfo;
  365. params.proposalContent=data.html;
  366. if(that.checkidx&&that.checkidx.length>0){
  367. params.negotiateType=that.checkidx.join(',')
  368. }
  369. if(that.pagetype=='add'){
  370. getCaseAddFn(params).then(res=>{
  371. if(res.code==200){
  372. that.$toast("提交成功")
  373. }
  374. })
  375. }else{
  376. getCaseEditFn(params).then(res=>{
  377. if(res.code==200){
  378. that.$toast("修改成功")
  379. uni.$emit("refreshdetail")
  380. setTimeout(function(){
  381. uni.navigateBack({
  382. delta: 1 //返回层数,2则上上页
  383. });
  384. },1200)
  385. }
  386. })
  387. }
  388. }
  389. })
  390. },
  391. onuploadEnd(item) {
  392. var newobj={}
  393. var responseText=JSON.parse(item.responseText)
  394. newobj.name=responseText.originalFilename;
  395. newobj.path=responseText.fileName;
  396. this.filelist.push(newobj)
  397. this.datainfo.zxFjList=JSON.parse(JSON.stringify(this.filelist))
  398. },
  399. getDelFj(idx){
  400. var that=this;
  401. uni.showModal({
  402. title: '确认删除',
  403. content: "是否确认删除",
  404. cancelText: '取消',
  405. confirmText: '确认',
  406. success: function(res) {
  407. if (res.confirm) {
  408. that.filelist.splice(idx,1)
  409. that.datainfo.zxFjList=JSON.parse(JSON.stringify(that.filelist))
  410. } else if (res.cancel) {
  411. }
  412. }
  413. });
  414. },
  415. getDown(e){
  416. uni.showLoading({
  417. title: '加载中'
  418. });
  419. var url=baseUrl+e;
  420. uni.downloadFile({
  421. url: url,//文件的下载路径
  422. success(result) {
  423. uni.hideLoading()
  424. var filePath = result.tempFilePath;
  425. uni.openDocument({
  426. filePath: filePath,
  427. showMenu: true,
  428. success: function (res) {
  429. // console.log('打开文档成功');
  430. }
  431. });
  432. },
  433. fail(res) {uni.hideLoading()}
  434. })
  435. },
  436. onStatusChange(){
  437. },
  438. onEditorReady(){
  439. var that=this;
  440. uni.createSelectorQuery().select('#editor').context(function(res) {
  441. that.editorCtx = res.context;
  442. that.editorCtx.setContents({
  443. html:that.editinfo
  444. })
  445. }).exec();
  446. }
  447. }
  448. }
  449. </script>
  450. <style scoped lang="scss">
  451. .bgtop{height: 150rpx;background-color: $com-cd3;width: 100%;}
  452. .pdbox{padding: 34rpx 24rpx 16rpx;}
  453. .addbox /deep/ .uni-forms-item{margin-bottom:36rpx;}
  454. .addbox /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 30rpx;}
  455. .addbox /deep/ .uni-forms-item__label{font-weight: bold;font-size: 30rpx;color: #343434;width: 198rpx !important;padding-left:20rpx;}
  456. .addbox /deep/ .is-required{position: absolute;left: 0;top: 50%;margin-top: -10rpx;}
  457. .addbox /deep/ .uni-data-checklist{display: flex;align-items: center;justify-content: flex-end;}
  458. .addbox /deep/ .uni-easyinput__placeholder-class{font-weight: 500;font-size: 30rpx;color: #AAAAAA;}
  459. .addbox /deep/ .checklist-box{margin-right: 0 !important;margin-left: 40rpx !important;}
  460. .fjadd{
  461. .btn{font-weight: bold;font-size: 30rpx;color: #1D64E2;margin: 0;display: flex;align-items: center;}
  462. }
  463. .addbox{margin-top: -120rpx;
  464. padding: 0 24rpx 50rpx;
  465. .boxs{background: #FFFFFF;border-radius: 30rpx;margin-bottom: 24rpx;overflow: hidden;position: relative;
  466. .infobg{width: 102rpx;height: 106rpx;position: absolute;right: 26rpx;bottom: 22rpx;}
  467. .tips{background: #F1F6FF;padding: 18rpx 38rpx;display: flex;align-items: flex-start;
  468. image{width: 20rpx;height: 26rpx;margin-right: 16rpx;flex:0 0 auto;margin-top: 4rpx;}
  469. view{font-weight: 500;font-size: 26rpx;color: #1D64E2;}
  470. }
  471. .titbox{
  472. .tit{
  473. image{width: 32rpx;height: 18rpx;margin-right: 10rpx;}
  474. view{font-weight: bold;font-size: 32rpx;color: #222327;}
  475. }
  476. .titr{width: 146rpx;height: 50rpx;background: #E4EEFF;border-radius: 26rpx;font-weight: 500;font-size: 24rpx;color: #1D64E2;text-align: center;line-height: 50rpx;}
  477. }
  478. .titinf{display: flex;flex-wrap: wrap;
  479. .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;
  480. text{flex: 0 0 auto;color: #9F9F9F;}
  481. }
  482. }
  483. .openbox{display: flex;align-items: center;justify-content: flex-end;font-weight: 500;
  484. font-size: 30rpx;height: 100%;color: #222327;
  485. }
  486. .edtip{font-weight: 500;font-size: 22rpx;color: #FF0000;
  487. text{margin: 4rpx 8rpx 0 0;}
  488. &.pa{position: absolute;right: 0;bottom: -15px;text-align: right;width: 702rpx;}
  489. }
  490. }
  491. }
  492. .matab{display: flex;align-items: center;flex-wrap: nowrap;overflow: auto;position: absolute;left: 0;right: -48rpx;
  493. .list{min-width:112rpx;height: 50rpx;background: #ffffff;border-radius: 25rpx;font-size: 30rpx;font-weight: 500;box-sizing: border-box;
  494. 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;
  495. &.act{background: #E4EEFF;color: #1D64E2;border: none;}
  496. }
  497. }
  498. // 附件
  499. .fjlists {display: flex;align-items: flex-start;justify-content: space-between;margin-bottom: 12rpx;
  500. image{margin-right: 18rpx;flex: 0 0 auto;}
  501. .imgl{width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;margin-right: 16rpx;
  502. image{width: 26rpx;height: 24rpx;}
  503. }
  504. .tit{font-size: 26rpx;color: #343434;font-weight: 500;margin-top: 4rpx;}
  505. .delimg{width: 40rpx;height:40rpx;margin-left: 16rpx;display: flex;align-items: center;justify-content: center;
  506. image{width: 26rpx;height: 26rpx;}
  507. }
  508. }
  509. // 按钮
  510. .addbtn{display: flex;align-items: center;justify-content: space-between;padding-top: 26rpx;
  511. .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;
  512. &.btn1{border: 2rpx solid #1D64E2;background: #ffffff;color: #1D64E2;}
  513. &.btn2{background: #1D64E2;color: #ffffff;}
  514. }
  515. }
  516. .addbox /deep/ .pbbox .ql-editor p{text-indent: 2rem;}
  517. </style>