| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- <template>
- <el-dialog
- :title="title"
- v-if="visible"
- :visible.sync="visible"
- :before-close="handleClose"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- width="85%"
- >
- <el-card shadow="never">
- <!-- 数据表格 -->
- <user-search @search="reload" />
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- :selection.sync="selection"
- row-key="id"
- >
- <template v-slot:textType="{ row }">
- {{
- row.textType == 1
- ? '数值'
- : row.textType == 2
- ? '选择'
- : row.textType == 3
- ? '上下限'
- : row.textType == 4
- ? '规格'
- : row.textType == 5
- ? '时间'
- : row.textType == 6
- ? '范围'
- : ''
- }}
- </template>
- <template v-slot:type="{ row }">
- {{ getDictValue('质检标准类型', row.type) }}
- </template>
- <template v-slot:toolList="{ row }">
- <div style="display: inline-block;" v-for="(item,idx) in row.toolList" :key="idx">{{ item.name }} <span v-if="row.toolList && idx != row.toolList.length - 1">, </span></div>
- </template>
- </ele-pro-table>
- </el-card>
- <div class="btns">
- <el-button type="primary" size="small" @click="selected">选择</el-button>
- <el-button size="small" @click="handleClose">关闭</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import { getList } from '@/api/inspectionProject';
- import UserSearch from '@/views/inspectionProject/components/user-search.vue';
- import dictMixins from '@/mixins/dictMixins';
- export default {
- components: {
- UserSearch
- },
- mixins: [dictMixins],
- data() {
- return {
- visible: false,
- title: '选择质检项',
- columns: [
- {
- columnKey: 'selection',
- type: 'selection',
- width: 45,
- align: 'center',
- reserveSelection: true
- },
- {
- prop: 'inspectionCode',
- label: '参数编码',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'inspectionName',
- label: '参数名称',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'textType',
- label: '参数类型',
- showOverflowTooltip: true,
- align: 'center',
- slot: 'textType',
- minWidth: 110
- },
- {
- prop: 'maxValue',
- label: '参数上限',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'minValue',
- label: '参数下限',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'defaultValue',
- label: '默认值',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '工艺要求',
- prop: 'inspectionStandard',
- formatter: (row, column, cellValue) => {
- return row.symbol + ' ' + cellValue + ' ' + row.unit;
- },
- minWidth: 150
- },
- {
- label: '标准类型',
- prop: 'type',
- slot: 'type'
- },
- {
- prop: 'qualityStandardName',
- label: '标准名称',
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'toolList',
- slot: 'toolList',
- label: '设备名称',
- align: 'center',
- minWidth: 150
- },
- {
- label: '状态',
- prop: 'status',
- formatter: (row, column, cellValue) => {
- return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
- }
- },
- {
- label: '备注',
- prop: 'inspectionRemark'
- },
-
- ],
- // 表格选中数据
- selection: [],
- processData: [],
- categoryId: null
- };
- },
- watch: {},
- methods: {
- open(categoryId) {
- this.categoryId = categoryId;
- this.visible = true;
- },
- /* 表格数据源 */
- async datasource({ page, limit, where }) {
-
- const res = await getList({
- ...where,
- categoryLevelId: this.categoryId,
- pageNum: page,
- size: limit
- });
-
- return res;
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ page: 1, where: where });
- },
- handleClose() {
- this.visible = false;
- this.$refs.table.setSelectedRows([]);
- this.selection = [];
- },
- selected() {
- if (!this.selection.length) {
- this.$message.error('请至少选择一条数据');
- return;
- }
- let _arr = [];
- _arr = this.selection.map((m) => {
- return {
- inspectionItemId: m.id,
- status: 1,
- mode: null,
- version: null,
- categoryLevelId: this.categoryId,
- rootCategoryLevelId: '12'
- };
- });
- this.$emit('chooseProcess', _arr);
- this.handleClose();
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .btns {
- text-align: center;
- padding: 10px 0;
- }
- </style>
|