|
|
@ -30,6 +30,7 @@ |
|
|
<el-button @click="getDataList('Y')" plain class="search-btn">查询</el-button> |
|
|
<el-button @click="getDataList('Y')" plain class="search-btn">查询</el-button> |
|
|
<el-button @click="resetQuery()" plain class="reset-btn">重置</el-button> |
|
|
<el-button @click="resetQuery()" plain class="reset-btn">重置</el-button> |
|
|
<el-button @click="openEditDialog()" plain class="add-btn">新增订单</el-button> |
|
|
<el-button @click="openEditDialog()" plain class="add-btn">新增订单</el-button> |
|
|
|
|
|
<el-button @click="exportOrderData()" plain class="search-btn" :loading="exportLoading">{{ exportLoading ? '导出中...' : '导出' }}</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label=" " class="query-finish-item"> |
|
|
<el-form-item label=" " class="query-finish-item"> |
|
|
<el-button |
|
|
<el-button |
|
|
@ -344,7 +345,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { deleteHomeLiftOrder, finishHomeLiftOrder, getHomeLiftOrderList, getNodeAssigneeList, getNodeAssigneeUsers, getReportLogList, reportHomeLiftOrderNode, saveHomeLiftOrder, saveNodeAssignee } from '@/api/longchuang/productionPlan' |
|
|
|
|
|
|
|
|
import { deleteHomeLiftOrder, exportHomeLiftOrder, finishHomeLiftOrder, getHomeLiftOrderList, getNodeAssigneeList, getNodeAssigneeUsers, getReportLogList, reportHomeLiftOrderNode, saveHomeLiftOrder, saveNodeAssignee } from '@/api/longchuang/productionPlan' |
|
|
import { getOssVideoStreamUrl, previewOssFileById2, queryOssFilePlus, removeOss } from '@/api/oss/oss' |
|
|
import { getOssVideoStreamUrl, previewOssFileById2, queryOssFilePlus, removeOss } from '@/api/oss/oss' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
@ -375,6 +376,7 @@ export default { |
|
|
pageSize: 20, |
|
|
pageSize: 20, |
|
|
totalPage: 0, |
|
|
totalPage: 0, |
|
|
dataListLoading: false, |
|
|
dataListLoading: false, |
|
|
|
|
|
exportLoading: false, |
|
|
tableHeight: (window.innerHeight - 320)/2, |
|
|
tableHeight: (window.innerHeight - 320)/2, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
@ -720,6 +722,74 @@ export default { |
|
|
this.searchData = { projectNo: '', modelNo: '', color: '', status: '', deliveryStartDate: '', deliveryEndDate: '', page: 1, limit: 20 } |
|
|
this.searchData = { projectNo: '', modelNo: '', color: '', status: '', deliveryStartDate: '', deliveryEndDate: '', page: 1, limit: 20 } |
|
|
this.getDataList('Y') |
|
|
this.getDataList('Y') |
|
|
}, |
|
|
}, |
|
|
|
|
|
async exportOrderData() { |
|
|
|
|
|
if (this.exportLoading) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.exportLoading = true |
|
|
|
|
|
try { |
|
|
|
|
|
const response = await exportHomeLiftOrder({ ...this.searchData }) |
|
|
|
|
|
const contentType = String((response.headers && response.headers['content-type']) || '').toLowerCase() |
|
|
|
|
|
if (contentType.indexOf('application/json') > -1 || contentType.indexOf('text/plain') > -1 || contentType.indexOf('text/html') > -1) { |
|
|
|
|
|
const errorMsg = await this.resolveExportErrorMessage(response.data) |
|
|
|
|
|
this.$message.error(errorMsg) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const fileName = this.resolveExportFileName(response, '家用梯销售订单') |
|
|
|
|
|
this.downloadExportFile(response.data, fileName) |
|
|
|
|
|
this.$message.success('导出成功') |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
this.$message.error('导出失败') |
|
|
|
|
|
} finally { |
|
|
|
|
|
this.exportLoading = false |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
async resolveExportErrorMessage(blobData) { |
|
|
|
|
|
if (!(blobData instanceof Blob)) { |
|
|
|
|
|
return '导出失败' |
|
|
|
|
|
} |
|
|
|
|
|
try { |
|
|
|
|
|
const text = await blobData.text() |
|
|
|
|
|
if (!text) { |
|
|
|
|
|
return '导出失败' |
|
|
|
|
|
} |
|
|
|
|
|
try { |
|
|
|
|
|
const json = JSON.parse(text) |
|
|
|
|
|
return json.msg || json.message || '导出失败' |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
return text.length < 200 ? text : '导出失败' |
|
|
|
|
|
} |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
return '导出失败' |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
resolveExportFileName(response, prefix) { |
|
|
|
|
|
const disposition = String((response.headers && response.headers['content-disposition']) || '') |
|
|
|
|
|
const defaultName = `${prefix}_${this.dayjs().format('YYYYMMDDHHmmss')}.xlsx` |
|
|
|
|
|
if (!disposition) { |
|
|
|
|
|
return defaultName |
|
|
|
|
|
} |
|
|
|
|
|
const utf8Match = disposition.match(/filename\*=utf-8''([^;]+)/i) |
|
|
|
|
|
if (utf8Match && utf8Match[1]) { |
|
|
|
|
|
return decodeURIComponent(utf8Match[1]) |
|
|
|
|
|
} |
|
|
|
|
|
const normalMatch = disposition.match(/filename="?([^"]+)"?/i) |
|
|
|
|
|
if (normalMatch && normalMatch[1]) { |
|
|
|
|
|
return decodeURIComponent(normalMatch[1]) |
|
|
|
|
|
} |
|
|
|
|
|
return defaultName |
|
|
|
|
|
}, |
|
|
|
|
|
downloadExportFile(blobData, fileName) { |
|
|
|
|
|
const blob = blobData instanceof Blob ? blobData : new Blob([blobData], { type: 'application/octet-stream' }) |
|
|
|
|
|
const downloadUrl = URL.createObjectURL(blob) |
|
|
|
|
|
const linkNode = document.createElement('a') |
|
|
|
|
|
linkNode.href = downloadUrl |
|
|
|
|
|
linkNode.download = fileName |
|
|
|
|
|
document.body.appendChild(linkNode) |
|
|
|
|
|
linkNode.click() |
|
|
|
|
|
document.body.removeChild(linkNode) |
|
|
|
|
|
URL.revokeObjectURL(downloadUrl) |
|
|
|
|
|
}, |
|
|
openEditDialog(row) { |
|
|
openEditDialog(row) { |
|
|
this.saveHeaderData = row ? { ...row, autoAssignAllUsers: !!row.autoAssignAllUsers, nodeReportMode: row.nodeReportMode || 'PARALLEL' } : { orderNo: '', projectNo: '', modelNo: '', color: '', floorCount: 1, specialRequirement: '', planDeliveryDate: '', status: '已排产', autoAssignAllUsers: true, nodeReportMode: 'PARALLEL', nodeList: [] } |
|
|
this.saveHeaderData = row ? { ...row, autoAssignAllUsers: !!row.autoAssignAllUsers, nodeReportMode: row.nodeReportMode || 'PARALLEL' } : { orderNo: '', projectNo: '', modelNo: '', color: '', floorCount: 1, specialRequirement: '', planDeliveryDate: '', status: '已排产', autoAssignAllUsers: true, nodeReportMode: 'PARALLEL', nodeList: [] } |
|
|
this.setUp.reviewFlag = true |
|
|
this.setUp.reviewFlag = true |
|
|
|