addactive.vue 16 KB

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