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