SchemeLibrary.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <a-modal
  3. title="方案库"
  4. :width="1000"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. @cancel="handleCancel"
  8. :footer="null"
  9. >
  10. <div v-show="show">
  11. <div>
  12. <a-form layout="inline">
  13. <a-row >
  14. <a-col :md="8" :sm="24">
  15. <a-form-item label="关键字">
  16. <a-input style="width: 100%" v-model="keyword" placeholder="请输入关键字!"/>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="8" :sm="24">
  20. <a-form-item label="故障类别">
  21. <a-select style="width: 200px" v-model="errorTypeId">
  22. <a-select-option v-for="item in errorType" :key="item.id" :value="item.id">
  23. {{ item.title }}
  24. </a-select-option>
  25. </a-select>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :md="8" :sm="24">
  29. <span class="table-page-search-submitButtons">
  30. <a-button type="primary" @click="getInfo">查询</a-button>
  31. <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
  32. </span>
  33. </a-col>
  34. </a-row>
  35. </a-form>
  36. </div>
  37. <a-table
  38. :columns="columns"
  39. :data-source="dataSource"
  40. bordered
  41. :defaultExpandAllRows="true"
  42. >
  43. <template v-slot:index="text,record,index">
  44. {{ index+1 }}
  45. </template>
  46. <template v-slot:errorTypeId="text,record">
  47. {{ errorType.find(item=>item.id===text).title }}
  48. </template>
  49. <template v-slot:action="text,record">
  50. <a-button type="link" @click="addRepairSchemes(record)"> 获取 </a-button>
  51. <a-button type="link" @click="handleViewRepairResolve(record)"> 查看</a-button>
  52. </template>
  53. </a-table>
  54. </div>
  55. <resolve-detail ref="resolveDetail" @ok="handleOk"/>
  56. </a-modal>
  57. </template>
  58. <script>
  59. import { getRepairSchemePage, addRepairSchemes, getRepairType, fetchRepairScheme } from '@/api/repair/repair'
  60. import ResolveDetail from '@/views/repair/repair/modules/Detail'
  61. export default {
  62. name: 'LongYanSelectSpareForm',
  63. data () {
  64. return {
  65. model: null,
  66. visible: false,
  67. show: true,
  68. confirmLoading: false,
  69. keyword: '',
  70. errorTypeId: '',
  71. dataSource: [],
  72. errorType: [],
  73. columns: [
  74. {
  75. title: '序号',
  76. key: 'index',
  77. align: 'center',
  78. width: 50,
  79. scopedSlots: { customRender: 'index' }
  80. },
  81. {
  82. title: '故障描述',
  83. width: 150,
  84. dataIndex: 'errorContent'
  85. },
  86. {
  87. title: '方案描述',
  88. dataIndex: 'opinion',
  89. width: 150
  90. },
  91. {
  92. title: '故障类别',
  93. dataIndex: 'errorTypeId',
  94. width: 100,
  95. scopedSlots: { customRender: 'errorTypeId' }
  96. },
  97. {
  98. title: '操作',
  99. key: 'action',
  100. align: 'center',
  101. width: 100,
  102. scopedSlots: { customRender: 'action' }
  103. }
  104. ]
  105. }
  106. },
  107. components: {
  108. ResolveDetail
  109. },
  110. props: {
  111. },
  112. created () {
  113. // 下拉框map
  114. },
  115. methods: {
  116. base (record) {
  117. getRepairType().then(res => {
  118. this.errorType = res.data
  119. })
  120. this.visible = true
  121. this.model = record
  122. console.log(record)
  123. this.getInfo()
  124. },
  125. getInfo () {
  126. getRepairSchemePage({
  127. keyword: this.keyword,
  128. errorTypeId: this.errorTypeId,
  129. dataScope: {
  130. sortBy: 'desc',
  131. sortName: 'created_time'
  132. }
  133. }).then(res => {
  134. this.dataSource = res.data.rows
  135. })
  136. },
  137. resetSearchForm () {
  138. this.keyword = ''
  139. this.errorTypeId = ''
  140. this.getInfo()
  141. },
  142. handleViewRepairResolve (record) {
  143. this.show = false
  144. fetchRepairScheme({ id: record.id }).then(res => {
  145. const modal = this.$refs.resolveDetail
  146. modal.base(res.data)
  147. })
  148. },
  149. addRepairSchemes (val) {
  150. addRepairSchemes({
  151. id: val.id,
  152. repairId: this.model.id
  153. }).then(res => {
  154. this.$message.success('添加成功!')
  155. this.handleCancel()
  156. })
  157. },
  158. handleOk () {
  159. this.show = true
  160. },
  161. handleCancel () {
  162. this.visible = false
  163. this.confirmLoading = false
  164. this.keyword = ''
  165. this.errorTypeId = ''
  166. this.$emit('ok')
  167. }
  168. }
  169. }
  170. </script>