1.0
zss
2023-11-15 a96e9c262ebadc2e7e731b28aa5035b0dd2a7aad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<template>
  <el-dialog
    width="60%"
    title="检测标准编"
    top="5vh"
    :visible.sync="innerVisible"
    append-to-body
    @close="$emit('update:currshowlist', false)"
    :show="currshowlist"
    class="part-dialog"
  >
    <el-table
      border
      v-loading="listLoading"
      :data="dataList"
      height="300px"
      @row-dblclick="doubleClick"
      @row-click="rowClick"
      highlight-current-row
      @current-change="handleCurrentChange"
    >
      <el-table-column align="center" width="55" label="单选">
        <template slot-scope="scope">
          <el-checkbox
            class="detail-ifs-location-table-single-checkbox"
            v-model="scope.row.rowChecked"
          ></el-checkbox>
        </template>
      </el-table-column>
      <el-table-column prop="standardNo" label="标准编号"></el-table-column>
      <el-table-column prop="standardName" label="标准名称"></el-table-column>
    </el-table>
    <span slot="footer" class="dialog-footer">
      <el-button @click="innerVisible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>
 
<script>
import { getObj, qryDocTestStandard } from '@/api/technology/document'
import { getObj as getTechnologyDetail } from '@/api/technology/routing'
import { getRoutingTestStandardList } from '@/api/plan/moteststandard'
 
export default {
  props: {
    currshowlist: {
      type: Boolean,
      default: false
    },
    multiSelect: {
      type: Boolean,
      default: false
    },
    queryObject: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      dataList: [],
      listLoading: false,
      currentRow: null,
      multipleSelection: [],
      innerVisible: false,
      visible: false,
      dataRule: {}
    }
  },
  watch: {
    currshowlist() {
      this.innerVisible = this.currshowlist
      if (this.currshowlist) {
        this.getData()
      }
    },
    innerVisible: {
      handler(newValue, oldValue) {
        if (newValue) {
          this.dataList = []
        }
      },
      immediate: true
    }
  },
  methods: {
    getData() {
      var obj = {
        docBomId: this.queryObject.bomRoutingId,
        routingOperationId: this.queryObject.routingOperationId
      }
      qryDocTestStandard(obj).then((res) => {
        this.dataList = res.data.data
        console.log(this.dataList)
      })
    },
    doubleClick() {
      this.dataFormSubmit()
    },
    rowClick(row) {
      this.currentRow = row
      this.dataFormId.forEach((item) => {
        if (row.id !== item.id) {
          this.$set(item, 'rowChecked', false)
        } else {
          this.$set(item, 'rowChecked', true)
        }
      })
    },
    handleCurrentChange(row) {
      if (row != null) {
        this.dataList.forEach((item) => {
          // 排他,每次选择时把其他选项都清除
          if (item.id !== row.id) {
            item.rowChecked = false
          } else {
            item.rowChecked = true
          }
        })
      } else {
        this.dataList.forEach((item) => {
          // 选项都清除
          item.rowChecked = false
        })
      }
      this.currentRow = row
    },
    dataFormSubmit() {
      if (this.currentRow == null) {
        this.$message.error('请选择数据')
        return
      }
      // if (this.multiSelect) {
      //   this.$emit('handleSelectionChange', this.multipleSelection)
      // } else {
      this.$emit('listenToPartEvent', this.currentRow)
      // }
      this.innerVisible = false
    }
  }
}
</script>