chenlu
2024-02-20 6965db086df978e46e0a1bd7227b981ad48a9b1c
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
<script setup>
import {onMounted, reactive, ref} from "vue"
import {useRouter,useRoute} from "vue-router"
import request from "@/utils/request"
import {ElMessage} from "element-plus";
const router = useRouter()
const route = useRoute()
let dialogTableVisible = ref(false)
const xGrid = ref()
const gridOptions = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe:true,//斑马纹楼号
  rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮
  id: 'OrderList',
  showFooter: true,//显示脚
  printConfig: {},
  importConfig: {},
  exportConfig: {},
  scrollY:{ enabled: true },//开启虚拟滚动
  showOverflow:true,
  columnConfig: {
    resizable: true,
    useKey: true
  },
  filterConfig: {   //筛选配置项
    remote: true
  },
  customConfig: {
    storage: true
  },
  editConfig: {
    trigger: 'click',
    mode: 'row',
    showStatus: true
  },//表头参数
  columns:[
    {title: '操作', width: 110, slots: { default: 'button_slot' },fixed:"left",},
    {field: 'orderDetail.orderNumber',width:120,  title: '序号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    //{field: 'orderDetail.buildingNumber',width:120,  title: '楼号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'orderDetail.productName',width:120,  title: '成品名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'glassAddress',width:120,  title: '标记',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'glassChild',width:120,  title: '子产品',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'orderDetail.width',width:120,  title: '成品宽',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'orderDetail.height',width:120,  title: '成品高',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'orderDetail.shape',width:120,  title: '形状',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'orderDetail.grossArea',width:120,  title: '总尺寸',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'childWidth',width:120,  title: '单片宽',editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'childHeight',width:120,  title: '单片高',editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'orderDetail.area',width:120,  title: '单片尺寸',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'orderDetail.quantity',width:120,  title: '数量',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'process',width:120,  title: '工艺流程',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'orderDetail.processingNote',width:120,  title: '加工要求',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'orderDetail.remarks',width:120,  title: '备注',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'orderDetail.edgingType',width:120,  title: '磨边类型',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}
  ],//表头按钮
  mergeCells: [
    { row: 0, col: 1, rowspan: 4, colspan: 1 },
    { row: 0, col: 2, rowspan: 4, colspan: 1 },
    { row: 0, col: 4, rowspan: 4, colspan: 1 },
    { row: 0, col: 5, rowspan: 4, colspan: 1 },
    { row: 0, col: 6, rowspan: 4, colspan: 1 },
    { row: 0, col: 7, rowspan: 4, colspan: 1 },
    { row: 0, col: 8, rowspan: 4, colspan: 1 },
  ],
  toolbarConfig: {
    buttons: [
      {'code': 'remarks', 'name': '加工要求'},
      {'code': 'Craft', 'name': '订单详情',status: 'primary'},
      {'code': 'review', 'name': '审核',status: 'primary'},
    ],
    // import: false,
    // export: true,
    // print: true,
    zoom: true,
    custom: true
  },
  footerMethod ({ columns, data }) {//页脚函数
    return[
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return '合计:'
        }
        // if (props.tableProp.footList.includes(column.field)) {
        //   return sumNum(data, column.field)
        // }
        return ''
      })
    ]
  }
 
})
 
const gridEvents = {
  toolbarButtonClick ({ code }) {
    const $grid = xGrid.value
    if ($grid) {
      switch (code) {
        case 'Craft': {
          router.push({path: '/main/order/createOrder', query: { orderId: titleUploadData.value.orderId }})
          break
        }
        case 'review': {
          reviewOrderCraft(2)
          break
        }
        case 'reviews': {//反审
          reviewOrderCraft(0)
          break
        }
        case 'remarks':  {
          dialogTableVisible.value=true
          break
        }
      }
    }
  }
}
// 定义表头上传数据
const titleUploadData = ref({
  project:'',
  orderType:'',
  customerId:'',
  customerName:'',
  icon:'',
  orderClassify:'',
  packType:'',
  orderId:'',
  deliveryDate:'',
  batch:'',
  calculateType:'',
  salesmanId:'',
  salesman:'',
  alType:'',
  money:'',
  contractId:'',
  customerBatch:'',
  contacts:'',
  contactNumber:'',
  deliveryAddress:'',
  otherMoney:'',
  otherMoneyRemarks:'',
  processingNote:''
})
 
