wanggang
1 year ago
11 changed files with 213 additions and 25 deletions
@ -0,0 +1,59 @@ |
|||
import AppList from "../../components/list/index.js"; |
|||
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/commerce.js"; |
|||
import AppCheck from "./_check.js"; |
|||
|
|||
export default { |
|||
components: { AppList, AppCheck }, |
|||
template: html`<app-list ref="appListRef" :config="config" @command="onCommand" /> <app-check v-if="visable" v-model="visable" :businessType="businessType" :data="data" />`, |
|||
setup() { |
|||
const appListRef = ref(null); |
|||
const visable = ref(false); |
|||
const data = ref(null); |
|||
const route = useRoute(); |
|||
const businessType = route.meta.businessType; |
|||
const config = useConfig(businessType, "cai-wu"); |
|||
const onCommand = async (item, rows) => { |
|||
if (item.path === "approval" || item.path === "reject" || item.path === "receive") { |
|||
if (rows.length > 0) { |
|||
const message = |
|||
item.path === "approval" |
|||
? `确认审核通过选中的${rows.length}行数据吗?` |
|||
: item.path === "reject" |
|||
? `确认退回选中的${rows.length}行数据吗?` |
|||
: `确认选中的${rows.length}行数据客户已收票吗?`; |
|||
const data = item.path === "approval" ? rows.map((o) => o.invbillNum) : item.path === "reject" ? rows[0]["invGroupNum"] : rows.map((o) => o.invbillNum); |
|||
const url = item.path === "approval" ? config.edit.invoiceUrl : item.path === "reject" ? config.edit.rejectUrl : config.edit.receivedUrl; |
|||
await appListRef.value.onClick(async () => await request(url, data, { method: "POST" }), message, true); |
|||
} |
|||
} else if (item.path === "export-group") { |
|||
const url = config.edit.exportUrl; |
|||
const method = config.edit.exportMethod; |
|||
const postData = { |
|||
filters: [ |
|||
{ |
|||
logic: "and", |
|||
column: "invGroupNum", |
|||
action: "equal", |
|||
value: rows[0]["invGroupNum"], |
|||
}, |
|||
], |
|||
}; |
|||
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") { |
|||
data.value = { [item.path]: rows[0][item.path] }; |
|||
visable.value = true; |
|||
} |
|||
console.log(item.path, item, rows); |
|||
}; |
|||
return { appListRef, config, onCommand, visable, data, businessType }; |
|||
}, |
|||
}; |
@ -0,0 +1,60 @@ |
|||
import AppList from "../../components/list/index.js"; |
|||
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/inventory.js"; |
|||
import AppCheck from "./_check.js"; |
|||
|
|||
export default { |
|||
components: { AppList, AppCheck }, |
|||
template: html`<app-list ref="appListRef" :config="config" @command="onCommand" />
|
|||
<app-check v-if="visable" v-model="visable" :businessType="businessType" :data="data" :isBusiness="true" />`,
|
|||
setup() { |
|||
const appListRef = ref(null); |
|||
const visable = ref(false); |
|||
const data = ref(null); |
|||
const route = useRoute(); |
|||
const businessType = route.meta.businessType; |
|||
const config = useConfig(businessType, "shang-wu"); |
|||
const onCommand = async (item, rows) => { |
|||
if (item.path === "approval" || item.path === "reject" || item.path === "receive") { |
|||
if (rows.length > 0) { |
|||
const message = |
|||
item.path === "approval" |
|||
? `确认审核通过选中的${rows.length}行数据吗?` |
|||
: item.path === "reject" |
|||
? `确认退回选中的${rows.length}行数据吗?` |
|||
: `确认选中的${rows.length}行数据客户已收票吗?`; |
|||
const data = item.path === "approval" ? rows.map((o) => o.invbillNum) : item.path === "reject" ? rows[0]["invGroupNum"] : rows.map((o) => o.invbillNum); |
|||
const url = item.path === "approval" ? config.edit.invoiceUrl : item.path === "reject" ? config.edit.rejectUrl : config.edit.receivedUrl; |
|||
await appListRef.value.onClick(async () => await request(url, data, { method: "POST" }), message, true); |
|||
} |
|||
} else if (item.path === "export-group") { |
|||
const url = config.edit.exportUrl; |
|||
const method = config.edit.exportMethod; |
|||
const postData = { |
|||
filters: [ |
|||
{ |
|||
logic: "and", |
|||
column: "invGroupNum", |
|||
action: "equal", |
|||
value: rows[0]["invGroupNum"], |
|||
}, |
|||
], |
|||
}; |
|||
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") { |
|||
data.value = { [item.path]: rows[0][item.path] }; |
|||
visable.value = true; |
|||
} |
|||
console.log(item.path, item, rows); |
|||
}; |
|||
return { appListRef, config, onCommand, visable, data, businessType }; |
|||
}, |
|||
}; |
Loading…
Reference in new issue