repairList.vue 14 KB

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