repairList.vue 15 KB

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