|
|
@ -2,51 +2,94 @@ import AppList from "../../../components/list/index.js"; |
|
|
|
import html from "html"; |
|
|
|
import useConfig from "../../../models/inventory/log.js"; |
|
|
|
import { reactive, ref } from "vue"; |
|
|
|
import request from "../../request/index.js"; |
|
|
|
import { schemaToModel } from "../../utils/index.js"; |
|
|
|
import AppForm from "../../../components/form/index.js"; |
|
|
|
import AppTable from "../../components/table/index.js"; |
|
|
|
import request, { get, getUrl, post } from "../../request/index.js"; |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { AppList }, |
|
|
|
template: html`<app-list :config="config" @command="onCommand" />
|
|
|
|
<el-dialog v-model="dialog" width="45%" title="补货数据导出"> |
|
|
|
<el-form :model="exportModel" style="height:100%;"> |
|
|
|
<el-form-item label="" label-width="100px"> |
|
|
|
开始时间<el-date-picker v-model="exportModel.startDatetime" value-format="YYYY-MM-DD" /> |
|
|
|
<span style="margin:0 .5em;">-</span> |
|
|
|
结束时间<el-date-picker v-model="exportModel.endDatetime" value-format="YYYY-MM-DD" /> |
|
|
|
</el-form-item> |
|
|
|
<el-button type="primary" @click="openDialog" style="margin-left: 10px;">确定</el-button> |
|
|
|
</el-form> |
|
|
|
</el-dialog> `, |
|
|
|
components: { AppList, AppTable, AppForm }, |
|
|
|
template: html` |
|
|
|
<app-list :config="config" @command="onCommand" /> |
|
|
|
<el-dialog v-model="addDialogVisible" align-center destroy-on-close style="width:380px;height:480px;"> |
|
|
|
<template #header>补货数据导出</template> |
|
|
|
<el-scrollbar> |
|
|
|
<el-row> |
|
|
|
<el-col> |
|
|
|
<app-form |
|
|
|
ref="addAdjFormRef" |
|
|
|
v-if="addDialogVisible && adjModel" |
|
|
|
:schema="adjSchema" |
|
|
|
v-model="adjModel" |
|
|
|
:hideButton="true" |
|
|
|
inline |
|
|
|
@submit="submitAdj" |
|
|
|
/> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-scrollbar> |
|
|
|
<template #footer> |
|
|
|
<span class="dialog-footer"> |
|
|
|
<el-button type="primary" @click="submitAdj">确定</el-button> |
|
|
|
</span> |
|
|
|
</template> |
|
|
|
</el-dialog> |
|
|
|
`,
|
|
|
|
setup() { |
|
|
|
const defaultExportModel = { |
|
|
|
startDatetime: "", |
|
|
|
endDatetime: "", |
|
|
|
}; |
|
|
|
const exportModel = ref(defaultExportModel); |
|
|
|
const config = useConfig(); |
|
|
|
const dialog = ref(false); |
|
|
|
const prop = ref(""); |
|
|
|
const queryModel = ref(schemaToModel(config.query.schema)); |
|
|
|
function buildQuery() { |
|
|
|
const postData = JSON.parse(JSON.stringify(queryModel.value)); |
|
|
|
return postData; |
|
|
|
} |
|
|
|
const openDialog = async () => { |
|
|
|
const url = "settleaccount/vmi/replenished-export"; |
|
|
|
const method = "POST"; |
|
|
|
const postData = buildQuery(); |
|
|
|
const response = await request(url, postData, { method }); |
|
|
|
if (!response.errors) { |
|
|
|
window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`)); |
|
|
|
const addDialogVisible = ref(false); |
|
|
|
const addAdjFormRef = ref(null); |
|
|
|
const adjList = ref([]); |
|
|
|
const submitAdj = async () => { |
|
|
|
try { |
|
|
|
const url = "settleaccount/vmi/replenished-export"; |
|
|
|
const method = "POST"; |
|
|
|
const response = await request(url, null, { method }); |
|
|
|
if (!response.errors) { |
|
|
|
window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`)); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.log(error); |
|
|
|
} |
|
|
|
dialog.value = false; |
|
|
|
}; |
|
|
|
const adjSchema = { |
|
|
|
type: "object", |
|
|
|
properties: { |
|
|
|
startBillTime: { |
|
|
|
type: "string", |
|
|
|
title: "发运开始日期", |
|
|
|
input: "datetime", |
|
|
|
rules: [{ required: true }], |
|
|
|
}, |
|
|
|
endBillTime: { |
|
|
|
type: "string", |
|
|
|
title: "发运结束日期", |
|
|
|
input: "datetime", |
|
|
|
rules: [{ required: true }], |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
const defaultAdjModel = schemaToModel(adjSchema); |
|
|
|
const addAdj = () => { |
|
|
|
adjModel.value = Object.assign({}, defaultAdjModel); |
|
|
|
addDialogVisible.value = true; |
|
|
|
}; |
|
|
|
const adjModel = ref(defaultAdjModel); |
|
|
|
const config = useConfig(); |
|
|
|
const onCommand = async (item, rows) => { |
|
|
|
prop.value = item.path; |
|
|
|
dialog.value = true; |
|
|
|
addDialogVisible.value = true; |
|
|
|
console.log(item.path, item, rows); |
|
|
|
}; |
|
|
|
return { config, onCommand, dialog, prop, exportModel, openDialog }; |
|
|
|
return { |
|
|
|
config, |
|
|
|
onCommand, |
|
|
|
submitAdj, |
|
|
|
addDialogVisible, |
|
|
|
adjSchema, |
|
|
|
addAdjFormRef, |
|
|
|
defaultAdjModel, |
|
|
|
adjModel, |
|
|
|
addAdj, |
|
|
|
adjList, |
|
|
|
}; |
|
|
|
}, |
|
|
|
}; |
|
|
|