dailyReport.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <template>
  2. <view>
  3. <!-- 顶部 -->
  4. <cu-custom bgColor="bg-blue" :isBack="true">
  5. <block slot="backText">日志上报</block>
  6. <block slot="content"></block>
  7. <block slot="right">
  8. <view class="flex justify-center">
  9. <button @click="save()" class="margin-top-ssm cu-btn round line-blue text-white">确定</button>
  10. </view>
  11. </block>
  12. </cu-custom>
  13. <!-- 标题 -->
  14. <view class="cu-bar bg-white solid-bottom padding-tb-sm padding-lr" style="min-height: 44px;height: auto;">
  15. <text class="text-black text-bold" style="text-align:justify; text-justify:inter-ideograph;">{{title}}</text>
  16. </view>
  17. <!-- 内容 -->
  18. <form>
  19. <!-- <view class="cu-form-group_1 margin-top" @click="showdialog()"> -->
  20. <view class="cu-form-group_1 margin-top">
  21. <view class="title">上报流程</view>
  22. <!-- <view style="flex: 1;display: flex;">
  23. <input placeholder="请选择" disabled="true" placeholder-style="color:#AEAEAE;font-size:30rpx" v-model="flowName" name="input"></input>
  24. <text class='cuIcon-right text-gray' style="margin-left: 100px;"></text>
  25. </view> -->
  26. <picker @change="bindPickerChange" :value="flowName" :range="workflow" range-key="name" style="flex: 1;">
  27. <view style="display: flex;justify-content: space-between;">
  28. <view style="flex: 1;">
  29. <text v-if="flowName" style="font-size: 30rpx;">{{flowName}}</text>
  30. <text v-else style="color:#AEAEAE;font-size:30rpx">请选择</text>
  31. </view>
  32. <text class='cuIcon-right text-gray'></text>
  33. </view>
  34. </picker>
  35. </view>
  36. <!-- <view class="cu-form-group_3">
  37. <view class="title">限定日期</view>
  38. <view style="flex: 1;display: flex;">
  39. <datetime-picker v-model="data.blackoutDate" placeholder="请选择日期" style="color:#AEAEAE;font-size:30rpx;flex: 1;" fields="minute"
  40. @change="changeStartTime">
  41. <text class='cuIcon-right text-gray'></text>
  42. </datetime-picker>
  43. </view>
  44. </view> -->
  45. <view class="cu-form-group_2">
  46. <view class="title">上报说明</view>
  47. <view style="flex: 1;display: flex;">
  48. <textarea v-model="data.remarks" maxlength="-1" placeholder="请输入" placeholder-style="color:#AEAEAE;font-size:30rpx" ></textarea>
  49. </view>
  50. </view>
  51. <view class="cu-form-group_2">
  52. <view class="title">上报批次</view>
  53. <view style="flex: 1;display: flex;">
  54. <input placeholder="请输入正整数" placeholder-style="color:#AEAEAE;font-size:30rpx" v-model="data.reportTime" name="input" style="font-size:30rpx"></input>
  55. </view>
  56. </view>
  57. <view class="cu-form-group_2" @click="navToPer()" v-if="radio==0 || radio==-1">
  58. <view class="title">下一审批人</view>
  59. <view style="flex: 1;display: flex;justify-content: space-between;">
  60. <input placeholder="请选择" disabled="true" placeholder-style="color:#AEAEAE;font-size:30rpx" v-model="approver" name="input" style="font-size:30rpx"></input>
  61. <text class='cuIcon-right text-gray' ></text>
  62. </view>
  63. </view>
  64. <template v-else>
  65. <view class="cu-form-group_1">
  66. <view class="title">任务人</view>
  67. </view>
  68. <view class="cu-list_1 bg-white padding-sm" style="border-bottom: 1px solid #E3E1E1;">
  69. <view class="cu-list_item" style="margin-right: 0;" v-for="(item,index) in principal" :key="item.id">
  70. <view class="cu-capsule round">
  71. <view class="cu-tag bg-gray-secondary padding-sm">
  72. {{item.user_name}}
  73. </view>
  74. </view>
  75. <text class="padding-lr-sm" v-if="index != principal.length-1"> >> </text>
  76. </view>
  77. </view>
  78. </template>
  79. <view class="cu-form-group_1">
  80. <view class="title">抄送人</view>
  81. </view>
  82. <view class="cu-list_b">
  83. <view class="cu-list_1">
  84. <view class="cu-list_item" v-for="(item) in copyList" :key="item.id">
  85. <view class="cu-capsule round">
  86. <!-- <view v-if="item.type==1" class='cu-tag bg-gray-secondary '>
  87. 施工方
  88. </view>
  89. <view v-if="item.type==2" class='cu-tag bg-gray-secondary '>
  90. 监理方
  91. </view>
  92. <view v-if="item.type==3" class='cu-tag bg-gray-secondary '>
  93. 业主方
  94. </view> -->
  95. <!-- <view class="cu-tag bg-gray-secondary">
  96. <text class="cuIcon-titles text-gray"></text>
  97. </view> -->
  98. <view class="cu-tag bg-gray-secondary">
  99. {{item.user_name}}
  100. </view>
  101. <view class="cu-tag bg-gray-secondary" @tap="delprincipal(item,'copy')">
  102. <image src="/static/index/delete-blue.png" class="login-img"></image>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. <view>
  108. <button @click="addPrincipal('copy')" class="cu-btn round bg-blue-secondary"><text class="cuIcon-add text-blue">新增</text></button>
  109. </view>
  110. </view>
  111. <view class="cu-form-group_3 flex">
  112. <view class="title">每人限定时间</view>
  113. <picker class="flex-sub text-right" @change="timeLimitChange" :value="data.timeLimit" :range="timeLimitList">
  114. <view class="picker">
  115. {{timeLimitList[data.timeLimit]}}天
  116. <text class='cuIcon-right text-gray'></text>
  117. </view>
  118. </picker>
  119. </view>
  120. </form>
  121. <!--流程弹窗 -->
  122. <view class="cu-modal bottom-modal" :class="modalShow?'show':''" >
  123. <view class="cu-dialog" style="background-color: white;border-radius: 20rpx 20rpx 0 0;">
  124. <view class="cu-bar bg-white">
  125. <view class="action text-gray"></view>
  126. <view class="action text-black text-bold" style="color: #101010;">选择上报流程</view>
  127. <view class="action text-gray" @tap="showdialog()">取消</view>
  128. </view>
  129. <view class="">
  130. <radio-group class="block" @change="RadioChange">
  131. <view class="cu-list menu text-left" v-for="(item,index) in workflow" :key="index">
  132. <view class="cu-item">
  133. <label class="flex justify-between align-center flex-sub">
  134. <view class="flex-sub">{{item.name}}</view>
  135. <radio class="round" :class="radio==item.value?'checked':''" :checked="radio==item.value ? true:false"
  136. :value="item.value"></radio>
  137. </label>
  138. </view>
  139. </view>
  140. </radio-group>
  141. </view>
  142. </view>
  143. </view>
  144. </view>
  145. </template>
  146. <script>
  147. export default {
  148. data() {
  149. return {
  150. data: {
  151. name:'',
  152. blackoutDate: "",
  153. remarks:"",
  154. formDataId:"",
  155. userIDs:"",
  156. flow:"",
  157. processId:null,
  158. timeLimit:0,//每人限定时间在timeLimitList的索引
  159. reportTime:'',//上报批次
  160. },
  161. flowName:"",
  162. title:"",
  163. approver:"",
  164. approverList:[],
  165. workflow:[{id:1,name:"自定义流程"}],
  166. modalShow:false,
  167. radio: -1,
  168. timeLimitList:[1,2,3,4,5,6,7,10,15,20,25,30],
  169. principal:[],
  170. copyList:[],
  171. contractId : uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id).contractId,
  172. project:uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id),
  173. diary:{},
  174. urlName:'',
  175. isZJ:0,
  176. tableName:'',
  177. }
  178. },
  179. onLoad(e) {
  180. //console.log(e)
  181. this.diary = getApp().globalData.diary;
  182. this.urlName = e.urlName;
  183. this.isZJ = e.isZJ;
  184. this.getReportedName();
  185. this.findWorkflow();
  186. },
  187. methods: {
  188. save(){
  189. if(this.radio==-1){
  190. this.$prompt.none("请选择上报流程");
  191. return;
  192. }
  193. if(this.data.flow==0){
  194. if(this.data.userIDs==''){
  195. this.$prompt.none("请选择审批人");
  196. return;
  197. }
  198. }
  199. var userId = uni.getStorageSync("userInfo").id;
  200. let copyUserIds = [];
  201. for(let i=0;i<this.copyList.length;i++){
  202. copyUserIds.push(this.copyList[i].id)
  203. }
  204. let cs,contractId;
  205. // if(this.project.contract_type == 1 || this.project.contract_type == 2){
  206. // //监理抽检
  207. // contractId = uni.getStorageSync("curContractId");
  208. // cs = 1;
  209. // }else{
  210. // //施工质检
  211. // contractId = this.contractId;
  212. // cs = 0;
  213. // }
  214. contractId = this.contractId;
  215. //PC的日志上报cs是0
  216. cs = 0;
  217. //上报批次检验
  218. if (!this.data.reportTime) {
  219. this.$prompt.none("上报批次必须是大于0的正整数");
  220. return false;
  221. }
  222. else if (!(/(^[1-9]\d*$)/.test(this.data.reportTime))) {
  223. this.$prompt.none("上报批次必须是大于0的正整数");
  224. return false;
  225. }
  226. var that=this;
  227. let entityVoList = [];
  228. entityVoList.push(this.diary);
  229. let reportVo = {
  230. type: 1,
  231. tableName:this.tableName,
  232. entityVoList:entityVoList,
  233. taskVo: {
  234. name: this.data.name,
  235. blackout_days: this.timeLimitList[this.data.timeLimit],
  236. remarks: this.data.remark,
  237. reportTime: this.data.reportTime,
  238. userIds: this.data.userIDs,
  239. flow: this.data.flow,
  240. processId: null,
  241. formDataId: null,
  242. testDataId: null,
  243. cs: cs,
  244. copyUserIds: copyUserIds.join(','),
  245. type: 2
  246. }
  247. }
  248. this.http.request("/app/"+this.urlName + '/report',{
  249. "voStr":JSON.stringify([reportVo]),
  250. userId:userId,
  251. contractId:contractId
  252. }).then((res)=>{
  253. if(res.result=="1"){
  254. that.$prompt.none("上报成功");
  255. uni.$emit('report',"");
  256. setTimeout(function(){
  257. uni.navigateBack({
  258. delta:1
  259. })
  260. },2000)
  261. }else{
  262. //that.$prompt.none(res.msg)
  263. uni.showToast({
  264. title:res.msg,
  265. duration:3000,
  266. icon:"none"
  267. })
  268. }
  269. //console.log(res)
  270. })
  271. },
  272. navToPer(){
  273. getApp().globalData.principal = this.approverList;
  274. uni.navigateTo({
  275. url:"/pages/constructionLog/personnel/personnel?name=选择审批人"
  276. })
  277. },
  278. changeStartTime(date) {
  279. this.data.blackoutDate = date.fmt1 + " " + date.fmt8;
  280. },
  281. showdialog(){
  282. this.modalShow= !this.modalShow;
  283. },
  284. RadioChange(e) {
  285. this.radio = e.detail.value;
  286. this.flowName = this.workflow[this.radio].name;
  287. this.data.flow = this.workflow[this.radio].id;
  288. this.showdialog();
  289. },
  290. bindPickerChange(e){
  291. //console.log(e)
  292. this.radio = e.detail.value;
  293. this.flowName = this.workflow[this.radio].name;
  294. this.data.flow = this.workflow[this.radio].id;
  295. if(this.data.flow != 0){
  296. this.http.request("/app/getLinks",{id:this.data.flow}).then((res)=>{
  297. //console.log(res)
  298. if(res.datas && res.datas.length > 0){
  299. res.datas.forEach((item)=>{
  300. item.user_name = item.userName
  301. })
  302. this.principal = res.datas;
  303. }
  304. })
  305. }else{
  306. this.principal = [];
  307. }
  308. },
  309. /**
  310. * 查询固定流程
  311. */
  312. findWorkflow(){
  313. let contractId=this.contractId;
  314. this.http.request("/app/workflowlist",{type:'0',contractId:contractId}).then((res)=>{
  315. res.datas.forEach((item)=>{
  316. this.workflow.push(item);
  317. });
  318. this.workflow.forEach((item,index)=>{
  319. item.value =''+index+'';
  320. })
  321. })
  322. },
  323. timeLimitChange(e){
  324. this.data.timeLimit = e.detail.value;
  325. },
  326. addPrincipal(type) {
  327. //console.log(this.principal);
  328. let list = [];
  329. let name = '';
  330. if(type == 'task'){
  331. list = this.principal;
  332. name = '选择任务人'
  333. }else if(type == 'copy'){
  334. list = this.copyList;
  335. name = '选择抄送人'
  336. }
  337. //把已选值储存到全局变量
  338. getApp().globalData.principal = list;
  339. uni.navigateTo({
  340. url: "/pages/constructionLog/personnel/personnel?name=" + name
  341. })
  342. },
  343. delprincipal(value,type) {
  344. let list = []
  345. if(type == 'task'){
  346. list = this.principal;
  347. }else if(type == 'copy'){
  348. list = this.copyList;
  349. }
  350. list.forEach((item, index, arry) => {
  351. if (item.id == value.id) {
  352. list.splice(index, 1);
  353. return;
  354. }
  355. })
  356. },
  357. getReportedName(){
  358. this.http.request("/app/"+this.urlName + "/getReportedName",{
  359. isZj: this.isZJ,
  360. contractId:this.contractId,
  361. }).then((res)=>{
  362. //console.log(res)
  363. if(res.result == '1' && res.datas){
  364. this.tableName = res.datas[0].name;
  365. let dateStr = this.diary.date;
  366. let arr = dateStr.split('-');
  367. if(arr.length == 3){
  368. dateStr = arr[0]+'年'+arr[1]+'月'+arr[2]+'日';
  369. }
  370. this.title=dateStr + " " + this.tableName;
  371. this.data.name =this.title;
  372. }
  373. })
  374. }
  375. },
  376. onShow() {
  377. /* 监听选择施工人员页面的handleFun方法 */
  378. uni.$on("approve", res => {
  379. this.approverList = res;
  380. this.approver=res[0].user_name;
  381. this.data.userIDs=res[0].id;
  382. })
  383. uni.$on("copyPerson", res => {
  384. this.copyList = res;
  385. //console.log(this.principal)
  386. })
  387. }
  388. }
  389. </script>
  390. <style>
  391. .cu-list.grid>.cu-item uni-text {
  392. display: block;
  393. margin-top: 4px;
  394. color: #101010;
  395. font-size: 14px;
  396. line-height: 17px;
  397. }
  398. .boderbo {
  399. border-bottom: 1px solid #F7F7F7;
  400. }
  401. .cu-form-group_1 {
  402. display: flex;
  403. align-items: center;
  404. padding: 0 24rpx;
  405. border-bottom: 2rpx solid #E3E1E1;
  406. height: 88rpx;
  407. background-color: #fff;
  408. }
  409. .cu-form-group_1 .title {
  410. width: 180rpx;
  411. font-size: 30rpx;
  412. color: #101010;
  413. }
  414. /* .cu-form-group_1 input {
  415. width: 560rpx;
  416. color: #8a8a8a;
  417. font-size: 30rpx;
  418. } */
  419. .cu-form-group_2 {
  420. display: flex;
  421. padding: 22rpx 24rpx;
  422. background-color: #fff;
  423. margin-bottom: 2rpx;
  424. }
  425. .cu-form-group_2 .title {
  426. width: 180rpx;
  427. font-size: 30rpx;
  428. color: #101010;
  429. }
  430. .cu-form-group_2 textarea {
  431. /*font-size: 30rpx;
  432. color: #8a8a8a; */
  433. width: 100%;
  434. height: 130rpx;
  435. }
  436. .cu-form-group_3 {
  437. display: flex;
  438. align-items: center;
  439. justify-content: space-between;
  440. padding: 0 24rpx;
  441. border-bottom: 2rpx solid #E3E1E1;
  442. height: 45px;
  443. background-color: #fff;
  444. }
  445. .cu-form-group_3:last-child {
  446. border-bottom: none;
  447. margin-bottom: 22rpx;
  448. }
  449. .cu-form-group_3 .title {
  450. width: 180rpx;
  451. font-size: 30rpx;
  452. color: #101010;
  453. }
  454. .cu-form-group_3 .picker {
  455. color: #8a8a8a;
  456. font-size: 30rpx;
  457. }
  458. .cu-list_b{background-color: #fff;padding: 22rpx 24rpx;margin-bottom: 22rpx;}
  459. .cu-list_1{display: flex;flex-wrap: wrap;}
  460. .cu-list_item{margin-bottom: 26rpx;margin-right: 20rpx;}
  461. .text-black{color: #101010;font-size: 14px;}
  462. .uni-input-placeholder {
  463. /* left: 10px!important; */
  464. }
  465. .uni-textarea-compute, .uni-textarea-line, .uni-textarea-placeholder, .uni-textarea-textarea {
  466. /* left: 10px!important; */
  467. }
  468. .cu-form-group_1 .title{
  469. /* width: 100px!important; */
  470. }
  471. .cu-form-group_2 .title{
  472. /* width: 100px!important; */
  473. }
  474. .cu-modal.show {
  475. overflow-y: auto;
  476. pointer-events: auto;
  477. }
  478. uni-textarea{
  479. font-size: 30rpx;
  480. }
  481. </style>