123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <template>
- <a-modal
- title="方案库"
- :width="1000"
- :visible="visible"
- :confirmLoading="confirmLoading"
- @cancel="handleCancel"
- :footer="null"
- >
- <div v-show="show">
- <div>
- <a-form layout="inline">
- <a-row >
- <a-col :md="8" :sm="24">
- <a-form-item label="关键字">
- <a-input style="width: 100%" v-model="keyword" placeholder="请输入关键字!"/>
- </a-form-item>
- </a-col>
- <a-col :md="8" :sm="24">
- <a-form-item label="故障类别">
- <a-select style="width: 200px" v-model="errorTypeId">
- <a-select-option v-for="item in errorType" :key="item.id" :value="item.id">
- {{ item.title }}
- </a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :md="8" :sm="24">
- <span class="table-page-search-submitButtons">
- <a-button type="primary" @click="getInfo">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <a-table
- :columns="columns"
- :data-source="dataSource"
- bordered
- :defaultExpandAllRows="true"
- >
- <template v-slot:index="text,record,index">
- {{ index+1 }}
- </template>
- <template v-slot:errorTypeId="text,record">
- {{ errorType.find(item=>item.id===text).title }}
- </template>
- <template v-slot:action="text,record">
- <a-button type="link" @click="addRepairSchemes(record)"> 获取 </a-button>
- <a-button type="link" @click="handleViewRepairResolve(record)"> 查看</a-button>
- </template>
- </a-table>
- </div>
- <resolve-detail ref="resolveDetail" @ok="handleOk"/>
- </a-modal>
- </template>
- <script>
- import { getRepairSchemePage, addRepairSchemes, getRepairType, fetchRepairScheme } from '@/api/repair/repair'
- import ResolveDetail from '@/views/repair/repair/modules/Detail'
- export default {
- name: 'LongYanSelectSpareForm',
- data () {
- return {
- model: null,
- visible: false,
- show: true,
- confirmLoading: false,
- keyword: '',
- errorTypeId: '',
- dataSource: [],
- errorType: [],
- columns: [
- {
- title: '序号',
- key: 'index',
- align: 'center',
- width: 50,
- scopedSlots: { customRender: 'index' }
- },
- {
- title: '故障描述',
- width: 150,
- dataIndex: 'errorContent'
- },
- {
- title: '方案描述',
- dataIndex: 'opinion',
- width: 150
- },
- {
- title: '故障类别',
- dataIndex: 'errorTypeId',
- width: 100,
- scopedSlots: { customRender: 'errorTypeId' }
- },
- {
- title: '操作',
- key: 'action',
- align: 'center',
- width: 100,
- scopedSlots: { customRender: 'action' }
- }
- ]
- }
- },
- components: {
- ResolveDetail
- },
- props: {
- },
- created () {
- // 下拉框map
- },
- methods: {
- base (record) {
- getRepairType().then(res => {
- this.errorType = res.data
- })
- this.visible = true
- this.model = record
- console.log(record)
- this.getInfo()
- },
- getInfo () {
- getRepairSchemePage({
- keyword: this.keyword,
- errorTypeId: this.errorTypeId,
- dataScope: {
- sortBy: 'desc',
- sortName: 'created_time'
- }
- }).then(res => {
- this.dataSource = res.data.rows
- })
- },
- resetSearchForm () {
- this.keyword = ''
- this.errorTypeId = ''
- this.getInfo()
- },
- handleViewRepairResolve (record) {
- this.show = false
- fetchRepairScheme({ id: record.id }).then(res => {
- const modal = this.$refs.resolveDetail
- modal.base(res.data)
- })
- },
- addRepairSchemes (val) {
- addRepairSchemes({
- id: val.id,
- repairId: this.model.id
- }).then(res => {
- this.$message.success('添加成功!')
- this.handleCancel()
- })
- },
- handleOk () {
- this.show = true
- },
- handleCancel () {
- this.visible = false
- this.confirmLoading = false
- this.keyword = ''
- this.errorTypeId = ''
- this.$emit('ok')
- }
- }
- }
- </script>
|