repairList.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  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. <!-- v-permission="'studentRepair/export'" -->
  120. <el-button @click="onExport" type="primary" v-permission="'studentRepair/export'">导出</el-button>
  121. </el-form-item>
  122. </save-form>
  123. <div class="tableWrap">
  124. <el-table
  125. style="width: 100%"
  126. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  127. :data="tableList"
  128. >
  129. <el-table-column align="center" prop="organName" label="分部">
  130. <template slot-scope="scope">
  131. <copy-text>{{ scope.row.organName }}</copy-text>
  132. </template>
  133. </el-table-column>
  134. <el-table-column
  135. align="center"
  136. prop="transNo"
  137. label="维修单号"
  138. width="175"
  139. >
  140. <template slot-scope="scope">
  141. <copy-text>{{ scope.row.transNo }}</copy-text>
  142. </template>
  143. </el-table-column>
  144. <el-table-column align="center" prop="studentName" label="学生姓名">
  145. <template slot-scope="scope">
  146. <copy-text>{{ scope.row.studentName }}</copy-text>
  147. </template>
  148. </el-table-column>
  149. <el-table-column align="center" prop="studentId" label="学生编号">
  150. <template slot-scope="scope">
  151. <copy-text>{{ scope.row.studentId }}</copy-text>
  152. </template>
  153. </el-table-column>
  154. <el-table-column align="center" prop="employeeName" label="维修技师">
  155. <template slot-scope="scope">
  156. <copy-text>{{ scope.row.employeeName }}</copy-text>
  157. </template>
  158. </el-table-column>
  159. <!-- <el-table-column align="center" prop="subjectName" label="乐器种类">
  160. <template slot-scope="scope">
  161. <copy-text>{{ scope.row.subjectName }}</copy-text>
  162. </template>
  163. </el-table-column> -->
  164. <el-table-column align="center" prop="type" label="维修类型">
  165. <template slot-scope="scope">{{
  166. scope.row.type ? "线上" : "线下"
  167. }}</template>
  168. </el-table-column>
  169. <el-table-column
  170. align="center"
  171. prop="repairName"
  172. label="维修单名称"
  173. ></el-table-column>
  174. <el-table-column align="center" prop="createTime" label="送修日期">
  175. <template slot-scope="scope">{{
  176. scope.row.createTime | formatTimer
  177. }}</template>
  178. </el-table-column>
  179. <el-table-column align="center" prop="finishTime" label="完成日期">
  180. <template slot-scope="scope">{{
  181. scope.row.finishTime | formatTimer
  182. }}</template>
  183. </el-table-column>
  184. <el-table-column align="center" prop="repairStatus" label="状态">
  185. <template slot-scope="scope">{{
  186. scope.row.repairStatus ? "已完成" : "维修中"
  187. }}</template>
  188. </el-table-column>
  189. <el-table-column align="center" label="操作">
  190. <template slot-scope="scope">
  191. <el-button type="text" @click="showDetail(scope.row)"
  192. >详情</el-button
  193. >
  194. </template>
  195. </el-table-column>
  196. </el-table>
  197. <pagination
  198. sync
  199. :total.sync="rules.total"
  200. :page.sync="rules.page"
  201. :limit.sync="rules.limit"
  202. :page-sizes="rules.page_size"
  203. @pagination="getList"
  204. />
  205. </div>
  206. </div>
  207. <el-dialog
  208. title="维修单详情"
  209. :close-on-click-modal="false"
  210. :close-on-press-escape="false"
  211. :visible.sync="repairVisible"
  212. width="600px"
  213. >
  214. <el-form :model="visibleForm" :inline="true">
  215. <el-row>
  216. <el-col :span="12">
  217. <el-form-item label="维修单号:">
  218. <p v-if="activeRow" class="visibleCell">
  219. {{ activeRow.transNo }}
  220. </p>
  221. </el-form-item>
  222. </el-col>
  223. <el-col :span="12">
  224. <el-form-item label="维修单名称:">
  225. <p v-if="activeRow" class="visibleCell">
  226. {{ activeRow.repairName }}
  227. </p>
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="12" v-if="activeRow && activeRow.studentInstrumentId">
  231. <el-form-item label="维护编号:">
  232. <p class="visibleCell">
  233. {{ activeRow.studentInstrumentId }}
  234. </p>
  235. </el-form-item>
  236. </el-col>
  237. </el-row>
  238. <el-row>
  239. <el-col :span="12">
  240. <el-form-item label="学生姓名:">
  241. <p v-if="activeRow" class="visibleCell">
  242. {{ activeRow.studentName }}
  243. </p>
  244. </el-form-item>
  245. </el-col>
  246. <el-col :span="12">
  247. <el-form-item label="归属乐团:">
  248. <p v-if="activeRow" class="visibleCell">
  249. {{ activeRow.studentSchool }}
  250. </p>
  251. </el-form-item>
  252. </el-col>
  253. </el-row>
  254. <el-row v-if="activeRow&&activeRow.sendType!=0" >
  255. <el-col :span="12">
  256. <el-form-item label="联系人:">
  257. <p v-if="activeRow" class="visibleCell">
  258. {{ activeRow.contactName }}
  259. </p>
  260. </el-form-item>
  261. </el-col>
  262. <el-col :span="12">
  263. <el-form-item label="联系方式:">
  264. <p v-if="activeRow" class="visibleCell">
  265. {{ activeRow.contactMobile }}
  266. </p>
  267. </el-form-item>
  268. </el-col>
  269. </el-row>
  270. <el-row>
  271. <el-col :span="12">
  272. <el-form-item label="邮寄地址:" v-if="activeRow&&activeRow.sendType!=0">
  273. <p v-if="activeRow" class="visibleCell">
  274. {{ activeRow.address }}
  275. </p>
  276. </el-form-item>
  277. </el-col>
  278. <el-col :span="12">
  279. <el-form-item label="取件方式:">
  280. <p v-if="activeRow" class="visibleCell">
  281. {{ activeRow.sendType == "0" ? "自取" : "邮寄" }}
  282. </p>
  283. </el-form-item>
  284. </el-col>
  285. </el-row>
  286. <el-row>
  287. <el-col :span="12">
  288. <el-form-item label="维修服务费:">
  289. <p v-if="activeRow" class="visibleCell">
  290. {{ activeRow.amount | moneyFormat }}元
  291. </p>
  292. </el-form-item>
  293. </el-col>
  294. <el-col :span="12">
  295. <el-form-item label="是否乐保乐器:">
  296. <p v-if="activeRow" class="visibleCell">
  297. {{ activeRow.maintenanceStatus ? '是' : '否' }}
  298. </p>
  299. </el-form-item>
  300. </el-col>
  301. </el-row>
  302. <el-row>
  303. <el-col :span="12" v-if="activeRow && activeRow.maintenanceStatus">
  304. <el-form-item label="特权减免金额">
  305. <p v-if="activeRow">
  306. {{ activeRow.exemptionAmount | moneyFormat }}元
  307. </p>
  308. </el-form-item>
  309. </el-col>
  310. <el-col :span="12">
  311. <el-form-item label="应付金额">
  312. <p v-if="activeRow">
  313. {{ activeRow.payableAmount | moneyFormat }}元
  314. </p>
  315. </el-form-item>
  316. </el-col>
  317. </el-row>
  318. <!-- <el-row>
  319. <el-col>
  320. <el-form-item label="实际支付服务费">
  321. {{ 0.0 }}
  322. </el-form-item>
  323. </el-col>
  324. </el-row> -->
  325. <el-form-item
  326. label="问题描述及解决方案:"
  327. style="width: 100%; margin-bottom: 0"
  328. ></el-form-item>
  329. <div>
  330. <el-row>
  331. <el-col :span="5" v-for="url in imgList" :key="url">
  332. <el-card class="box-card" :body-style="{ padding: '0px' }">
  333. <el-image
  334. style="width: 100px; height: 100px"
  335. :src="url"
  336. fit="fill"
  337. :preview-src-list="imgList"
  338. ></el-image>
  339. </el-card>
  340. </el-col>
  341. </el-row>
  342. </div>
  343. <!-- <div>
  344. <el-image
  345. v-for="(item, index) in srcList"
  346. :key="index"
  347. style="width: 100px; height: 100px; margin-right: 10px"
  348. :src="url"
  349. :preview-src-list="srcList"
  350. >
  351. </el-image>
  352. </div> -->
  353. <el-input
  354. type="textarea"
  355. v-if="activeRow"
  356. style="width: 100%"
  357. :rows="3"
  358. v-model="activeRow.description"
  359. :disabled="activeRow && Boolean(activeRow.finishTime)"
  360. ></el-input>
  361. <el-form-item
  362. label="收费组成:"
  363. style="width: 100%; margin-bottom: 0"
  364. v-if="activeRow && activeRow.feeList"
  365. ></el-form-item>
  366. <el-input
  367. type="textarea"
  368. v-if="activeRow && activeRow.feeList"
  369. style="width: 100%"
  370. :rows="3"
  371. v-model="activeRow.feeList"
  372. :disabled="true"
  373. ></el-input>
  374. <el-form-item
  375. label="商品列表:"
  376. style="width: 100%; margin-bottom: 0"
  377. ></el-form-item>
  378. <el-table
  379. style="width: 100%"
  380. v-if="activeRow"
  381. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  382. :data="activeRow.goodsList"
  383. >
  384. <el-table-column
  385. align="center"
  386. prop="name"
  387. label="商品名"
  388. ></el-table-column>
  389. <el-table-column
  390. align="center"
  391. prop="groupPurchasePrice"
  392. label="商品价格(元)"
  393. >
  394. <template slot-scope="scope">
  395. <div>
  396. {{ scope.row.groupPurchasePrice | moneyFormat }}
  397. </div>
  398. </template>
  399. </el-table-column>
  400. </el-table>
  401. </el-form>
  402. <span slot="footer" class="dialog-footer">
  403. <el-button
  404. type="danger"
  405. v-if="!(activeRow && Boolean(activeRow.finishTime))"
  406. v-permission="'studentRepair/repairSuccess'"
  407. @click="repairEnd('save', activeRow)"
  408. >保存</el-button
  409. >
  410. <el-button
  411. type="primary"
  412. v-permission="'studentRepair/repairSuccess'"
  413. v-if="!(activeRow && activeRow.finishTime)"
  414. @click="repairEnd('end', activeRow)"
  415. >完成维修</el-button
  416. >
  417. </span>
  418. </el-dialog>
  419. </div>
  420. </template>
  421. <script>
  422. import axios from "axios";
  423. import { getToken } from "@/utils/auth";
  424. import pagination from "@/components/Pagination/index";
  425. import load from "@/utils/loading";
  426. import { getSoundTree } from "@/api/buildTeam";
  427. import { Export } from '@/utils/downLoadFile'
  428. import qs from 'qs'
  429. import { getTimes } from "@/utils";
  430. import {
  431. findAllTechnician,
  432. studentRepairList,
  433. repairSuccess,
  434. } from "@/api/repairManager";
  435. export default {
  436. components: { pagination },
  437. data() {
  438. return {
  439. searchForm: {
  440. search: null,
  441. employeeId: null,
  442. organIdList: null,
  443. repairStatus: null,
  444. // subjectId: null,
  445. time: [],
  446. exemptionAmount: "",
  447. },
  448. repairVisible: false,
  449. employeeList: [],
  450. tableList: [],
  451. rules: {
  452. // 分页规则
  453. limit: 10, // 限制显示条数
  454. page: 1, // 当前页
  455. total: 0, // 总条数
  456. page_size: [10, 20, 40, 50], // 选择限制显示条数
  457. },
  458. soundLists: [],
  459. soundList: [],
  460. isInit: false,
  461. visibleForm: {},
  462. activeRow: null,
  463. srcList: [],
  464. };
  465. },
  466. //生命周期 - 创建完成(可以访问当前this实例)
  467. created() {},
  468. //生命周期 - 挂载完成(可以访问DOM元素)
  469. mounted() {
  470. if (this.$route.query.studentInstrumentId) {
  471. this.searchForm = {
  472. ...this.searchForm,
  473. ...this.$route.query,
  474. };
  475. this.$router.replace("/otherManager/repairList");
  476. }
  477. findAllTechnician().then((res) => {
  478. if (res.code == 200) {
  479. this.employeeList = res.data;
  480. }
  481. });
  482. this.$store.dispatch("setBranchs");
  483. // 获取声部
  484. getSoundTree({ tenantId: 1, rows: 9999 }).then((res) => {
  485. if (res.code == 200) {
  486. if (res.code == 200) {
  487. this.soundList = res.data.rows;
  488. this.getSound();
  489. }
  490. }
  491. });
  492. // if (!this.isInit) {
  493. this.init();
  494. // }
  495. },
  496. methods: {
  497. init() {
  498. this.isInit = true;
  499. this.getList();
  500. },
  501. getList() {
  502. let obj = JSON.parse(JSON.stringify(this.searchForm));
  503. obj.page = this.rules.page;
  504. obj.rows = this.rules.limit;
  505. if (this.searchForm.timer && this.searchForm.timer.length > 0) {
  506. obj.startTime = this.searchForm.timer[0];
  507. obj.endTime = this.searchForm.timer[1];
  508. }
  509. delete obj.timer;
  510. studentRepairList(obj).then((res) => {
  511. if (res.code == 200) {
  512. this.isInit = false;
  513. this.tableList = res.data.rows;
  514. this.rules.total = res.data.total;
  515. }
  516. });
  517. },
  518. getSound() {
  519. // soundLists
  520. // soundList
  521. this.soundLists = [];
  522. for (let i in this.soundList) {
  523. if (this.soundList[i].subjects.length > 0) {
  524. this.soundLists = this.soundLists.concat(this.soundList[i].subjects);
  525. }
  526. }
  527. },
  528. onReSet() {
  529. this.searchForm = {
  530. search: null,
  531. employeeId: null,
  532. organIdList: null,
  533. repairStatus: null,
  534. // subjectId: null,
  535. time: [],
  536. };
  537. this.search();
  538. },
  539. search() {
  540. this.rules.page = 1;
  541. this.getList();
  542. },
  543. showDetail(row) {
  544. let goodsList = row.goodsJson ? JSON.parse(row.goodsJson) : [];
  545. row.goodsList = goodsList;
  546. let payableAmount = row.amount
  547. goodsList.forEach(item => {
  548. payableAmount += parseFloat(item.discountPrice ? item.discountPrice : item.groupPurchasePrice)
  549. });
  550. payableAmount = (payableAmount - (row.exemptionAmount || 0)).toFixed(2)
  551. row.payableAmount = payableAmount
  552. this.activeRow = row;
  553. this.repairVisible = true;
  554. },
  555. repairEnd(str, row) {
  556. let repairStatus = null;
  557. if (str && str == "end") {
  558. repairStatus = 1;
  559. }
  560. repairSuccess({
  561. repairStatus: repairStatus,
  562. id: row.id,
  563. description: row.description,
  564. }).then((res) => {
  565. if (res.code == 200) {
  566. if (str && str == "end") {
  567. this.$message.success("完成维修");
  568. } else {
  569. this.$message.success("保存成功");
  570. }
  571. this.repairVisible = false;
  572. this.getList();
  573. }
  574. });
  575. },
  576. onExport() {
  577. const {timer, ...rest} = this.searchForm
  578. Export(this, {
  579. url: '/api-web/studentRepair/export',
  580. fileName: '维修单.xls',
  581. method: 'post',
  582. params: qs.stringify({ ...rest, ...getTimes(timer, ["startTime", "endTime"]) })
  583. }, '您确定导出维修单列表?')
  584. }
  585. },
  586. watch: {
  587. repairVisible(val) {
  588. if (!val) {
  589. this.activeRow = null;
  590. }
  591. },
  592. },
  593. computed: {
  594. imgList() {
  595. let activeRow = this.activeRow
  596. let arr = activeRow?.repairImg ? activeRow.repairImg.split(",") : []
  597. return arr;
  598. },
  599. },
  600. };
  601. </script>
  602. <style lang='scss' scoped>
  603. .visibleCell {
  604. // width: 180px;
  605. }
  606. .box-card {
  607. align-items: center;
  608. height: 102px;
  609. width: 102px;
  610. margin-bottom: 20px;
  611. }
  612. </style>