details.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <!-- 查看任务自定义 -->
  2. <template>
  3. <view>
  4. <!-- 顶部 -->
  5. <cu-custom bgColor="bg-blue" :isBack="true">
  6. <block slot="backText">任务详情</block>
  7. <block slot="content"></block>
  8. <block slot="right">
  9. <view class=" flex justify-center">
  10. <button v-if="initiate==1 && type!=1" :class="initiate==1 ? 'text-white line-blue ':'bg-blue text-blue '" @click="repeal()" class="cu-btn round line-blue " style="width: 160rpx;height: 66rpx;padding: 0;">废除任务</button>
  11. <button v-if="initiate==0 && type==1" @click="repeal()" class="text-white line-blue cu-btn round line-blue " style="width: 160rpx;height: 66rpx;padding: 0;">废除任务</button>
  12. </view>
  13. </block>
  14. </cu-custom>
  15. <!-- 内容 -->
  16. <view class="bg-white" style="padding: 36rpx 24rpx 30rpx;">
  17. <view class="cu_name">{{diySingle.name}}</view>
  18. <view class="cu_remarks">{{diySingle.task_explain}}</view>
  19. <!--审核、自定义任务的 附件 -->
  20. <view v-if="type!=2" class="cu-list_b">
  21. <view class="cu-item_1 flex justify-between">
  22. <text>附件(<text class="text-blue">{{fileList!=null? fileList.length:0}}</text>)</text>
  23. <text class="text-bold padding-right-sm" :class="[isFlod ? 'cuIcon-unfold' : 'cuIcon-fold']" style="font-size: 36rpx;" @tap="flodHandle"></text>
  24. </view>
  25. <template v-if="!isFlod">
  26. <view class="cu-item_2" v-for="item in fileList" @click="viewFile(item)" :key="item.id">
  27. <view class="cu-item_img">
  28. <image v-if="item.fileType==1" src="/static/task/excel.png"></image>
  29. <image v-if="item.fileType==2" src="/static/task/word.png"></image>
  30. <image v-if="item.fileType==3" src="/static/task/pdf.png"></image>
  31. <image v-if="item.fileType==4" src="/static/task/image.png"></image>
  32. </view>
  33. <view class="cu-item_cut">
  34. <view class="cu-item_filename">{{item.fileName}}</view>
  35. <view class="cu-item_start">{{item.fileSize}}</view>
  36. </view>
  37. <view class="action"style="width: auto;" >
  38. <text class="cuIcon-right text-bold"></text>
  39. </view>
  40. </view>
  41. </template>
  42. </view>
  43. <!-- 填报显示的-->
  44. <view class="cu-item bg-gray-secondary padding" v-if="type==2">
  45. <view class="content">
  46. <view class="text-gray text-cut text-lg">[{{formName}}]资料填报</view>
  47. </view>
  48. </view>
  49. <view class="cu_use_name" style="height: 39px;">
  50. <view>
  51. 发送人:{{diySingle.use_name}}
  52. </view>
  53. <view>
  54. {{ diySingle.start_date | timeStamp }} 至 {{ diySingle.end_date!=null ? diySingle.end_date : diySingle.blackout_date | timeStamp }}
  55. </view>
  56. </view>
  57. </view>
  58. <view style="height: 16rpx;background-color: #F7F7F7;"></view>
  59. <!-- 负责人 -->
  60. <view class="cu-bar_b" style="height: 39px;" >
  61. <text v-if="type==4">负责人</text>
  62. <text v-if="type==2">任务人</text>
  63. <text v-if="type==1 || type==3">任务进度</text>
  64. </view>
  65. <!-- 自定义、填报任务显示的负责人、任务人内容 -->
  66. <view v-if="type!=1" class="cu-list grid bg-black margin-bottom-xxxl" :class="['col-' + gridCol,gridBorder?'':'no-border']">
  67. <view class="cu-item" v-if="type!=2" v-for="(item,index) in diyData" :key="index">
  68. <view style="position: relative;">
  69. <image v-if="item.task_status==1" class="round" src ='/static/index/unfill-blue.png' style="background-color: white; z-index: 3;width: 36rpx;height: 36rpx;position: absolute;right: 20rpx;top: 0;"></image>
  70. <image class="menuImageTask round" :src="item.userp==null ? '/static/information/defaultAvatar.png' : item.userp" ></image>
  71. </view>
  72. <view class="task_user_name">{{item.task_user_name}}</view>
  73. </view>
  74. <view class="cu-item" v-if="type==2" v-for="item in reportTask" :key="item.id">
  75. <view style="position: relative;">
  76. <image v-if="item.task_status==1" class="round" src ='/static/index/unfill-blue.png' style="background-color: white;z-index: 3;width: 36rpx;height: 36rpx;position: absolute;right: 20rpx;top: 0;"></image>
  77. <image class="menuImageTask round" :src="item.userp==null ? '/static/information/defaultAvatar.png' : item.userp" ></image>
  78. </view>
  79. <view class="task_user_name">{{item.task_user_name}}</view>
  80. </view>
  81. </view>
  82. <!-- 审批任务显示的任务进度内容 -->
  83. <view v-if="type==1" class="cu-timeline" style="font-size: 58rpx;padding-bottom: 200px;" >
  84. <view v-for="(item,index) in taskProgressList" :key="index" :class="[item.taskStatus==0 ? 'cuIcon-time text-gray' :'cuIcon-roundcheck text-blue']" class="cu-item">
  85. <view class="text-black text-lg flex justify-between ">
  86. <view><text>{{item.name}}</text></view>
  87. <view v-if="index!=0">
  88. <text v-if="item.taskStatus == 0">等待审批</text>
  89. <text v-else-if="item.taskStatus == -1">审批未通过</text>
  90. <text v-else>审批同意</text>
  91. </view>
  92. <view v-else>
  93. <text v-if="item.taskStatus == -1">审批未通过</text>
  94. <text v-else>上报任务</text>
  95. </view>
  96. <view><text>{{item.start_date | timeStamp }}</text></view>
  97. </view>
  98. </view>
  99. </view>
  100. <!-- 底部-->
  101. <view v-if="initiate==0" class="cu-bar tabbar bg-white shadow foot solid-type-top" style="height: 120rpx;">
  102. <view v-if="type==4" class="btn-group text-xxl ">
  103. <button class="cu-btn lg bg-blue round" style="width: 560rpx;" @click="complete()">我已完成任务</button>
  104. </view>
  105. <view v-if="type==2" class="btn-group text-xxl ">
  106. <button class="cu-btn lg bg-yellow round text-white" style="width: 300rpx;" @click="complete()">我已完成任务</button>
  107. <button class="cu-btn lg bg-blue round" style="width: 300rpx;" @click="report(form)">立即填报</button>
  108. </view>
  109. <view v-if="type==1 || type==3" class="btn-group text-xxl ">
  110. <button class="cu-btn lg bg-blue round" style="width: 560rpx;" :class="btnType==true ? 'bg-gray' : '' " @click="approvalTasks()">立即审批</button>
  111. </view>
  112. </view>
  113. </view>
  114. </template>
  115. <script>
  116. export default {
  117. data() {
  118. return {
  119. userInfo:"",
  120. project:"",
  121. fileList:[],
  122. gridCol:5,
  123. gridBorder: false,
  124. type:1,// 1、任务审批显示的内容,2、//任务填报显示的内容 4、//任务自定义显示的内容
  125. initiate:0,//判断传递过来是不是我发起的任务
  126. taskProgressList:[],
  127. diyData:[],//任务的数据,
  128. diySingle:"",
  129. taskId:'',//数据ID
  130. reportTask:[],//填报类型的任务人
  131. btnType:false,
  132. formName:"",
  133. form:"",//表单数据
  134. contractid:'',//合同段id
  135. doMain:'https://huazheng2021.oss-cn-shenzhen.aliyuncs.com/',
  136. signType:{
  137. isOpenSign:0,//合同是否开启电签,0关闭,1开启
  138. isPfxFile:'',//是否有证书文件,1有
  139. isPhone:'',//绑定的手机号,没有则没绑定
  140. },
  141. smscode:'',
  142. sendCoded:false,//
  143. isFlod:false,//折叠
  144. }
  145. },
  146. onLoad(e) {
  147. var that =this;
  148. that.userInfo = uni.getStorageSync("userInfo");
  149. that.project = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id);
  150. that.type=e.type;
  151. that.taskId=e.taskId;
  152. that.initiate = e.value;
  153. this.contractid = e.contractid;
  154. //console.log(e)
  155. /* that.findTask(that.type); */
  156. this.getOss()
  157. },
  158. onShow() {
  159. var that=this;
  160. that.taskProgressList=[];
  161. that.findTask(that.type);
  162. uni.$on("save",res=>{
  163. that.btnType=true
  164. })
  165. },
  166. methods: {
  167. /* 获取任务信息 */
  168. findTask(type){
  169. var that=this;
  170. //查询任务数据
  171. if(type==2){//填报类型
  172. that.http.request("/app/task/findTaskByReport",{taskId:that.taskId,contractId:that.contractid}).then((res)=>{
  173. that.diyData = res.datas;
  174. that.diySingle = that.diyData[0];
  175. that.diySingle.use_name=that.diyData[0].userName;
  176. that.findTaskMan(that.diyData[0].id);//获取任务填报的任务人
  177. that.findTaskTemplate(that.diyData[0].template_id);//获取表单信息
  178. })
  179. }else{//自定义,审批类型 type :0为待办 , 1为我发起的
  180. that.http.request("/app/task/findtaskByType",{type:that.initiate, taskId:that.taskId,userId:that.userInfo.id , contractId:that.contractid}).then((res)=>{
  181. that.diyData = res.datas;
  182. that.diySingle = that.diyData[0];
  183. that.findTaskFile(that.diySingle);
  184. //获取任务的进度
  185. that.schedule(that.diySingle);
  186. that.signType = res.data;
  187. })
  188. }
  189. },
  190. /* 获取任务附件*/
  191. findTaskFile(data){
  192. var that=this;
  193. var taskId;
  194. if(that.type==1 || data.form_data_id==null){//自定义的附件
  195. taskId =data.id;
  196. }else if(that.type==3){//审批的附件
  197. taskId =data.form_data_id;
  198. }
  199. that.http.request("/app/task/findtaskFileById",{taskId:taskId}).then((res)=>{
  200. that.fileList = res.datas;
  201. })
  202. },
  203. /* 获取填报类型的任务人*/
  204. findTaskMan(taskId){
  205. var that=this;
  206. that.http.request("/app/task/findtaskBy",{taskId:that.taskId,contractId:that.contractid}).then((res)=>{
  207. that.reportTask = res.datas;
  208. })
  209. },
  210. /*获取任务填报的表单信息*/
  211. findTaskTemplate(templateId){
  212. var that =this;
  213. that.http.request("/app/task/findTaskTemplate",{templateId:templateId}).then((res)=>{
  214. var name = res.data.name.split("/");
  215. that.formName =name[name.length-2]+"/"+name[name.length-1];
  216. that.form= res.data;
  217. })
  218. },
  219. /* 获取任务的进度*/
  220. schedule(data){
  221. var that=this;
  222. var taskId;
  223. if(data.form_data_id==null || data.form_data_id==""){
  224. taskId =data.id;
  225. }else{
  226. taskId =data.form_data_id;
  227. }
  228. // that.http.request("/app/task/findTaskSchedule",{taskId:taskId}).then((res)=>{
  229. // that.taskProgressList=res.datas;
  230. // })
  231. that.http.request("/app/task/findTaskSchedulenew",{taskId:taskId}).then((res)=>{
  232. that.taskProgressList=res.datas;
  233. })
  234. },
  235. complete(){
  236. var that =this;
  237. that.http.request("/app/task/updateTaskStatus",{taskId:that.diySingle.id}).then((res)=>{
  238. if(res.result=="1"){
  239. that.$prompt.none("操作成功");
  240. setTimeout(function(){
  241. uni.navigateBack({
  242. delta:1
  243. })
  244. },500)
  245. }else{
  246. that.$prompt.none("操作失败")
  247. }
  248. })
  249. },
  250. repeal(){
  251. var that=this;
  252. if(that.initiate==1 || that.type==1){
  253. that.http.request("/app/task/delTask",{type:that.type,taskName:that.diySingle.name,userId:that.userInfo.id , contractId:that.contractid}).then((res)=>{
  254. if(res.result=="1"){
  255. that.$prompt.none("废除成功");
  256. setTimeout(function(){
  257. uni.navigateBack({
  258. delta:1
  259. })
  260. },500)
  261. }
  262. })
  263. }
  264. },
  265. report(data){
  266. uni.navigateTo({
  267. url:"/pages/personBaseIndex/personBaseIndex?id="+this.diySingle.template_id
  268. })
  269. },
  270. approvalTasks(){
  271. if(this.btnType){
  272. this.$prompt.none("你已审批");
  273. return;
  274. }
  275. uni.navigateTo({
  276. url:"/pages/task/approvalTasks/approvalTasks?taskId="+this.taskId+"&isOpenSign="+this.signType.isOpenSign+"&isPfxFile="+this.signType.isPfxFile+"&isPhone="+this.signType.isPhone
  277. })
  278. return;
  279. },
  280. viewFile(data){
  281. //console.log(data.file)
  282. //debugger
  283. var reg=/huazheng2021\w*.oss-cn-shenzhen.aliyuncs.com/;
  284. var path = '';
  285. if(reg.test(data.file)){
  286. path = data.file;
  287. }else{
  288. path = data.file.replace(this.doMain,"");
  289. path = this.doMain+path;
  290. }
  291. if(data.fileType==4){
  292. uni.navigateTo({
  293. url:"/pages/view/view?file="+path+"&title="+data.fileName
  294. })
  295. }else if(data.fileType==3){
  296. var encode=encodeURIComponent(path);
  297. uni.navigateTo({
  298. url:"/pages/view/preview/preview?preview="+ encode
  299. })
  300. }else{
  301. uni.showLoading({
  302. title:"跳转中..."
  303. })
  304. uni.downloadFile({
  305. url:path,
  306. success: function (res) {
  307. var filePath = res.tempFilePath;
  308. uni.openDocument({
  309. filePath: filePath,
  310. success: function (res) {
  311. uni.hideLoading()
  312. console.log('打开文档成功');
  313. },
  314. });
  315. }
  316. });
  317. }
  318. },
  319. getOss(){
  320. this.http.request("/app/getDoMain",{}).then((res)=>{
  321. this.doMain = res.data;
  322. })
  323. },
  324. flodHandle(){
  325. this.isFlod = !this.isFlod;
  326. }
  327. },
  328. filters: {
  329. timeStamp: function(value) {
  330. if (!value) return '';
  331. var now = new Date(value);
  332. var year = now.getFullYear();
  333. var month = now.getMonth() + 1;
  334. if (month < 10) {
  335. month = '0' + month
  336. }
  337. var date = now.getDate();
  338. if (date < 10) {
  339. date = '0' + date
  340. }
  341. return year + "-" + month + "-" + date
  342. },
  343. }
  344. }
  345. </script>
  346. <style>
  347. page{
  348. background-color: white;
  349. }
  350. .login-img{
  351. width:70rpx;
  352. height:70rpx;
  353. }
  354. .solid-type-top {
  355. border-top: 2upx solid rgba(0, 0, 0, 0.1);
  356. }
  357. .cu-list.menu-avatar>.cu-item {
  358. position: relative;
  359. display: -webkit-box;
  360. display: -webkit-flex;
  361. display: flex;
  362. padding-right: 4px;
  363. height: 59px;
  364. background-color: #F7F7F7;
  365. -webkit-box-pack: end;
  366. -webkit-justify-content: flex-end;
  367. justify-content: flex-end;
  368. -webkit-box-align: center;
  369. -webkit-align-items: center;
  370. align-items: center;
  371. }
  372. .cu-avatar-bg{
  373. background-color: #F7F7F7;
  374. }
  375. /* .cu-timeline>.cu-item::after {
  376. left:30px !important;
  377. } */
  378. .cu-list.menu-avatar>.cu-item:after, .cu-list.menu>.cu-item:after {
  379. position: absolute;
  380. top: 0;
  381. left: 0;
  382. box-sizing: border-box;
  383. width: 200%;
  384. height: 200%;
  385. border-bottom: 1.5px dashed #ddd;
  386. border-radius: inherit;
  387. content: " ";
  388. -webkit-transform: scale(.5);
  389. transform: scale(.5);
  390. -webkit-transform-origin: 0 0;
  391. transform-origin: 0 0;
  392. pointer-events: none;
  393. }
  394. .cu_name{color: #101010;font-size: 34rpx;font-weight: bold;}
  395. .cu_remarks{font-size: 30rpx;color: #101010;margin: 30rpx 0;}
  396. .cu-list_b{background-color: #F7F7F7;}
  397. .cu-item_1{padding: 26rpx 22rpx;border-bottom: 2rpx dashed #E3E1E1;font-size: 30rpx;color: #101010;font-weight: bold;}
  398. .cu-item_2{padding: 20rpx 22rpx;border-bottom: 2rpx dashed #E3E1E1;display: flex;align-items: center;}
  399. .cu-item_2:last-child{border-bottom: none;}
  400. .cu-item_img image{width: 80rpx;height: 80rpx;margin-right: 10rpx;}
  401. .cu-item_cut{width: 530rpx;margin-right: 10rpx;}
  402. .cu-item_filename{font-size: 30rpx;color: #101010;overflow: hidden;text-overflow: ellipsis; -o-text-overflow: ellipsis;white-space:nowrap;}
  403. .cu-item_start{font-size: 26rpx;color: #8A8A8A;margin-top: 6rpx;}
  404. .cu_use_name{display: flex;align-items: center;justify-content: space-between;font-size: 26rpx;color: #8A8A8A;padding-top: 26rpx;}
  405. .cu-bar_b{padding: 30rpx 24rpx;margin-top: 20rpx;font-size: 30rpx;color: #101010;font-weight: bold;background-color: #fff;border-bottom: 2rpx solid #E3E1E1;}
  406. .task_user_name{font-size: 30rpx;color: #101010;overflow-y: scroll;word-break:keep-all;white-space:nowrap;}
  407. .cu-bar_b {
  408. padding: 5px 10px !important;
  409. }
  410. .cu-timeline>.cu-item[class*="cuIcon-"]::before{
  411. top: 30upx;
  412. }
  413. .cu-timeline>.cu-item:not(:first-child)::after {
  414. left: 64upx;
  415. }
  416. </style>