index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. <template>
  2. <div class='appealBox'>
  3. <div class='top'>
  4. <Head :headText='headText'></Head>
  5. </div>
  6. <div class='bottom'>
  7. <div class='appealContainer'>
  8. <div class='appeal-left'>
  9. <div class='appeal-left-top'>
  10. <span class='appeal-left-top-span Micbold'>待审核</span>
  11. <el-select v-model='value' placeholder='请选择'>
  12. <el-option v-for='item in appealOptions' :key='item.value' :label='item.label' :value='item.value'></el-option>
  13. </el-select>
  14. </div>
  15. <div class='appeal-left-box'>
  16. <div v-if='auditArr.length==0' class='no-data'>
  17. <span>暂无待审核策略</span>
  18. </div>
  19. <div v-else v-for='(item1,index) in auditArr' :key='index'>
  20. <div v-if='item1.date'>
  21. <p class='date MicrYaHei' v-if='item1.date==today'>{{formatterStr(item1.date)+'&nbsp;&nbsp;今天'}}</p>
  22. <p v-if='item1.date==yesterday' class='date MicrYaHei'>{{formatterStr(item1.date)+'&nbsp;&nbsp;昨天'}}</p>
  23. <p class='date MicrYaHei' v-if='item1.date!=today&&item1.date!=yesterday'>
  24. {{formatterStr(item1.date)+'&nbsp;&nbsp;'}}
  25. <span v-if='formatter3(formatters(item1.date))==0'>星期日</span>
  26. <span v-if='formatter3(formatters(item1.date))==1'>星期一</span>
  27. <span v-if='formatter3(formatters(item1.date))==2'>星期二</span>
  28. <span v-if='formatter3(formatters(item1.date))==3'>星期三</span>
  29. <span v-if='formatter3(formatters(item1.date))==4'>星期四</span>
  30. <span v-if='formatter3(formatters(item1.date))==5'>星期五</span>
  31. <span v-if='formatter3(formatters(item1.date))==6'>星期六</span>
  32. </p>
  33. </div>
  34. <div
  35. class='appeal-left-div'
  36. v-for='(item,index) in item1.children'
  37. :key='index'
  38. @click='appealClick(item)'
  39. :class='{border: ids==item.id}'
  40. >
  41. <div class='time'>
  42. <span>{{item.pushTime?formatter(item.pushTime):'--'}} {{item.title||'--'}}</span>
  43. <span v-if='item.pics'>
  44. <img src='../../assets/tp.png' alt />
  45. <span>{{item.pics.length}}</span>
  46. </span>
  47. </div>
  48. <div class='content'>
  49. <span>申请人:{{'--'}}</span>
  50. <span>申请时间:{{item.updateTime?formatter1(item.updateTime):'--'}}</span>
  51. <span>申请原因:{{item.reasonType||'--'}}</span>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. <div class='appeal-right'>
  58. <div class='title Micbold' v-if='Object.keys(auditObj).length>0'>未执行申诉单</div>
  59. <div class='detailContainer' v-if='Object.keys(auditObj).length>0'>
  60. <div class='nav MicrYaHei'>
  61. <span>项目名称:{{'--'}}</span>
  62. <span>申请人:{{auditObj.applyUser||'--'}}</span>
  63. <span>申请时间:{{auditObj.updateTime?formatter1(auditObj.updateTime):'--'}}</span>
  64. </div>
  65. <div class='cont1 MicrYaHei'>申诉未执行指令:{{auditObj.title||'--'}}</div>
  66. <div class='cont2'>
  67. <audit-table v-if='tableList.length>=0' :tableList='tableList'></audit-table>
  68. </div>
  69. <div class='cont3'>
  70. <span class='Micbold'>策略评价</span>
  71. <span class='MicrYaHei'>{{auditObj.judgement||'--'}}</span>
  72. </div>
  73. <div class='cont4'>
  74. <span class='Micbold'>申请原因</span>
  75. <span>
  76. <el-select size='mini' v-model='auditObj.reasonType' placeholder='请选择'>
  77. <el-option v-for='item in options' :key='item.value' :label='item.label' :value='item.value'></el-option>
  78. </el-select>
  79. </span>
  80. <span>
  81. <textarea class='text-color' placeholder='填写申请原因' v-model='auditObj.reason'></textarea>
  82. </span>
  83. </div>
  84. <div>
  85. <upload-img :souseArr='auditObj.pics || []'></upload-img>
  86. </div>
  87. </div>
  88. <div class='opinion' v-if='Object.keys(auditObj).length>0'>
  89. <span class='opinion-title Micbold'>审批意见</span>
  90. <div class='opinion-bottom MicrYaHei'>
  91. <input type='text' v-model='comment' :class='{isRed: isRed}' />
  92. <span @click='approvalOpinion(auditObj,"reject")'>不同意</span>
  93. <span @click='approvalOpinion(auditObj,"approve")'>同意</span>
  94. </div>
  95. </div>
  96. <div class='no-data' v-if='Object.keys(auditObj).length==0'>
  97. <img src='@/assets/noData.png' />
  98. <br />
  99. <div>暂无内容</div>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </template>
  106. <script>
  107. import Head from '../main/index'
  108. import AuditTable from './auditTable'
  109. import uploadImg from '../../components/uploadImg'
  110. import { queryWorkflow, queryChillerExecuteInfo } from '@/api/appeal/appeal.js'
  111. import { updateWorkflow } from '@/api/audit/audit.js'
  112. import { querySimpleInfo } from '@/api/appeal/appeal.js'
  113. var moment = require('moment')
  114. import 'moment/locale/zh-cn'
  115. export default {
  116. data() {
  117. return {
  118. headText: '申诉审核',
  119. isactive: 0, //默认第一个
  120. appealOptions: [
  121. {
  122. value: '0',
  123. label: '按未执行策略的时间'
  124. }
  125. ],
  126. resonOptions: [
  127. {
  128. value: '1',
  129. label: '策略原因'
  130. }
  131. ],
  132. resonValue: '1',
  133. options: [
  134. {
  135. value: '0',
  136. label: '策略原因'
  137. },
  138. {
  139. value: '1',
  140. label: '设备原因'
  141. },
  142. {
  143. value: '2',
  144. label: '其他'
  145. }
  146. ],
  147. auditArr: [],
  148. auditObj: {},
  149. value: '0',
  150. comment: '',
  151. souseArr: [],
  152. tableList: [],
  153. isRed: false,
  154. auditArr1: [],
  155. yesterday: '',
  156. today: '',
  157. day: '',
  158. ids: ''
  159. }
  160. },
  161. components: {
  162. Head,
  163. AuditTable,
  164. uploadImg
  165. },
  166. mounted() {
  167. this.today = this.formatter2(moment(new Date()))
  168. this.yesterday = this.formatter2(moment(new Date()).add(-1, 'days'))
  169. this.day = this.formatter2(moment(new Date()).add(-3, 'days'))
  170. this.query()
  171. },
  172. methods: {
  173. check() {
  174. this.isRed = !this.comment
  175. return this.isRed
  176. },
  177. quertName(id) {
  178. querySimpleInfo(id, {}).then(res => {
  179. this.auditObj.applyUser = res.realname
  180. })
  181. },
  182. approvalOpinion(item, type) {
  183. let params = {
  184. postParams: {
  185. id: item.id,
  186. commit: type,
  187. comment: this.comment,
  188. roles: [1002],
  189. updateUser: item.updateUser
  190. }
  191. }
  192. if (this.check()) return
  193. updateWorkflow(params).then(res => {
  194. if (res.result == 'success') {
  195. this.$message.success('操作成功')
  196. } else {
  197. this.$message.error('操作失败: ' + res.message)
  198. }
  199. this.query()
  200. })
  201. },
  202. formatterStr(str) {
  203. if (str) {
  204. return str.substring(0, 4) + '.' + str.substring(4, 6) + '.' + str.substring(6, 8)
  205. }
  206. },
  207. formatters(date) {
  208. return moment(date).valueOf()
  209. },
  210. formatter(date) {
  211. return moment.unix(date / 1000).format('YYYY.MM.DD HH:mm')
  212. },
  213. formatter1(date) {
  214. return moment.unix(date / 1000).format('YYYY.MM.DD')
  215. },
  216. formatter3(date) {
  217. return moment.unix(date / 1000).format('d')
  218. },
  219. formatter2(date) {
  220. return moment.unix(date / 1000).format('YYYYMMDD')
  221. },
  222. appealClick(item) {
  223. this.ids = item.id
  224. this.auditObj = item
  225. this.quertName(item.updateUser)
  226. let params = {
  227. postParams: {
  228. criteria: {
  229. id: item.commandId
  230. }
  231. }
  232. }
  233. queryChillerExecuteInfo(params).then(res => {
  234. this.tableList = []
  235. const list = res.data || [{}, {}, {}]
  236. if (list.length > 0) {
  237. let current = list[0].current
  238. current.title = '当前运行状态'
  239. this.tableList.push(current)
  240. list.forEach(item => {
  241. if (Object.keys(item.recommend).length > 0) {
  242. let obj = {
  243. title: '推送策略',
  244. id: item.recommend.id,
  245. date: item.recommend.date,
  246. time: item.recommend.time,
  247. projectId: item.recommend.projectId,
  248. chillerNumSetLOrg: item.recommend.chillerNumSetL,
  249. chillerNumSetSOrg: item.recommend.chillerNumSetS,
  250. chillWaterOutTempSetOrg: item.recommend.chillWaterOutTempSet,
  251. coolPumpNumSetLOrg: item.recommend.coolPumpNumSetL,
  252. coolPumpNumSetSOrg: item.recommend.coolPumpNumSetS,
  253. coolPumpFreqSetOrg: item.recommend.coolPumpFreqSet,
  254. chillPumpNumSetLOrg: item.recommend.chillPumpNumSetL,
  255. chillPumpNumSetSOrg: item.recommend.chillPumpNumSetS,
  256. chillPumpFreqSetOrg: item.recommend.chillPumpFreqSet,
  257. coolTowerNumSetLOrg: item.recommend.coolTowerNumSetL,
  258. coolTowerNumSetSOrg: item.recommend.coolTowerNumSetS,
  259. coolTowerFreqSetOrg: item.recommend.coolTowerFreqSet,
  260. plrAllOrg: item.recommend.plrAllOrg
  261. }
  262. this.tableList.push(obj)
  263. }
  264. })
  265. let real = list[0].real
  266. real.title = '执行策略'
  267. this.tableList.push(real)
  268. }
  269. // console.log(list)
  270. // this.tableList = Object.values(list[0]).map(i => i || {})
  271. // this.tableList[0].title = '当前运行状态'
  272. // this.tableList[1].title = '推送策略'
  273. // this.tableList[2].title = '执行策略'
  274. console.log(this.tableList)
  275. })
  276. },
  277. unique(array) {
  278. var res = []
  279. for (var i = 0, len = array.length; i < len; i++) {
  280. var current = array[i]
  281. if (res.indexOf(current) === -1) {
  282. res.push(current)
  283. }
  284. }
  285. return res
  286. },
  287. query() {
  288. let params = {
  289. postParams: {
  290. criteria: {
  291. projectId: this.$store.state.projectId,
  292. trackerId: 3,
  293. status: 302
  294. // createTime: {
  295. // $gte: this.day + '000000'
  296. // }
  297. },
  298. orders: [
  299. {
  300. column: 'createTime',
  301. asc: false
  302. }
  303. ],
  304. withColumns: ['customAttribute']
  305. }
  306. }
  307. queryWorkflow(params).then(res => {
  308. let arr = []
  309. this.auditArr = []
  310. this.auditArr1 = []
  311. this.auditArr1 = res.content ? res.content : []
  312. if (this.auditArr1.length > 0) {
  313. this.auditArr1.forEach(el => {
  314. arr.push(this.formatter2(el.createTime))
  315. })
  316. let arrNew = this.unique(arr)
  317. arrNew.forEach(item => {
  318. let obj1 = {
  319. date: item,
  320. children: []
  321. }
  322. this.auditArr.push(obj1)
  323. })
  324. this.auditArr.forEach(item => {
  325. this.auditArr1.forEach(item2 => {
  326. if (item.date == this.formatter2(item2.createTime)) {
  327. item.children.push(item2)
  328. }
  329. })
  330. })
  331. this.auditObj = this.auditArr[0].children[0]
  332. this.ids = this.auditArr[0].children[0].id
  333. this.quertName(this.auditObj.applyUser)
  334. this.appealClick(this.auditObj)
  335. }
  336. })
  337. }
  338. }
  339. }
  340. </script>
  341. <style lang="scss" scoped>
  342. .appealBox {
  343. height: 100%;
  344. display: flex;
  345. .top {
  346. height: 100px;
  347. }
  348. .bottom {
  349. flex: 1;
  350. .appealContainer {
  351. height: 100%;
  352. display: flex;
  353. background: rgba(247, 249, 250, 1);
  354. border-top: 1px solid #e4e5e7;
  355. margin-top: 5px;
  356. .appeal-left {
  357. height: 100%;
  358. display: flex;
  359. flex-direction: column;
  360. max-width: 460px;
  361. min-width: 350px;
  362. padding-left: 20px;
  363. .appeal-left-top {
  364. display: flex;
  365. justify-content: space-between;
  366. align-items: center;
  367. margin-bottom: 12px;
  368. padding-top: 112px;
  369. .appeal-left-top-span {
  370. height: 24px;
  371. font-size: 16px;
  372. color: rgba(31, 36, 41, 1);
  373. line-height: 21px;
  374. }
  375. }
  376. .appeal-left-box {
  377. flex: 1;
  378. overflow: scroll;
  379. margin-bottom: 24px;
  380. .no-data {
  381. display: flex;
  382. justify-content: center;
  383. align-items: center;
  384. font-size: 14px;
  385. height: 100%;
  386. font-family: MicrosoftYaHei;
  387. color: rgba(100, 108, 115, 1);
  388. }
  389. .date {
  390. height: 18px;
  391. font-size: 12px;
  392. color: rgba(141, 147, 153, 1);
  393. line-height: 16px;
  394. text-align: center;
  395. }
  396. .appeal-left-div {
  397. margin-bottom: 8px;
  398. padding: 16px 20px;
  399. background: rgba(255, 255, 255, 1);
  400. border-radius: 4px;
  401. border: 1px solid rgba(228, 230, 231, 1);
  402. .time {
  403. display: flex;
  404. justify-content: space-between;
  405. margin-bottom: 12px;
  406. span:nth-of-type(1) {
  407. height: 24px;
  408. font-size: 16px;
  409. font-family: PingFangSC-Regular, PingFang SC;
  410. font-weight: 400;
  411. color: rgba(31, 36, 41, 1);
  412. line-height: 22px;
  413. }
  414. span:nth-of-type(2) {
  415. display: flex;
  416. align-items: center;
  417. height: 22px;
  418. font-size: 14px;
  419. font-family: ArialMT;
  420. color: rgba(31, 36, 41, 1);
  421. line-height: 16px;
  422. img {
  423. width: 16px;
  424. height: 16px;
  425. margin-right: 6px;
  426. }
  427. }
  428. .content {
  429. span {
  430. display: block !important;
  431. height: 22px;
  432. width: 100%;
  433. font-size: 14px;
  434. font-family: PingFangSC-Regular, PingFang SC;
  435. font-weight: 400;
  436. color: rgba(100, 108, 115, 1);
  437. line-height: 20px;
  438. }
  439. span:nth-of-type(2) {
  440. margin: 4px 0;
  441. }
  442. }
  443. }
  444. }
  445. .border {
  446. border: 1px solid rgba(0, 145, 255, 1);
  447. }
  448. }
  449. }
  450. .appeal-right {
  451. position: relative;
  452. flex: 1;
  453. margin-left: 28px;
  454. height: 100%;
  455. display: flex;
  456. flex-direction: column;
  457. background: #fff;
  458. .no-data {
  459. height: 100%;
  460. display: flex;
  461. justify-content: center;
  462. align-items: center;
  463. flex-direction: column;
  464. font-size: 14px;
  465. font-family: MicrosoftYaHei;
  466. color: rgba(100, 108, 115, 1);
  467. }
  468. .title {
  469. height: 32px;
  470. font-size: 24px;
  471. color: rgba(31, 36, 41, 1);
  472. line-height: 32px;
  473. padding-top: 148px;
  474. text-align: center;
  475. }
  476. .detailContainer {
  477. overflow: auto;
  478. // min-width: 762px;
  479. padding: 0 100px;
  480. padding-bottom: 24px;
  481. background: rgba(255, 255, 255, 1);
  482. margin-bottom: 100px;
  483. .nav {
  484. display: flex;
  485. justify-content: space-between;
  486. margin-top: 40px;
  487. margin-bottom: 12px;
  488. span {
  489. height: 22px;
  490. font-size: 14px;
  491. color: rgba(31, 36, 41, 1);
  492. line-height: 19px;
  493. }
  494. }
  495. .cont1 {
  496. height: 22px;
  497. font-size: 14px;
  498. color: rgba(31, 36, 41, 1);
  499. line-height: 19px;
  500. margin-bottom: 16px;
  501. }
  502. .cont2 {
  503. margin-bottom: 24px;
  504. }
  505. .cont3 {
  506. margin-bottom: 24px;
  507. span {
  508. display: block;
  509. }
  510. span:nth-of-type(1) {
  511. height: 24px;
  512. font-size: 16px;
  513. color: rgba(31, 36, 41, 1);
  514. line-height: 21px;
  515. margin-bottom: 8px;
  516. }
  517. span:nth-of-type(2) {
  518. height: 22px;
  519. font-size: 14px;
  520. color: rgba(100, 108, 115, 1);
  521. line-height: 19px;
  522. }
  523. }
  524. .cont4 {
  525. margin-bottom: 8px;
  526. span {
  527. display: block;
  528. }
  529. span:nth-of-type(1) {
  530. height: 24px;
  531. font-size: 16px;
  532. color: rgba(31, 36, 41, 1);
  533. line-height: 21px;
  534. }
  535. span:nth-of-type(2) {
  536. margin: 8px 0;
  537. }
  538. span:nth-of-type(3) {
  539. textarea {
  540. width: 762px;
  541. height: 64px;
  542. border-radius: 4px;
  543. border: 1px solid rgba(195, 199, 203, 1);
  544. // color: rgba(195, 199, 203, 1);
  545. }
  546. }
  547. textarea:focus {
  548. color: #000;
  549. }
  550. textarea {
  551. color: #c3c7cb;
  552. }
  553. .text-color::-webkit-input-placeholder {
  554. color: #c3c7cb;
  555. }
  556. }
  557. }
  558. .opinion {
  559. width: 100%;
  560. box-sizing: border-box;
  561. background: rgba(247, 249, 250, 1);
  562. box-shadow: 0px -1px 8px 0px rgba(0, 0, 0, 0.08);
  563. position: absolute;
  564. bottom: 0px;
  565. padding: 16px 32px;
  566. .opinion-title {
  567. height: 24px;
  568. font-size: 16px;
  569. color: rgba(31, 36, 41, 1);
  570. line-height: 21px;
  571. margin-bottom: 8px;
  572. display: block;
  573. }
  574. .opinion-bottom {
  575. display: flex;
  576. align-items: center;
  577. .isRed {
  578. border: 1px solid #f54e45;
  579. }
  580. input {
  581. flex: 1;
  582. height: 32px;
  583. background: rgba(255, 255, 255, 1);
  584. border-radius: 4px;
  585. border: 1px solid rgba(195, 199, 203, 1);
  586. margin-right: 32px;
  587. }
  588. span {
  589. display: inline-block;
  590. width: 80px;
  591. height: 32px;
  592. background: rgba(255, 255, 255, 1);
  593. border-radius: 4px;
  594. border: 1px solid rgba(195, 199, 203, 1);
  595. font-size: 14px;
  596. color: rgba(31, 35, 41, 1);
  597. line-height: 32px;
  598. text-align: center;
  599. cursor: pointer;
  600. }
  601. span:nth-of-type(1) {
  602. margin-right: 12px;
  603. }
  604. }
  605. }
  606. }
  607. }
  608. }
  609. }
  610. </style>