addspeak.vue 16 KB

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