You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

934 lines
28 KiB

  1. <template>
  2. <div class="mod-config">
  3. <div>
  4. <span @click="favoriteFunction()">
  5. <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>
  6. </span>
  7. </div>
  8. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  9. <el-form-item :label="'BU'">
  10. <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 130px">
  11. <el-option
  12. v-for = "i in userBuList"
  13. :key = "i.buNo"
  14. :label = "i.buDesc"
  15. :value = "i.buDesc">
  16. </el-option>
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item :label="'计划编码'">
  20. <el-input v-model="searchData.planID" clearable style="width: 120px"></el-input>
  21. </el-form-item>
  22. <el-form-item :label="'工单编码'">
  23. <el-input v-model="searchData.orderNo" clearable style="width: 120px"></el-input>
  24. </el-form-item>
  25. <el-form-item :label="'设备编码'">
  26. <el-input v-model="searchData.objectID" clearable style="width: 120px"></el-input>
  27. </el-form-item>
  28. <el-form-item :label="'计划执行人员'">
  29. <el-input v-model="searchData.planOperatorName" clearable style="width: 120px"></el-input>
  30. </el-form-item>
  31. <el-form-item :label="'状态'">
  32. <el-select filterable v-model="searchData.status" style="width: 130px">
  33. <el-option label="全部" value=""></el-option>
  34. <el-option label="未开工" value="未开工"></el-option>
  35. <el-option label="待审核" value="待审核"></el-option>
  36. <el-option label="已完工" value="已完工"></el-option>
  37. <el-option label="已取消" value="已取消"></el-option>
  38. </el-select>
  39. </el-form-item>
  40. </el-form>
  41. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  42. <el-form-item :label="'点检项目编码'">
  43. <el-input v-model="searchData.itemNo" clearable style="width: 120px"></el-input>
  44. </el-form-item>
  45. <el-form-item :label="'点检项目名称'">
  46. <el-input v-model="searchData.itemDesc" clearable style="width: 120px"></el-input>
  47. </el-form-item>
  48. <el-form-item :label="'计划执行日期'">
  49. <el-date-picker
  50. style="width: 120px"
  51. v-model="searchData.startDate"
  52. :picker-options="pickerOptions"
  53. type="date"
  54. value-format="yyyy-MM-dd"
  55. placeholder="选择日期">
  56. </el-date-picker>
  57. </el-form-item>
  58. <el-form-item style="margin-top: 23px;">
  59. <laber style="margin-left: -9px;font-size: 19px">&#10142</laber>
  60. </el-form-item>
  61. <el-form-item :label="' '">
  62. <el-date-picker
  63. style="width: 120px"
  64. v-model="searchData.endDate"
  65. :picker-options="pickerOptions"
  66. type="date"
  67. value-format="yyyy-MM-dd"
  68. placeholder="选择日期">
  69. </el-date-picker>
  70. </el-form-item>
  71. <el-form-item :label="'执行时间'">
  72. <el-date-picker
  73. style="width: 170px"
  74. v-model="searchData.reachDate"
  75. :picker-options="pickerOptions"
  76. type="datetime"
  77. value-format='yyyy-MM-dd HH:mm:ss'
  78. format='yyyy-MM-dd HH:mm:ss'
  79. placeholder="开始时间">
  80. </el-date-picker>
  81. </el-form-item>
  82. <el-form-item style="margin-top: 23px;">
  83. <laber style="margin-left: -9px;font-size: 19px">&#10142</laber>
  84. </el-form-item>
  85. <el-form-item :label="' '">
  86. <el-date-picker
  87. style="width: 170px"
  88. v-model="searchData.actualDate"
  89. :picker-options="pickerOptions"
  90. type="datetime"
  91. value-format="yyyy-MM-dd HH:mm:ss"
  92. format='yyyy-MM-dd HH:mm:ss'
  93. placeholder="结束时间">
  94. </el-date-picker>
  95. </el-form-item>
  96. <el-form-item :label="' '">
  97. <el-button type="primary" @click="searchClick()">查询</el-button>
  98. <download-excel
  99. :fields="fields()"
  100. :data="exportData"
  101. type="xls"
  102. :name="exportName"
  103. :header="exportHeader"
  104. :footer="exportFooter"
  105. :fetch="createExportData"
  106. :before-generate="startDownload"
  107. :before-finish="finishDownload"
  108. worksheet="导出信息"
  109. class="el-button el-button--primary el-button--medium">
  110. {{ "导出" }}
  111. </download-excel>
  112. </el-form-item>
  113. </el-form>
  114. <el-table
  115. :height="height"
  116. :data="dataList"
  117. border
  118. :row-style="controlRowStyle"
  119. style="width: 100%;">
  120. <el-table-column
  121. prop="checkResult"
  122. header-align="center"
  123. align="center"
  124. label="点检结论"
  125. width="80">
  126. <template slot-scope="scope">
  127. <div :style="{ color: scope.row.checkResult === '合格' ? 'green' : scope.row.checkResult === '不合格' ? 'red' : ''}">
  128. {{ scope.row.checkResult }}
  129. </div>
  130. </template>
  131. </el-table-column>
  132. <el-table-column
  133. v-for="(item,index) in columnList" :key="index"
  134. :sortable="item.columnSortable"
  135. :prop="item.columnProp"
  136. :header-align="item.headerAlign"
  137. :show-overflow-tooltip="item.showOverflowTooltip"
  138. :align="item.align"
  139. :fixed="item.fixed==''?false:item.fixed"
  140. :min-width="item.columnWidth"
  141. :label="item.columnLabel">
  142. <template slot-scope="scope">
  143. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  144. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  145. </template>
  146. </el-table-column>
  147. </el-table>
  148. <el-pagination
  149. @size-change="sizeChangeHandle"
  150. @current-change="currentChangeHandle"
  151. :current-page="pageIndex"
  152. :page-sizes="[20, 50, 100, 200, 500]"
  153. :page-size="pageSize"
  154. :total="totalPage"
  155. layout="total, sizes, prev, pager, next, jumper">
  156. </el-pagination>
  157. <el-dialog title="图片查看" :close-on-click-modal="false" v-drag :visible.sync="imageModalFlag" width="390px" style="height: 550px;">
  158. <div v-viewer>
  159. <img v-for="(item, index) in descImages" :src="item" :key="index" style="width: 100px;height: 100px"/>
  160. </div>
  161. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  162. <el-button type="primary" @click="imageModalFlag = false">关闭</el-button>
  163. </el-footer>
  164. </el-dialog>
  165. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  166. </div>
  167. </template>
  168. <script>
  169. import {
  170. eamCheckRecordSearch,
  171. eamWorkOrderReportSearch,
  172. cancelOrder,
  173. changeOrderOperator,
  174. checkWorkOrder, // 审核
  175. updateWorkOrder, // 修改工单
  176. searchFileUrl,
  177. getSiteAndBuByUserName
  178. } from "@/api/eam/eam.js"
  179. import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  180. import Chooselist from '@/views/modules/common/Chooselist_eam'
  181. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  182. export default {
  183. components: {
  184. Chooselist
  185. },
  186. watch: {
  187. searchData: {
  188. deep: true,
  189. handler: function (newV, oldV) {
  190. this.searchData.groupID = this.searchData.groupID.toUpperCase()
  191. }
  192. }
  193. },
  194. data () {
  195. return {
  196. // 是否收藏
  197. favorite: false,
  198. // 导出 start
  199. exportData: [],
  200. exportName: "设备点检记录" + this.dayjs().format('YYYYMMDDHHmmss'),
  201. exportHeader: ["设备点检记录"],
  202. exportFooter: [],
  203. exportList: [],
  204. // 导出 end
  205. tagNo:'',
  206. searchData: {
  207. site: this.$store.state.user.site,
  208. userName: this.$store.state.user.name,
  209. orderNo: '',
  210. planID: '',
  211. objectID: '',
  212. planOperator: '',
  213. buDesc: '',
  214. functionType: 'A',
  215. status: '',
  216. startDate: '',
  217. endDate: '',
  218. planDate: new Date(),
  219. page: 1,
  220. limit: 10,
  221. searchType: 'checkOrder',
  222. reachDate: '',
  223. actualDate: '',
  224. itemNo: '',
  225. itemDesc: ''
  226. },
  227. height: 200,
  228. pageIndex: 1,
  229. pageSize: 20,
  230. totalPage: 0,
  231. dataList: [],
  232. // 展示列集
  233. columnList: [
  234. {
  235. userId: this.$store.state.user.name,
  236. functionId: 101005007,
  237. serialNumber: '101005007Table1BuDesc',
  238. tableId: "101005007Table1",
  239. tableName: "点检工单表",
  240. columnProp: 'buDesc',
  241. headerAlign: "center",
  242. align: "center",
  243. columnLabel: 'BU',
  244. columnHidden: false,
  245. columnImage: false,
  246. columnSortable: true,
  247. sortLv: 0,
  248. status: true,
  249. fixed: '',
  250. columnWidth: 100,
  251. },
  252. {
  253. userId: this.$store.state.user.name,
  254. functionId: 101005007,
  255. serialNumber: '101005007Table1PlanID',
  256. tableId: "101005007Table1",
  257. tableName: "点检工单表",
  258. columnProp: 'planID',
  259. headerAlign: "center",
  260. align: "center",
  261. columnLabel: '计划编码',
  262. columnHidden: false,
  263. columnImage: false,
  264. columnSortable: true,
  265. sortLv: 0,
  266. status: true,
  267. fixed: '',
  268. columnWidth: 100,
  269. },
  270. {
  271. userId: this.$store.state.user.name,
  272. functionId: 101005007,
  273. serialNumber: '101005007Table1PlanDesc',
  274. tableId: "101005007Table1",
  275. tableName: "点检工单表",
  276. columnProp: 'planDesc',
  277. headerAlign: "center",
  278. align: "center",
  279. columnLabel: '计划描述',
  280. columnHidden: false,
  281. columnImage: false,
  282. columnSortable: false,
  283. sortLv: 0,
  284. status: true,
  285. fixed: '',
  286. columnWidth: 120,
  287. },
  288. {
  289. userId: this.$store.state.user.name,
  290. functionId: 101005007,
  291. serialNumber: '101005007Table1OrderNo',
  292. tableId: "101005007Table1",
  293. tableName: "点检工单表",
  294. columnProp: 'orderNo',
  295. headerAlign: "center",
  296. align: "center",
  297. columnLabel: '工单编码',
  298. columnHidden: false,
  299. columnImage: false,
  300. columnSortable: true,
  301. sortLv: 0,
  302. status: true,
  303. fixed: '',
  304. columnWidth: 100,
  305. },
  306. {
  307. userId: this.$store.state.user.name,
  308. functionId: 101005007,
  309. serialNumber: '101005007Table1PropertiesCode',
  310. tableId: "101005007Table1",
  311. tableName: "点检工单表",
  312. columnProp: 'propertiesCode',
  313. headerAlign: "center",
  314. align: "center",
  315. columnLabel: '模板编码',
  316. columnHidden: false,
  317. columnImage: false,
  318. columnSortable: false,
  319. sortLv: 0,
  320. status: true,
  321. fixed: '',
  322. columnWidth: 80,
  323. },
  324. {
  325. userId: this.$store.state.user.name,
  326. functionId: 101005007,
  327. serialNumber: '101005007Table1CodeDesc',
  328. tableId: "101005007Table1",
  329. tableName: "点检工单表",
  330. columnProp: 'codeDesc',
  331. headerAlign: "center",
  332. align: "center",
  333. columnLabel: '模板名称',
  334. columnHidden: false,
  335. columnImage: false,
  336. columnSortable: false,
  337. sortLv: 0,
  338. status: true,
  339. fixed: '',
  340. columnWidth: 120,
  341. },
  342. {
  343. userId: this.$store.state.user.name,
  344. functionId: 101005007,
  345. serialNumber: '101005007Table1ObjectID',
  346. tableId: "101005007Table1",
  347. tableName: "点检工单表",
  348. columnProp: 'objectID',
  349. headerAlign: "center",
  350. align: "center",
  351. columnLabel: '设备编码',
  352. columnHidden: false,
  353. columnImage: false,
  354. columnSortable: false,
  355. sortLv: 0,
  356. status: true,
  357. fixed: '',
  358. columnWidth: 80,
  359. },
  360. {
  361. userId: this.$store.state.user.name,
  362. functionId: 101005007,
  363. serialNumber: '101005007Table1ObjectDesc',
  364. tableId: "101005007Table1",
  365. tableName: "点检工单表",
  366. columnProp: 'objectDesc',
  367. headerAlign: "center",
  368. align: "center",
  369. columnLabel: '设备名称',
  370. columnHidden: false,
  371. columnImage: false,
  372. columnSortable: false,
  373. sortLv: 0,
  374. status: true,
  375. fixed: '',
  376. columnWidth: 80,
  377. },
  378. {
  379. userId: this.$store.state.user.name,
  380. functionId: 101005007,
  381. serialNumber: '101005007Table1Status',
  382. tableId: "101005007Table1",
  383. tableName: "点检工单表",
  384. columnProp: 'status',
  385. headerAlign: "center",
  386. align: "center",
  387. columnLabel: '状态',
  388. columnHidden: false,
  389. columnImage: false,
  390. columnSortable: true,
  391. sortLv: 0,
  392. status: true,
  393. fixed: '',
  394. columnWidth: 80,
  395. },
  396. {
  397. userId: this.$store.state.user.name,
  398. functionId: 101005007,
  399. serialNumber: '101005007Table1PlanOperatorName',
  400. tableId: "101005007Table1",
  401. tableName: "点检工单表",
  402. columnProp: 'planOperatorName',
  403. headerAlign: "center",
  404. align: "center",
  405. columnLabel: '计划执行人员',
  406. columnHidden: false,
  407. columnImage: false,
  408. columnSortable: false,
  409. sortLv: 0,
  410. status: true,
  411. fixed: '',
  412. columnWidth: 120,
  413. },
  414. {
  415. userId: this.$store.state.user.name,
  416. functionId: 101005007,
  417. serialNumber: '101005007Table1ActualOperatorName',
  418. tableId: "101005007Table1",
  419. tableName: "点检工单表",
  420. columnProp: 'actualOperatorName',
  421. headerAlign: "center",
  422. align: "center",
  423. columnLabel: '实际执行人员',
  424. columnHidden: false,
  425. columnImage: false,
  426. columnSortable: false,
  427. sortLv: 0,
  428. status: true,
  429. fixed: '',
  430. columnWidth: 100,
  431. },
  432. {
  433. userId: this.$store.state.user.name,
  434. functionId: 101005007,
  435. serialNumber: '101005007Table1CheckerName',
  436. tableId: "101005007Table1",
  437. tableName: "点检工单表",
  438. columnProp: 'checkerName',
  439. headerAlign: "center",
  440. align: "center",
  441. columnLabel: '审核人员',
  442. columnHidden: false,
  443. columnImage: false,
  444. columnSortable: false,
  445. sortLv: 0,
  446. status: true,
  447. fixed: '',
  448. columnWidth: 100,
  449. },
  450. {
  451. userId: this.$store.state.user.name,
  452. functionId: 101005007,
  453. serialNumber: '101005007Table1PlanDate',
  454. tableId: "101005007Table1",
  455. tableName: "点检工单表",
  456. columnProp: 'planDate',
  457. headerAlign: "center",
  458. align: "center",
  459. columnLabel: '计划执行日期',
  460. columnHidden: false,
  461. columnImage: false,
  462. columnSortable: false,
  463. sortLv: 0,
  464. status: true,
  465. fixed: '',
  466. columnWidth: 100,
  467. },
  468. {
  469. userId: this.$store.state.user.name,
  470. functionId: 101005007,
  471. serialNumber: '101005007Table1ReachDate',
  472. tableId: "101005007Table1",
  473. tableName: "点检工单表",
  474. columnProp: 'reachDate',
  475. headerAlign: "center",
  476. align: "center",
  477. columnLabel: '执行开始时间',
  478. columnHidden: false,
  479. columnImage: false,
  480. columnSortable: false,
  481. sortLv: 0,
  482. status: true,
  483. fixed: '',
  484. columnWidth: 130,
  485. },
  486. {
  487. userId: this.$store.state.user.name,
  488. functionId: 101005007,
  489. serialNumber: '101005007Table1ActualDate',
  490. tableId: "101005007Table1",
  491. tableName: "点检工单表",
  492. columnProp: 'actualDate',
  493. headerAlign: "center",
  494. align: "center",
  495. columnLabel: '执行结束时间',
  496. columnHidden: false,
  497. columnImage: false,
  498. columnSortable: false,
  499. sortLv: 0,
  500. status: true,
  501. fixed: '',
  502. columnWidth: 130,
  503. },
  504. {
  505. userId: this.$store.state.user.name,
  506. functionId: 101005007,
  507. serialNumber: '101005007Table1WorkTime',
  508. tableId: "101005007Table1",
  509. tableName: "点检工单表",
  510. columnProp: 'workTime',
  511. headerAlign: "center",
  512. align: "right",
  513. columnLabel: '工作时长(m)',
  514. columnHidden: false,
  515. columnImage: false,
  516. columnSortable: false,
  517. sortLv: 0,
  518. status: true,
  519. fixed: '',
  520. columnWidth: 80,
  521. },
  522. {
  523. userId: this.$store.state.user.name,
  524. functionId: 101005007,
  525. serialNumber: '101005007Table1Remark',
  526. tableId: "101005007Table1",
  527. tableName: "点检工单表",
  528. columnProp: 'remark',
  529. headerAlign: "center",
  530. align: "center",
  531. columnLabel: '执行结果备注',
  532. columnHidden: false,
  533. columnImage: false,
  534. columnSortable: false,
  535. sortLv: 0,
  536. status: true,
  537. fixed: '',
  538. columnWidth: 120,
  539. },
  540. {
  541. userId: this.$store.state.user.name,
  542. functionId: 101005007,
  543. serialNumber: '101005007Table1ItemNo',
  544. tableId: "101005007Table1",
  545. tableName: "点检项目表",
  546. columnProp: 'itemNo',
  547. headerAlign: "center",
  548. align: "center",
  549. columnLabel: '点检项目编码',
  550. columnHidden: false,
  551. columnImage: false,
  552. columnSortable: false,
  553. sortLv: 0,
  554. status: true,
  555. fixed: '',
  556. columnWidth: 90,
  557. },
  558. {
  559. userId: this.$store.state.user.name,
  560. functionId: 101005007,
  561. serialNumber: '101005007Table1ItemDesc',
  562. tableId: "101005007Table1",
  563. tableName: "点检项目表",
  564. columnProp: 'itemDesc',
  565. headerAlign: "center",
  566. align: "center",
  567. columnLabel: '点检项目名称',
  568. columnHidden: false,
  569. columnImage: false,
  570. columnSortable: false,
  571. sortLv: 0,
  572. status: true,
  573. fixed: '',
  574. columnWidth: 90,
  575. },
  576. {
  577. userId: this.$store.state.user.name,
  578. functionId: 101005007,
  579. serialNumber: '101005007Table1ItemRemark',
  580. tableId: "101005007Table1",
  581. tableName: "点检项目表",
  582. columnProp: 'itemRemark',
  583. headerAlign: "center",
  584. align: "center",
  585. columnLabel: '点检方法说明',
  586. columnHidden: false,
  587. columnImage: false,
  588. columnSortable: false,
  589. sortLv: 0,
  590. status: true,
  591. fixed: '',
  592. columnWidth: 120,
  593. },
  594. {
  595. userId: this.$store.state.user.name,
  596. functionId: 101005007,
  597. serialNumber: '101005007Table1ValueType',
  598. tableId: "101005007Table1",
  599. tableName: "点检项目表",
  600. columnProp: 'valueType',
  601. headerAlign: "center",
  602. align: "center",
  603. columnLabel: '检测值类型',
  604. columnHidden: false,
  605. columnImage: false,
  606. columnSortable: false,
  607. sortLv: 0,
  608. status: true,
  609. fixed: '',
  610. columnWidth: 70,
  611. },
  612. {
  613. userId: this.$store.state.user.name,
  614. functionId: 101005007,
  615. serialNumber: '101005007Table1DefaultValue',
  616. tableId: "101005007Table1",
  617. tableName: "点检项目表",
  618. columnProp: 'defaultValue',
  619. headerAlign: "center",
  620. align: "center",
  621. columnLabel: '参照值',
  622. columnHidden: false,
  623. columnImage: false,
  624. columnSortable: false,
  625. sortLv: 0,
  626. status: true,
  627. fixed: '',
  628. columnWidth: 70,
  629. },
  630. {
  631. userId: this.$store.state.user.name,
  632. functionId: 101005007,
  633. serialNumber: '101005007Table1MaxValue',
  634. tableId: "101005007Table1",
  635. tableName: "点检项目表",
  636. columnProp: 'maxValue',
  637. headerAlign: "center",
  638. align: "center",
  639. columnLabel: '最大值',
  640. columnHidden: false,
  641. columnImage: false,
  642. columnSortable: false,
  643. sortLv: 0,
  644. status: true,
  645. fixed: '',
  646. columnWidth: 70,
  647. },
  648. {
  649. userId: this.$store.state.user.name,
  650. functionId: 101005007,
  651. serialNumber: '101005007Table1MinValue',
  652. tableId: "101005007Table1",
  653. tableName: "点检项目表",
  654. columnProp: 'minValue',
  655. headerAlign: "center",
  656. align: "center",
  657. columnLabel: '最小值',
  658. columnHidden: false,
  659. columnImage: false,
  660. columnSortable: false,
  661. sortLv: 0,
  662. status: true,
  663. fixed: '',
  664. columnWidth: 70,
  665. },
  666. ],
  667. planOperator: '',
  668. planOperatorName: '',
  669. // 日期限制
  670. pickerOptions: {
  671. disabledDate(time) {
  672. return time.getTime() > Date.now();
  673. },
  674. },
  675. descImages: [],
  676. imageModalFlag: false,
  677. userBuList: []
  678. }
  679. },
  680. mounted () {
  681. this.$nextTick(() => {
  682. this.height = window.innerHeight - 210
  683. })
  684. },
  685. created () {
  686. // 获取用户的 site 和 bu
  687. this.getSiteAndBuByUserName()
  688. // 校验用户是否收藏
  689. this.favoriteIsOk()
  690. // 获取数据列表
  691. this.getDataList()
  692. // 动态列
  693. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  694. },
  695. methods: {
  696. // 获取用户的bu
  697. getSiteAndBuByUserName () {
  698. let tempData = {
  699. username: this.$store.state.user.name,
  700. }
  701. getSiteAndBuByUserName(tempData).then(({data}) => {
  702. if (data.code === 0) {
  703. this.userBuList = data.rows
  704. }
  705. })
  706. },
  707. // 控制单行的背景颜色
  708. controlRowStyle ({row, rowIndex}) {
  709. // 区分不同的样式对应不同的颜色
  710. if (row.status === '待审核') {
  711. return "background-color: #D8ECF1"
  712. }
  713. },
  714. /**
  715. * 查看项目图片
  716. */
  717. checkItemImageModal (row) {
  718. this.descImages = []
  719. let tempData = {
  720. site: row.site,
  721. orderNo: row.orderNo,
  722. folder: row.itemNo,
  723. buNo: row.buNo
  724. }
  725. searchFileUrl(tempData).then(({data}) => {
  726. if (data.code === 0) {
  727. for (let i = 0; i < data.rows.length; i++) {
  728. this.descImages.push(data.rows[i].url)
  729. }
  730. } else {
  731. this.$message.warning(data.msg)
  732. }
  733. })
  734. this.imageModalFlag = true
  735. },
  736. // 校验用户是否收藏
  737. favoriteIsOk () {
  738. let userFavorite = {
  739. userId: this.$store.state.user.id,
  740. languageCode: this.$i18n.locale
  741. }
  742. userFavoriteList(userFavorite).then(({data}) => {
  743. for (let i = 0; i < data.list.length; i++) {
  744. if (this.$route.meta.menuId === data.list[i].menuId) {
  745. this.favorite = true
  746. }
  747. }
  748. })
  749. },
  750. // 收藏 OR 取消收藏
  751. favoriteFunction () {
  752. let userFavorite = {
  753. userId: this.$store.state.user.id,
  754. functionId: this.$route.meta.menuId,
  755. }
  756. if (this.favorite) {
  757. removeUserFavorite(userFavorite).then(({data}) => {
  758. this.$message.success(data.msg)
  759. this.favorite = false
  760. })
  761. } else {
  762. // 收藏
  763. saveUserFavorite(userFavorite).then(({data}) => {
  764. this.$message.success(data.msg)
  765. this.favorite = true
  766. })
  767. }
  768. },
  769. // 获取基础数据列表S
  770. getBaseList (val,type) {
  771. this.tagNo = val
  772. this.$nextTick(() => {
  773. let strVal = ''
  774. if (val === 201) {
  775. strVal = this.planOperator
  776. this.$refs.baseList.init(val, strVal)
  777. }
  778. })
  779. },
  780. /* 列表方法的回调 */
  781. getBaseData (val) {
  782. if (this.tagNo === 201) {
  783. this.planOperator = val.username
  784. this.planOperatorName = val.user_display
  785. }
  786. },
  787. //导出excel
  788. async createExportData () {
  789. this.searchData.limit = -1
  790. this.searchData.page = 1
  791. await eamCheckRecordSearch(this.searchData).then(({data}) => {
  792. this.exportList= data.page.list
  793. })
  794. return this.exportList
  795. },
  796. startDownload() {},
  797. finishDownload() {},
  798. fields() {
  799. let json = "{"
  800. this.columnList.forEach((item, index) => {
  801. if (index == this.columnList.length - 1) {
  802. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  803. } else {
  804. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  805. }
  806. })
  807. json += "}"
  808. let s = eval("(" + json + ")")
  809. return s
  810. },
  811. // 重置查询时间
  812. searchClick () {
  813. this.searchData.planDate = ''
  814. this.getDataList()
  815. },
  816. // 获取数据列表
  817. getDataList () {
  818. this.searchData.limit = this.pageSize
  819. this.searchData.page = this.pageIndex
  820. eamCheckRecordSearch(this.searchData).then(({data}) => {
  821. if (data.code === 0) {
  822. this.dataList = data.page.list
  823. this.pageIndex = data.page.currPage
  824. this.pageSize = data.page.pageSize
  825. this.totalPage = data.page.totalCount
  826. }
  827. })
  828. },
  829. // 每页数
  830. sizeChangeHandle (val) {
  831. this.pageSize = val
  832. this.pageIndex = 1
  833. this.getDataList()
  834. },
  835. // 当前页
  836. currentChangeHandle (val) {
  837. this.pageIndex = val
  838. this.getDataList()
  839. },
  840. // 动态列开始 获取 用户保存的 格式列
  841. async getTableUserColumn (tableId, columnId) {
  842. let queryTableUser = {
  843. userId: this.$store.state.user.name,
  844. functionId: this.$route.meta.menuId,
  845. tableId: tableId,
  846. status: true,
  847. languageCode: this.$i18n.locale
  848. }
  849. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  850. if (data.rows.length > 0) {
  851. //this.columnList1 = []
  852. switch (columnId) {
  853. case 1:
  854. this.columnList = data.rows
  855. break;
  856. // case 2:
  857. // this.columnDetailList = data.rows
  858. // break;
  859. // case 3:
  860. // this.columnList2 = data.rows
  861. // break;
  862. // case 4:
  863. // this.columnList3 = data.rows
  864. // break;
  865. }
  866. } else {
  867. this.getColumnList(tableId, columnId)
  868. }
  869. })
  870. },
  871. // 获取 tableDefault 列
  872. async getColumnList(tableId, columnId) {
  873. let queryTable = {
  874. functionId: this.$route.meta.menuId,
  875. tableId: tableId,
  876. languageCode: this.$i18n.locale
  877. }
  878. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  879. if (!data.rows.length == 0) {
  880. switch (columnId) {
  881. case 1:
  882. this.columnList = data.rows
  883. break;
  884. // case 2:
  885. // this.columnDetailList = data.rows
  886. // break;
  887. // case 3:
  888. // this.columnList2 = data.rows
  889. // break;
  890. // case 4:
  891. // this.columnList3 = data.rows
  892. // break;
  893. }
  894. } else {
  895. // this.showDefault = true.
  896. }
  897. })
  898. },
  899. }
  900. }
  901. </script>
  902. <style scoped>
  903. .numInput /deep/ .el-input__inner{
  904. text-align: right;
  905. }
  906. </style>