repairList.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>
  6. 维修单列表
  7. </h2>
  8. <div class="m-core">
  9. <save-form
  10. :inline="true"
  11. @submit="search"
  12. @reset="onReSet"
  13. :model="searchForm"
  14. >
  15. <el-form-item>
  16. <el-input
  17. v-model.trim="searchForm.search"
  18. clearable
  19. @keyup.enter.native="search"
  20. placeholder="维修单号/姓名"
  21. ></el-input>
  22. </el-form-item>
  23. <el-form-item>
  24. <el-input
  25. type="number"
  26. v-model="searchForm.studentInstrumentId"
  27. clearable
  28. placeholder="维护编号"
  29. ></el-input>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-select
  33. placeholder="是否有特权减免金额"
  34. v-model.trim="searchForm.hasExemptionAmount"
  35. clearable
  36. >
  37. <el-option label="是" value="1"></el-option>
  38. <el-option label="否" value="0"></el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-select
  43. placeholder="维修技师"
  44. v-model="searchForm.employeeId"
  45. clearable
  46. filterable
  47. >
  48. <el-option
  49. v-for="(item, index) in employeeList"
  50. :label="item.userName"
  51. :value="item.userId"
  52. :key="index"
  53. ></el-option>
  54. </el-select>
  55. </el-form-item>
  56. <el-form-item>
  57. <el-select
  58. placeholder="请选择分部"
  59. v-model="searchForm.organIdList"
  60. clearable
  61. >
  62. <el-option
  63. v-for="(item, index) in selects.branchs"
  64. :label="item.name"
  65. :value="item.id"
  66. :key="index"
  67. ></el-option>
  68. </el-select>
  69. </el-form-item>
  70. <!-- <el-form-item>
  71. <el-select
  72. placeholder="请选择乐器类型"
  73. v-model="searchForm.subjectId"
  74. clearable
  75. filterable
  76. >
  77. <el-option
  78. v-for="(item, index) in soundLists"
  79. :label="item.name"
  80. :value="item.id"
  81. :key="index"
  82. ></el-option>
  83. </el-select>
  84. </el-form-item> -->
  85. <el-form-item>
  86. <el-select
  87. placeholder="维修状态"
  88. v-model="searchForm.repairStatus"
  89. clearable
  90. >
  91. <el-option label="已完成" value="1"></el-option>
  92. <el-option label="维修中" value="0"></el-option>
  93. </el-select>
  94. </el-form-item>
  95. <el-form-item>
  96. <el-select placeholder="维修类型" v-model="searchForm.type" clearable>
  97. <el-option label="线上" value="1"></el-option>
  98. <el-option label="线下" value="0"></el-option>
  99. </el-select>
  100. </el-form-item>
  101. <br />
  102. <el-form-item label="送修日期">
  103. <el-date-picker
  104. v-model.trim="searchForm.timer"
  105. style="width: 400px"
  106. type="daterange"
  107. value-format="yyyy-MM-dd"
  108. :picker-options="{
  109. firstDayOfWeek: 1,
  110. }"
  111. range-separator="至"
  112. start-placeholder="送修开始日期"
  113. end-placeholder="送修结束日期"
  114. ></el-date-picker>
  115. </el-form-item>
  116. <el-form-item>
  117. <el-button type="danger" native-type="submit">搜索</el-button>
  118. <el-button native-type="reset" type="primary">重置</el-button>
  119. </el-form-item>
  120. </save-form>
  121. <div class="tableWrap">
  122. <el-table
  123. style="width: 100%"
  124. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  125. :data="tableList"
  126. >
  127. <el-table-column align="center" prop="organName" label="分部">
  128. <template slot-scope="scope">
  129. <copy-text>{{ scope.row.organName }}</copy-text>
  130. </template>
  131. </el-table-column>
  132. <el-table-column
  133. align="center"
  134. prop="transNo"
  135. label="维修单号"
  136. width="175"
  137. >
  138. <template slot-scope="scope">
  139. <copy-text>{{ scope.row.transNo }}</copy-text>
  140. </template>
  141. </el-table-column>
  142. <el-table-column align="center" prop="studentName" label="学生姓名">
  143. <template slot-scope="scope">
  144. <copy-text>{{ scope.row.studentName }}</copy-text>
  145. </template>
  146. </el-table-column>
  147. <el-table-column align="center" prop="studentId" label="学生编号">
  148. <template slot-scope="scope">
  149. <copy-text>{{ scope.row.studentId }}</copy-text>
  150. </template>
  151. </el-table-column>
  152. <el-table-column align="center" prop="employeeName" label="维修技师">
  153. <template slot-scope="scope">
  154. <copy-text>{{ scope.row.employeeName }}</copy-text>
  155. </template>
  156. </el-table-column>
  157. <el-table-column align="center" prop="subjectName" label="乐器种类">
  158. <template slot-scope="scope">
  159. <copy-text>{{ scope.row.subjectName }}</copy-text>
  160. </template>
  161. </el-table-column>
  162. <el-table-column align="center" prop="type" label="维修类型">
  163. <template slot-scope="scope">{{
  164. scope.row.type ? "线上" : "线下"
  165. }}</template>
  166. </el-table-column>
  167. <el-table-column
  168. align="center"
  169. prop="repairName"
  170. label="维修单名称"
  171. ></el-table-column>
  172. <el-table-column align="center" prop="createTime" label="送修日期">
  173. <template slot-scope="scope">{{
  174. scope.row.createTime | formatTimer
  175. }}</template>
  176. </el-table-column>
  177. <el-table-column align="center" prop="finishTime" label="完成日期">
  178. <template slot-scope="scope">{{
  179. scope.row.finishTime | formatTimer
  180. }}</template>
  181. </el-table-column>
  182. <el-table-column align="center" prop="repairStatus" label="状态">
  183. <template slot-scope="scope">{{
  184. scope.row.repairStatus ? "已完成" : "维修中"
  185. }}</template>
  186. </el-table-column>
  187. <el-table-column align="center" label="操作">
  188. <template slot-scope="scope">
  189. <el-button type="text" @click="showDetail(scope.row)"
  190. >详情</el-button
  191. >
  192. </template>
  193. </el-table-column>
  194. </el-table>
  195. <pagination
  196. sync
  197. :total.sync="rules.total"
  198. :page.sync="rules.page"
  199. :limit.sync="rules.limit"
  200. :page-sizes="rules.page_size"
  201. @pagination="getList"
  202. />
  203. </div>
  204. </div>
  205. <el-dialog
  206. title="维修单详情"
  207. :close-on-click-modal="false"
  208. :visible.sync="repairVisible"
  209. width="600px"
  210. >
  211. <el-form :model="visibleForm" :inline="true">
  212. <el-row>
  213. <el-col :span="12">
  214. <el-form-item label="维修单号:">
  215. <p v-if="activeRow" class="visibleCell">
  216. {{ activeRow.transNo }}
  217. </p>
  218. </el-form-item>
  219. </el-col>
  220. <el-col :span="12">
  221. <el-form-item label="维修单名称:">
  222. <p v-if="activeRow" class="visibleCell">
  223. {{ activeRow.repairName }}
  224. </p>
  225. </el-form-item>
  226. </el-col>
  227. </el-row>
  228. <el-row>
  229. <el-col :span="12">
  230. <el-form-item label="学生姓名:">
  231. <p v-if="activeRow" class="visibleCell">
  232. {{ activeRow.studentName }}
  233. </p>
  234. </el-form-item>
  235. </el-col>
  236. <el-col :span="12">
  237. <el-form-item label="归属乐团:">
  238. <p v-if="activeRow" class="visibleCell">
  239. {{ activeRow.studentSchool }}
  240. </p>
  241. </el-form-item>
  242. </el-col>
  243. </el-row>
  244. <el-row v-if="activeRow&&activeRow.sendType!=0" >
  245. <el-col :span="12">
  246. <el-form-item label="联系人:">
  247. <p v-if="activeRow" class="visibleCell">
  248. {{ activeRow.contactName }}
  249. </p>
  250. </el-form-item>
  251. </el-col>
  252. <el-col :span="12">
  253. <el-form-item label="联系方式:">
  254. <p v-if="activeRow" class="visibleCell">
  255. {{ activeRow.contactMobile }}
  256. </p>
  257. </el-form-item>
  258. </el-col>
  259. </el-row>
  260. <el-row>
  261. <el-col :span="12">
  262. <el-form-item label="邮寄地址:" v-if="activeRow&&activeRow.sendType!=0">
  263. <p v-if="activeRow" class="visibleCell">
  264. {{ activeRow.address }}
  265. </p>
  266. </el-form-item>
  267. </el-col>
  268. <el-col :span="12">
  269. <el-form-item label="取件方式:">
  270. <p v-if="activeRow" class="visibleCell">
  271. {{ activeRow.sendType == "0" ? "自取" : "邮寄" }}
  272. </p>
  273. </el-form-item>
  274. </el-col>
  275. </el-row>
  276. <el-row>
  277. <el-col :span="12">
  278. <el-form-item label="维修服务费:">
  279. <p v-if="activeRow" class="visibleCell">
  280. {{ activeRow.amount | moneyFormat }}元
  281. </p>
  282. </el-form-item>
  283. </el-col>
  284. <el-col :span="12">
  285. <el-form-item label="是否乐保乐器:">
  286. <p v-if="activeRow" class="visibleCell">
  287. {{ activeRow.maintenanceStatus ? '是' : '否' }}
  288. </p>
  289. </el-form-item>
  290. </el-col>
  291. </el-row>
  292. <el-row>
  293. <el-col>
  294. <el-form-item label="特权减免金额">
  295. <p v-if="activeRow">
  296. {{ activeRow.exemptionAmount | moneyFormat }}
  297. </p>
  298. </el-form-item>
  299. </el-col>
  300. </el-row>
  301. <!-- <el-row>
  302. <el-col>
  303. <el-form-item label="实际支付服务费">
  304. {{ 0.0 }}
  305. </el-form-item>
  306. </el-col>
  307. </el-row> -->
  308. <el-form-item
  309. label="问题描述及解决方案:"
  310. style="width: 100%; margin-bottom: 0"
  311. ></el-form-item>
  312. <div>
  313. <el-row>
  314. <el-col :span="5" v-for="url in imgList" :key="url">
  315. <el-card class="box-card" :body-style="{ padding: '0px' }">
  316. <el-image
  317. style="width: 100px; height: 100px"
  318. :src="url"
  319. fit="fill"
  320. :preview-src-list="imgList"
  321. ></el-image>
  322. </el-card>
  323. </el-col>
  324. </el-row>
  325. </div>
  326. <!-- <div>
  327. <el-image
  328. v-for="(item, index) in srcList"
  329. :key="index"
  330. style="width: 100px; height: 100px; margin-right: 10px"
  331. :src="url"
  332. :preview-src-list="srcList"
  333. >
  334. </el-image>
  335. </div> -->
  336. <el-input
  337. type="textarea"
  338. v-if="activeRow"
  339. style="width: 100%"
  340. :rows="3"
  341. v-model="activeRow.description"
  342. :disabled="activeRow && Boolean(activeRow.finishTime)"
  343. ></el-input>
  344. <el-form-item
  345. label="收费组成:"
  346. style="width: 100%; margin-bottom: 0"
  347. v-if="activeRow && activeRow.feeList"
  348. ></el-form-item>
  349. <el-input
  350. type="textarea"
  351. v-if="activeRow && activeRow.feeList"
  352. style="width: 100%"
  353. :rows="3"
  354. v-model="activeRow.feeList"
  355. :disabled="true"
  356. ></el-input>
  357. <el-form-item
  358. label="商品列表:"
  359. style="width: 100%; margin-bottom: 0"
  360. ></el-form-item>
  361. <el-table
  362. style="width: 100%"
  363. v-if="activeRow"
  364. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  365. :data="activeRow.goodsList"
  366. >
  367. <el-table-column
  368. align="center"
  369. prop="name"
  370. label="商品名"
  371. ></el-table-column>
  372. <el-table-column
  373. align="center"
  374. prop="groupPurchasePrice"
  375. label="商品价格(元)"
  376. >
  377. <template slot-scope="scope">
  378. <div>
  379. {{ scope.row.groupPurchasePrice | moneyFormat }}
  380. </div>
  381. </template>
  382. </el-table-column>
  383. </el-table>
  384. </el-form>
  385. <span slot="footer" class="dialog-footer">
  386. <el-button
  387. type="danger"
  388. v-if="!(activeRow && Boolean(activeRow.finishTime))"
  389. v-permission="'studentRepair/repairSuccess'"
  390. @click="repairEnd('save', activeRow)"
  391. >保存</el-button
  392. >
  393. <el-button
  394. type="primary"
  395. v-permission="'studentRepair/repairSuccess'"
  396. v-if="!(activeRow && activeRow.finishTime)"
  397. @click="repairEnd('end', activeRow)"
  398. >完成维修</el-button
  399. >
  400. </span>
  401. </el-dialog>
  402. </div>
  403. </template>
  404. <script>
  405. import axios from "axios";
  406. import { getToken } from "@/utils/auth";
  407. import pagination from "@/components/Pagination/index";
  408. import load from "@/utils/loading";
  409. import { getSoundTree } from "@/api/buildTeam";
  410. import {
  411. findAllTechnician,
  412. studentRepairList,
  413. repairSuccess,
  414. } from "@/api/repairManager";
  415. export default {
  416. components: { pagination },
  417. data() {
  418. return {
  419. searchForm: {
  420. search: null,
  421. employeeId: null,
  422. organIdList: null,
  423. repairStatus: null,
  424. // subjectId: null,
  425. time: [],
  426. exemptionAmount: "",
  427. },
  428. repairVisible: false,
  429. employeeList: [],
  430. tableList: [],
  431. rules: {
  432. // 分页规则
  433. limit: 10, // 限制显示条数
  434. page: 1, // 当前页
  435. total: 0, // 总条数
  436. page_size: [10, 20, 40, 50], // 选择限制显示条数
  437. },
  438. soundLists: [],
  439. soundList: [],
  440. isInit: false,
  441. visibleForm: {},
  442. activeRow: null,
  443. srcList: [],
  444. };
  445. },
  446. //生命周期 - 创建完成(可以访问当前this实例)
  447. created() {},
  448. //生命周期 - 挂载完成(可以访问DOM元素)
  449. mounted() {
  450. if (this.$route.query.studentInstrumentId) {
  451. this.searchForm = {
  452. ...this.searchForm,
  453. ...this.$route.query,
  454. };
  455. this.$router.replace("/business/repairList");
  456. }
  457. findAllTechnician().then((res) => {
  458. if (res.code == 200) {
  459. this.employeeList = res.data;
  460. }
  461. });
  462. this.$store.dispatch("setBranchs");
  463. // 获取声部
  464. getSoundTree({ tenantId: 1, rows: 9999 }).then((res) => {
  465. if (res.code == 200) {
  466. if (res.code == 200) {
  467. this.soundList = res.data.rows;
  468. this.getSound();
  469. }
  470. }
  471. });
  472. // if (!this.isInit) {
  473. this.init();
  474. // }
  475. },
  476. methods: {
  477. init() {
  478. this.isInit = true;
  479. this.getList();
  480. },
  481. getList() {
  482. let obj = JSON.parse(JSON.stringify(this.searchForm));
  483. obj.page = this.rules.page;
  484. obj.rows = this.rules.limit;
  485. if (this.searchForm.timer && this.searchForm.timer.length > 0) {
  486. obj.startTime = this.searchForm.timer[0];
  487. obj.endTime = this.searchForm.timer[1];
  488. }
  489. delete obj.timer;
  490. studentRepairList(obj).then((res) => {
  491. if (res.code == 200) {
  492. this.isInit = false;
  493. this.tableList = res.data.rows;
  494. this.rules.total = res.data.total;
  495. }
  496. });
  497. },
  498. getSound() {
  499. // soundLists
  500. // soundList
  501. this.soundLists = [];
  502. for (let i in this.soundList) {
  503. if (this.soundList[i].subjects.length > 0) {
  504. this.soundLists = this.soundLists.concat(this.soundList[i].subjects);
  505. }
  506. }
  507. },
  508. onReSet() {
  509. this.searchForm = {
  510. search: null,
  511. employeeId: null,
  512. organIdList: null,
  513. repairStatus: null,
  514. // subjectId: null,
  515. time: [],
  516. };
  517. this.search();
  518. },
  519. search() {
  520. this.rules.page = 1;
  521. this.getList();
  522. },
  523. showDetail(row) {
  524. let goodsList = row.goodsJson ? JSON.parse(row.goodsJson) : [];
  525. row.goodsList = goodsList;
  526. this.activeRow = row;
  527. this.repairVisible = true;
  528. },
  529. repairEnd(str, row) {
  530. let repairStatus = null;
  531. if (str && str == "end") {
  532. repairStatus = 1;
  533. }
  534. repairSuccess({
  535. repairStatus: repairStatus,
  536. id: row.id,
  537. description: row.description,
  538. }).then((res) => {
  539. if (res.code == 200) {
  540. if (str && str == "end") {
  541. this.$message.success("完成维修");
  542. } else {
  543. this.$message.success("保存成功");
  544. }
  545. this.repairVisible = false;
  546. this.getList();
  547. }
  548. });
  549. },
  550. },
  551. watch: {
  552. repairVisible(val) {
  553. if (!val) {
  554. this.activeRow = null;
  555. }
  556. },
  557. },
  558. computed: {
  559. imgList() {
  560. let activeRow = this.activeRow
  561. let arr = activeRow?.repairImg ? activeRow.repairImg.split(",") : []
  562. return arr;
  563. },
  564. },
  565. };
  566. </script>
  567. <style lang='scss' scoped>
  568. .visibleCell {
  569. // width: 180px;
  570. }
  571. .box-card {
  572. align-items: center;
  573. height: 102px;
  574. width: 102px;
  575. margin-bottom: 20px;
  576. }
  577. </style>