index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  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. this.comment = ''
  197. this.query()
  198. } else {
  199. this.$message.error('操作失败: ' + res.message)
  200. }
  201. })
  202. },
  203. formatterStr(str) {
  204. if (str) {
  205. return str.substring(0, 4) + '.' + str.substring(4, 6) + '.' + str.substring(6, 8)
  206. }
  207. },
  208. formatters(date) {
  209. return moment(date).valueOf()
  210. },
  211. formatter(date) {
  212. return moment.unix(date / 1000).format('YYYY.MM.DD HH:mm')
  213. },
  214. formatter1(date) {
  215. return moment.unix(date / 1000).format('YYYY.MM.DD')
  216. },
  217. formatter3(date) {
  218. return moment.unix(date / 1000).format('d')
  219. },
  220. formatter2(date) {
  221. return moment.unix(date / 1000).format('YYYYMMDD')
  222. },
  223. appealClick(item) {
  224. this.ids = item.id
  225. this.auditObj = item
  226. this.quertName(item.updateUser)
  227. let params = {
  228. postParams: {
  229. criteria: {
  230. id: item.commandId
  231. }
  232. }
  233. }
  234. queryChillerExecuteInfo(params).then(res => {
  235. this.tableList = []
  236. const list = res.data || [{}, {}, {}]
  237. if (list.length > 0) {
  238. let current = list[0].current
  239. current.title = '当前运行状态'
  240. this.tableList.push(current)
  241. list.forEach(item => {
  242. if (Object.keys(item.recommend).length > 0) {
  243. let obj = {
  244. title: '推送策略',
  245. id: item.recommend.id,
  246. date: item.recommend.date,
  247. time: item.recommend.time,
  248. projectId: item.recommend.projectId,
  249. chillerNumSetLOrg: item.recommend.chillerNumSetL,
  250. chillerNumSetSOrg: item.recommend.chillerNumSetS,
  251. chillWaterOutTempSetOrg: item.recommend.chillWaterOutTempSet,
  252. coolPumpNumSetLOrg: item.recommend.coolPumpNumSetL,
  253. coolPumpNumSetSOrg: item.recommend.coolPumpNumSetS,
  254. coolPumpFreqSetOrg: item.recommend.coolPumpFreqSet,
  255. chillPumpNumSetLOrg: item.recommend.chillPumpNumSetL,
  256. chillPumpNumSetSOrg: item.recommend.chillPumpNumSetS,
  257. chillPumpFreqSetOrg: item.recommend.chillPumpFreqSet,
  258. coolTowerNumSetLOrg: item.recommend.coolTowerNumSetL,
  259. coolTowerNumSetSOrg: item.recommend.coolTowerNumSetS,
  260. coolTowerFreqSetOrg: item.recommend.coolTowerFreqSet,
  261. plrAllOrg: item.recommend.plrAllOrg
  262. }
  263. this.tableList.push(obj)
  264. }
  265. })
  266. let real = list[0].real
  267. real.title = '执行策略'
  268. this.tableList.push(real)
  269. }
  270. // console.log(list)
  271. // this.tableList = Object.values(list[0]).map(i => i || {})
  272. // this.tableList[0].title = '当前运行状态'
  273. // this.tableList[1].title = '推送策略'
  274. // this.tableList[2].title = '执行策略'
  275. console.log(this.tableList)
  276. })
  277. },
  278. unique(array) {
  279. var res = []
  280. for (var i = 0, len = array.length; i < len; i++) {
  281. var current = array[i]
  282. if (res.indexOf(current) === -1) {
  283. res.push(current)
  284. }
  285. }
  286. return res
  287. },
  288. query() {
  289. let params = {
  290. postParams: {
  291. criteria: {
  292. projectId: this.$store.state.projectId,
  293. trackerId: 3,
  294. status: 302
  295. // createTime: {
  296. // $gte: this.day + '000000'
  297. // }
  298. },
  299. orders: [
  300. {
  301. column: 'createTime',
  302. asc: false
  303. }
  304. ],
  305. withColumns: ['customAttribute']
  306. }
  307. }
  308. queryWorkflow(params).then(res => {
  309. let arr = []
  310. this.auditArr = []
  311. this.auditArr1 = []
  312. this.auditArr1 = res.content ? res.content : []
  313. if (this.auditArr1.length > 0) {
  314. this.auditArr1.forEach(el => {
  315. arr.push(this.formatter2(el.createTime))
  316. })
  317. let arrNew = this.unique(arr)
  318. arrNew.forEach(item => {
  319. let obj1 = {
  320. date: item,
  321. children: []
  322. }
  323. this.auditArr.push(obj1)
  324. })
  325. this.auditArr.forEach(item => {
  326. this.auditArr1.forEach(item2 => {
  327. if (item.date == this.formatter2(item2.createTime)) {
  328. item.children.push(item2)
  329. }
  330. })
  331. })
  332. this.auditObj = this.auditArr[0].children[0]
  333. this.ids = this.auditArr[0].children[0].id
  334. this.quertName(this.auditObj.applyUser)
  335. this.appealClick(this.auditObj)
  336. } else {
  337. this.appealClick({})
  338. }
  339. })
  340. }
  341. }
  342. }
  343. </script>
  344. <style lang="scss" scoped>
  345. .appealBox {
  346. height: 100%;
  347. display: flex;
  348. .top {
  349. height: 100px;
  350. }
  351. .bottom {
  352. flex: 1;
  353. .appealContainer {
  354. height: 100%;
  355. display: flex;
  356. background: rgba(247, 249, 250, 1);
  357. border-top: 1px solid #e4e5e7;
  358. margin-top: 5px;
  359. .appeal-left {
  360. height: 100%;
  361. display: flex;
  362. flex-direction: column;
  363. max-width: 460px;
  364. min-width: 350px;
  365. padding-left: 20px;
  366. .appeal-left-top {
  367. display: flex;
  368. justify-content: space-between;
  369. align-items: center;
  370. margin-bottom: 12px;
  371. padding-top: 112px;
  372. .appeal-left-top-span {
  373. height: 24px;
  374. font-size: 16px;
  375. color: rgba(31, 36, 41, 1);
  376. line-height: 21px;
  377. }
  378. }
  379. .appeal-left-box {
  380. flex: 1;
  381. overflow: auto;
  382. margin-bottom: 24px;
  383. .no-data {
  384. display: flex;
  385. justify-content: center;
  386. align-items: center;
  387. font-size: 14px;
  388. height: 100%;
  389. font-family: MicrosoftYaHei;
  390. color: rgba(100, 108, 115, 1);
  391. }
  392. .date {
  393. height: 18px;
  394. font-size: 12px;
  395. color: rgba(141, 147, 153, 1);
  396. line-height: 16px;
  397. text-align: center;
  398. }
  399. .appeal-left-div {
  400. margin-bottom: 8px;
  401. padding: 16px 20px;
  402. background: rgba(255, 255, 255, 1);
  403. border-radius: 4px;
  404. border: 1px solid rgba(228, 230, 231, 1);
  405. .time {
  406. display: flex;
  407. justify-content: space-between;
  408. margin-bottom: 12px;
  409. span:nth-of-type(1) {
  410. height: 24px;
  411. font-size: 16px;
  412. font-family: PingFangSC-Regular, PingFang SC;
  413. font-weight: 400;
  414. color: rgba(31, 36, 41, 1);
  415. line-height: 22px;
  416. }
  417. span:nth-of-type(2) {
  418. display: flex;
  419. align-items: center;
  420. height: 22px;
  421. font-size: 14px;
  422. font-family: ArialMT;
  423. color: rgba(31, 36, 41, 1);
  424. line-height: 16px;
  425. img {
  426. width: 16px;
  427. height: 16px;
  428. margin-right: 6px;
  429. }
  430. }
  431. }
  432. .content {
  433. span {
  434. display: block !important;
  435. height: 22px;
  436. width: 100%;
  437. font-size: 14px;
  438. font-family: PingFangSC-Regular, PingFang SC;
  439. font-weight: 400;
  440. color: rgba(100, 108, 115, 1);
  441. line-height: 20px;
  442. }
  443. span:nth-of-type(2) {
  444. margin: 4px 0;
  445. }
  446. }
  447. }
  448. .border {
  449. border: 1px solid rgba(0, 145, 255, 1);
  450. }
  451. }
  452. }
  453. .appeal-right {
  454. position: relative;
  455. flex: 1;
  456. margin-left: 28px;
  457. height: 100%;
  458. display: flex;
  459. flex-direction: column;
  460. background: #fff;
  461. .no-data {
  462. height: 100%;
  463. display: flex;
  464. justify-content: center;
  465. align-items: center;
  466. flex-direction: column;
  467. font-size: 14px;
  468. font-family: MicrosoftYaHei;
  469. color: rgba(100, 108, 115, 1);
  470. }
  471. .title {
  472. height: 32px;
  473. font-size: 24px;
  474. color: rgba(31, 36, 41, 1);
  475. line-height: 32px;
  476. padding-top: 148px;
  477. text-align: center;
  478. }
  479. .detailContainer {
  480. overflow: auto;
  481. // min-width: 762px;
  482. padding: 0 100px;
  483. padding-bottom: 24px;
  484. background: rgba(255, 255, 255, 1);
  485. margin-bottom: 100px;
  486. .nav {
  487. display: flex;
  488. justify-content: space-between;
  489. margin-top: 40px;
  490. margin-bottom: 12px;
  491. span {
  492. height: 22px;
  493. font-size: 14px;
  494. color: rgba(31, 36, 41, 1);
  495. line-height: 19px;
  496. }
  497. }
  498. .cont1 {
  499. height: 22px;
  500. font-size: 14px;
  501. color: rgba(31, 36, 41, 1);
  502. line-height: 19px;
  503. margin-bottom: 16px;
  504. }
  505. .cont2 {
  506. margin-bottom: 24px;
  507. }
  508. .cont3 {
  509. margin-bottom: 24px;
  510. span {
  511. display: block;
  512. }
  513. span:nth-of-type(1) {
  514. height: 24px;
  515. font-size: 16px;
  516. color: rgba(31, 36, 41, 1);
  517. line-height: 21px;
  518. margin-bottom: 8px;
  519. }
  520. span:nth-of-type(2) {
  521. height: 22px;
  522. font-size: 14px;
  523. color: rgba(100, 108, 115, 1);
  524. line-height: 19px;
  525. }
  526. }
  527. .cont4 {
  528. margin-bottom: 8px;
  529. span {
  530. display: block;
  531. }
  532. span:nth-of-type(1) {
  533. height: 24px;
  534. font-size: 16px;
  535. color: rgba(31, 36, 41, 1);
  536. line-height: 21px;
  537. }
  538. span:nth-of-type(2) {
  539. margin: 8px 0;
  540. }
  541. span:nth-of-type(3) {
  542. textarea {
  543. width: 762px;
  544. height: 64px;
  545. border-radius: 4px;
  546. border: 1px solid rgba(195, 199, 203, 1);
  547. // color: rgba(195, 199, 203, 1);
  548. }
  549. }
  550. textarea:focus {
  551. color: #000;
  552. }
  553. textarea {
  554. color: #c3c7cb;
  555. }
  556. .text-color::-webkit-input-placeholder {
  557. color: #c3c7cb;
  558. }
  559. }
  560. }
  561. .opinion {
  562. width: 100%;
  563. box-sizing: border-box;
  564. background: rgba(247, 249, 250, 1);
  565. box-shadow: 0px -1px 8px 0px rgba(0, 0, 0, 0.08);
  566. position: absolute;
  567. bottom: 0px;
  568. padding: 16px 32px;
  569. .opinion-title {
  570. height: 24px;
  571. font-size: 16px;
  572. color: rgba(31, 36, 41, 1);
  573. line-height: 21px;
  574. margin-bottom: 8px;
  575. display: block;
  576. }
  577. .opinion-bottom {
  578. display: flex;
  579. align-items: center;
  580. .isRed {
  581. border: 1px solid #f54e45;
  582. }
  583. input {
  584. flex: 1;
  585. height: 32px;
  586. background: rgba(255, 255, 255, 1);
  587. border-radius: 4px;
  588. border: 1px solid rgba(195, 199, 203, 1);
  589. margin-right: 32px;
  590. }
  591. span {
  592. display: inline-block;
  593. width: 80px;
  594. height: 32px;
  595. background: rgba(255, 255, 255, 1);
  596. border-radius: 4px;
  597. border: 1px solid rgba(195, 199, 203, 1);
  598. font-size: 14px;
  599. color: rgba(31, 35, 41, 1);
  600. line-height: 32px;
  601. text-align: center;
  602. cursor: pointer;
  603. }
  604. span:nth-of-type(1) {
  605. margin-right: 12px;
  606. }
  607. }
  608. }
  609. }
  610. }
  611. }
  612. }
  613. </style>