ultStatic.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. <template>
  2. <el-dialog
  3. v-loading="loading"
  4. :title="title"
  5. :visible.sync="dialogVisible"
  6. :close-on-click-modal="false"
  7. :close-on-press-escape="false"
  8. :show-close="false"
  9. append-to-body
  10. fullscreen
  11. class="dialog paper-detail-dialog"
  12. top="0"
  13. >
  14. <div slot="title" class="dialog-title">
  15. <span class="dialogtitle">{{ title }}</span>
  16. <div>
  17. <ibps-toolbar :actions="toolbars" @action-event="handleActionEvent" />
  18. </div>
  19. </div>
  20. <div class="container">
  21. <div class="left" :style="{width:initWidth}">
  22. <div class="search">
  23. <div class="item">
  24. <div class="label">维护月份:</div>
  25. <div class="content">
  26. <el-date-picker
  27. v-model="month"
  28. :clearable="false"
  29. type="month"
  30. placeholder="选择查询的月份"
  31. value-format="yyyy-MM"
  32. :picker-options="pickerOptions"
  33. size="mini"
  34. @change="handleMonthChange"
  35. />
  36. </div>
  37. </div>
  38. <div class="item">
  39. <div class="label">部门:</div>
  40. <ibps-user-selector
  41. v-model="position"
  42. type="position"
  43. readonly-text="text"
  44. :disabled="false"
  45. :multiple="false"
  46. :filter="filter"
  47. filtrate
  48. />
  49. </div>
  50. <div class="item">
  51. <div class="label">灯管号:</div>
  52. <div class="content">
  53. <el-input v-model="deviceNo" size="mini" />
  54. </div>
  55. </div>
  56. <div class="item">
  57. <div class="label">紫外灯名:</div>
  58. <div class="content">
  59. <el-input v-model="deviceName" size="mini" />
  60. </div>
  61. </div>
  62. <div class="item">
  63. <div class="label">岗位:</div>
  64. <div class="content">
  65. <el-input v-model="gangWei" size="mini" />
  66. </div>
  67. </div>
  68. </div>
  69. <div class="hearder">
  70. <div class="agend">
  71. <div class="item">
  72. <div class="green-circle" />
  73. <span>已完成</span>
  74. </div>
  75. <!-- <div class="item">
  76. <div class="orange-circle" />
  77. <span>部分完成</span>
  78. </div> -->
  79. <div class="item">
  80. <div class="red-circle" />
  81. <span>待处理</span>
  82. </div>
  83. <!-- <div class="item">
  84. <div class="red-bg" />
  85. <span>设备状况异常</span>
  86. </div> -->
  87. <div class="item-time">
  88. <span>统计时间:{{ curTime }}</span>
  89. </div>
  90. </div>
  91. </div>
  92. <div v-if="fliterData.length>0" class="table">
  93. <div class="column">
  94. <div class="item">紫外灯/日期</div>
  95. <div v-for="(item,index) in fliterData" :key="index" class="item" style="cursor:pointer" @click="goLookStatic(item)">
  96. <span style="padding:0 6px">{{ item.deng_guan_hao_ }}/{{ item.zi_wai_deng_ming_ }}</span>
  97. </div>
  98. </div>
  99. <div class="column">
  100. <div v-for="(item,index) in formatData" :key="index" class="content-item">
  101. <div class="item">{{ index+1 }}</div>
  102. <div v-for="(i,ind) in item" :key="ind" class="item">
  103. <el-tooltip v-show="i.count>0" class="item" effect="light" placement="top-start">
  104. <template slot="content">
  105. <div>
  106. <div v-for="(ii,indd) in i.data" :key="indd" class="detail">
  107. <el-divider />
  108. <div class="detail-item">
  109. <div class="item" style="margin:2px 0">处理人:{{ switchIdToUserName(ii.qian_ming_)|| '/' }}</div>
  110. <div class="item" style="margin:2px 0">岗位:{{ ii.gang_wei_|| '/' }}</div>
  111. <div class="item" style="margin:2px 0">额定时长:{{ ii.e_ding_shi_chang_|| '/' }}</div>
  112. <div class="item" style="margin:2px 0">已使用总时长:{{ ii.zsc2|| '/' }}</div>
  113. <div class="item" style="margin:2px 0">当次使用时长:{{ ii.shi_yong_shi_chan|| '/' }}</div>
  114. <div class="item" style="margin:2px 0">使用时间:{{ ii.sysj1|| '/' }}</div>
  115. <div class="item" style="margin:2px 0">擦拭情况:{{ ii.wan_cheng_qing_ku|| '/' }}</div>
  116. </div>
  117. </div>
  118. </div>
  119. </template>
  120. <div class="green-circle" />
  121. <!-- <div v-else class="orange-circle" /> -->
  122. </el-tooltip>
  123. <div v-if=" i.count===0 && i.show" class="red-circle" />
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. <el-empty v-else description="暂无数据" />
  129. </div>
  130. </div>
  131. </el-dialog>
  132. </template>
  133. <script>
  134. import dayjs from 'dayjs'
  135. import ibpsUserSelector from '@/business/platform/org/selector'
  136. export default {
  137. components: {
  138. ibpsUserSelector
  139. },
  140. props: {
  141. params: {
  142. type: Object,
  143. default: function () {
  144. return {}
  145. }
  146. },
  147. dialogVisible: {
  148. type: Boolean,
  149. default: false
  150. }
  151. },
  152. data () {
  153. const monthList = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
  154. const monthValue = dayjs().format('YYYY-MM')
  155. const year = +monthValue.split('-')[0]
  156. const month = +monthValue.split('-')[1]
  157. const monthDays = monthList[month - 1]
  158. if ((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) {
  159. monthList[1] = 29
  160. }
  161. const { userId, position, level, mainPosition } = this.$store.getters
  162. return {
  163. dialogParams: {},
  164. MaintenanceStaticVisible: false,
  165. pickerOptions: {
  166. disabledDate (time) {
  167. return time.getTime() > Date.now()
  168. }
  169. },
  170. curTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
  171. deviceNo: '',
  172. deviceName: '',
  173. gangWei: '',
  174. monthList: monthList,
  175. month: monthValue,
  176. monthDays: monthDays,
  177. userId: userId,
  178. position: (mainPosition && mainPosition.id) || position,
  179. level: level.second || level.first,
  180. loading: false,
  181. title: '设备维护统计',
  182. toolbars: [
  183. { key: 'export', label: '导出', type: 'primary', hidden: true },
  184. { key: 'cancel', label: '退出', type: 'danger' }
  185. ],
  186. initWidth: '1800px',
  187. isEdit: false,
  188. isFinished: false,
  189. readonly: false,
  190. preParams: {},
  191. Ids: [],
  192. form: {
  193. },
  194. rules: {
  195. },
  196. dataList: [],
  197. type: [],
  198. filter: [{
  199. descVal: '1',
  200. includeSub: true,
  201. old: 'position',
  202. partyId: this.$store.getters.userInfo.employee.positions,
  203. partyName: '',
  204. scriptContent: '',
  205. type: 'user',
  206. userType: 'position'
  207. }],
  208. totalList: []
  209. }
  210. },
  211. computed: {
  212. fliterData () {
  213. const fliterData = this.dataList
  214. let result = []
  215. fliterData.forEach(item => {
  216. const { she_shi_id_, zi_wai_deng_ming_, deng_guan_hao_, bu_men_, gang_wei_ } = item
  217. const t = result.find(i => i.she_shi_id_ === she_shi_id_)
  218. if (t) {
  219. t.children.push(item)
  220. } else {
  221. result.push({
  222. she_shi_id_: she_shi_id_ || '',
  223. zi_wai_deng_ming_: zi_wai_deng_ming_ || '',
  224. deng_guan_hao_: deng_guan_hao_ || '',
  225. bu_men_: bu_men_ || '',
  226. gang_wei_: gang_wei_ || '',
  227. children: [item]
  228. })
  229. }
  230. })
  231. // console.log('fliterData', result)
  232. this.totalList.forEach(item => {
  233. const { she_shi_id_, zi_wai_deng_ming_, deng_guan_hao_, bian_zhi_bu_men_, gang_wei_ } = item
  234. const t = result.find(i => i.she_shi_id_ === item.she_shi_id_)
  235. if (!t) {
  236. result.push({
  237. she_shi_id_: she_shi_id_ || '',
  238. zi_wai_deng_ming_: zi_wai_deng_ming_ || '',
  239. deng_guan_hao_: deng_guan_hao_ || '',
  240. bu_men_: bian_zhi_bu_men_ || '',
  241. gang_wei_: gang_wei_ || '',
  242. children: []
  243. })
  244. }
  245. })
  246. if (this.position) {
  247. result = result.filter(item => item.bu_men_ === this.position)
  248. }
  249. if (this.deviceNo) {
  250. result = result.filter(item => item.deng_guan_hao_.indexOf(this.deviceNo) > -1)
  251. }
  252. if (this.deviceName) {
  253. result = result.filter(item => item.zi_wai_deng_ming_.indexOf(this.deviceName) > -1)
  254. }
  255. if (this.gangWei) {
  256. result = result.filter(item => item.gang_wei_.indexOf(this.gangWei) > -1)
  257. }
  258. return result
  259. },
  260. formatData () {
  261. const answer = new Array(this.monthDays)
  262. for (let i = 0; i < this.monthDays; i++) {
  263. const arr = []
  264. const day = ('0' + (i + 1)).slice(-2)
  265. const fullDay = this.month + '-' + day
  266. // console.log(fullDay)
  267. this.fliterData.forEach(item => {
  268. const obj = {
  269. data: [],
  270. count: 0,
  271. show: true,
  272. fullDay
  273. }
  274. const tempList = item.children.filter(k => k.ri_qi_.slice(0, 10) === fullDay)
  275. obj.count = tempList.length
  276. obj.data = tempList
  277. if (new Date(fullDay).getTime() > new Date(this.curTime).getTime()) {
  278. obj.show = false
  279. }
  280. arr.push(obj)
  281. })
  282. answer[i] = arr
  283. }
  284. // console.log('answer', answer)
  285. return answer
  286. }
  287. },
  288. async mounted () {
  289. this.init()
  290. const sql = `select she_shi_id_,zi_wai_deng_ming_,deng_guan_hao_,bian_zhi_bu_men_,gang_wei_ from t_jykzwdxdjlbsc where di_dian_='${this.level}' and shi_fou_ting_yong='1'`
  291. const { variables: { data }} = await this.$common.request('sql', sql)
  292. this.totalList = data
  293. },
  294. methods: {
  295. handleActionEvent ({ key }) {
  296. switch (key) {
  297. case 'cancel':
  298. this.closeDialog()
  299. break
  300. case 'export':
  301. this.handleExport()
  302. break
  303. default:
  304. break
  305. }
  306. },
  307. // 查看设备统计
  308. goLookStatic (row) {
  309. // this.dialogParams = row
  310. // this.dialogParams.searchMonth = this.month
  311. // this.MaintenanceStaticVisible = true
  312. },
  313. // 人员id 转人员名称
  314. switchIdToUserName (id) {
  315. const { userList } = this.$store.getters
  316. const temp = userList.find(item => item.userId === id)
  317. return temp ? temp.userName : ''
  318. },
  319. async handleMonthChange (val) {
  320. const year = +val.split('-')[0]
  321. const month = +val.split('-')[1]
  322. this.monthDays = this.monthList[month - 1]
  323. if ((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) {
  324. this.monthList[1] = 29
  325. } else {
  326. this.monthList[1] = 28
  327. }
  328. await this.init()
  329. },
  330. // 获取人员部门
  331. getPersonPosition (id) {
  332. const userList = this.$store.getters.userList
  333. const bianzhiUserid = userList.find(i => i.userId === id)
  334. if (bianzhiUserid) {
  335. return bianzhiUserid.positionId
  336. }
  337. },
  338. checkRequired (flag) {
  339. },
  340. // 刷新
  341. async goRefresh () {
  342. },
  343. // 关闭当前窗口
  344. closeDialog (needRefresh) {
  345. this.$emit('update:dialogVisible', false, needRefresh)
  346. },
  347. async init () {
  348. this.loading = true
  349. this.title = `紫外灯消毒月度统计`
  350. const y = +this.month.split('-')[0]
  351. const m = +this.month.split('-')[1]
  352. const sql = `select a.id_,a.parent_id_,a.she_bei_hao_,a.ri_qi_,a.bu_men_,a.wan_cheng_qing_ku,a.pi_ci_,a.shi_yong_shi_chan,a.zong_shi_chang_ as zsc1,a.qian_ming_,a.fang_jian_di_zhi_,a.e_ding_shi_chang_,a.zi_wai_deng_id_,a.gang_wei_,a.pan_ding_ri_qi_ as pdrq1,b.zi_wai_deng_ming_,b.zong_shi_chang_ as zsc2,b.deng_guan_hao_,b.ri_chang_zhao_she,b.shang_ci_xiao_du_,b.she_shi_id_,b.fang_jian_,b.shi_fou_gen_huan_,b.shi_fou_ting_yong,b.pan_ding_ri_qi_ as pdrq2 FROM t_jykzwdxdjlbzb a LEFT JOIN t_jykzwdxdjlbsc b ON a.zi_wai_deng_id_=b.id_ where b.di_dian_='${this.level}' and b.shi_fou_ting_yong='1' and YEAR(a.ri_qi_) = ${y} and MONTH(a.ri_qi_) = ${m}`
  353. const { variables: { data }} = await this.$common.request('sql', sql)
  354. // console.log('data', data)
  355. this.dataList = data
  356. // this.dataList.forEach(item => {
  357. // if (!Object.hasOwn(item, 'wei_hu_lei_xing_') || !item.wei_hu_lei_xing_) {
  358. // item.wei_hu_lei_xing_ = '按需保养'
  359. // }
  360. // })
  361. this.loading = false
  362. }
  363. }
  364. }
  365. </script>
  366. <style lang="scss" scoped>
  367. .paper-detail-dialog {
  368. ::v-deep {
  369. .el-dialog__header {
  370. text-align: center;
  371. }
  372. }
  373. .dialog-title{
  374. display: flex;
  375. align-items: center;
  376. justify-content: center;
  377. div{
  378. z-index: 99999999;
  379. position: absolute;
  380. right:8vw;
  381. }
  382. .dialogtitle{
  383. font-size: 22px;
  384. font-family: SimHei;
  385. font-weight: bold;
  386. color: #222;
  387. }
  388. }
  389. .container {
  390. display: flex;
  391. width: 100%;
  392. justify-content: center;
  393. .el-row{
  394. margin: 0 !important;
  395. }
  396. .required{
  397. color: #606266 !important;
  398. &::before{
  399. content: '*';
  400. margin: 0 4px 0 -7.5px;
  401. color: red;
  402. }
  403. }
  404. .left{
  405. height: calc(100vh - 100px);
  406. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  407. padding:20px;
  408. overflow-y: auto;
  409. .agend{
  410. margin: 20px 0 10px 0;
  411. display: flex;
  412. .item-time{
  413. margin-left: 40px;
  414. width: 200px;
  415. }
  416. .item{
  417. width: 100px;
  418. display: flex;
  419. align-items: center;
  420. gap: 4px;
  421. .green-circle {
  422. width: 12px;
  423. height: 12px;
  424. background-color: #67C23A;
  425. border-radius: 50%;
  426. }
  427. .red-circle {
  428. width: 12px;
  429. height: 12px;
  430. background-color: #F56C6C;
  431. border-radius: 50%;
  432. }
  433. .orange-circle {
  434. width: 12px;
  435. height: 12px;
  436. background-color: #E6A23C;
  437. border-radius: 50%;
  438. }
  439. .red-bg {
  440. width: 12px;
  441. height: 12px;
  442. background-color: #F56C6C;
  443. opacity: .7;
  444. }
  445. }
  446. }
  447. .search{
  448. display: flex;
  449. .item{
  450. width: 300px;
  451. display: flex;
  452. align-items: center;
  453. .label{
  454. font-size: 12px;
  455. width: 60px;
  456. }
  457. }
  458. }
  459. .item{
  460. width: 100%;
  461. }
  462. .title{
  463. margin: 16px 0 6px -16px;
  464. }
  465. .table{
  466. display: flex;
  467. .column{
  468. flex: 1;
  469. &:nth-child(2){
  470. display: flex;
  471. }
  472. >.item{
  473. height: 46px;
  474. line-height: 46px;
  475. min-width: 100px;
  476. border-bottom: 1px solid #333;
  477. border-right: 1px solid #333;
  478. border-left: 1px solid #333;
  479. white-space: nowrap;
  480. }
  481. @media screen and (max-width: 1800px) {
  482. >.item{
  483. height: 40px;
  484. line-height: 40px;
  485. }
  486. }
  487. @media screen and (max-width: 1550px) {
  488. >.item{
  489. height: 34px;
  490. line-height: 34px;
  491. }
  492. }
  493. >.item:nth-child(1){
  494. font-weight: 600;
  495. border-top: 1px solid #333;
  496. height: 30px;
  497. line-height: 30px;
  498. text-align: center;
  499. }
  500. >.item:not(:first-child) {
  501. :hover{
  502. color: #409EFF;
  503. }
  504. }
  505. .content-item{
  506. .unusual{
  507. background-color: #F56C6C;
  508. opacity: .7;
  509. }
  510. >.item{
  511. position: relative;
  512. height: 46px;
  513. width: 46px;
  514. text-align: center;
  515. line-height: 46px;
  516. border-bottom: 1px solid #333;
  517. border-right: 1px solid #333;
  518. }
  519. @media screen and (max-width: 1800px) {
  520. >.item{
  521. height: 40px;
  522. width: 40px;
  523. line-height: 40px;
  524. }
  525. }
  526. @media screen and (max-width: 1550px) {
  527. >.item{
  528. height: 34px;
  529. width: 34px;
  530. line-height: 34px;
  531. }
  532. }
  533. >.item:nth-child(1){
  534. font-weight: 600;
  535. border-top: 1px solid #333;
  536. height: 30px;
  537. line-height: 30px;
  538. }
  539. .green-circle {
  540. cursor: pointer;
  541. position: absolute;
  542. top: 50%;
  543. left: 50%;
  544. transform: translate(-50%, -50%);
  545. width: 10px;
  546. height: 10px;
  547. background-color: #67C23A;
  548. border-radius: 50%;
  549. }
  550. .red-circle {
  551. cursor: pointer;
  552. position: absolute;
  553. top: 50%;
  554. left: 50%;
  555. transform: translate(-50%, -50%);
  556. width: 10px;
  557. height: 10px;
  558. background-color: #F56C6C;
  559. border-radius: 50%;
  560. }
  561. .orange-circle {
  562. cursor: pointer;
  563. position: absolute;
  564. top: 50%;
  565. left: 50%;
  566. transform: translate(-50%, -50%);
  567. width: 10px;
  568. height: 10px;
  569. background-color: #E6A23C;
  570. border-radius: 50%;
  571. }
  572. }
  573. }
  574. }
  575. }
  576. }
  577. }
  578. ::v-deep {
  579. .el-form-item__label{
  580. text-align: left;
  581. font-size: 12px !important;
  582. }
  583. .el-form-item__content{
  584. font-size: 12px !important;
  585. }
  586. .el-divider--horizontal{
  587. margin: 10px 0;
  588. }
  589. }
  590. </style>