zhouhongjun
12 months ago
7 changed files with 181 additions and 9 deletions
@ -1,18 +1,73 @@ |
|||||
|
|
||||
import AppList from "../../components/list/index.js"; |
import AppList from "../../components/list/index.js"; |
||||
import html from "html"; |
import html from "html"; |
||||
|
import { useRoute } from "vue-router"; |
||||
|
import { ref } from "vue"; |
||||
|
import request, { getUrl } from "../../request/index.js"; |
||||
import useConfig from "../../models/settle/sync.js"; |
import useConfig from "../../models/settle/sync.js"; |
||||
|
import AppCheck from "../_check.js"; |
||||
|
|
||||
export default { |
export default { |
||||
components: { AppList }, |
components: { AppList, AppCheck }, |
||||
template: html`<app-list v-if="config" :config="config" @command="onCommand" />`, |
template: html`<app-list ref="appListRef" :config="config" @command="onCommand" />
|
||||
|
<app-check v-if="visable" v-model="visable" :businessType="businessType" :row="row" :data="data" />`,
|
||||
setup() { |
setup() { |
||||
const config = useConfig(); |
const appListRef = ref(null); |
||||
|
const visable = ref(false); |
||||
|
const row = ref(null); |
||||
|
const data = ref(null); |
||||
|
const route = useRoute(); |
||||
|
const businessType = route.meta.businessType; |
||||
|
const config = useConfig(businessType, "cai-wu"); |
||||
const onCommand = async (item, rows) => { |
const onCommand = async (item, rows) => { |
||||
|
if (item.path === "approval" || item.path === "reject" || item.path === "receive" || item.path === "sync") { |
||||
|
if (rows.length > 0) { |
||||
|
let message = null; |
||||
|
let url = null; |
||||
|
let data = rows.map((o) => o.invbillNum); |
||||
|
if (item.path === "approval") { |
||||
|
message = `确认审核通过选中的${rows.length}行数据吗?`; |
||||
|
url = config.edit.approvalUrl; |
||||
|
} else if (item.path === "reject") { |
||||
|
message = `确认退回选中的${rows.length}行数据吗?`; |
||||
|
data = rows[0]["invGroupNum"]; |
||||
|
url = config.edit.rejectUrl; |
||||
|
} else if (item.path === "receive") { |
||||
|
message = `确认选中的${rows.length}行数据客户已收票吗?`; |
||||
|
url = config.edit.receivedUrl; |
||||
|
} else if (item.path === "sync") { |
||||
|
message = `确认选中的${rows.length}行数据同步到QAD吗?`; |
||||
|
url = "settleaccount/invoice_service/submit-to-qad"; |
||||
|
} |
||||
|
await appListRef.value.onClick(async () => await request(url, data, { method: "POST" }), message, true); |
||||
|
} |
||||
|
} else if (item.path === "export-group") { |
||||
|
const url = config.edit.exportGroupUrl; |
||||
|
const method = config.edit.exportMethod; |
||||
|
const postData = { |
||||
|
filters: [ |
||||
|
{ |
||||
|
logic: "and", |
||||
|
column: "invoiceNumber", |
||||
|
action: "equal", |
||||
|
value: rows[0]["invoiceNumber"], |
||||
|
}, |
||||
|
], |
||||
|
}; |
||||
|
await appListRef.value.onClick(async () => { |
||||
|
const response = await request(url, postData, { method }, true); |
||||
|
if (!response.errors) { |
||||
|
window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`)); |
||||
|
} |
||||
|
}); |
||||
|
} else if (item.path === "invbillNum" || item.path === "invGroupNum") { |
||||
|
row.value = rows[0]; |
||||
|
data.value = { [item.path]: rows[0][item.path] }; |
||||
|
visable.value = true; |
||||
|
} |
||||
console.log(item.path, item, rows); |
console.log(item.path, item, rows); |
||||
}; |
}; |
||||
return { |
return { appListRef, config, onCommand, visable, row, data, businessType }; |
||||
config, |
|
||||
onCommand, |
|
||||
}; |
|
||||
}, |
}, |
||||
}; |
}; |
||||
|
|
||||
|
Loading…
Reference in new issue