22
schangxiang@126.com
2024-12-15 c1c1b1f95b0880cd58afadb98d6933287fe6311c
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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<template>
  <div class="wmsRecordPackageProcess-container">
    <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> 
      <el-form :model="queryParamsWmsRecordPackageProcess" ref="queryForm" labelWidth="90">
        <el-row>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
            <el-form-item label="关键字">
              <el-input v-model="queryParamsWmsRecordPackageProcess.searchKey" clearable="" placeholder="包装号,生产单号,批次号,订单号,位置,备注,创建人"/>
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUIWmsRecordPackageProcess">
            <el-form-item label="包装号">
              <el-input v-model="queryParamsWmsRecordPackageProcess.packageCode" clearable="" placeholder="请输入包装号"/>
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUIWmsRecordPackageProcess">
            <el-form-item label="生产单号">
              <el-input v-model="queryParamsWmsRecordPackageProcess.info5" clearable="" placeholder="请输入生产单号"/>
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUIWmsRecordPackageProcess">
            <el-form-item label="批次号">
              <el-input v-model="queryParamsWmsRecordPackageProcess.planNo" clearable="" placeholder="请输入批次号"/>
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUIWmsRecordPackageProcess">
            <el-form-item label="订单号">
              <el-input v-model="queryParamsWmsRecordPackageProcess.orderId" clearable="" placeholder="请输入订单号"/>
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUIWmsRecordPackageProcess">
            <el-form-item label="包状态">
              <el-select clearable="" v-model="queryParamsWmsRecordPackageProcess.upiStatus" placeholder="请选择包状态">
                <el-option v-for="(item,index) in getEnumUpiStatusData_Index" :key="index" :value="item.value" :label="`${item.describe}`" />
                
              </el-select>
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUIWmsRecordPackageProcess">
            <el-form-item label="标记">
              <el-select clearable="" v-model="queryParamsWmsRecordPackageProcess.upiFlag" placeholder="请选择标记">
                <el-option v-for="(item,index) in getEnumUpiFlagData_Index" :key="index" :value="item.value" :label="`${item.describe}`" />
                
              </el-select>
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUIWmsRecordPackageProcess">
            <el-form-item label="位置">
              <el-input v-model="queryParamsWmsRecordPackageProcess.location" clearable="" placeholder="请输入位置"/>
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUIWmsRecordPackageProcess">
            <el-form-item label="备注">
              <el-input v-model="queryParamsWmsRecordPackageProcess.operRemark" clearable="" placeholder="请输入备注"/>
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUIWmsRecordPackageProcess">
            <el-form-item label="创建时间">
              <el-date-picker placeholder="请选择创建时间" value-format="YYYY/MM/DD  HH:mm:ss" type="datetimerange" :default-time="defaultTimeRange" v-model="queryParamsWmsRecordPackageProcess.createTimeRange" />
              
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" class="mb10">
            <el-form-item>
              <el-button-group style="display: flex; align-items: center;">
                <el-button type="primary"  icon="ele-Search" @click="handleQueryWmsRecordPackageProcess" v-auth="'wmsRecordPackageProcess:page'" :disabled="disabled_btnWmsRecordPackageProcess"> 查询 </el-button>
                      <el-button icon="ele-Refresh" @click="resetWmsRecordPackageProcess"> 重置 </el-button>
                        <el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUIWmsRecordPackageProcess" v-if="!showAdvanceQueryUIWmsRecordPackageProcess" style="margin-left:5px;"> 高级查询 </el-button>
                        <el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUIWmsRecordPackageProcess" v-if="showAdvanceQueryUIWmsRecordPackageProcess" style="margin-left:5px;"> 隐藏 </el-button>
                <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddWmsRecordPackageProcess" v-auth="'wmsRecordPackageProcess:add'"> 新增 </el-button>
                <el-button type="primary" style="margin-left:5px;" icon="ele-Download" @click="handleExportExcelWmsRecordPackageProcess"  v-auth="'wmsRecordPackageProcess:exportExcel'" > 导出 </el-button>
              </el-button-group>
            </el-form-item>
            
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <el-card class="full-table" shadow="hover" style="margin-top: 5px">
      <el-table
                ref="tableRefWmsRecordPackageProcess"
                :data="tableDataWmsRecordPackageProcess"
                style="width: 100%"
                v-loading="loadingWmsRecordPackageProcess"
                tooltip-effect="light"
                                row-key="id"
                @sort-change="sortChangeWmsRecordPackageProcess"
                border="">
        <el-table-column type="index" label="序号" width="55" align="center"/>
        <el-table-column prop="packageCode" label="包装号"  show-overflow-tooltip="" />
        <el-table-column prop="info5" label="生产单号"  show-overflow-tooltip="" />
        <el-table-column prop="planNo" label="批次号"  show-overflow-tooltip="" />
        <el-table-column prop="orderId" label="订单号"  show-overflow-tooltip="" />
          <el-table-column prop="upiStatus" label="包状态"  show-overflow-tooltip="" >
            <template #default="scope">
              <el-tag>{{ getEnumDesc(scope.row.upiStatus, getEnumUpiStatusData_Index)}}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="upiFlag" label="标记"  show-overflow-tooltip="" >
            <template #default="scope">
              <el-tag>{{ getEnumDesc(scope.row.upiFlag, getEnumUpiFlagData_Index)}}</el-tag>
            </template>
          </el-table-column>
        <el-table-column prop="location" label="位置"  show-overflow-tooltip="" />
        <el-table-column prop="operRemark" label="备注"  show-overflow-tooltip="" />
         <el-table-column prop="createTime" label="创建时间" width="130" :formatter="formatDate_T_Time"  show-overflow-tooltip="" />
        <el-table-column prop="createUserName" label="创建人"  show-overflow-tooltip="" />
        <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('wmsRecordPackageProcess:update') || auth('wmsRecordPackageProcess:delete')">
          <template #default="scope">
            <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWmsRecordPackageProcess(scope.row)" v-auth="'wmsRecordPackageProcess:update'"> 编辑 </el-button>
            <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWmsRecordPackageProcess(scope.row)" v-auth="'wmsRecordPackageProcess:delete'"> 删除 </el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
                v-model:currentPage="tableParamsWmsRecordPackageProcess.page"
                v-model:page-size="tableParamsWmsRecordPackageProcess.pageSize"
                :total="tableParamsWmsRecordPackageProcess.total"
                :page-sizes="[10, 20, 50, 100, 200, 500]"
                small=""
                background=""
                @size-change="handleSizeChangeWmsRecordPackageProcess"
                @current-change="handleCurrentChangeWmsRecordPackageProcess"
                layout="total, sizes, prev, pager, next, jumper"
    />
      <printDialogWmsRecordPackageProcess
        ref="printDialogRefWmsRecordPackageProcess"
        :title="printWmsRecordPackageProcessTitle"
        @reloadTable="handleQueryWmsRecordPackageProcess" />
      <editDialogWmsRecordPackageProcess
        ref="editDialogRefWmsRecordPackageProcess"
        :title="editWmsRecordPackageProcessTitle"
        @reloadTable="handleQueryWmsRecordPackageProcess"
      />
    </el-card>
  </div>
