廖井涛
7 天以前 a660db06773007b1be690e0674829c00a57aeb7b
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<script setup>
import {nextTick, onMounted, reactive, ref, watch} from "vue";
import request from "@/utils/request";
import {useI18n} from "vue-i18n";
import {ElMessage} from "element-plus";
import deepClone from "@/utils/deepClone";
const { t } = useI18n()
 
const xGrid = ref()
 
const checkboxCellRender = reactive({
  name: 'VxeCheckboxGroup',
  options: [
    { label: '幕墙模式', value: '1' },
    { label: '允许横排', value: '2' },
    { label: '钢化', value: '3' },
 
  ]
})
 
const gridOptions = reactive({
 
  height:'100%',
  loading: false,
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 30, useKey: true},//鼠标移动或选择高亮
  id: 'ComputeCard',
  scrollX:{enabled: true},
  scrollY:{ enabled: true ,gt:0},//开启虚拟滚动
  showOverflow:true,
  columnConfig: {
    resizable: true,
    useKey: true
  },
  filterConfig: {   //筛选配置项
    remote: true
  },
  customConfig: {
    storage: true
  },
  editConfig: {
    trigger: 'click',
    mode: 'row',
    showStatus: true
  },
 
  columns:[
    {type: 'seq', title: t('basicData.Number'), width: 80},
    {field: 'curtain_wall',title: '幕墙模式',width: 80, slots: { default: 'state1' }},
    {field: "allow_rotate", title: '允许横排', width: 80, slots: { default: 'state2' }},
    {field: "tempering", title: '钢化', width: 80, slots: { default: 'state3' }},
 
    {field: 'processId',width: 150, title: t('processCard.processId'), sortable: true},
    {field: 'technologyNumber',width: 70, title: '层', sortable: true},
    {field: 'total_layers',width: 150, title: '总层数', sortable: true},
    {field: 'TotalNumber',width: 150, title: '规格', sortable: true},
    {field: 'total_num',width: 150, title: t('order.quantity'), sortable: true},
    {field: 'glass_child',width: 150, title: t('order.product'), sortable: true},
    {field: 'project', width:150, title: t('order.project'), showOverflow: "ellipsis"},
    {field: 'total_area',width: 150, title: t('order.area'), sortable: true},
 
 
  ],//表头参数
  data:null,//表格数据
 
  toolbarConfig: {
    buttons: [],
    zoom: true,
    custom: true
  },
 
})
 
let emit = defineEmits([
  'changeDialog','upProcessId', 'sendData'
]);
 
 
const selectFullData =  () => {
  return xGrid.value.getTableData().fullData
}
 
 
const props = defineProps({
  tableData: Array,
  processId: null,
  technologyNumber: null,
  patchState: null,
});
 
 
 
 
watch(() => props.tableData, async (newData) => {
  if (Array.isArray(newData)) {
    console.log(newData)
    xGrid.value.loadData(deepClone(newData))
    const data = xGrid.value.getTableData().fullData
    data.forEach(item => {
      item.tempering = item.tempering === 1;
      item.allow_rotate = item.allow_rotate === 1;
      item.curtain_wall = item.curtain_wall === 1;
    })
  }
});
 
 
 
 
let process_id = ref()
//获取流程卡号详情
let rowClickIndex = ref(null)
const gridEvents = {
  cellClick({row}) {
    rowClickIndex.value = row
    // Emit 事件将更新后的值传递给父组件
    emit('upProcessId', rowClickIndex.value.processId,rowClickIndex.value.technologyNumber);
    emit('updateTechnologyNumber', rowClickIndex.value.processId,rowClickIndex.value.technologyNumber);
  }
}
 
defineExpose({selectFullData})
</script>
 
<template>
  <div style="width: 100%;height: 100%">
    <span>流程卡</span>
    <vxe-grid
        size="small"
        height="100%"
        class="mytable-scrollbar"
        ref="xGrid"
        v-bind="gridOptions"
        v-on="gridEvents"
    >
      <template #num2_filter="{ column, $panel }">
        <div>
          <div v-for="(option, index) in column.filters" :key="index">
            <vxe-select v-model="option.data" :placeholder="$t('processCard.pleaseSelect')"  @change="changeFilterEvent($event, option, $panel)">
              <vxe-option value="0" :label="$t('basicData.unchecked')"></vxe-option>
              <vxe-option value="1" :label="$t('basicData.selected')"></vxe-option>
            </vxe-select>
          </div>
        </div>
      </template>
 
      <template #num1_filter="{ column, $panel }">
        <div>
          <div v-for="(option, index) in column.filters" :key="index">
            <input
 
                type="type"
                v-model="option.data"
                @keyup.enter.native="$panel.confirmFilter()"
                @input="changeFilterEvent($event, option, $panel)"/>
          </div>
        </div>
      </template>
 
      <template #state1="{ row,column}">
        <el-checkbox
            v-model="row.curtain_wall"/>
      </template>
      <template #state2="{ row,column}">
        <el-checkbox
            v-model="row.allow_rotate"/>
      </template>
      <template #state3="{ row,column}">
        <el-checkbox
            v-model="row.tempering"/>
      </template>
    </vxe-grid>
  </div>
</template>
 
<style scoped>
:deep(.vxe-tools--operate){
  height: 20px;
  margin-top: -20px;
}
 
</style>