RepairForm.vue 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  1. <template>
  2. <div>
  3. <el-row class="row">
  4. <el-col :span="5">
  5. <span class="machineClass">机号:</span>
  6. <el-select style="width:100px" v-model="forms.bed">
  7. <el-option
  8. v-for="item in this.bedNumber"
  9. :key="item.id"
  10. :label="item.number"
  11. :value="item.id"
  12. ></el-option>
  13. </el-select>
  14. </el-col>
  15. <el-col :span="11">
  16. <span class="machineClass">日期查询:</span>
  17. <el-date-picker
  18. v-model="forms.start_time"
  19. prefix-icon="none"
  20. type="date"
  21. placeholder="请选择"
  22. format="yyyy-MM-dd"
  23. value-format="yyyy-MM-dd"
  24. style="width:150px"
  25. ></el-date-picker
  26. >-
  27. <el-date-picker
  28. v-model="forms.end_time"
  29. prefix-icon="none"
  30. type="date"
  31. placeholder="请选择"
  32. format="yyyy-MM-dd"
  33. value-format="yyyy-MM-dd"
  34. style="width:150px"
  35. ></el-date-picker>
  36. </el-col>
  37. <el-col :span="2">
  38. <el-button style="background-color:#409eff;color: #DCDFE6" @click="queryRepair()">查询</el-button>
  39. </el-col>
  40. </el-row>
  41. <el-row style="display: flex;align-items: center;">
  42. <el-col :span="2">
  43. <el-checkbox v-model="checkAllStatus" @change="changeCheck"
  44. >全选</el-checkbox
  45. >
  46. </el-col>
  47. <el-col :span="2">
  48. <el-button size="small" @click="BatchDelete">批量删除</el-button>
  49. </el-col>
  50. </el-row>
  51. <el-row>
  52. <el-table
  53. ref="multipleTable"
  54. @selection-change="handleSelectionChange"
  55. :row-style="{ color: '#303133' }"
  56. :header-cell-style="{
  57. backgroundColor: 'rgb(245, 247, 250)',
  58. color: '#606266'
  59. }"
  60. :data="tableData"
  61. border
  62. fit
  63. highlight-current-row
  64. style="width: 100%;margin-top: 10px;"
  65. >
  66. <el-table-column
  67. align="center"
  68. type="selection"
  69. width="55"
  70. ></el-table-column>
  71. <el-table-column prop="date" label="机号" width="80" align="center">
  72. <template slot-scope="scope">{{ scope.row.bed_number }}</template>
  73. </el-table-column>
  74. <el-table-column
  75. prop="name"
  76. label="保修时间"
  77. width="100"
  78. align="center"
  79. >
  80. <template slot-scope="scope">
  81. {{ getTime(scope.row.guarantee_date) }}
  82. </template>
  83. </el-table-column>
  84. <el-table-column
  85. prop="address"
  86. label="出发时间"
  87. width="100"
  88. align="center"
  89. >
  90. <template slot-scope="scope">
  91. {{ getTimes(scope.row.start_time) }}
  92. </template>
  93. </el-table-column>
  94. <el-table-column
  95. prop="address"
  96. label="到达时间"
  97. width="100"
  98. align="center"
  99. >
  100. <template slot-scope="scope">
  101. {{ getTimes(scope.row.arrive_time) }}
  102. </template>
  103. </el-table-column>
  104. <el-table-column
  105. prop="address"
  106. label="完成时间"
  107. width="100"
  108. align="center"
  109. >
  110. <template slot-scope="scope">
  111. {{ getTimes(scope.row.finish_time) }}
  112. </template>
  113. </el-table-column>
  114. <el-table-column
  115. prop="address"
  116. label="总路程(公里)"
  117. width="110"
  118. align="center"
  119. >
  120. <template slot-scope="scope">{{ scope.row.total_distance }}</template>
  121. </el-table-column>
  122. <el-table-column
  123. prop="address"
  124. label="故障发生阶段"
  125. width="110"
  126. align="center"
  127. >
  128. <template slot-scope="scope">{{ scope.row.failure_stage }}</template>
  129. </el-table-column>
  130. <el-table-column
  131. prop="address"
  132. label="故障提示信息及代码"
  133. width="120"
  134. align="center"
  135. >
  136. <template slot-scope="scope">
  137. {{ scope.row.code_information }}
  138. </template>
  139. </el-table-column>
  140. <el-table-column
  141. prop="address"
  142. label="故障描述"
  143. width="100"
  144. align="center"
  145. >
  146. <template slot-scope="scope">
  147. {{ scope.row.fault_description }}
  148. </template>
  149. </el-table-column>
  150. <el-table-column
  151. prop="address"
  152. label="原因分析"
  153. width="100"
  154. align="center"
  155. >
  156. <template slot-scope="scope">{{ scope.row.cause_analysis }}</template>
  157. </el-table-column>
  158. <el-table-column
  159. prop="address"
  160. label="处理过程"
  161. width="100"
  162. align="center"
  163. >
  164. <template slot-scope="scope">
  165. {{ scope.row.treatment_process }}
  166. </template>
  167. </el-table-column>
  168. <el-table-column
  169. prop="address"
  170. label="故障是否排除"
  171. width="110"
  172. align="center"
  173. >
  174. <template slot-scope="scope">{{ scope.row.exclude }}</template>
  175. </el-table-column>
  176. <el-table-column prop="address" label="原因" width="80" align="center">
  177. <template slot-scope="scope">{{ scope.row.reason }}</template>
  178. </el-table-column>
  179. <el-table-column label="操作" align="center" min-width="150px">
  180. <template slot-scope="scope">
  181. <el-tooltip
  182. class="item"
  183. effect="dark"
  184. content="编辑"
  185. placement="top"
  186. >
  187. <el-button
  188. size="mini"
  189. type="primary"
  190. icon="el-icon-edit-outline"
  191. @click="
  192. EditRepair(scope.row.id, scope.row.sampler, scope.$index)
  193. "
  194. ></el-button>
  195. </el-tooltip>
  196. <el-tooltip
  197. class="item"
  198. effect="dark"
  199. content="删除"
  200. placement="top"
  201. >
  202. <el-button
  203. size="mini"
  204. type="danger"
  205. icon="el-icon-delete"
  206. @click="DeleteRepairs(scope.row.id, scope.$index)"
  207. ></el-button>
  208. </el-tooltip>
  209. </template>
  210. </el-table-column>
  211. </el-table>
  212. <el-pagination
  213. @size-change="handleSizeChange"
  214. @current-change="handleCurrentChange"
  215. :page-sizes="[10, 20, 50, 100]"
  216. :page-size="10"
  217. background
  218. style="margin-top:20px;float: right"
  219. layout="total, sizes, prev, pager, next, jumper"
  220. :total="total"
  221. ></el-pagination>
  222. </el-row>
  223. <!-- 编辑维修记录 -->
  224. <el-dialog
  225. title="编辑维修记录"
  226. :visible.sync="dialogVisible"
  227. width="65%"
  228. center
  229. >
  230. <el-form :model="guaForm" ref="guaForm" :rules="repirRules">
  231. <el-row>
  232. <el-col :span="8">
  233. <el-form-item label="保修日期:" required prop="guarantee_date">
  234. <el-date-picker
  235. v-model="guaForm.guarantee_date"
  236. prefix-icon="none"
  237. type="date"
  238. placeholder="请选择"
  239. format="yyyy-MM-dd"
  240. value-format="yyyy-MM-dd"
  241. style="width:150px"
  242. ></el-date-picker>
  243. </el-form-item>
  244. </el-col>
  245. <el-col :span="10">
  246. <el-form-item label="出发时间:">
  247. <el-date-picker
  248. type="datetime"
  249. format="yyyy-MM-dd HH:mm"
  250. value-format="yyyy-MM-dd HH:mm"
  251. placeholder="选择时间"
  252. v-model="guaForm.start_time"
  253. style="width:200px;"
  254. ></el-date-picker>
  255. </el-form-item>
  256. </el-col>
  257. </el-row>
  258. <el-row>
  259. <el-col :span="8">
  260. <el-form-item label="到达时间:">
  261. <el-date-picker
  262. type="datetime"
  263. format="yyyy-MM-dd HH:mm"
  264. value-format="yyyy-MM-dd HH:mm"
  265. placeholder="选择时间"
  266. v-model="guaForm.arrive_time"
  267. style="width:200px;"
  268. ></el-date-picker>
  269. </el-form-item>
  270. </el-col>
  271. <el-col :span="8">
  272. <el-form-item label="完成时间:">
  273. <el-date-picker
  274. type="datetime"
  275. format="yyyy-MM-dd HH:mm"
  276. value-format="yyyy-MM-dd HH:mm"
  277. placeholder="选择时间"
  278. v-model="guaForm.finish_time"
  279. style="width:200px;"
  280. ></el-date-picker>
  281. </el-form-item>
  282. </el-col>
  283. <el-col :span="8">
  284. <el-form-item label="总路程:(公里)">
  285. <el-input
  286. style="width:200px"
  287. v-model="guaForm.total_distance"
  288. ></el-input>
  289. </el-form-item>
  290. </el-col>
  291. </el-row>
  292. <el-row>
  293. <el-col :span="24">
  294. <el-form-item label="故障发生阶段">
  295. <el-radio-group v-model="guaForm.failure_stage">
  296. <el-radio
  297. :label="gender.id"
  298. :value="gender.id"
  299. v-for="(gender, index) in faultPhase"
  300. :key="index"
  301. >{{ gender.name }}</el-radio
  302. >
  303. </el-radio-group>
  304. </el-form-item>
  305. </el-col>
  306. </el-row>
  307. <el-row>
  308. <el-col :span="24">
  309. <el-form-item label="故障提示信息及代码">
  310. <el-input
  311. type="textarea"
  312. :rows="2"
  313. placeholder="请输入内容"
  314. v-model="guaForm.code_information"
  315. style="width:500px"
  316. ></el-input>
  317. </el-form-item>
  318. </el-col>
  319. </el-row>
  320. <el-row>
  321. <el-col :span="8">
  322. <el-form-item label="故障描述:" required prop="fault_description">
  323. <el-input
  324. type="textarea"
  325. :rows="2"
  326. placeholder="请输入内容"
  327. v-model="guaForm.fault_description"
  328. style="width:300px"
  329. ></el-input>
  330. </el-form-item>
  331. </el-col>
  332. <el-col :span="8">
  333. <el-form-item label="原因分析:">
  334. <el-input
  335. type="textarea"
  336. :rows="2"
  337. placeholder="请输入内容"
  338. v-model="guaForm.cause_analysis"
  339. style="width:300px"
  340. ></el-input>
  341. </el-form-item>
  342. </el-col>
  343. <el-col :span="8">
  344. <el-form-item label="处理过程:">
  345. <el-input
  346. type="textarea"
  347. :rows="2"
  348. placeholder="请输入内容"
  349. v-model="guaForm.treatment_process"
  350. style="width:300px"
  351. ></el-input>
  352. </el-form-item>
  353. </el-col>
  354. </el-row>
  355. <el-row>
  356. <el-col :span="24">
  357. <el-form-item label="上传图片:">
  358. <el-upload
  359. :data="uploadFileData"
  360. class="upload-demo"
  361. action="https://upload.qiniup.com"
  362. :on-success="handleSuccess"
  363. :before-upload="beforeUploadFile"
  364. :limit="1"
  365. ref="upload"
  366. >
  367. <el-button size="small" type="primary">上传图片</el-button>
  368. </el-upload>
  369. </el-form-item>
  370. <a class="el-upload-list__item-name">
  371. <i>
  372. <a @click="toLink()">{{ filename }}</a>
  373. </i>
  374. </a>
  375. </el-col>
  376. </el-row>
  377. <el-row>
  378. <el-col :span="20">
  379. <el-form-item label="故障是否排除:">
  380. <el-radio-group v-model="guaForm.exclude">
  381. <el-radio
  382. :label="gender.id"
  383. :value="gender.id"
  384. v-for="(gender, index) in breakDown"
  385. :key="index"
  386. >{{ gender.name }}</el-radio
  387. >
  388. </el-radio-group>
  389. </el-form-item>
  390. </el-col>
  391. </el-row>
  392. <el-row>
  393. <el-col :span="20">
  394. <el-form-item label="原因:">
  395. <el-input
  396. type="textarea"
  397. :rows="2"
  398. placeholder="请输入内容"
  399. v-model="guaForm.reason"
  400. style="width:300px"
  401. ></el-input>
  402. </el-form-item>
  403. </el-col>
  404. </el-row>
  405. </el-form>
  406. <span slot="footer" class="dialog-footer">
  407. <!-- <button @click="lili">调试</button>-->
  408. <el-button @click="dialogVisible = false">取 消</el-button>
  409. <el-button type="primary" @click="UpdateRepair('guaForm')"
  410. >保存</el-button
  411. >
  412. </span>
  413. </el-dialog>
  414. </div>
  415. </template>
  416. <script>
  417. import {
  418. getAllSubregion,
  419. getAllRepair,
  420. EditRepair,
  421. UpdateRepair,
  422. DeleteRepair,
  423. queryRepair,
  424. DeleteRepairs
  425. } from "@/api/manage";
  426. import { uParseTime } from "@/utils/tools";
  427. import { getFileExtension } from "@/utils/tools";
  428. export default {
  429. name: "RepairForm",
  430. data() {
  431. return {
  432. dialogVisible: false,
  433. selectCulture: [],
  434. forms: {
  435. bed: "",
  436. sename: 1,
  437. start_time: "",
  438. end_time: ""
  439. },
  440. guaForm: {
  441. id: "",
  442. guarantee_date: "",
  443. start_time: "",
  444. arrive_time: "",
  445. finish_time: "",
  446. total_distance: "",
  447. failure_stage: "",
  448. fault_description: "",
  449. cause_analysis: "",
  450. treatment_process: "",
  451. images: "",
  452. exclude: "",
  453. reason: "",
  454. code_information: "",
  455. image_name: ""
  456. },
  457. isIndeterminate: false,
  458. checkAllStatus: false,
  459. bedNumber: [],
  460. tableData: [],
  461. qiniuDomain: "https://images.shengws.com/",
  462. uploadFileData: { token: "", key: "" },
  463. faultPhase: [
  464. { id: 1, name: "开机启动" },
  465. { id: 2, name: "自检" },
  466. { id: 3, name: "准备" },
  467. { id: 4, name: "治疗" },
  468. { id: 5, name: "消毒" }
  469. ],
  470. breakDown: [
  471. { id: 1, name: "是" },
  472. { id: 2, name: "待观察" },
  473. { id: 3, name: "未解决" }
  474. ],
  475. repirRules: {
  476. guarantee_date: [{ required: true, message: "请填写保修日期" }],
  477. fault_description: [{ required: true, message: "请填写故障描述" }]
  478. },
  479. filename: "",
  480. limit: 10,
  481. page: 1,
  482. total: 0,
  483. };
  484. },
  485. methods: {
  486. lili(){
  487. console.log("this.guaForm",this.guaForm)
  488. },
  489. changeCheck() {
  490. this.$refs.multipleTable.clearSelection();
  491. if (this.checkAllStatus) {
  492. this.$refs.multipleTable.toggleAllSelection();
  493. }
  494. },
  495. getAllSubregion() {
  496. getAllSubregion().then(response => {
  497. var zones = response.data.data.zones;
  498. var numbers = response.data.data.numbers;
  499. var number = [{ id: 0, number: "全部" }];
  500. for (let index = 0; index < numbers.length; index++) {
  501. const item = numbers[index];
  502. number.push({ id: item.id, number: item.number });
  503. }
  504. this.bedNumber = number;
  505. });
  506. },
  507. handleSelectionChange(val) {
  508. this.selectCulture = val;
  509. },
  510. getAllRepair() {
  511. getAllRepair(this.limit, this.page).then(response => {
  512. if (response.data.state === 1) {
  513. var repair = response.data.data.repair;
  514. console.log("repair是", repair);
  515. // eslint-disable-next-line no-unused-vars
  516. var total = response.data.data.total;
  517. this.total = total;
  518. for (let index = 0; index < repair.length; index++) {
  519. if (repair[index].failure_stage === 0) {
  520. repair[index].failure_stage = "";
  521. }
  522. if (repair[index].failure_stage === 1) {
  523. repair[index].failure_stage = "开机启动";
  524. }
  525. if (repair[index].failure_stage === 2) {
  526. repair[index].failure_stage = "自检";
  527. }
  528. if (repair[index].failure_stage === 3) {
  529. repair[index].failure_stage = "准备";
  530. }
  531. if (repair[index].failure_stage === 4) {
  532. repair[index].failure_stage = "治疗";
  533. }
  534. if (repair[index].failure_stage === 5) {
  535. repair[index].failure_stage = "消毒";
  536. }
  537. if (repair[index].exclude === 0) {
  538. repair[index].exclude = "";
  539. }
  540. if (repair[index].exclude === 1) {
  541. repair[index].exclude = "是";
  542. }
  543. if (repair[index].exclude === 2) {
  544. repair[index].exclude = "待观察";
  545. }
  546. if (repair[index].exclude === 3) {
  547. repair[index].exclude = "未解决";
  548. }
  549. }
  550. this.tableData = repair;
  551. }
  552. });
  553. },
  554. getTime(time) {
  555. return uParseTime(time, "{y}-{m}-{d}");
  556. },
  557. getTimes(time) {
  558. return uParseTime(time, "{y}-{m}-{d} {h}:{i}");
  559. },
  560. handleExceed(file) {
  561. // console.log(file)
  562. },
  563. handlePreview(file) {
  564. // console.log(file)
  565. },
  566. EditRepair(id) {
  567. this.dialogVisible = true;
  568. EditRepair(id).then(response => {
  569. if (response.data.state === 1) {
  570. var repair = response.data.data.repair;
  571. console.log("repair", repair);
  572. this.guaForm.guarantee_date = uParseTime(
  573. repair.guarantee_date,
  574. "{y}-{m}-{d}"
  575. );
  576. this.guaForm.start_time = uParseTime(
  577. repair.start_time,
  578. "{y}-{m}-{d} {h}:{i}"
  579. );
  580. this.guaForm.arrive_time = uParseTime(
  581. repair.arrive_time,
  582. "{y}-{m}-{d} {h}:{i}"
  583. );
  584. this.guaForm.finish_time = uParseTime(
  585. repair.finish_time,
  586. "{y}-{m}-{d} {h}:{i}"
  587. );
  588. this.guaForm.total_distance = repair.total_distance;
  589. this.guaForm.failure_stage = repair.failure_stage;
  590. this.guaForm.fault_description = repair.fault_description;
  591. this.guaForm.cause_analysis = repair.cause_analysis;
  592. this.guaForm.treatment_process = repair.treatment_process;
  593. this.guaForm.images = repair.images;
  594. this.guaForm.exclude = repair.exclude;
  595. this.guaForm.reason = repair.reason;
  596. this.guaForm.code_information = repair.code_information;
  597. this.guaForm.id = repair.id;
  598. this.filename = repair.image_name;
  599. }
  600. });
  601. },
  602. handleSuccess(res, file, fileList) {
  603. this.guaForm.images = this.qiniuDomain + res.url;
  604. console.log("图片上传", this.guaForm.images);
  605. this.$refs.upload.clearFiles();
  606. this.filename = file.name;
  607. this.guaForm.image_name = file.name;
  608. },
  609. beforeUploadFile(file) {
  610. this.filename = file.name;
  611. this.guaForm.image_name = file.name;
  612. const isLt2M = file.size / 1024 / 1024 <= 2048;
  613. console.log("filename", file);
  614. // console.log('视频大小', file.size / 1024 / 1024)
  615. // console.log('isLt2M是什么', isLt2M)
  616. if (!isLt2M) {
  617. this.$message.error("上传视频大小不能超过 2G!");
  618. return false;
  619. }
  620. var date = new Date();
  621. var ext = getFileExtension(file.name);
  622. var key =
  623. date.getFullYear() +
  624. (date.getMonth() + 1) +
  625. date.getDate() +
  626. date.getHours() +
  627. date.getMinutes() +
  628. date.getSeconds() +
  629. "_o_" +
  630. file.uid +
  631. "." +
  632. ext;
  633. const _self = this;
  634. return new Promise((resolve, reject) => {
  635. // eslint-disable-next-line no-undef
  636. getToken()
  637. .then(response => {
  638. const token = response.data.data.uptoken;
  639. console.log("token2是什么?", token);
  640. _self._data.uploadFileData.token = token;
  641. _self._data.uploadFileData.key = key;
  642. resolve(true);
  643. })
  644. // eslint-disable-next-line handle-callback-err
  645. .catch(err => {
  646. reject(false);
  647. });
  648. });
  649. },
  650. toLink() {
  651. window.location.href = this.guaForm.images;
  652. },
  653. UpdateRepair(formName) {
  654. console.log("formName",formName)
  655. console.log("this.guaForm",this.guaForm)
  656. this.$refs[formName].validate(valid => {
  657. // this.guaForm.start_time = uParseTime(
  658. // this.guaForm.start_time,
  659. // "{y}-{m}-{d} {h}:{i}"
  660. // );
  661. // this.guaForm.arrive_time = uParseTime(
  662. // this.guaForm.arrive_time,
  663. // "{y}-{m}-{d} {h}:{i}"
  664. // );
  665. // this.guaForm.finish_time = uParseTime(
  666. // this.guaForm.finish_time,
  667. // "{y}-{m}-{d} {h}:{i}"
  668. // );
  669. if (this.guaForm.failure_stage === "") {
  670. this.guaForm.failure_stage = 0;
  671. }
  672. var failurestages = this.guaForm.failure_stage;
  673. var falur = parseInt(failurestages);
  674. this.guaForm.failure_stage = falur;
  675. if (this.guaForm.exclude === "") {
  676. this.guaForm.exclude = 0;
  677. }
  678. var excludes = this.guaForm.exclude;
  679. var exclude = parseInt(excludes);
  680. this.guaForm.exclude = exclude;
  681. if (valid) {
  682. UpdateRepair(this.guaForm).then(response => {
  683. if (response.data.state === 1) {
  684. var repair = response.data.data.repair;
  685. this.dialogVisible = false;
  686. this.$message.success("修改成功");
  687. }
  688. });
  689. }
  690. });
  691. },
  692. BatchDelete() {
  693. if (this.selectCulture.length == 0) {
  694. this.$message.error("请选择要删除的信息");
  695. return false;
  696. }
  697. this.$confirm(
  698. "确认要删除所选记录吗? <br>删除后,信息将无法恢复",
  699. "删除提示",
  700. {
  701. dangerouslyUseHTMLString: true,
  702. confirmButtonText: "确定",
  703. cancelButtonText: "取消",
  704. type: "warning"
  705. }
  706. ).then(() => {
  707. var ids = [];
  708. var idMap = {};
  709. for (const index in this.selectCulture) {
  710. ids.push(this.selectCulture[index].id);
  711. idMap[this.selectCulture[index].id] = this.selectCulture[index].id;
  712. }
  713. DeleteRepair({ ids: ids }).then(response => {
  714. if (response.data.state === 1) {
  715. var msg = response.data.data.msg;
  716. var planDataLength = this.tableData.length;
  717. for (let index = planDataLength - 1; index >= 0; index--) {
  718. if (this.tableData[index].id in idMap) {
  719. this.tableData.splice(index, 1);
  720. }
  721. }
  722. this.$message.success("删除成功");
  723. }
  724. });
  725. });
  726. },
  727. queryRepair() {
  728. queryRepair(
  729. this.forms.bed,
  730. this.forms.start_time,
  731. this.forms.end_time
  732. ).then(response => {
  733. if (response.data.state === 1) {
  734. var repair = response.data.data.repair;
  735. for (let index = 0; index < repair.length; index++) {
  736. if (repair[index].failure_stage === 0) {
  737. repair[index].failure_stage = "";
  738. }
  739. if (repair[index].failure_stage === 1) {
  740. repair[index].failure_stage = "开机启动";
  741. }
  742. if (repair[index].failure_stage === 2) {
  743. repair[index].failure_stage = "自检";
  744. }
  745. if (repair[index].failure_stage === 3) {
  746. repair[index].failure_stage = "准备";
  747. }
  748. if (repair[index].failure_stage === 4) {
  749. repair[index].failure_stage = "治疗";
  750. }
  751. if (repair[index].failure_stage === 5) {
  752. repair[index].failure_stage = "消毒";
  753. }
  754. if (repair[index].exclude === 0) {
  755. repair[index].exclude = "";
  756. }
  757. if (repair[index].exclude === 1) {
  758. repair[index].exclude = "是";
  759. }
  760. if (repair[index].exclude === 2) {
  761. repair[index].exclude = "待观察";
  762. }
  763. if (repair[index].exclude === 3) {
  764. repair[index].exclude = "未解决";
  765. }
  766. }
  767. this.tableData = repair;
  768. }
  769. });
  770. },
  771. handleSizeChange(limit) {
  772. this.limit = limit;
  773. this.getAllRepair();
  774. },
  775. handleCurrentChange(page) {
  776. this.page = page;
  777. this.getAllRepair();
  778. },
  779. DeleteRepairs(id, index) {
  780. this.$confirm(
  781. "确认要删除所选记录吗? <br>删除后,信息将无法恢复",
  782. "删除提示",
  783. {
  784. dangerouslyUseHTMLString: true,
  785. confirmButtonText: "确定",
  786. cancelButtonText: "取消",
  787. type: "warning"
  788. }
  789. ).then(() => {
  790. DeleteRepairs(id, index).then(response => {
  791. if (response.data.state === 1) {
  792. var msg = response.data.data.msg;
  793. this.tableData.splice(index, 1);
  794. }
  795. });
  796. });
  797. }
  798. },
  799. created() {
  800. this.getAllSubregion();
  801. this.getAllRepair();
  802. }
  803. };
  804. </script>
  805. <style scoped>
  806. .row {
  807. margin-bottom: 10px;
  808. }
  809. </style>