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.

1327 lines
44 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  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="'计划编码'">
  10. <el-input v-model="searchData.planID" style="width: 120px"></el-input>
  11. </el-form-item>
  12. <el-form-item :label="'计划描述'">
  13. <el-input v-model="searchData.planDesc" style="width: 120px"></el-input>
  14. </el-form-item>
  15. <el-form-item :label="'设备编码'">
  16. <el-input v-model="searchData.objectID" style="width: 120px"></el-input>
  17. </el-form-item>
  18. <el-form-item :label="'计划执行人员'">
  19. <el-input v-model="searchData.planOperatorName" style="width: 120px"></el-input>
  20. </el-form-item>
  21. <el-form-item :label="'计划执行日期:'">
  22. <el-date-picker
  23. style="width: 120px"
  24. v-model="searchData.startDate"
  25. :picker-options="pickerOptions"
  26. type="date"
  27. value-format="yyyy-MM-dd"
  28. placeholder="选择日期">
  29. </el-date-picker>
  30. </el-form-item>
  31. <el-form-item style="margin-top: 23px;">
  32. <laber style="margin-left: -9px;font-size: 19px">&#10142</laber>
  33. </el-form-item>
  34. <el-form-item :label="' '">
  35. <el-date-picker
  36. style="width: 120px"
  37. v-model="searchData.endDate"
  38. :picker-options="pickerOptions"
  39. type="date"
  40. value-format="yyyy-MM-dd"
  41. placeholder="选择日期">
  42. </el-date-picker>
  43. </el-form-item>
  44. <el-form-item label=" ">
  45. <el-button @click="searchClick()">查询</el-button>
  46. <download-excel
  47. :fields="fields()"
  48. :data="exportData"
  49. type="xls"
  50. :name="exportName"
  51. :header="exportHeader"
  52. :footer="exportFooter"
  53. :fetch="createExportData"
  54. :before-generate="startDownload"
  55. :before-finish="finishDownload"
  56. worksheet="导出信息"
  57. class="el-button el-button--primary el-button--medium">
  58. {{ "导出" }}
  59. </download-excel>
  60. </el-form-item>
  61. </el-form>
  62. <el-table
  63. :height="height"
  64. :data="dataList"
  65. border
  66. v-loading="dataListLoading"
  67. style="width: 100%;">
  68. <el-table-column
  69. prop="planID"
  70. header-align="center"
  71. align="center"
  72. label="计划编码">
  73. </el-table-column>
  74. <el-table-column
  75. prop="planDesc"
  76. header-align="center"
  77. align="left"
  78. label="计划描述"
  79. :width="flexColumnWidth('计划描述','planDesc')">
  80. </el-table-column>
  81. <el-table-column
  82. v-for="(item,index) in columnList" :key="index"
  83. :sortable="item.columnSortable"
  84. :prop="item.columnProp"
  85. :header-align="item.headerAlign"
  86. :show-overflow-tooltip="item.showOverflowTooltip"
  87. :align="item.align"
  88. :fixed="item.fixed==''?false:item.fixed"
  89. :min-width="item.columnWidth"
  90. :label="item.columnLabel">
  91. <template slot-scope="scope">
  92. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  93. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column
  97. prop=""
  98. header-align="center"
  99. align="center"
  100. min-width="100"
  101. fixed="right"
  102. label="操作">
  103. <template slot-scope="scope">
  104. <a type="text" size="small" v-if="scope.row.status=='未开工'" @click="reportModal(scope.row)">执行</a>
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. <el-pagination
  109. @size-change="sizeChangeHandle"
  110. @current-change="currentChangeHandle"
  111. :current-page="pageIndex"
  112. :page-sizes="[20, 100, 500, 1000]"
  113. :page-size="pageSize"
  114. :total="totalPage"
  115. layout="total, sizes, prev, pager, next, jumper">
  116. </el-pagination>
  117. <el-dialog title="执行点检工单" :close-on-click-modal="false" v-drag :visible.sync="detailModelFlag" width="1200px">
  118. <el-form :inline="true" label-position="top" @keyup.enter.native="getDataList()">
  119. <el-form-item :label="'工厂编码'">
  120. <el-input v-model="saveData.site" disabled style="width: 120px"></el-input>
  121. </el-form-item>
  122. <el-form-item :label="'工单号'">
  123. <el-input v-model="saveData.orderNo" disabled style="width: 120px"></el-input>
  124. </el-form-item>
  125. <el-form-item :label="'计划执行人员'">
  126. <el-input v-model="saveData.planOperatorName" disabled style="width: 120px"></el-input>
  127. </el-form-item>
  128. <el-form-item :label="'执行日期:'">
  129. <el-date-picker style="width: 150px" v-model="saveData.startDate" type="datetime"
  130. value-format='yyyy-MM-dd HH:mm:ss' format='yyyy-MM-dd HH:mm:ss' placeholder="开始日期">
  131. </el-date-picker>
  132. -
  133. <el-date-picker style="width: 150px" v-model="saveData.endDate" type="datetime"
  134. value-format='yyyy-MM-dd HH:mm:ss' format='yyyy-MM-dd HH:mm:ss' placeholder="结束日期">
  135. </el-date-picker>
  136. </el-form-item>
  137. <el-form-item :label="'工作时长(m)'">
  138. <el-input v-model="saveData.workTime" type="number" readonly :min="0" style="width: 60px"></el-input>
  139. </el-form-item>
  140. <el-form-item :label="'执行结果备注'">
  141. <el-input v-model="saveData.remark" style="width: 200px"></el-input>
  142. </el-form-item>
  143. <el-form-item :label="'点检结论'">
  144. <el-select v-model="saveData.checkResult" style="width: 100px" placeholder="请选择">
  145. <el-option label="合格" value="合格"></el-option>
  146. <el-option label="不合格" value="不合格"></el-option>
  147. </el-select>
  148. </el-form-item>
  149. </el-form>
  150. <el-tabs v-model="activeTable" style="margin-top: 10px; width: 100%; height: 100%;" type="border-card" @tab-click="tabClick" class="customer-tab">
  151. <el-tab-pane label="点检单" name="inspection_form">
  152. <div class="rq ">
  153. <el-table
  154. :height="400"
  155. :data="detailList"
  156. border
  157. v-loading="dataListLoading"
  158. style="width: 100%;">
  159. <el-table-column
  160. prop=""
  161. header-align="center"
  162. align="center"
  163. min-width="60"
  164. label="操作">
  165. <template slot-scope="scope">
  166. <el-button type="primary" @click="addUploadFileModal(scope.row)">上传图片</el-button>
  167. </template>
  168. </el-table-column>
  169. <el-table-column
  170. v-for="(item,index) in columnDetailList" :key="index"
  171. :sortable="item.columnSortable"
  172. :prop="item.columnProp"
  173. :header-align="item.headerAlign"
  174. :show-overflow-tooltip="item.showOverflowTooltip"
  175. :align="item.align"
  176. :fixed="item.fixed==''?false:item.fixed"
  177. :min-width="item.columnWidth"
  178. :label="item.columnLabel">
  179. <template slot-scope="scope">
  180. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  181. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  182. </template>
  183. </el-table-column>
  184. <el-table-column
  185. prop=""
  186. header-align="center"
  187. align="right"
  188. min-width="80"
  189. label="实测值">
  190. <template slot-scope="scope">
  191. <el-input v-if="scope.row.valueTypeDb=='T'&&scope.row.valueChooseFlag=='N'" v-model="scope.row.textValue" style="height: 11px;padding: 0px " filterable allow-create>;width:98%"></el-input>
  192. <el-input v-if="scope.row.valueTypeDb=='N'&&scope.row.valueChooseFlag=='N'" v-model="scope.row.numberValue" type="number" style="height: 11px;padding: 0px " filterable allow-create>;width:98%"></el-input>
  193. <el-select v-if="scope.row.valueTypeDb=='T'&&scope.row.valueChooseFlag=='Y'" v-model="scope.row.textValue" placeholder="请选择" style="height: 11px;padding: 0px " filterable allow-create>
  194. <el-option
  195. v-for="item in scope.row.availableList"
  196. :key="index"
  197. :label="item.availableValue"
  198. :value="item.availableValue">
  199. </el-option>
  200. </el-select>
  201. <el-select v-if="scope.row.valueTypeDb=='N'&&scope.row.valueChooseFlag=='Y'" v-model="scope.row.numberValue" placeholder="请选择" style="height: 11px;padding: 0px " filterable allow-create>
  202. <el-option
  203. v-for="item in scope.row.availableList"
  204. :key="index"
  205. :label="item.availableValue"
  206. :value="item.availableValue">
  207. </el-option>
  208. </el-select>
  209. </template>
  210. </el-table-column>
  211. <el-table-column
  212. prop=""
  213. header-align="center"
  214. align="right"
  215. min-width="80"
  216. label="检验结论">
  217. <template slot-scope="scope">
  218. <el-select v-model="scope.row.itemResult" style="height: 11px;padding: 0px" placeholder="合格">
  219. <el-option label="合格" value="合格" style="color: green"></el-option>
  220. <el-option label="不合格" value="不合格" style="color: red"></el-option>
  221. </el-select>
  222. </template>
  223. </el-table-column>
  224. </el-table>
  225. </div>
  226. </el-tab-pane>
  227. <el-tab-pane label="点检记录" name="history_record">
  228. <el-table
  229. :height="400"
  230. :data="HistoryRecordList"
  231. border
  232. v-loading="dataListLoading"
  233. style="width: 100%;">
  234. <el-table-column
  235. v-for="(item,index) in columnHistoryList" :key="index"
  236. :sortable="item.columnSortable"
  237. :prop="item.columnProp"
  238. :header-align="item.headerAlign"
  239. :show-overflow-tooltip="item.showOverflowTooltip"
  240. :align="item.align"
  241. :fixed="item.fixed==''?false:item.fixed"
  242. :min-width="item.columnWidth"
  243. :label="item.columnLabel">
  244. <template slot-scope="scope">
  245. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  246. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  247. </template>
  248. </el-table-column>
  249. <el-table-column
  250. fixed="right"
  251. header-align="center"
  252. align="center"
  253. width="100"
  254. label="操作">
  255. <template slot-scope="scope">
  256. <a type="text" size="small" @click="detailModal(scope.row)">详情</a>
  257. </template>
  258. </el-table-column>
  259. </el-table>
  260. </el-tab-pane>
  261. </el-tabs>
  262. <!-- <el-button type="primary" @click="">点检单</el-button>-->
  263. <!-- <el-button type="primary" @click="queryHistoryRecord()">点检记录</el-button>-->
  264. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  265. <el-button type="primary" @click="saveCheckReport()">保存</el-button>
  266. <el-button type="primary" @click="detailModelFlag = false">关闭</el-button>
  267. </el-footer>
  268. </el-dialog>
  269. <el-dialog title="详情" :close-on-click-modal="false" v-drag :visible.sync="historyDetailModelFlag" width="830px">
  270. <div class="rq ">
  271. <el-table
  272. :height="300"
  273. :data="historyDetailList"
  274. border
  275. v-loading="dataListLoading"
  276. style="width: 100%;">
  277. <el-table-column
  278. v-for="(item,index) in columnHistoryDetailList" :key="index"
  279. :sortable="item.columnSortable"
  280. :prop="item.columnProp"
  281. :header-align="item.headerAlign"
  282. :show-overflow-tooltip="item.showOverflowTooltip"
  283. :align="item.align"
  284. :fixed="item.fixed==''?false:item.fixed"
  285. :min-width="item.columnWidth"
  286. :label="item.columnLabel">
  287. <template slot-scope="scope">
  288. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  289. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  290. </template>
  291. </el-table-column>
  292. <el-table-column
  293. prop=""
  294. header-align="center"
  295. align="right"
  296. min-width="80"
  297. label="实测值">
  298. <template slot-scope="scope">
  299. <el-input v-if="scope.row.valueTypeDb=='T'" v-model="scope.row.textValue" readonly style="height: 11px;padding: 0px " filterable
  300. allow-create>;width:98%"></el-input>
  301. <el-input v-if="scope.row.valueTypeDb=='N'" v-model="scope.row.numberValue" readonly style="height: 11px;padding: 0px " filterable
  302. allow-create>;width:98%"></el-input>
  303. </template>
  304. </el-table-column>
  305. <el-table-column
  306. prop=""
  307. header-align="center"
  308. align="right"
  309. min-width="80"
  310. label="检验结论">
  311. <template slot-scope="scope">
  312. <el-select v-model="scope.row.itemResult" disabled style="height: 11px;padding: 0px">
  313. <el-option label="合格" value="合格"></el-option>
  314. <el-option label="不合格" value="不合格"></el-option>
  315. </el-select>
  316. </template>
  317. </el-table-column>
  318. </el-table>
  319. </div>
  320. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  321. <el-button type="primary" @click="historyDetailModelFlag = false">关闭</el-button>
  322. </el-footer>
  323. </el-dialog>
  324. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  325. <!-- 上传文件的modal -->
  326. <comEamItemImageUploadFile ref="comEamItemImageUploadFile" @refreshPageTables="getDataList()" v-drag></comEamItemImageUploadFile>
  327. </div>
  328. </template>
  329. <script>
  330. import {
  331. eamWorkOrderSearch,
  332. eamWorkOrderItemSearch,
  333. saveCheckOrderReport,
  334. queryHistoryRecord, // 查询设备的点检历史记录
  335. eamWorkOrderReportSearch, 历史记录详情
  336. } from "@/api/eam/eam.js"
  337. import Chooselist from '@/views/modules/common/Chooselist_eam'
  338. import comEamItemImageUploadFile from "./com_eam_itemImage_upload_file";
  339. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  340. export default {
  341. components: {
  342. Chooselist,
  343. comEamItemImageUploadFile
  344. },
  345. watch: {
  346. saveData: {
  347. deep: true,
  348. handler: function (newV, oldV) {
  349. this.saveData.workTime = Math.ceil(Math.floor(this.dayjs(this.saveData.endDate).diff(this.saveData.startDate, 'seconds') / 30) / 2)
  350. }
  351. },
  352. searchData: {
  353. deep: true,
  354. handler: function (newV, oldV) {
  355. this.searchData.groupID = this.searchData.groupID.toUpperCase()
  356. }
  357. },
  358. modalData: {
  359. deep: true,
  360. handler: function (newV, oldV) {
  361. this.modalData.groupID = this.modalData.groupID.toUpperCase()
  362. }
  363. }
  364. },
  365. data () {
  366. return {
  367. // 是否收藏
  368. favorite: false,
  369. tagNo:'',
  370. // 导出 start
  371. exportData: [],
  372. exportName: "点检执行" + this.dayjs().format('YYYYMMDDHHmmss'),
  373. exportHeader: ["点检执行"],
  374. exportFooter: [],
  375. exportList:[],
  376. // 导出 end
  377. searchData: {
  378. site: this.$store.state.user.site,
  379. orderNo: '',
  380. planID: '',
  381. planDesc: '',
  382. objectID: '',
  383. planOperator: '',
  384. functionType: 'A',
  385. status: '未开工',
  386. startDate: '',
  387. planDate: new Date(),
  388. endDate: '',
  389. page: 1,
  390. limit: 10,
  391. },
  392. height: 200,
  393. pageIndex: 1,
  394. pageSize: 100,
  395. totalPage: 0,
  396. dataList: [],
  397. dataListLoading: false,
  398. dataListSelections: [],
  399. modalFlag:false,
  400. modalDisableFlag:false,
  401. modalData:{
  402. flag:'',
  403. site: this.$store.state.user.site,
  404. groupID:'',
  405. groupDesc:'',
  406. active:'',
  407. },
  408. departmentList:[],
  409. // 展示列集
  410. columnList: [
  411. {
  412. userId: this.$store.state.user.name,
  413. functionId: 101019,
  414. serialNumber: '101019TableActualPlanDate',
  415. tableId: "101019Table",
  416. tableName: "common",
  417. columnProp: 'planDate',
  418. headerAlign: "center",
  419. align: "center",
  420. columnLabel: '计划执行日期',
  421. columnHidden: false,
  422. columnImage: false,
  423. columnSortable: false,
  424. sortLv: 0,
  425. status: true,
  426. fixed: '',
  427. },
  428. {
  429. userId: this.$store.state.user.name,
  430. functionId: 101019,
  431. serialNumber: '101019TableOrderNo',
  432. tableId: "101019Table",
  433. tableName: "common",
  434. columnProp: 'orderNo',
  435. headerAlign: "center",
  436. align: "center",
  437. columnLabel: '工单编码',
  438. columnHidden: false,
  439. columnImage: false,
  440. columnSortable: false,
  441. sortLv: 0,
  442. status: true,
  443. fixed: '',
  444. },
  445. {
  446. userId: this.$store.state.user.name,
  447. functionId: 101019,
  448. serialNumber: '101019TablePlanID',
  449. tableId: "101019Table",
  450. tableName: "common",
  451. columnProp: 'planID',
  452. headerAlign: "center",
  453. align: "center",
  454. columnLabel: '计划编码',
  455. columnHidden: false,
  456. columnImage: false,
  457. columnSortable: false,
  458. sortLv: 0,
  459. status: true,
  460. fixed: '',
  461. },
  462. {
  463. userId: this.$store.state.user.name,
  464. functionId: 101019,
  465. serialNumber: '101019TablePropertiesCode',
  466. tableId: "101019Table",
  467. tableName: "common",
  468. columnProp: 'propertiesCode',
  469. headerAlign: "center",
  470. align: "center",
  471. columnLabel: '模板编码',
  472. columnHidden: false,
  473. columnImage: false,
  474. columnSortable: false,
  475. sortLv: 0,
  476. status: true,
  477. fixed: '',
  478. },
  479. {
  480. userId: this.$store.state.user.name,
  481. functionId: 101019,
  482. serialNumber: '101019TableObjectID',
  483. tableId: "101019Table",
  484. tableName: "common",
  485. columnProp: 'objectID',
  486. headerAlign: "center",
  487. align: "center",
  488. columnLabel: '设备编码',
  489. columnHidden: false,
  490. columnImage: false,
  491. columnSortable: false,
  492. sortLv: 0,
  493. status: true,
  494. fixed: '',
  495. },
  496. {
  497. userId: this.$store.state.user.name,
  498. functionId: 101019,
  499. serialNumber: '101019TableStatus',
  500. tableId: "101019Table",
  501. tableName: "common",
  502. columnProp: 'status',
  503. headerAlign: "center",
  504. align: "center",
  505. columnLabel: '状态',
  506. columnHidden: false,
  507. columnImage: false,
  508. columnSortable: false,
  509. sortLv: 0,
  510. status: true,
  511. fixed: '',
  512. },
  513. {
  514. userId: this.$store.state.user.name,
  515. functionId: 101019,
  516. serialNumber: '101019TablePlanOperatorName',
  517. tableId: "101019Table",
  518. tableName: "common",
  519. columnProp: 'planOperatorName',
  520. headerAlign: "center",
  521. align: "center",
  522. columnLabel: '计划机修人员',
  523. columnHidden: false,
  524. columnImage: false,
  525. columnSortable: false,
  526. sortLv: 0,
  527. status: true,
  528. fixed: '',
  529. },
  530. {
  531. userId: this.$store.state.user.name,
  532. functionId: 101019,
  533. serialNumber: '101019TableActualOperatorName',
  534. tableId: "101019Table",
  535. tableName: "common",
  536. columnProp: 'actualOperatorName',
  537. headerAlign: "center",
  538. align: "center",
  539. columnLabel: '实际机修人员',
  540. columnHidden: false,
  541. columnImage: false,
  542. columnSortable: false,
  543. sortLv: 0,
  544. status: true,
  545. fixed: '',
  546. },
  547. {
  548. userId: this.$store.state.user.name,
  549. functionId: 101019,
  550. serialNumber: '101019TableActualOperatorName',
  551. tableId: "101019Table",
  552. tableName: "common",
  553. columnProp: 'checkerName',
  554. headerAlign: "center",
  555. align: "center",
  556. columnLabel: '审核人员',
  557. columnHidden: false,
  558. columnImage: false,
  559. columnSortable: false,
  560. sortLv: 0,
  561. status: true,
  562. fixed: '',
  563. },
  564. {
  565. userId: this.$store.state.user.name,
  566. functionId: 101019,
  567. serialNumber: '101019TableActualActualDate',
  568. tableId: "101019Table",
  569. tableName: "common",
  570. columnProp: 'actualDate',
  571. headerAlign: "center",
  572. align: "center",
  573. columnLabel: '实际执行时间',
  574. columnHidden: false,
  575. columnImage: false,
  576. columnSortable: false,
  577. sortLv: 0,
  578. status: true,
  579. fixed: '',
  580. },
  581. {
  582. userId: this.$store.state.user.name,
  583. functionId: 101019,
  584. serialNumber: '101019TableWorkTime',
  585. tableId: "101019Table",
  586. tableName: "common",
  587. columnProp: 'workTime',
  588. headerAlign: "center",
  589. align: "center",
  590. columnLabel: '工作时间',
  591. columnHidden: false,
  592. columnImage: false,
  593. columnSortable: false,
  594. sortLv: 0,
  595. status: true,
  596. fixed: '',
  597. },
  598. {
  599. userId: this.$store.state.user.name,
  600. functionId: 101019,
  601. serialNumber: '101019TableActualRemark',
  602. tableId: "101019Table",
  603. tableName: "common",
  604. columnProp: 'remark',
  605. headerAlign: "center",
  606. align: "center",
  607. columnLabel: '备注',
  608. columnHidden: false,
  609. columnImage: false,
  610. columnSortable: false,
  611. sortLv: 0,
  612. status: true,
  613. fixed: '',
  614. },
  615. ],
  616. detailModelFlag:false,
  617. detailList:[],
  618. saveData:{
  619. site:'',
  620. orderNo:'',
  621. planOperatorName:'',
  622. startDate: '',
  623. endDate: '',
  624. workTime:'',
  625. remark:'',
  626. mesUser:'',
  627. planID:'',
  628. itemList:[],
  629. checkResult: '',
  630. functionType: 'A'
  631. },
  632. columnDetailList: [
  633. {
  634. userId: this.$store.state.user.name,
  635. functionId: 101019,
  636. serialNumber: '101019Table2EamPropertiesItemID',
  637. tableId: "101019Table2",
  638. tableName: "点检项目表",
  639. columnProp: 'itemNo',
  640. headerAlign: "center",
  641. align: "center",
  642. columnLabel: '点检项目编码',
  643. columnHidden: false,
  644. columnImage: false,
  645. columnSortable: false,
  646. sortLv: 0,
  647. status: true,
  648. fixed: '',
  649. columnWidth: 60,
  650. },
  651. {
  652. userId: this.$store.state.user.name,
  653. functionId: 101019,
  654. serialNumber: '101019Table2EamPropertiesItemDesc',
  655. tableId: "101019Table2",
  656. tableName: "点检项目表",
  657. columnProp: 'itemDesc',
  658. headerAlign: "center",
  659. align: "center",
  660. columnLabel: '点检项目名称',
  661. columnHidden: false,
  662. columnImage: false,
  663. columnSortable: false,
  664. sortLv: 0,
  665. status: true,
  666. fixed: '',
  667. columnWidth: 150,
  668. },
  669. {
  670. userId: this.$store.state.user.name,
  671. functionId: 101019,
  672. serialNumber: '101019Table2EamPropertiesItemRemark',
  673. tableId: "101019Table2",
  674. tableName: "点检项目表",
  675. columnProp: 'itemRemark',
  676. headerAlign: "center",
  677. align: "center",
  678. columnLabel: '点检方法说明',
  679. columnHidden: false,
  680. columnImage: false,
  681. columnSortable: false,
  682. sortLv: 0,
  683. status: true,
  684. fixed: '',
  685. columnWidth: 150,
  686. },
  687. {
  688. userId: this.$store.state.user.name,
  689. functionId: 101019,
  690. serialNumber: '101019Table2ValueType',
  691. tableId: "101019Table2",
  692. tableName: "点检项目表",
  693. columnProp: 'valueType',
  694. headerAlign: "center",
  695. align: "center",
  696. columnLabel: '检测值类型',
  697. columnHidden: false,
  698. columnImage: false,
  699. columnSortable: false,
  700. sortLv: 0,
  701. status: true,
  702. fixed: '',
  703. columnWidth: 70,
  704. },
  705. {
  706. userId: this.$store.state.user.name,
  707. functionId: 101019,
  708. serialNumber: '101019Table2DefaultValue',
  709. tableId: "101019Table2",
  710. tableName: "点检项目表",
  711. columnProp: 'defaultValue',
  712. headerAlign: "center",
  713. align: "center",
  714. columnLabel: '参照值',
  715. columnHidden: false,
  716. columnImage: false,
  717. columnSortable: false,
  718. sortLv: 0,
  719. status: true,
  720. fixed: '',
  721. columnWidth: 70,
  722. },
  723. {
  724. userId: this.$store.state.user.name,
  725. functionId: 101019,
  726. serialNumber: '101019Table2MaxValue',
  727. tableId: "101019Table2",
  728. tableName: "点检项目表",
  729. columnProp: 'maxValue',
  730. headerAlign: "center",
  731. align: "center",
  732. columnLabel: '最大值',
  733. columnHidden: false,
  734. columnImage: false,
  735. columnSortable: false,
  736. sortLv: 0,
  737. status: true,
  738. fixed: '',
  739. columnWidth: 70,
  740. },
  741. {
  742. userId: this.$store.state.user.name,
  743. functionId: 101019,
  744. serialNumber: '101019Table2MinValue',
  745. tableId: "101019Table2",
  746. tableName: "点检项目表",
  747. columnProp: 'minValue',
  748. headerAlign: "center",
  749. align: "center",
  750. columnLabel: '最小值',
  751. columnHidden: false,
  752. columnImage: false,
  753. columnSortable: false,
  754. sortLv: 0,
  755. status: true,
  756. fixed: '',
  757. columnWidth: 70,
  758. },
  759. ],
  760. HistoryRecordList: [],
  761. HistoryModelFlag: false,
  762. activeTable: 'inspection_form',
  763. columnHistoryList: [
  764. {
  765. columnProp: 'orderNo',
  766. headerAlign: "center",
  767. align: "center",
  768. columnLabel: '工单编号',
  769. columnHidden: false,
  770. columnImage: false,
  771. columnSortable: false,
  772. sortLv: 0,
  773. status: true,
  774. fixed: '',
  775. },
  776. {
  777. columnProp: 'planDesc',
  778. headerAlign: "center",
  779. align: "center",
  780. columnLabel: '计划描述',
  781. columnHidden: false,
  782. columnImage: false,
  783. columnSortable: false,
  784. sortLv: 0,
  785. status: true,
  786. fixed: '',
  787. },
  788. {
  789. columnProp: 'actualDate',
  790. headerAlign: "center",
  791. align: "center",
  792. columnLabel: '点检日期',
  793. columnHidden: false,
  794. columnImage: false,
  795. columnSortable: false,
  796. sortLv: 0,
  797. status: true,
  798. fixed: '',
  799. },
  800. {
  801. columnProp: 'checkResult',
  802. headerAlign: "center",
  803. align: "center",
  804. columnLabel: '点检结论',
  805. columnHidden: false,
  806. columnImage: false,
  807. columnSortable: false,
  808. sortLv: 0,
  809. status: true,
  810. fixed: '',
  811. },
  812. {
  813. columnProp: 'actualOperatorName',
  814. headerAlign: "center",
  815. align: "center",
  816. columnLabel: '点检人员',
  817. columnHidden: false,
  818. columnImage: false,
  819. columnSortable: false,
  820. sortLv: 0,
  821. status: true,
  822. fixed: '',
  823. },
  824. {
  825. columnProp: 'objectID',
  826. headerAlign: "center",
  827. align: "center",
  828. columnLabel: '设备编码',
  829. columnHidden: false,
  830. columnImage: false,
  831. columnSortable: false,
  832. sortLv: 0,
  833. status: true,
  834. fixed: '',
  835. },
  836. {
  837. columnProp: 'objectDesc',
  838. headerAlign: "center",
  839. align: "center",
  840. columnLabel: '设备名称',
  841. columnHidden: false,
  842. columnImage: false,
  843. columnSortable: false,
  844. sortLv: 0,
  845. status: true,
  846. fixed: '',
  847. },
  848. {
  849. columnProp: 'remark',
  850. headerAlign: "center",
  851. align: "center",
  852. columnLabel: '备注',
  853. columnHidden: false,
  854. columnImage: false,
  855. columnSortable: false,
  856. sortLv: 0,
  857. status: true,
  858. fixed: '',
  859. },
  860. ],
  861. historyDetailList: [],
  862. historyDetailModelFlag: false,
  863. columnHistoryDetailList: [
  864. {
  865. columnProp: 'itemNo',
  866. headerAlign: "center",
  867. align: "center",
  868. columnLabel: '点检项目编码',
  869. columnHidden: false,
  870. columnImage: false,
  871. columnSortable: false,
  872. sortLv: 0,
  873. status: true,
  874. fixed: '',
  875. columnWidth: 90,
  876. },
  877. {
  878. columnProp: 'itemDesc',
  879. headerAlign: "center",
  880. align: "center",
  881. columnLabel: '点检项目名称',
  882. columnHidden: false,
  883. columnImage: false,
  884. columnSortable: false,
  885. sortLv: 0,
  886. status: true,
  887. fixed: '',
  888. columnWidth: 90,
  889. },
  890. {
  891. columnProp: 'itemRemark',
  892. headerAlign: "center",
  893. align: "center",
  894. columnLabel: '点检方法说明',
  895. columnHidden: false,
  896. columnImage: false,
  897. columnSortable: false,
  898. sortLv: 0,
  899. status: true,
  900. fixed: '',
  901. columnWidth: 120,
  902. },
  903. {
  904. columnProp: 'valueType',
  905. headerAlign: "center",
  906. align: "center",
  907. columnLabel: '检测值类型',
  908. columnHidden: false,
  909. columnImage: false,
  910. columnSortable: false,
  911. sortLv: 0,
  912. status: true,
  913. fixed: '',
  914. columnWidth: 70,
  915. },
  916. {
  917. columnProp: 'defaultValue',
  918. headerAlign: "center",
  919. align: "center",
  920. columnLabel: '参照值',
  921. columnHidden: false,
  922. columnImage: false,
  923. columnSortable: false,
  924. sortLv: 0,
  925. status: true,
  926. fixed: '',
  927. columnWidth: 70,
  928. },
  929. {
  930. columnProp: 'maxValue',
  931. headerAlign: "center",
  932. align: "center",
  933. columnLabel: '最大值',
  934. columnHidden: false,
  935. columnImage: false,
  936. columnSortable: false,
  937. sortLv: 0,
  938. status: true,
  939. fixed: '',
  940. columnWidth: 70,
  941. },
  942. {
  943. columnProp: 'minValue',
  944. headerAlign: "center",
  945. align: "center",
  946. columnLabel: '最小值',
  947. columnHidden: false,
  948. columnImage: false,
  949. columnSortable: false,
  950. sortLv: 0,
  951. status: true,
  952. fixed: '',
  953. columnWidth: 70,
  954. },
  955. ],
  956. // 日期限制
  957. pickerOptions: {
  958. disabledDate(time) {
  959. return time.getTime() > Date.now();
  960. },
  961. },
  962. }
  963. },
  964. mounted () {
  965. this.$nextTick(() => {
  966. this.height = window.innerHeight - 210
  967. })
  968. },
  969. created () {
  970. this.favoriteIsOk()
  971. this.getDataList()
  972. },
  973. methods: {
  974. // 校验用户是否收藏
  975. favoriteIsOk() {
  976. let userFavorite = {
  977. userId: this.$store.state.user.id,
  978. languageCode: this.$i18n.locale
  979. }
  980. userFavoriteList(userFavorite).then(({data}) => {
  981. for (let i = 0; i < data.list.length; i++) {
  982. if(this.$route.meta.menuId == data.list[i].menuId){
  983. this.favorite = true
  984. }
  985. }
  986. })
  987. },
  988. // 收藏 OR 取消收藏
  989. favoriteFunction() {
  990. let userFavorite = {
  991. userId: this.$store.state.user.id,
  992. functionId: this.$route.meta.menuId,
  993. }
  994. if (this.favorite) {
  995. removeUserFavorite(userFavorite).then(({data}) => {
  996. this.$message.success(data.msg)
  997. this.favorite = false
  998. })
  999. } else {
  1000. // 收藏
  1001. saveUserFavorite(userFavorite).then(({data}) => {
  1002. this.$message.success(data.msg)
  1003. this.favorite = true
  1004. })
  1005. }
  1006. },
  1007. // 获取基础数据列表S
  1008. getBaseList (val,type) {
  1009. this.tagNo = val
  1010. this.$nextTick(() => {
  1011. let strVal = ''
  1012. if (val === 201) {
  1013. strVal = this.searchData.planOperator
  1014. this.$refs.baseList.init(val, strVal)
  1015. }
  1016. })
  1017. },
  1018. /* 列表方法的回调 */
  1019. getBaseData (val) {
  1020. if (this.tagNo === 201) {
  1021. this.searchData.planOperator = val.AdminID
  1022. }
  1023. },
  1024. // 重置查询时间
  1025. searchClick(){
  1026. this.searchData.planDate = ''
  1027. this.getDataList()
  1028. },
  1029. // 获取数据列表
  1030. getDataList () {
  1031. this.searchData.limit = this.pageSize
  1032. this.searchData.page = this.pageIndex
  1033. eamWorkOrderSearch(this.searchData).then(({data}) => {
  1034. if (data.code === 0) {
  1035. this.dataList = data.page.list
  1036. this.pageIndex = data.page.currPage
  1037. this.pageSize = data.page.pageSize
  1038. this.totalPage = data.page.totalCount
  1039. }
  1040. this.dataListLoading = false
  1041. })
  1042. },
  1043. //导出excel
  1044. async createExportData() {
  1045. this.searchData.limit = -1
  1046. this.searchData.page = 1
  1047. await eamWorkOrderSearch(this.searchData).then(({data}) => {
  1048. this.exportList= data.page.list;
  1049. })
  1050. return this.exportList;
  1051. },
  1052. startDownload() {
  1053. },
  1054. finishDownload() {
  1055. },
  1056. fields() {
  1057. let json = "{"
  1058. this.columnList.forEach((item, index) => {
  1059. if (index == this.columnList.length - 1) {
  1060. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  1061. } else {
  1062. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  1063. }
  1064. })
  1065. json += "}"
  1066. let s = eval("(" + json + ")")
  1067. return s
  1068. },
  1069. // 导出 end
  1070. // 每页数
  1071. sizeChangeHandle (val) {
  1072. this.pageSize = val
  1073. this.pageIndex = 1
  1074. this.getDataList()
  1075. },
  1076. // 当前页
  1077. currentChangeHandle (val) {
  1078. this.pageIndex = val
  1079. this.getDataList()
  1080. },
  1081. // 多选
  1082. selectionChangeHandle (val) {
  1083. this.dataListSelections = val
  1084. },
  1085. reportModal(row){
  1086. let indata = {
  1087. site:row.site,
  1088. itemNo:row.itemNo,
  1089. planID:row.planID,
  1090. orderNo:row.orderNo,
  1091. itemType:row.functionType,
  1092. objectID:row.objectID
  1093. }
  1094. eamWorkOrderItemSearch(indata).then(({data}) => {
  1095. this.detailList = data.rows
  1096. })
  1097. this.saveData = {
  1098. site: row.site,
  1099. orderNo: row.orderNo,
  1100. planID: row.planID,
  1101. objectID: row.objectID,
  1102. planOperatorName: row.planOperatorName,
  1103. workTime: '',
  1104. remark: '',
  1105. mesUser: this.$store.state.user.name,
  1106. itemList: [],
  1107. checkResult: '',
  1108. functionType: 'A'
  1109. }
  1110. this.getInspectionFormData();
  1111. this.queryHistoryRecord();
  1112. this.detailModelFlag = true;
  1113. },
  1114. async saveCheckReport(){
  1115. if(this.saveData.checkResult === ''|| this.saveData.checkResult == null){
  1116. this.$alert('请选择点检结论!', '错误', {
  1117. confirmButtonText: '确定'
  1118. })
  1119. return false
  1120. }
  1121. if(this.saveData.startDate === ''|| this.saveData.startDate == null){
  1122. this.$alert('请输入开始时间!', '错误', {
  1123. confirmButtonText: '确定'
  1124. })
  1125. return false
  1126. }
  1127. if(this.saveData.endDate === ''|| this.saveData.endDate == null){
  1128. this.$alert('请输入结束时间!', '错误', {
  1129. confirmButtonText: '确定'
  1130. })
  1131. return false
  1132. }
  1133. if(this.saveData.workTime === 0){
  1134. this.$alert('工作时长不能为0!', '错误', {
  1135. confirmButtonText: '确定'
  1136. })
  1137. return false
  1138. }
  1139. if(this.saveData.workTime < 0){
  1140. this.$alert('工作时长不能小于0', '错误', {
  1141. confirmButtonText: '确定'
  1142. })
  1143. return false
  1144. }
  1145. for (let i = 0; i < this.detailList.length; i++) {
  1146. if(this.detailList[i].valueTypeDb === 'N' && (this.detailList[i].numberValue === '' || this.detailList[i].numberValue == null)){
  1147. this.$alert(this.detailList[i].itemDesc+'实测值未填写!', '错误', {
  1148. confirmButtonText: '确定'
  1149. })
  1150. return false
  1151. }
  1152. if(this.detailList[i].itemResult === '' || this.detailList[i].itemResult == null){
  1153. this.detailList[i].itemResult = '合格'
  1154. }
  1155. if(this.detailList[i].valueTypeDb === 'N' && this.detailList[i].numberValue != '' && this.detailList[i].numberValue != null){
  1156. if(this.detailList[i].minValue != "" && this.detailList[i].minValue != null && this.detailList[i].minValue > this.detailList[i].numberValue){
  1157. await this.$confirm(this.detailList[i].itemDesc+'实测值小于最小值!是否继续', '提示', {
  1158. confirmButtonText: '确定',
  1159. cancelButtonText: '取消',
  1160. type: 'warning'
  1161. }).then(() => {
  1162. }).then(() =>{
  1163. return false
  1164. })
  1165. }
  1166. if(this.detailList[i].minValue != ""&& this.detailList[i].minValue != null && this.detailList[i].maxValue < this.detailList[i].numberValue){
  1167. await this.$confirm(this.detailList[i].itemDesc+'实测值大于最大值!是否继续', '提示', {
  1168. confirmButtonText: '确定',
  1169. cancelButtonText: '取消',
  1170. type: 'warning'
  1171. }).then(() => {
  1172. }).then(() =>{
  1173. return false
  1174. })
  1175. }
  1176. }
  1177. }
  1178. this.saveData.itemList = JSON.parse(JSON.stringify(this.detailList))
  1179. await saveCheckOrderReport(this.saveData).then(({data}) => {
  1180. if (data && data.code == '0') {
  1181. this.getDataList()
  1182. this.detailModelFlag = false
  1183. this.$message({
  1184. message: '操作成功',
  1185. type: 'success',
  1186. duration: 1500,
  1187. onClose: () => {
  1188. }
  1189. })
  1190. } else {
  1191. this.$alert(data.msg, '错误', {
  1192. confirmButtonText: '确定'
  1193. })
  1194. }
  1195. })
  1196. },
  1197. // 列表表格选择替换
  1198. tabClick (tab, event) {
  1199. // 刷新列表数据
  1200. this.refreshCurrentTabTable()
  1201. },
  1202. // 刷新页签的table数据
  1203. refreshCurrentTabTable () {
  1204. // 区分不同的页签刷新不同的列表数据
  1205. if (this.activeTable == 'inspection_form') {
  1206. this.getInspectionFormData();
  1207. } else if (this.activeTable == 'history_record') {
  1208. this.queryHistoryRecord();
  1209. }
  1210. },
  1211. // 检验单
  1212. getInspectionFormData(){
  1213. let tempData = {
  1214. site: this.saveData.site,
  1215. planID: this.saveData.planID,
  1216. orderNo: this.saveData.orderNo,
  1217. itemType: 'A',
  1218. objectID: this.saveData.objectID
  1219. }
  1220. eamWorkOrderItemSearch(tempData).then(({data}) => {
  1221. if (data && data.code === 0) {
  1222. this.detailList = data.rows
  1223. }else {
  1224. this.detailList = [];
  1225. }
  1226. })
  1227. },
  1228. // 点检记录
  1229. queryHistoryRecord(){
  1230. let tempData = {
  1231. site: this.saveData.site,
  1232. objectID: this.saveData.objectID,
  1233. functionType: 'A'
  1234. }
  1235. queryHistoryRecord(tempData).then(({data}) => {
  1236. if (data && data.code === 0) {
  1237. this.HistoryRecordList = data.rows
  1238. }else {
  1239. this.HistoryRecordList = [];
  1240. }
  1241. })
  1242. },
  1243. // 详情
  1244. detailModal(row){
  1245. let tempData = {
  1246. site: this.saveData.site,
  1247. orderNo: row.orderNo,
  1248. }
  1249. eamWorkOrderReportSearch(tempData).then(({data}) => {
  1250. this.historyDetailList = data.rows
  1251. })
  1252. this.historyDetailModelFlag = true;
  1253. },
  1254. /**
  1255. * 自适应
  1256. * @param label
  1257. * @param prop
  1258. * @returns {string}
  1259. */
  1260. flexColumnWidth (label, prop) {
  1261. // 1.获取该列的所有数据
  1262. const arr = this.dataList.map(x => x[prop])
  1263. arr.push(label) // 把每列的表头也加进去算
  1264. // 2.计算每列内容最大的宽度 + 表格的内间距(依据实际情况而定)
  1265. return (this.getMaxLength(arr) + 25) + 'px'
  1266. },
  1267. getTextWidth (str) {
  1268. let width = 0
  1269. const html = document.createElement('span')
  1270. html.innerText = str
  1271. html.className = 'getTextWidth'
  1272. document.querySelector('body').appendChild(html)
  1273. width = document.querySelector('.getTextWidth').offsetWidth
  1274. document.querySelector('.getTextWidth').remove()
  1275. return width
  1276. },
  1277. getMaxLength (arr) {
  1278. return arr.reduce((acc, item) => {
  1279. if (item) {
  1280. const calcLen = this.getTextWidth(item)
  1281. if (acc < calcLen) {
  1282. acc = calcLen
  1283. }
  1284. }
  1285. return acc
  1286. }, 0)
  1287. },
  1288. /**
  1289. * 上传图片
  1290. */
  1291. addUploadFileModal(row){
  1292. let currentData = {
  1293. site: this.$store.state.user.site,
  1294. createBy: this.$store.state.user.name,
  1295. orderNo: this.saveData.orderNo,
  1296. functionType: 'A',
  1297. itemNo: row.itemNo,
  1298. };
  1299. //打开组件 去做新增业务
  1300. this.$nextTick(() => {
  1301. this.$refs.comEamItemImageUploadFile.init(currentData);
  1302. })
  1303. },
  1304. }
  1305. }
  1306. </script>
  1307. <style >
  1308. </style>