</template>
 
<script lang="ts" setup="" name="wmsRecordPackageProcess">
  import { ref,onMounted } from "vue";
  import { ElMessageBox, ElMessage } from "element-plus";
  import { auth } from '/@/utils/authFunction';
  import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
  import { formatDate,formatDate_T_Date,formatDate_T_Time,defaultTimeRange } from '/@/utils/formatTime';
  import { exportPageExcel } from '/@/utils/exportPageExcel' //引入导出方法
 
 
  import printDialogWmsRecordPackageProcess from '/@/views/system/print/component/hiprint/preview.vue'
  import { pageWmsRecordPackageProcess, deleteWmsRecordPackageProcess,importExcelWmsRecordPackageProcess,downloadExcelTemplateWmsRecordPackageProcess } from '/@/api/main/ReportCenter/wmsRecordPackageProcess';
    import { getAPI } from '/@/utils/axios-utils';
    import { SysEnumApi } from '/@/api-services/api';
  import commonFunction from '/@/utils/commonFunction';
 
  const getEnumUpiStatusData_Index = ref<any>([]);
  const getEnumUpiFlagData_Index = ref<any>([]);
 
    const { getEnumDesc } = commonFunction();
  
  /***************************************************[包过程履历操作]开始***************************************************/
  const showAdvanceQueryUIWmsRecordPackageProcess = ref(false);
  const tableRefWmsRecordPackageProcess = ref(null);
  const printDialogRefWmsRecordPackageProcess = ref();
  const editDialogRefWmsRecordPackageProcess = ref();
  const loadingWmsRecordPackageProcess = ref(false);
  const disabled_btnWmsRecordPackageProcess = ref(false);
  const tableDataWmsRecordPackageProcess = ref<any>([]);
  const queryParamsWmsRecordPackageProcess = ref<any>({});
  const tableParamsWmsRecordPackageProcess = ref({
    page: 1,
    pageSize: 10,
    total: 0,
  });
 
  const printWmsRecordPackageProcessTitle = ref("");
  const editWmsRecordPackageProcessTitle = ref("");
 
  // 改变高级查询的控件显示状态
  const changeAdvanceQueryUIWmsRecordPackageProcess = () => {
    showAdvanceQueryUIWmsRecordPackageProcess.value = !showAdvanceQueryUIWmsRecordPackageProcess.value;
  }
 
  // 查询包过程履历
  const handleQueryWmsRecordPackageProcess = async () => {
    loadingWmsRecordPackageProcess.value = true;
    disabled_btnWmsRecordPackageProcess.value = true;
    var res = await pageWmsRecordPackageProcess(Object.assign(queryParamsWmsRecordPackageProcess.value, tableParamsWmsRecordPackageProcess.value));
    if(res.data.type=="success"){
      tableDataWmsRecordPackageProcess.value = res.data.result?.items ?? [];
      tableParamsWmsRecordPackageProcess.value.total = res.data.result?.total;
    }
    loadingWmsRecordPackageProcess.value = false;
    disabled_btnWmsRecordPackageProcess.value = false;
  };
 
  // 重置包过程履历查询
  const resetWmsRecordPackageProcess = async () => {
    queryParamsWmsRecordPackageProcess.value = {}
  };
 
  // 包过程履历列排序
  const sortChangeWmsRecordPackageProcess = async (column: any) => {
    queryParamsWmsRecordPackageProcess.value.field = column.prop;
    queryParamsWmsRecordPackageProcess.value.order = column.order;
    await handleQueryWmsRecordPackageProcess();
  };
 
  // 打开新增包过程履历页面
  const openAddWmsRecordPackageProcess = () => {
    editWmsRecordPackageProcessTitle.value = '添加包过程履历';
    editDialogRefWmsRecordPackageProcess.value.openDialog(1,{});
  };
 
  // 打开打印包过程履历页面
  const openPrintWmsRecordPackageProcess = async (row: any) => {
    printWmsRecordPackageProcessTitle.value = '打印包过程履历';
  }
  
  // 打开编辑包过程履历页面
  const openEditWmsRecordPackageProcess = (row: any) => {
    editWmsRecordPackageProcessTitle.value = '编辑包过程履历';
    editDialogRefWmsRecordPackageProcess.value.openDialog(2,row);
  };
 
  // 删除包过程履历
  const delWmsRecordPackageProcess = (row: any) => {
    ElMessageBox.confirm(`确定要删除吗?`, "提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  })
  .then(async () => {
    loadingWmsRecordPackageProcess.value = true;
    var ret = await deleteWmsRecordPackageProcess(row);
    if(ret.data.type=="success"){
        ElMessage.success("删除成功");
    }
    loadingWmsRecordPackageProcess.value = false;
    handleQueryWmsRecordPackageProcess();
  })
  .catch(() => {});
  };
 
  // 改变包过程履历页面容量
  const handleSizeChangeWmsRecordPackageProcess = (val: number) => {
    tableParamsWmsRecordPackageProcess.value.pageSize = val;
    handleQueryWmsRecordPackageProcess();
  };
 
  // 改变包过程履历页码序号
  const handleCurrentChangeWmsRecordPackageProcess = (val: number) => {
    tableParamsWmsRecordPackageProcess.value.page = val;
    handleQueryWmsRecordPackageProcess();
  };
 
/***************************************************[包过程履历操作]结束***************************************************/
/***************************************************[包过程履历导出]开始***************************************************/
//定义当前页面的方法组
const functionMapWmsRecordPackageProcess = {
      getEnumUpiStatusData_Index,
      getEnumUpiFlagData_Index,
      formatDate_T_Date,
      formatDate_T_Time
};
//点击导出按钮
const handleExportExcelWmsRecordPackageProcess = async (formData:Blob) => {
    loadingWmsRecordPackageProcess.value = true;
    disabled_btnWmsRecordPackageProcess.value = true;
    var new_tableParamsWmsRecordPackageProcess=JSON.parse(JSON.stringify(tableParamsWmsRecordPackageProcess.value));
    new_tableParamsWmsRecordPackageProcess.page = 1;
    new_tableParamsWmsRecordPackageProcess.pageSize = 100000;
    var res = await pageWmsRecordPackageProcess(Object.assign(queryParamsWmsRecordPackageProcess.value, new_tableParamsWmsRecordPackageProcess));
    if(res.data.type=="success"){
      exportExcelWmsRecordPackageProcess(res.data.result?.items ?? []);
    }
    loadingWmsRecordPackageProcess.value = false;
    disabled_btnWmsRecordPackageProcess.value = false;
};
//导出
const exportExcelWmsRecordPackageProcess  = async (exportDataList:Array) => {
  exportPageExcel(exportDataList, tableRefWmsRecordPackageProcess,"包过程履历",functionMapWmsRecordPackageProcess);
};
/***************************************************[包过程履历导出]结束***************************************************/
  // 包过程履历页面加载时
  onMounted(async () => {
    getEnumUpiStatusData_Index.value = (await getAPI(SysEnumApi).apiSysEnumEnumDataListGet('UpiStatusEnum')).data.result ?? [];
    getEnumUpiFlagData_Index.value = (await getAPI(SysEnumApi).apiSysEnumEnumDataListGet('UpiFlagEnum')).data.result ?? [];
  });
 
  handleQueryWmsRecordPackageProcess();
</script>
<style scoped>
:deep(.el-input),
:deep(.el-select),
:deep(.el-input-number) {
    width: 100%;
}
</style>