addpointfn.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <template>
  2. <view :style="'padding-bottom:' + bottom ">
  3. <view class='zhanline'></view>
  4. <uni-forms class='inform ' ref="form" v-show="type==1">
  5. <!-- -->
  6. <view v-for="(ite,idx) in pointlist" :key="'point-'+idx" class="pointlist" >
  7. <view class="info_box" >
  8. <view class="info_tit">节点安排{{Number(idx)+1}}</view>
  9. <view class="delbx" @click.stop="getDelpoint(idx)" v-if="idx!=0">
  10. <image :src="delimg"></image>
  11. </view>
  12. </view>
  13. <uni-forms-item name="jdsj" style='margin-bottom: 0;'>
  14. <view class="flexc infolist" @click="getTimeFn(idx)">
  15. <view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>要求完成日期</view>
  16. <picker mode="date" :value="ite.jdsj" class="infolist_a" @change='bindDateChangetimea'>
  17. <view :class="ite.jdsj?'':'f16 co80'">{{ite.jdsj||"请选择要求完成日期"}}</view>
  18. </picker>
  19. </view>
  20. </uni-forms-item>
  21. <uni-forms-item name="deptName" style='margin-bottom: 0;'>
  22. <view class="flexc infolist" @click="showPicker('zrdw',idx)">
  23. <view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>责任单位</view>
  24. <view class="f16 c34 txr flex1">
  25. <view :class="ite.fgwJdapZrDwList.length?'':'f16 co80'">{{checkstring(ite.fgwJdapZrDwList)||"请选择责任单位"}}</view>
  26. </view>
  27. </view>
  28. </uni-forms-item>
  29. <uni-forms-item name="deptName" style='margin-bottom: 0;'>
  30. <view class="flexc infolist" @click="showPicker('xtdw',idx)">
  31. <view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>协同单位</view>
  32. <view class="f16 c34 txr flex1">
  33. <view :class="ite.fgwJdapXtDwList.length?'':'f16 co80'">{{checkstring(ite.fgwJdapXtDwList)||"请选择协同单位"}}</view>
  34. </view>
  35. </view>
  36. </uni-forms-item>
  37. <uni-forms-item name="jdannr" style='margin-bottom: 0;'>
  38. <view class="flexc infolist">
  39. <view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>具体内容</view>
  40. <input placeholder="请输入具体内容" v-model="ite.jdannr" class="f16 c34 flex1 txr"/>
  41. </view>
  42. </uni-forms-item>
  43. <uni-forms-item name="zsyzFjList" style='margin-bottom: 0;'>
  44. <view class="flexc infolist">
  45. <view class="f16 fw c34 flex0 pr pl12">附件</view>
  46. <view class="infolist_a co28">
  47. <lsj-upload ref="lsjUpload" :xmtype='idx' @getFile="getFile" childId="upload1" :width="width" :height="height" :option="option" :size="size" :formats="formats" :debug="debug" :instantly="instantly" @progress="" @uploadEnd="onuploadEnd" >
  48. <view class="btn" :style="{width: width,height: height}">上传文件</view>
  49. </lsj-upload>
  50. </view>
  51. </view>
  52. </uni-forms-item>
  53. <view class=" cldelistbf" v-for="(fite,fidx) in ite.fgwJdapFjList" :key="'fj_'+fidx">
  54. <view class="flext f15 c6" @click.stop="getDown(fite.path)">
  55. <view class="imgl"><image :src="wimg" ></image></view>
  56. <view>{{fite.fjName}}</view>
  57. </view>
  58. <!-- 删除 -->
  59. <view class="delimg flex0" @click.stop="getDelFj(idx,fidx)">
  60. <image :src="delimg"></image>
  61. </view>
  62. </view>
  63. <view class="infolist_b"><text>*</text>请上传大小不超过<text>100MB</text>格式为<text>doc/xls/ppt/txt/pdf/zip/rar/word</text>的文件</view>
  64. </view>
  65. <!-- 添加按钮 -->
  66. <view class="addbox" @click.stop="getAddPoint" v-if="pagetype=='add'">
  67. <image :src="addpimg"></image>
  68. <view>添加节点安排</view>
  69. </view>
  70. <view class="infobtn flexcc cf f16 f500" @click="getSubmit">提交</view>
  71. </uni-forms>
  72. <bartree-pickerfixed ref="treePickerzrdw" deptType='1' :multiple='true' @select-change="selectChangezrdw" title="选择责任单位"
  73. :localdata="localdata" valueKey="id" textKey="label" childrenKey="children"></bartree-pickerfixed>
  74. <bartree-pickerfixed deptType='2' ref="treePickerxtdw" :multiple='true' @select-change="selectChangextdw" title="选择协同单位"
  75. :localdata="localdata" valueKey="id" textKey="label" childrenKey="children"></bartree-pickerfixed>
  76. </view>
  77. </template>
  78. <script>
  79. import { getDictionaryFn} from '@/api/work/index.js'
  80. import {selectDictLabel} from "@/utils/common.js"
  81. import {getaddzdapdFn,getdetailzdapdFn,getputzdapdFn} from "@/api/zdwork/addclue.js"
  82. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  83. import config from '@/config'
  84. const baseUrl = config.baseUrl
  85. import { getToken } from '@/utils/auth'
  86. import {gettreeselect,getfgwtreeFn} from "@/api/system/user.js"
  87. import bartreePickerfixed from "@/components/ba-tree-picker/ba-tree-pickerfixed.vue"
  88. export default {
  89. components:{bartreePickerfixed},
  90. data() {
  91. return {
  92. //附件
  93. option: {
  94. // 上传服务器地址,需要替换为你的接口地址
  95. url: baseUrl+'/common/upload', // 该地址非真实路径,需替换为你项目自己的接口地址
  96. // 上传附件的key
  97. name: 'file',
  98. // 根据你接口需求自定义请求头,默认不要写content-type,让浏览器自适配
  99. header: {
  100. // 示例参数可删除
  101. 'Authorization': 'Bearer ' + getToken(),
  102. },
  103. // 根据你接口需求自定义body参数
  104. formData: {
  105. }
  106. },
  107. // 选择文件后是否立即自动上传,true=选择后立即上传
  108. instantly: true,
  109. // 必传宽高且宽高应与slot宽高保持一致
  110. width: '',
  111. height: '48rpx',
  112. // 限制允许上传的格式,空串=不限制,默认为空
  113. formats: 'doc,docx,xls,ppt,txt,pdf,zip,rar,word',
  114. // 文件上传大小限制
  115. size: 100,
  116. // 文件数量限制 默认10
  117. count: 5,
  118. // 文件回显列表
  119. files: new Map(),
  120. // 微信小程序Map对象for循环不显示,所以转成普通数组,不要问为什么,我也不知道
  121. wxFiles: [],
  122. // 是否打印日志
  123. debug: false,
  124. filelist:[],
  125. selectDate: '',
  126. defaultPhoneHeight: '', //屏幕默认高度
  127. nowPhoneHeight: '', //屏幕现在的高度
  128. bottom:0,
  129. type:1,
  130. datainfo:{
  131. // "xmId":"",//项目ID
  132. // "xmmc":"",//项目名称
  133. // "dbnrId":"",//督办内容编号
  134. // "dbnrName":"",//督办内容名称
  135. // "deptId":"",//督办部门id
  136. // "deptName":"",//督办部门名称
  137. // "dbdj":"",//督办等级
  138. // "yqwcsj":""//要求完成时间
  139. },
  140. tanfalg:false,
  141. addimg:require("@/static/images/mine/add.png"),
  142. delimg:require("@/static/images/mine/del.png"),
  143. checknimg:require("@/static/images/mine/jnicon.png"),
  144. gcheckimg:require("@/static/images/mine/jicon.png"),
  145. closeimg:require('@/static/images/close.png'),
  146. wimg:require('@/static/images/index/wicon.png'),
  147. downimg:require('@/static/images/index/down.png'),
  148. addpimg:require('@/static/images/new/index/addp.png'),
  149. rules: {
  150. // xmmc: {rules: [{required: true,errorMessage: '请输入项目名称'}]},
  151. // dbnrName: {rules: [{required: true,errorMessage: '请选择督办内容',}]},
  152. // deptName: {rules: [{required: true,errorMessage: '请选择责任单位',}]},
  153. // dbdj: {rules: [{required: true,errorMessage: '请选择督办等级' } ]},
  154. // yqwcsj: {rules: [{required: true,errorMessage: '请选择签要求完成时间'} ]},
  155. },
  156. currentdate:'',//当天日期
  157. superviselist:[],//督办内容bindDateChangedana
  158. dbnrindex:0,//督办内容
  159. location:[],//责任单位bindDateChangedanb
  160. zrdwindex:0,
  161. pagetype:'add',
  162. sfys:'',//是否宜商
  163. pointidx:0,
  164. pointlist:[],
  165. localdata:[],//市值单位
  166. selectValue:[],//选中的市值单位
  167. checktype:'',//选择的是哪个
  168. }
  169. },
  170. onLoad(e) {
  171. // this.currentdate = this.getNowFormatDate();
  172. var newObj=JSON.parse(decodeURIComponent(e.data))
  173. this.pagetype=newObj.pagetype||'add';
  174. // this.getinvestmentarea();
  175. this.gettreeselect()
  176. this.datainfo.xmId=newObj.id;
  177. this.datainfo.xmmc=newObj.xmmc;
  178. var pointobj ={
  179. "xmId":newObj.id,//项目ID
  180. "xmmc":newObj.xmmc,//项目名称
  181. 'jdId':newObj.jdId,//节点id
  182. "jdsj":"",//节点完成时间
  183. "jdannr":"",//节点安排内容
  184. "fgwJdapZrDwList":[],//责任单位
  185. "fgwJdapXtDwList":[],//协同单位
  186. "fgwJdapFjList":[],//附件
  187. }
  188. this.pointlist=[];
  189. this.pointlist.push(pointobj)
  190. if(this.pagetype=='update'){
  191. this.datainfo.jdId=newObj.jdId;
  192. // 获取详情 修改
  193. this.getDataFn()
  194. }else{
  195. }
  196. // #ifdef APP
  197. uni.onKeyboardHeightChange(res=> { //监听键盘高度变化
  198. const res_keyboard = uni.getSystemInfoSync();
  199. let key_height = res.height - (res_keyboard.screenHeight - res_keyboard.windowHeight)
  200. this.bottom = `${ key_height>0 ? key_height : 0}px`;
  201. })
  202. // #endif
  203. },
  204. onHide() {
  205. // #ifdef APP-PLUS
  206. uni.offKeyboardHeightChange(); // 取消监听键盘高度变化事件,避免内存消耗
  207. // #endif
  208. },
  209. onReady() {
  210. // this.$refs.form.setRules(this.rules)
  211. },
  212. methods: {
  213. checkPermi, checkRole,
  214. checkstring(e){
  215. var newArr=[];
  216. e.forEach((ite,idx)=>{
  217. newArr[idx]=ite.deptName
  218. })
  219. return newArr.join(',')
  220. },
  221. showPicker(e,idx) {
  222. this.checktype=e;
  223. this.pointidx=idx;
  224. if(e=='xtdw'){
  225. this.$refs.treePickerxtdw._show();
  226. }else if(e=='zrdw'){
  227. this.$refs.treePickerzrdw._show();
  228. }
  229. },
  230. selectChangezrdw(e){
  231. var val=e;
  232. var idx=this.pointidx;
  233. this.pointlist[idx].fgwJdapZrDwList=JSON.parse(JSON.stringify(val));
  234. },
  235. selectChangextdw(e){
  236. var val=e;
  237. var idx=this.pointidx;
  238. this.pointlist[idx].fgwJdapXtDwList=JSON.parse(JSON.stringify(val))
  239. },
  240. gettreeselect(){
  241. // 市值部门102 承接地103
  242. //线下 210 线上212
  243. var url=baseUrl;
  244. var parentId=''
  245. if(url.indexOf('https://qszs.qs163.cn')!=-1){
  246. parentId=212
  247. }else{
  248. parentId=210
  249. }
  250. var params={
  251. parentId:parentId
  252. }
  253. getfgwtreeFn(params).then(res=>{
  254. if(res.code==200){
  255. if(res.data&&res.data.length){
  256. this.localdata=res.data;
  257. // var neArr=res.data
  258. // for(var i=0;i<neArr.length;i++){
  259. // if(neArr[i].id=='201'){
  260. // this.cityrange=neArr[i].children
  261. // }
  262. // if(neArr[i].id=='103'){
  263. // this.adrrange=neArr[i].children
  264. // }
  265. // }
  266. }
  267. // this.list=res.rows
  268. }else{
  269. this.$toast(res.msg)
  270. }
  271. })
  272. },
  273. getAddPoint(){
  274. var obj ={
  275. "xmId":this.datainfo.xmId,//项目ID
  276. "xmmc":this.datainfo.xmmc,//项目名称
  277. 'jdId':this.datainfo.jdId,//节点信息
  278. "jdsj":"",//节点完成时间
  279. "jdannr":"",//节点安排内容
  280. "fgwJdapZrDwList":[],//责任单位
  281. "fgwJdapXtDwList":[],//协同单位
  282. "fgwJdapFjList":[],//附件
  283. }
  284. this.pointlist.push(obj)
  285. },
  286. getDelpoint(idx){
  287. var that = this;
  288. uni.showModal({
  289. title: '提示',
  290. content: "是否确认删除",
  291. success: function(res) {
  292. if (res.confirm) {
  293. that.pointlist.splice(idx, 1)
  294. } else if (res.cancel) {
  295. }
  296. }
  297. });
  298. },
  299. // 项目详情
  300. getDataFn(){
  301. var that=this;
  302. getdetailzdapdFn(this.datainfo.jdId).then(res=>{
  303. if(res.code==200){
  304. that.pointlist=[];
  305. that.pointlist.push(res.data)
  306. }else{
  307. this.$toast(res.msg)
  308. }
  309. })
  310. },
  311. // 字典值
  312. getinvestmentarea(){
  313. // 督办内容
  314. // getDictionaryFn('supervise_handle').then(res=>{
  315. // if(res.code==200){
  316. // this.superviselist=res.data
  317. // }
  318. // })
  319. // 获取责任单位
  320. getDictionaryFn('proposed_location').then(res=>{
  321. if(res.code==200){
  322. this.location = res.data.map(v => {
  323. return {
  324. dictLabel: v.dictLabel,
  325. dictValue: Number(v.dictValue)
  326. }
  327. })
  328. }
  329. })
  330. },
  331. getNowFormatDate(){
  332. let date = new Date();
  333. let y = date.getFullYear();
  334. let m = date.getMonth() + 1;
  335. m = m < 10 ? "0" + m : m;
  336. let d = date.getDate();
  337. d = d < 10 ? "0" + d : d;
  338. const timeday = y + "-" + m + "-" + d;
  339. return timeday;
  340. },
  341. getTimeFn(idx){
  342. this.pointidx=idx;
  343. },
  344. bindDateChangetimea(e){//完成时间
  345. var val=e.detail.value;
  346. var idx=this.pointidx;
  347. this.pointlist[idx].jdsj = e.detail.value
  348. // this.datainfo.jdsj=
  349. },
  350. bindDateChangedana(e){
  351. var val=e.detail.value;
  352. this.datainfo.dbnrName=this.superviselist[val].dictLabel
  353. this.datainfo.dbnrId=this.superviselist[val].dictValue
  354. },
  355. bindDateChangedanb(e){
  356. var val=e.detail.value;
  357. this.datainfo.deptName=this.location[val].dictLabel
  358. this.datainfo.deptId=this.location[val].dictValue
  359. },
  360. getSubmit() {
  361. var that=this;
  362. //
  363. var pointlist=that.pointlist;
  364. for(var i =0;i<pointlist.length;i++){
  365. var str='节点安排'+(Number(i)+1)
  366. var nstr=''
  367. if(!pointlist[i].jdsj){
  368. nstr="请选择"+str+":要求完成时间"
  369. that.$toast(nstr)
  370. return
  371. }
  372. if(!pointlist[i].fgwJdapZrDwList||pointlist[i].fgwJdapZrDwList.length<1){
  373. nstr="请选择"+str+":责任单位"
  374. that.$toast(nstr)
  375. return
  376. }
  377. if(!pointlist[i].fgwJdapXtDwList||pointlist[i].fgwJdapXtDwList.length<1){
  378. nstr="请选择"+str+":协同单位"
  379. that.$toast(nstr)
  380. return
  381. }
  382. if(!pointlist[i].jdannr){
  383. nstr="请输入"+str+":具体内容"
  384. that.$toast(nstr)
  385. return
  386. }
  387. }
  388. if(this.pagetype=='add'){
  389. var params={
  390. fgwJdapList:pointlist
  391. }
  392. getaddzdapdFn(params).then(res=>{
  393. if(res.code==200){
  394. this.$toast('新增节点安排成功')
  395. setTimeout(function() {
  396. uni.$emit('refreshdatazd');
  397. uni.navigateBack({delta: 1});
  398. },1500);
  399. }else{
  400. this.$toast(res.msg)
  401. }
  402. })
  403. }else{
  404. var params=that.pointlist[0];
  405. getputzdapdFn(params).then(res=>{
  406. if(res.code==200){
  407. this.$toast('修改节点安排成功')
  408. setTimeout(function() {
  409. uni.$emit('refreshdatazd');
  410. uni.navigateBack({delta: 1});
  411. },1500);
  412. }else{
  413. this.$toast(res.msg)
  414. }
  415. })
  416. }
  417. this.$refs.form.validate().then(res => {
  418. })
  419. },
  420. getFile(idx){
  421. this.filetype=idx
  422. },
  423. onuploadEnd(item) {
  424. var newobj={}
  425. var responseText=JSON.parse(item.responseText)
  426. newobj.fjName=responseText.originalFilename;
  427. newobj.path=responseText.fileName;
  428. var pidx=this.filetype;
  429. var filelist=JSON.parse(JSON.stringify(this.pointlist[pidx].fgwJdapFjList))
  430. filelist.push(newobj)
  431. this.pointlist[pidx].fgwJdapFjList=JSON.parse(JSON.stringify(filelist))
  432. },
  433. getDelFj(idx,fidx){
  434. var filelist=JSON.parse(JSON.stringify(this.pointlist[idx].fgwJdapFjList))
  435. filelist.splice(fidx,1)
  436. this.pointlist[idx].fgwJdapFjList=JSON.parse(JSON.stringify(filelist))
  437. },
  438. getDown(e){
  439. uni.showLoading({
  440. title: '加载中'
  441. });
  442. var url=baseUrl+e;
  443. uni.downloadFile({
  444. url: url,//文件的下载路径
  445. success(result) {
  446. uni.hideLoading()
  447. var filePath = result.tempFilePath;
  448. uni.openDocument({
  449. filePath: filePath,
  450. showMenu: true,
  451. success: function (res) {
  452. }
  453. });
  454. },
  455. fail(res) {uni.hideLoading()}
  456. })
  457. },
  458. }
  459. }
  460. </script>
  461. <style lang="scss" scoped>
  462. .inform{padding-bottom: 160rpx;}
  463. .infolist{padding: 30rpx 32rpx 30rpx 24rpx;position: relative;
  464. .cir{position: absolute;font-size: 36rpx;font-weight: bold;color: #FE5706;left: 0rpx;}
  465. }
  466. .delimg{width: 40rpx;height:40rpx;margin-left: 16rpx;display: flex;align-items: center;justify-content: center;
  467. image{width: 30rpx;height: 30rpx;}
  468. }
  469. .infobtn{width: 100%;height: 88rpx;background: #FA5F03;line-height: 88rpx;position: fixed;left: 0;right: 0;bottom: 0;z-index: 3;}
  470. .input_ye image{width: 34rpx;height: 18rpx;}
  471. .info_box{
  472. padding: 30rpx 26rpx;display: flex;align-items: center;
  473. .info_tit{font-size: 32rpx;color: #FE5706;font-weight: bold;flex: 1;}
  474. }
  475. .infolist_a{height: 44rpx;flex: 1;text-align: right;font-size: 32rpx;color: #343434;}
  476. .addbox{display: flex;align-items: center;justify-content: flex-end;padding: 0 24rpx;margin-top:30rpx;
  477. image{width: 32rpx;height: 32rpx;margin-right: 20rpx;}
  478. view{font-size: 32rpx;color: #1FB9F7;font-weight: 500;}
  479. }
  480. .pointlist{padding: 30rpx 0;}
  481. .inform /deep/ .uni-forms-item__error{margin-top: -30rpx;margin-left: 24rpx;}
  482. .inform .pl12{margin-right: 10rpx;}
  483. .fixedbox .pl12{margin-right: 10rpx;}
  484. </style>