//初始化判断是否有id传入
onMounted(()=>{
  const str = route.query.orderId
  if (typeof str === 'undefined' || str === null || str === '' || str === '\n' || str === '\r'){
    return
  }
  request.post(`/order/getOrderCraftById/${str}`).then((res) => {
    if(res.code==200){
      console.log(res.data)
      titleUploadData.value = res.data.order
 
      //取消审核按钮禁用
      if(res.data.order.processReview === 2 ){
        //gridOptions.toolbarConfig.buttons[2].disabled = false
        gridOptions.toolbarConfig.buttons[2].code='reviews'
        gridOptions.toolbarConfig.buttons[2].name='反审'
 
      }
 
      //按钮审核过后变为反审
      if(res.data.order.orderReview === 2){
        gridOptions.toolbarConfig.buttons[2].disabled = true
 
      }
 
      xGrid.value.reloadData(res.data.orderGlassDetails)
 
      //xGrid.value.reloadData(res.data.orderDetails)
    }else{
      ElMessage.error(res.msg)
    }
  })
})
const reviewOrderCraft = (state) => {
  request.post(`/order/reviewProcessById/${titleUploadData.value.orderId}/${state}`).then(res =>{
    if(res.code==200){
      gridOptions.toolbarConfig.buttons[2].disabled = true
      if(state==2){
        ElMessage.success('审核成功!')
      }else if (state==0){
        ElMessage.success('反审成功!')
      }
      setTimeout(() =>{
        location.reload()
      },1500)
 
    }else{
      ElMessage.error(res.msg)
    }
  })
}
</script>
 
<template>
  <div class="main-div">
 
    <div class="order-primary" style="background-color: white">
      <el-row>
        <el-col  :span="4"><el-text>销售单号:</el-text></el-col>
        <el-col  :span="4"><el-text>{{titleUploadData.orderId}}</el-text></el-col>
        <el-col  :span="4"><el-text>客户名称:</el-text></el-col>
        <el-col  :span="4"><el-text>{{titleUploadData.customerName}}</el-text></el-col>
        <el-col  :span="4"><el-text>项目名称:</el-text></el-col>
        <el-col  :span="4"><el-text>{{titleUploadData.project}}</el-text></el-col>
      </el-row>
      <el-row>
        <el-col  :span="4"><el-text>订单批次:</el-text></el-col>
        <el-col  :span="4"><el-text>{{titleUploadData.batch}}</el-text></el-col>
        <el-col  :span="4"><el-text>订单类型:</el-text></el-col>
        <el-col  :span="4"><el-text>{{ titleUploadData.orderType }}</el-text></el-col>
        <el-col  :span="4"><el-text>业务员</el-text></el-col>
        <el-col  :span="4"><el-text>{{titleUploadData.salesman}}</el-text></el-col>
      </el-row>
      <el-row>
        <el-col  :span="4"><el-text>包装方式:</el-text></el-col>
        <el-col  :span="4"><el-text>{{titleUploadData.packType}}</el-text></el-col>
        <el-col  :span="4"><el-text>交货日期:</el-text></el-col>
        <el-col  :span="4"><el-text>{{titleUploadData.deliveryDate}}</el-text></el-col>
      </el-row>
    </div>
    <div class="order-detail">
 
      <vxe-grid
          max-height="97%"
          class="mytable-scrollbar"
          ref="xGrid"
          v-bind="gridOptions"
          v-on="gridEvents"
 
      >
        <!--      下拉显示所有信息插槽-->
        <template #content="{ row}">
          <ul class="expand-wrapper">
            <li  v-for="(item,key,index) in row">
              <span style="font-weight: bold">{{key+':  '}}</span>
              <span>{{ item }}</span>
            </li>
          </ul>
        </template>
 
        <!--左边固定显示的插槽-->
        <template #button_slot="{ row }">
          <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">修改工艺</el-button>
        </template>
 
        <template #num1_filter="{ column, $panel }">
          <div>
            <div v-for="(option, index) in column.filters" :key="index">
              <input type="type" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/>
            </div>
          </div>
        </template>
      </vxe-grid>
 
    </div>
    <el-dialog v-model="dialogTableVisible" title="加工要求" style="width: 60%;height:75% ">
      <el-input
          v-model="titleUploadData.processingNote"
          type="textarea"
          :autosize="{ minRows: 2, maxRows: 20 }"
      />
    </el-dialog>
  </div>
</template>
 
<style scoped>
.main-div {
  width: 100%;
  height: 100%;
  text-align: center;
}
.el-col{
  border: #181818 1px solid;
}
.order-primary{
  width: 100%;
}
.order-detail{
  width: 100%;
  height: 90%;
}
 
</style>