|
@@ -1,25 +1,57 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import { ref } from "vue";
|
|
|
|
|
|
+import { ref, computed } from "vue";
|
|
import contentConfig from "./config/content.config";
|
|
import contentConfig from "./config/content.config";
|
|
import searchConfig from "./config/search.config";
|
|
import searchConfig from "./config/search.config";
|
|
import CapitalModal from "./components/capital-modal.vue";
|
|
import CapitalModal from "./components/capital-modal.vue";
|
|
import { usePageSearch, type PageHooks, type PageEvents } from "/@/hooks/page";
|
|
import { usePageSearch, type PageHooks, type PageEvents } from "/@/hooks/page";
|
|
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
|
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
|
import { usePermission } from "/@/hooks/core/usePermission";
|
|
import { usePermission } from "/@/hooks/core/usePermission";
|
|
-import { httpWithdraw } from "/@/api/InvoiceSales/capitalClaim";
|
|
|
|
|
|
+import { httpWithdraw, httpBatchStatus } from "/@/api/InvoiceSales/capitalClaim";
|
|
import { useAsync } from "/@/hooks/core/useAsync";
|
|
import { useAsync } from "/@/hooks/core/useAsync";
|
|
import { useRouter } from "vue-router";
|
|
import { useRouter } from "vue-router";
|
|
|
|
+import { useTask } from "/@/hooks/core"
|
|
|
|
+import { ElMessage } from "element-plus"
|
|
|
|
+import { useCompany } from "/@/hooks/core/useCompany";
|
|
|
|
+import { httpRequsetExport } from "/@/utils/export";
|
|
|
|
+import { useUserInfo } from "/@/hooks/core/useUser";
|
|
|
|
+import { template, capitalTemplate } from "./config/xls-template";
|
|
|
|
+import ExeclCapitalUpload from "./components/execl-capital-files-upload/index.vue";
|
|
|
|
+import { utils, writeFile } from "xlsx";
|
|
|
|
|
|
const PageName = "capitalPool";
|
|
const PageName = "capitalPool";
|
|
|
|
+
|
|
|
|
+const selected = ref([])
|
|
|
|
+const formRef = ref<any>(null)
|
|
|
|
+const visible = ref(false)
|
|
|
|
+
|
|
|
|
+const loading = ref(false);
|
|
|
|
+const formData = ref({ status: '', remark: '' })
|
|
|
|
+
|
|
|
|
+const { currentCompany } = useCompany();
|
|
|
|
+
|
|
|
|
+const rules = computed(() => ({
|
|
|
|
+ status: [{ required: true, message: "请选择审核状态", trigger: 'change' }],
|
|
|
|
+ remark: [{ required: formData.value.status == '3', message: "请选择审核状态", trigger: 'change' }],
|
|
|
|
+}))
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+const batchTask = useTask({
|
|
|
|
+ success: () => {
|
|
|
|
+ pageContentRef.value.onSearch()
|
|
|
|
+ visible.value = false
|
|
|
|
+ }
|
|
|
|
+})
|
|
|
|
+
|
|
const capitalModalRef = ref<InstanceType<typeof CapitalModal> | null>(null);
|
|
const capitalModalRef = ref<InstanceType<typeof CapitalModal> | null>(null);
|
|
-const { hasPermissionWithCode } = usePermission("capitalClaim");
|
|
|
|
|
|
+
|
|
|
|
+const { hasPermissionWithCode } = usePermission("capitalPool");
|
|
const pageContentRef = ref(null)
|
|
const pageContentRef = ref(null)
|
|
|
|
+const execlCapitalUploadRef = ref<InstanceType<typeof ExeclCapitalUpload>>(null);
|
|
|
|
+const { run: withDraw } = useAsync({ success: () => pageContentRef.value.onSearch() });
|
|
|
|
+const handleWithDraw = data => withDraw(httpWithdraw(data));
|
|
|
|
|
|
-const { run: withDraw } = useAsync({
|
|
|
|
- success: () => pageContentRef.value.onSearch()
|
|
|
|
-});
|
|
|
|
|
|
|
|
-const handleWithDraw = data => withDraw(httpWithdraw(data));
|
|
|
|
|
|
+const { isSuperUser } = useUserInfo();
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
|
|
|
@@ -29,24 +61,185 @@ const hooks: PageHooks = {
|
|
|
|
|
|
const events: PageEvents = {
|
|
const events: PageEvents = {
|
|
content: {
|
|
content: {
|
|
- preview: ({ logNo }) => router.push('/InvoiceSales/capitalDetail?id=' + logNo + "&back=capitalPool")
|
|
|
|
|
|
+ preview: ({ logNo }) => router.push('/InvoiceSales/capitalPoolDetail?id=' + logNo),
|
|
|
|
+ create: () => router.push('/InvoiceSales/capitalPoolDetail')
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+//导出模板
|
|
|
|
+function onCapitalDownloadTemplate() {
|
|
|
|
+ //创建数据表
|
|
|
|
+ const workBook = utils.book_new();
|
|
|
|
+ const workSheet = utils.json_to_sheet([capitalTemplate]);
|
|
|
|
+ utils.book_append_sheet(workBook, workSheet, "sheet");
|
|
|
|
+ //导出模板
|
|
|
|
+ writeFile(workBook, "订单认款导入模板.xlsx", { bookType: "xlsx" });
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+function handleBatch(){
|
|
|
|
+ if(selected.value.length === 0){
|
|
|
|
+ ElMessage.warning('请选择至少一条状态为`待审批`的数据')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const hasNoWaitData = selected.value.some(item => item.status !== '1')
|
|
|
|
+
|
|
|
|
+ if(hasNoWaitData){
|
|
|
|
+ ElMessage.warning('请选择状态为`待审批`的数据')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ visible.value = true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//导出模板
|
|
|
|
+async function onDownloadOpenInv() {
|
|
|
|
+ const params = pageContentRef.value.getBasicParams()
|
|
|
|
+ if (!params.start || !params.end) {
|
|
|
|
+ ElMessage.warning('请选择导出的时间区间')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(params.status != 2){
|
|
|
|
+ ElMessage.warning('请筛选资金认领状态为`审核通过`的数据')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ const { start, end, ...rest } = params
|
|
|
|
+
|
|
|
|
+ const parameter = {
|
|
|
|
+ create_start: start,
|
|
|
|
+ create_end: end,
|
|
|
|
+ ...rest
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const delay = 24 * 60 * 60 * 1000;
|
|
|
|
+ const start_updatetime = new Date(params.start).valueOf();
|
|
|
|
+ const end_updatetime = new Date(params.end).valueOf() + delay;
|
|
|
|
+ const day = (end_updatetime - start_updatetime) / delay;
|
|
|
|
+
|
|
|
|
+ if (day > 31) {
|
|
|
|
+ ElMessage.warning("时间区间不能超过31天!");
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ await httpRequsetExport({
|
|
|
|
+ url: "ope",
|
|
|
|
+ name: "资金认领数据表",
|
|
|
|
+ onStart: () => (loading.value = true),
|
|
|
|
+ onSuccess: () => (loading.value = false),
|
|
|
|
+ onFail: () => (loading.value = false),
|
|
|
|
+ params: { ...parameter, company: currentCompany.value.companyNo }
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+async function handleBatchSubmit(){
|
|
|
|
+ try{
|
|
|
|
+ await formRef.value?.validate()
|
|
|
|
+ batchTask.run(httpBatchStatus({
|
|
|
|
+ idArr: selected.value.map(({id}) => id),
|
|
|
|
+ status: formData.value.status,
|
|
|
|
+ remark: formData.value.remark
|
|
|
|
+ }))
|
|
|
|
+ }catch(err){
|
|
|
|
+ console.log(err)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function handleImportData(){
|
|
|
|
+ execlCapitalUploadRef.value?.onDisplay()
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
- <PageAuth :pageName="PageName">
|
|
|
|
- <PageContainer :hooks="hooks" :events="events" :get-content-ref="ref => pageContentRef = ref" :contentConfig="contentConfig" :search-config="searchConfig">
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <PageAuth :pageName="PageName" class="capital-claim">
|
|
|
|
+ <PageContainer
|
|
|
|
+ :hooks="hooks"
|
|
|
|
+ :events="events"
|
|
|
|
+ :get-content-ref="ref => pageContentRef = ref"
|
|
|
|
+ :contentConfig="contentConfig"
|
|
|
|
+ :search-config="searchConfig"
|
|
|
|
+ @content-select-change="values => selected = values"
|
|
|
|
+ >
|
|
|
|
+ <template #content_header>
|
|
|
|
+ <ElButton v-if="hasPermissionWithCode('040')" size="small" type="primary" @click="handleBatch">
|
|
|
|
+ 批量审批
|
|
|
|
+ </ElButton>
|
|
|
|
+ </template>
|
|
|
|
+
|
|
<template #content_action="row">
|
|
<template #content_action="row">
|
|
<el-popconfirm
|
|
<el-popconfirm
|
|
- v-if="hasPermissionWithCode('009') && String(row.status) === '1'" placement="top"
|
|
|
|
- title="是否确认撤销资金认领?" @confirm="() => handleWithDraw({ logNo: row.logNo })">
|
|
|
|
|
|
+ placement="top"
|
|
|
|
+ title="是否确认撤销资金认领?"
|
|
|
|
+ @confirm="() => handleWithDraw({ logNo: row.logNo })"
|
|
|
|
+ v-if="hasPermissionWithCode('009') && String(row.status) === '1'"
|
|
|
|
+ >
|
|
<template #reference>
|
|
<template #reference>
|
|
<el-button :icon="useRenderIcon('refresh-right')" type="primary" link />
|
|
<el-button :icon="useRenderIcon('refresh-right')" type="primary" link />
|
|
</template>
|
|
</template>
|
|
</el-popconfirm>
|
|
</el-popconfirm>
|
|
</template>
|
|
</template>
|
|
|
|
+
|
|
|
|
+ <template #search_action>
|
|
|
|
+ <el-button-group>
|
|
|
|
+ <el-button
|
|
|
|
+ type="warning" plain
|
|
|
|
+ v-if="!isSuperUser && hasPermissionWithCode('034')"
|
|
|
|
+ @click="onCapitalDownloadTemplate"
|
|
|
|
+ >
|
|
|
|
+ 1.下载订单认款导入模板
|
|
|
|
+ </el-button>
|
|
|
|
+
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary" plain
|
|
|
|
+ v-if="!isSuperUser && hasPermissionWithCode('035')"
|
|
|
|
+ @click="handleImportData"
|
|
|
|
+ >
|
|
|
|
+ 2.导入订单认款数据(批量)
|
|
|
|
+ </el-button>
|
|
|
|
+
|
|
|
|
+ <el-button
|
|
|
|
+ type="success" plain
|
|
|
|
+ :loading="loading" @click="() => onDownloadOpenInv()">
|
|
|
|
+ 3.导出资金认领数据
|
|
|
|
+ </el-button>
|
|
|
|
+ </el-button-group>
|
|
|
|
+ </template>
|
|
</PageContainer>
|
|
</PageContainer>
|
|
- <CapitalModal ref="capitalModalRef" />
|
|
|
|
|
|
+ <CapitalModal ref="capitalModalRef" />
|
|
|
|
+
|
|
|
|
+ <ElDialog v-model="visible" title="批量审批" center @close="formData = { status: '', remark: '' }">
|
|
|
|
+ <ElForm :model="formData" :rules="rules" ref="formRef" v-loading="batchTask.loading">
|
|
|
|
+ <ElFormItem prop="status" label="审核状态">
|
|
|
|
+ <ElSelect placeholder="审核状态" v-model="formData.status" style="width: 100%">
|
|
|
|
+ <ElOption value="2" label="通过" />
|
|
|
|
+ <ElOption value="3" label="驳回" />
|
|
|
|
+ </ElSelect>
|
|
|
|
+ </ElFormItem>
|
|
|
|
+
|
|
|
|
+ <ElFormItem prop="remark" label="审核备注">
|
|
|
|
+ <ElInput
|
|
|
|
+ v-model="formData.remark"
|
|
|
|
+ placeholder="审核备注"
|
|
|
|
+ type="textarea"
|
|
|
|
+ />
|
|
|
|
+ </ElFormItem>
|
|
|
|
+
|
|
|
|
+ <ElFormItem>
|
|
|
|
+ <div class="w-full flex justify-end">
|
|
|
|
+ <ElButton type="primary" @click="handleBatchSubmit">
|
|
|
|
+ 保存
|
|
|
|
+ </ElButton>
|
|
|
|
+ </div>
|
|
|
|
+ </ElFormItem>
|
|
|
|
+ </ElForm>
|
|
|
|
+ </ElDialog>
|
|
</PageAuth>
|
|
</PageAuth>
|
|
|
|
+
|
|
|
|
+ <ExeclCapitalUpload ref="execlCapitalUploadRef" @onSuccess="pageContentRef.onSearch()" />
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|