fix: 修复PIMTable不支持懒加载问题。修复【来票登记】金额格式化显示NaN问题。
style: 重构来票登记页面。
feat: 完善文件上传组件功能。【来票台账】底部添加合计。【来票登记】添加上传附件
| | |
| | | // éè´-æ¥ç¥¨ç»è®°æ¥å£ |
| | | import request from '@/utils/request' |
| | | import request from "@/utils/request"; |
| | | |
| | | // æ¥è¯¢éè´ååå· |
| | | export function getProduct(query) { |
| | | return request({ |
| | | url: '/purchase/ledger/getProduct', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/purchase/ledger/getProduct", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ¥è¯¢idéè´ååå· |
| | | export function getPurchaseNoById(query) { |
| | | return request({ |
| | | url: '/purchase/ledger/getPurchaseNoById', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/purchase/ledger/getPurchaseNoById", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | // æ ¹æ®éè´ååå·æ¥è¯¢è¯¦ç»ä¿¡æ¯ |
| | | export function getInfo(query) { |
| | | return request({ |
| | | url: '/purchase/ledger/getInfo', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/purchase/ledger/getInfo", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | // 主å表æ¥è¯¢ |
| | | export function gePurchaseList(query) { |
| | | return request({ |
| | | url: '/purchase/ledger/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/purchase/ledger/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | // 主å表æ¥è¯¢ |
| | | export function getRegistrationById(query) { |
| | | return request({ |
| | | url: '/purchase/registration/getRegistrationById', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/purchase/registration/getRegistrationById", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | // æ°å¢ç¼è¾æ¥ç¥¨ç»è®° |
| | | export function addOrUpdateRegistration(query) { |
| | | return request({ |
| | | url: '/purchase/registration/addOrUpdateRegistration', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | url: "/purchase/registration/addOrUpdateRegistration", |
| | | method: "post", |
| | | data: query, |
| | | }); |
| | | } |
| | | // å 餿¥ç¥¨ç»è®° |
| | | export function delRegistration(query) { |
| | | return request({ |
| | | url: '/purchase/registration/delRegistration', |
| | | method: 'delete', |
| | | data: query |
| | | }) |
| | | url: "/purchase/registration/delRegistration", |
| | | method: "delete", |
| | | data: query, |
| | | }); |
| | | } |
| | | |
| | | // 主å表æ¥è¯¢ |
| | | export function gePurchaseListPage(query) { |
| | | return request({ |
| | | url: '/purchase/ledger/listPage', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/purchase/ledger/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | |
| | | }); |
| | | } |
| | | // æ¥è¯¢è¯¦æ
|
| | | export function getInvoiceById(query) { |
| | | return request({ |
| | | url: "/purchase/registration/getRegistrationById", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | // export function getInvoiceById(query) { |
| | | // return request({ |
| | | // url: "/purchase/registration/getRegistrationById", |
| | | // method: "get", |
| | | // params: query, |
| | | // }); |
| | | // } |
| | | // æ°å¢ãç¼è¾ |
| | | export function addOrUpdateInvoice(query) { |
| | | return request({ |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import axios from 'axios' |
| | | import { QuillEditor } from "@vueup/vue-quill" |
| | | import "@vueup/vue-quill/dist/vue-quill.snow.css" |
| | | import { getToken } from "@/utils/auth" |
| | | import axios from "axios"; |
| | | import { QuillEditor } from "@vueup/vue-quill"; |
| | | import "@vueup/vue-quill/dist/vue-quill.snow.css"; |
| | | import { getToken } from "@/utils/auth"; |
| | | |
| | | const { proxy } = getCurrentInstance() |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const quillEditorRef = ref() |
| | | const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload") // ä¸ä¼ çå¾çæå¡å¨å°å |
| | | const quillEditorRef = ref(); |
| | | const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // ä¸ä¼ çå¾çæå¡å¨å°å |
| | | const headers = ref({ |
| | | Authorization: "Bearer " + getToken() |
| | | }) |
| | | Authorization: "Bearer " + getToken(), |
| | | }); |
| | | |
| | | const props = defineProps({ |
| | | /* ç¼è¾å¨çå
容 */ |
| | |
| | | type: { |
| | | type: String, |
| | | default: "url", |
| | | } |
| | | }) |
| | | }, |
| | | }); |
| | | |
| | | const options = ref({ |
| | | theme: "snow", |
| | |
| | | [{ color: [] }, { background: [] }], // åä½é¢è²ãåä½èæ¯é¢è² |
| | | [{ align: [] }], // 坹齿¹å¼ |
| | | ["clean"], // æ¸
é¤ææ¬æ ¼å¼ |
| | | ["link", "image", "video"] // 龿¥ãå¾çãè§é¢ |
| | | ["link", "image", "video"], // 龿¥ãå¾çãè§é¢ |
| | | ], |
| | | }, |
| | | placeholder: "请è¾å
¥å
容", |
| | | readOnly: props.readOnly |
| | | }) |
| | | readOnly: props.readOnly, |
| | | }); |
| | | |
| | | const styles = computed(() => { |
| | | let style = {} |
| | | let style = {}; |
| | | if (props.minHeight) { |
| | | style.minHeight = `${props.minHeight}px` |
| | | style.minHeight = `${props.minHeight}px`; |
| | | } |
| | | if (props.height) { |
| | | style.height = `${props.height}px` |
| | | style.height = `${props.height}px`; |
| | | } |
| | | return style |
| | | }) |
| | | return style; |
| | | }); |
| | | |
| | | const content = ref("") |
| | | watch(() => props.modelValue, (v) => { |
| | | const content = ref(""); |
| | | watch( |
| | | () => props.modelValue, |
| | | (v) => { |
| | | if (v !== content.value) { |
| | | content.value = v == undefined ? "<p></p>" : v |
| | | content.value = v == undefined ? "<p></p>" : v; |
| | | } |
| | | }, { immediate: true }) |
| | | }, |
| | | { immediate: true } |
| | | ); |
| | | |
| | | // å¦æè®¾ç½®äºä¸ä¼ å°ååèªå®ä¹å¾çä¸ä¼ äºä»¶ |
| | | onMounted(() => { |
| | | if (props.type == 'url') { |
| | | let quill = quillEditorRef.value.getQuill() |
| | | let toolbar = quill.getModule("toolbar") |
| | | if (props.type == "url") { |
| | | let quill = quillEditorRef.value.getQuill(); |
| | | let toolbar = quill.getModule("toolbar"); |
| | | toolbar.addHandler("image", (value) => { |
| | | if (value) { |
| | | proxy.$refs.uploadRef.click() |
| | | proxy.$refs.uploadRef.click(); |
| | | } else { |
| | | quill.format("image", false) |
| | | quill.format("image", false); |
| | | } |
| | | }) |
| | | quill.root.addEventListener('paste', handlePasteCapture, true) |
| | | }); |
| | | quill.root.addEventListener("paste", handlePasteCapture, true); |
| | | } |
| | | }) |
| | | }); |
| | | |
| | | // ä¸ä¼ åæ ¡æ£æ ¼å¼åå¤§å° |
| | | function handleBeforeUpload(file) { |
| | | const type = ["image/jpeg", "image/jpg", "image/png", "image/svg"] |
| | | const isJPG = type.includes(file.type) |
| | | const type = ["image/jpeg", "image/jpg", "image/png", "image/svg"]; |
| | | const isJPG = type.includes(file.type); |
| | | //æ£éªæä»¶æ ¼å¼ |
| | | if (!isJPG) { |
| | | proxy.$modal.msgError(`å¾çæ ¼å¼é误!`) |
| | | return false |
| | | proxy.$modal.msgError(`å¾çæ ¼å¼é误!`); |
| | | return false; |
| | | } |
| | | // æ ¡æ£æä»¶å¤§å° |
| | | if (props.fileSize) { |
| | | const isLt = file.size / 1024 / 1024 < props.fileSize |
| | | const isLt = file.size / 1024 / 1024 < props.fileSize; |
| | | if (!isLt) { |
| | | proxy.$modal.msgError(`ä¸ä¼ æä»¶å¤§å°ä¸è½è¶
è¿ ${props.fileSize} MB!`) |
| | | return false |
| | | proxy.$modal.msgError(`ä¸ä¼ æä»¶å¤§å°ä¸è½è¶
è¿ ${props.fileSize} MB!`); |
| | | return false; |
| | | } |
| | | } |
| | | return true |
| | | return true; |
| | | } |
| | | |
| | | // ä¸ä¼ æåå¤ç |
| | |
| | | // 妿ä¸ä¼ æå |
| | | if (res.code == 200) { |
| | | // è·å坿æ¬å®ä¾ |
| | | let quill = toRaw(quillEditorRef.value).getQuill() |
| | | let quill = toRaw(quillEditorRef.value).getQuill(); |
| | | // è·åå
æ ä½ç½® |
| | | let length = quill.selection.savedRange.index |
| | | let length = quill.selection.savedRange.index; |
| | | // æå
¥å¾çï¼res.url为æå¡å¨è¿åçå¾ç龿¥å°å |
| | | quill.insertEmbed(length, "image", import.meta.env.VITE_APP_BASE_API + res.fileName) |
| | | quill.insertEmbed( |
| | | length, |
| | | "image", |
| | | import.meta.env.VITE_APP_BASE_API + res.fileName |
| | | ); |
| | | // è°æ´å
æ å°æå |
| | | quill.setSelection(length + 1) |
| | | quill.setSelection(length + 1); |
| | | } else { |
| | | proxy.$modal.msgError("å¾çæå
¥å¤±è´¥") |
| | | proxy.$modal.msgError("å¾çæå
¥å¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | // ä¸ä¼ 失败å¤ç |
| | | function handleUploadError() { |
| | | proxy.$modal.msgError("å¾çæå
¥å¤±è´¥") |
| | | proxy.$modal.msgError("å¾çæå
¥å¤±è´¥"); |
| | | } |
| | | |
| | | // å¤å¶ç²è´´å¾çå¤ç |
| | | function handlePasteCapture(e) { |
| | | const clipboard = e.clipboardData || window.clipboardData |
| | | const clipboard = e.clipboardData || window.clipboardData; |
| | | if (clipboard && clipboard.items) { |
| | | for (let i = 0; i < clipboard.items.length; i++) { |
| | | const item = clipboard.items[i] |
| | | if (item.type.indexOf('image') !== -1) { |
| | | e.preventDefault() |
| | | const file = item.getAsFile() |
| | | insertImage(file) |
| | | const item = clipboard.items[i]; |
| | | if (item.type.indexOf("image") !== -1) { |
| | | e.preventDefault(); |
| | | const file = item.getAsFile(); |
| | | insertImage(file); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | function insertImage(file) { |
| | | const formData = new FormData() |
| | | formData.append("file", file) |
| | | axios.post(uploadUrl.value, formData, { headers: { "Content-Type": "multipart/form-data", Authorization: headers.value.Authorization } }).then(res => { |
| | | handleUploadSuccess(res.data) |
| | | const formData = new FormData(); |
| | | formData.append("file", file); |
| | | axios |
| | | .post(uploadUrl.value, formData, { |
| | | headers: { |
| | | "Content-Type": "multipart/form-data", |
| | | Authorization: headers.value.Authorization, |
| | | }, |
| | | }) |
| | | .then((res) => { |
| | | handleUploadSuccess(res.data); |
| | | }); |
| | | } |
| | | </script> |
| | | |
| | |
| | | .editor-img-uploader { |
| | | display: none; |
| | | } |
| | | .editor, .ql-toolbar { |
| | | .editor, |
| | | .ql-toolbar { |
| | | white-space: pre-wrap !important; |
| | | line-height: normal !important; |
| | | } |
| | |
| | | <!-- ä¸ä¼ æç¤º -->
|
| | | <div class="el-upload__tip" v-if="showTip && !disabled">
|
| | | 请ä¸ä¼
|
| | | <template v-if="fileSize"> 大å°ä¸è¶
è¿ <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
|
| | | <template v-if="fileType"> æ ¼å¼ä¸º <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
|
| | | <template v-if="fileSize">
|
| | | 大å°ä¸è¶
è¿ <b style="color: #f56c6c">{{ fileSize }}MB</b>
|
| | | </template>
|
| | | <template v-if="fileType">
|
| | | æ ¼å¼ä¸º <b style="color: #f56c6c">{{ fileType.join("/") }}</b>
|
| | | </template>
|
| | | çæä»¶
|
| | | </div>
|
| | | <!-- æä»¶å表 -->
|
| | | <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
| | | <li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
|
| | | <el-link :href="`${baseUrl}${file.url}`" :underline="false" target="_blank">
|
| | | <transition-group
|
| | | class="upload-file-list el-upload-list el-upload-list--text"
|
| | | name="el-fade-in-linear"
|
| | | tag="ul"
|
| | | >
|
| | | <li
|
| | | :key="file.uid"
|
| | | class="el-upload-list__item ele-upload-list__item-content"
|
| | | v-for="(file, index) in fileList"
|
| | | >
|
| | | <el-link
|
| | | :href="`${baseUrl}${file.url}`"
|
| | | :underline="false"
|
| | | target="_blank"
|
| | | >
|
| | | <span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
| | | </el-link>
|
| | | <div class="ele-upload-list__item-content-action">
|
| | | <el-link :underline="false" @click="handleDelete(index)" type="danger" v-if="!disabled"> å é¤</el-link>
|
| | | <el-link
|
| | | :underline="false"
|
| | | @click="handleDelete(index)"
|
| | | type="danger"
|
| | | v-if="!disabled"
|
| | | > å é¤</el-link
|
| | | >
|
| | | </div>
|
| | | </li>
|
| | | </transition-group>
|
| | |
| | | </template>
|
| | |
|
| | | <script setup>
|
| | | import { getToken } from "@/utils/auth"
|
| | | import Sortable from 'sortablejs'
|
| | | import { getToken } from "@/utils/auth";
|
| | | import Sortable from "sortablejs";
|
| | |
|
| | | const props = defineProps({
|
| | | modelValue: [String, Object, Array],
|
| | | // ä¸ä¼ æ¥å£å°å
|
| | | action: {
|
| | | type: String,
|
| | | default: "/common/upload"
|
| | | default: "/common/upload",
|
| | | },
|
| | | // ä¸ä¼ æºå¸¦çåæ°
|
| | | data: {
|
| | | type: Object
|
| | | type: Object,
|
| | | },
|
| | | // æ°ééå¶
|
| | | limit: {
|
| | | type: Number,
|
| | | default: 5
|
| | | default: 5,
|
| | | },
|
| | | // 大å°éå¶(MB)
|
| | | fileSize: {
|
| | | type: Number,
|
| | | default: 5
|
| | | default: 5,
|
| | | },
|
| | | // æä»¶ç±»å, ä¾å¦['png', 'jpg', 'jpeg']
|
| | | fileType: {
|
| | | type: Array,
|
| | | default: () => ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "pdf"]
|
| | | default: () => ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "pdf"],
|
| | | },
|
| | | // æ¯å¦æ¾ç¤ºæç¤º
|
| | | isShowTip: {
|
| | | type: Boolean,
|
| | | default: true
|
| | | default: true,
|
| | | },
|
| | | // ç¦ç¨ç»ä»¶ï¼ä»
æ¥çæä»¶ï¼
|
| | | disabled: {
|
| | | type: Boolean,
|
| | | default: false
|
| | | default: false,
|
| | | },
|
| | | // æå¨æåº
|
| | | drag: {
|
| | | type: Boolean,
|
| | | default: true
|
| | | }
|
| | | })
|
| | | default: true,
|
| | | },
|
| | | });
|
| | |
|
| | | const { proxy } = getCurrentInstance()
|
| | | const emit = defineEmits()
|
| | | const number = ref(0)
|
| | | const uploadList = ref([])
|
| | | const baseUrl = import.meta.env.VITE_APP_BASE_API
|
| | | const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + props.action) // ä¸ä¼ æä»¶æå¡å¨å°å
|
| | | const headers = ref({ Authorization: "Bearer " + getToken() })
|
| | | const fileList = ref([])
|
| | | const { proxy } = getCurrentInstance();
|
| | | const emit = defineEmits();
|
| | | const number = ref(0);
|
| | | const uploadList = ref([]);
|
| | | const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
| | | const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + props.action); // ä¸ä¼ æä»¶æå¡å¨å°å
|
| | | const headers = ref({ Authorization: "Bearer " + getToken() });
|
| | | const fileList = ref([]);
|
| | | const showTip = computed(
|
| | | () => props.isShowTip && (props.fileType || props.fileSize)
|
| | | )
|
| | | );
|
| | |
|
| | | watch(() => props.modelValue, val => {
|
| | | watch(
|
| | | () => props.modelValue,
|
| | | (val) => {
|
| | | if (val) {
|
| | | let temp = 1
|
| | | let temp = 1;
|
| | | // é¦å
å°å¼è½¬ä¸ºæ°ç»
|
| | | const list = Array.isArray(val) ? val : props.modelValue.split(',')
|
| | | const list = Array.isArray(val) ? val : props.modelValue.split(",");
|
| | | // ç¶åå°æ°ç»è½¬ä¸ºå¯¹è±¡æ°ç»
|
| | | fileList.value = list.map(item => {
|
| | | fileList.value = list.map((item) => {
|
| | | if (typeof item === "string") {
|
| | | item = { name: item, url: item }
|
| | | item = { name: item, url: item };
|
| | | }
|
| | | item.uid = item.uid || new Date().getTime() + temp++
|
| | | return item
|
| | | })
|
| | | item.uid = item.uid || new Date().getTime() + temp++;
|
| | | return item;
|
| | | });
|
| | | } else {
|
| | | fileList.value = []
|
| | | return []
|
| | | fileList.value = [];
|
| | | return [];
|
| | | }
|
| | | },{ deep: true, immediate: true })
|
| | | },
|
| | | { deep: true, immediate: true }
|
| | | );
|
| | |
|
| | | // ä¸ä¼ åæ ¡æ£æ ¼å¼å大å°
|
| | | function handleBeforeUpload(file) {
|
| | | // æ ¡æ£æä»¶ç±»å
|
| | | if (props.fileType.length) {
|
| | | const fileName = file.name.split('.')
|
| | | const fileExt = fileName[fileName.length - 1]
|
| | | const isTypeOk = props.fileType.indexOf(fileExt) >= 0
|
| | | const fileName = file.name.split(".");
|
| | | const fileExt = fileName[fileName.length - 1];
|
| | | const isTypeOk = props.fileType.indexOf(fileExt) >= 0;
|
| | | if (!isTypeOk) {
|
| | | proxy.$modal.msgError(`æä»¶æ ¼å¼ä¸æ£ç¡®ï¼è¯·ä¸ä¼ ${props.fileType.join("/")}æ ¼å¼æä»¶!`)
|
| | | return false
|
| | | proxy.$modal.msgError(
|
| | | `æä»¶æ ¼å¼ä¸æ£ç¡®ï¼è¯·ä¸ä¼ ${props.fileType.join("/")}æ ¼å¼æä»¶!`
|
| | | );
|
| | | return false;
|
| | | }
|
| | | }
|
| | | // æ ¡æ£æä»¶åæ¯å¦å
å«ç¹æ®å符
|
| | | if (file.name.includes(',')) {
|
| | | proxy.$modal.msgError('æä»¶å䏿£ç¡®ï¼ä¸è½å
å«è±æéå·!')
|
| | | return false
|
| | | if (file.name.includes(",")) {
|
| | | proxy.$modal.msgError("æä»¶å䏿£ç¡®ï¼ä¸è½å
å«è±æéå·!");
|
| | | return false;
|
| | | }
|
| | | // æ ¡æ£æä»¶å¤§å°
|
| | | if (props.fileSize) {
|
| | | const isLt = file.size / 1024 / 1024 < props.fileSize
|
| | | const isLt = file.size / 1024 / 1024 < props.fileSize;
|
| | | if (!isLt) {
|
| | | proxy.$modal.msgError(`ä¸ä¼ æä»¶å¤§å°ä¸è½è¶
è¿ ${props.fileSize} MB!`)
|
| | | return false
|
| | | proxy.$modal.msgError(`ä¸ä¼ æä»¶å¤§å°ä¸è½è¶
è¿ ${props.fileSize} MB!`);
|
| | | return false;
|
| | | }
|
| | | }
|
| | | proxy.$modal.loading("æ£å¨ä¸ä¼ æä»¶ï¼è¯·ç¨å...")
|
| | | number.value++
|
| | | return true
|
| | | proxy.$modal.loading("æ£å¨ä¸ä¼ æä»¶ï¼è¯·ç¨å...");
|
| | | number.value++;
|
| | | return true;
|
| | | }
|
| | |
|
| | | // æä»¶ä¸ªæ°è¶
åº
|
| | | function handleExceed() {
|
| | | proxy.$modal.msgError(`ä¸ä¼ æä»¶æ°éä¸è½è¶
è¿ ${props.limit} 个!`)
|
| | | proxy.$modal.msgError(`ä¸ä¼ æä»¶æ°éä¸è½è¶
è¿ ${props.limit} 个!`);
|
| | | }
|
| | |
|
| | | // ä¸ä¼ 失败
|
| | | function handleUploadError(err) {
|
| | | proxy.$modal.msgError("ä¸ä¼ æä»¶å¤±è´¥")
|
| | | proxy.$modal.closeLoading()
|
| | | proxy.$modal.msgError("ä¸ä¼ æä»¶å¤±è´¥");
|
| | | proxy.$modal.closeLoading();
|
| | | }
|
| | |
|
| | | // ä¸ä¼ æååè°
|
| | | function handleUploadSuccess(res, file) {
|
| | | if (res.code === 200) {
|
| | | uploadList.value.push({ name: res.fileName, url: res.fileName })
|
| | | uploadedSuccessfully()
|
| | | uploadList.value.push({ name: res.fileName, url: res.fileName });
|
| | | uploadedSuccessfully();
|
| | | } else {
|
| | | number.value--
|
| | | proxy.$modal.closeLoading()
|
| | | proxy.$modal.msgError(res.msg)
|
| | | proxy.$refs.fileUpload.handleRemove(file)
|
| | | uploadedSuccessfully()
|
| | | number.value--;
|
| | | proxy.$modal.closeLoading();
|
| | | proxy.$modal.msgError(res.msg);
|
| | | proxy.$refs.fileUpload.handleRemove(file);
|
| | | uploadedSuccessfully();
|
| | | }
|
| | | }
|
| | |
|
| | | // å 餿件
|
| | | function handleDelete(index) {
|
| | | fileList.value.splice(index, 1)
|
| | | emit("update:modelValue", listToString(fileList.value))
|
| | | fileList.value.splice(index, 1);
|
| | | emit("update:modelValue", listToString(fileList.value));
|
| | | }
|
| | |
|
| | | // ä¸ä¼ ç»æå¤ç
|
| | | function uploadedSuccessfully() {
|
| | | if (number.value > 0 && uploadList.value.length === number.value) {
|
| | | fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value)
|
| | | uploadList.value = []
|
| | | number.value = 0
|
| | | emit("update:modelValue", listToString(fileList.value))
|
| | | proxy.$modal.closeLoading()
|
| | | fileList.value = fileList.value
|
| | | .filter((f) => f.url !== undefined)
|
| | | .concat(uploadList.value);
|
| | | uploadList.value = [];
|
| | | number.value = 0;
|
| | | emit("update:modelValue", listToString(fileList.value));
|
| | | proxy.$modal.closeLoading();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | function getFileName(name) {
|
| | | // 妿æ¯urlé£ä¹åæåçåå 妿䏿¯ç´æ¥è¿å
|
| | | if (name.lastIndexOf("/") > -1) {
|
| | | return name.slice(name.lastIndexOf("/") + 1)
|
| | | return name.slice(name.lastIndexOf("/") + 1);
|
| | | } else {
|
| | | return name
|
| | | return name;
|
| | | }
|
| | | }
|
| | |
|
| | | // 对象转ææå®å符串åé
|
| | | function listToString(list, separator) {
|
| | | let strs = ""
|
| | | separator = separator || ","
|
| | | let strs = "";
|
| | | separator = separator || ",";
|
| | | for (let i in list) {
|
| | | if (list[i].url) {
|
| | | strs += list[i].url + separator
|
| | | strs += list[i].url + separator;
|
| | | }
|
| | | }
|
| | | return strs != '' ? strs.substr(0, strs.length - 1) : ''
|
| | | return strs != "" ? strs.substr(0, strs.length - 1) : "";
|
| | | }
|
| | |
|
| | | // åå§åææ½æåº
|
| | | onMounted(() => {
|
| | | if (props.drag) {
|
| | | nextTick(() => {
|
| | | const element = document.querySelector('.upload-file-list')
|
| | | const element = document.querySelector(".upload-file-list");
|
| | | Sortable.create(element, {
|
| | | ghostClass: 'file-upload-darg',
|
| | | ghostClass: "file-upload-darg",
|
| | | onEnd: (evt) => {
|
| | | const movedItem = fileList.value.splice(evt.oldIndex, 1)[0]
|
| | | fileList.value.splice(evt.newIndex, 0, movedItem)
|
| | | emit('update:modelValue', listToString(fileList.value))
|
| | | const movedItem = fileList.value.splice(evt.oldIndex, 1)[0];
|
| | | fileList.value.splice(evt.newIndex, 0, movedItem);
|
| | | emit("update:modelValue", listToString(fileList.value));
|
| | | },
|
| | | });
|
| | | });
|
| | | }
|
| | | })
|
| | | })
|
| | | }
|
| | | })
|
| | | });
|
| | | </script>
|
| | | <style scoped lang="scss">
|
| | | .file-upload-darg {
|
| | |
| | | :border="border" |
| | | :data="tableData" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" |
| | | height="calc(100vh - 18.5em)" |
| | | :height="height" |
| | | :highlight-current-row="highlightCurrentRow" |
| | | :row-class-name="rowClassName" |
| | | :row-style="rowStyle" |
| | | :row-key="rowKey" |
| | | style="width: 100%" |
| | | tooltip-effect="dark" |
| | | @row-click="rowClick" |
| | | @current-change="currentChange" |
| | | :expand-row-keys="expandRowKeys" |
| | | :show-summary="isShowSummary" |
| | | :summary-method="summaryMethod" |
| | | @row-click="rowClick" |
| | | @current-change="currentChange" |
| | | @selection-change="handleSelectionChange" |
| | | @expand-change="expandChange" |
| | | class="lims-table" |
| | | > |
| | | <el-table-column |
| | |
| | | const uploadHeader = proxy.uploadHeader; |
| | | const javaApi = proxy.javaApi; |
| | | |
| | | const emit = defineEmits(["pagination"]); |
| | | const emit = defineEmits(["pagination", "expand-change", "selection-change"]); |
| | | |
| | | // Filters |
| | | const typeFn = (val, row) => { |
| | |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | handleSelectionChange: { |
| | | type: Function, |
| | | default: () => {}, |
| | | height: { |
| | | type: [Number, String], |
| | | default: "calc(100vh - 18.5em)", |
| | | }, |
| | | expandRowKeys: { |
| | | type: Array, |
| | | default: () => [], |
| | | }, |
| | | summaryMethod: { |
| | | type: Function, |
| | |
| | | const paginationSearch = ({ page, limit }) => { |
| | | emit("pagination", { page: page, limit: limit }); |
| | | }; |
| | | |
| | | const expandChange = (row, expandedRows) => { |
| | | emit("expand-change", row, expandedRows); |
| | | }; |
| | | |
| | | const handleSelectionChange = (newSelection) => { |
| | | emit("selection-change", newSelection); |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | showTip: { |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | autoUpload: { |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | limit: { |
| | | type: Number, |
| | | default: 1, |
| | | }, |
| | | }); |
| | | const emits = defineEmits(["success", "error"]); |
| | | const emits = defineEmits(["success", "remove"]); |
| | | |
| | | const uploadRef = ref(); |
| | | const fileList = ref([]); |
| | |
| | | }; |
| | | |
| | | const handleFileSuccess = (response, file, fileList) => { |
| | | upload.open = false; |
| | | upload.isUploading = false; |
| | | uploadRef.value.handleRemove(file); |
| | | // uploadRef.value.handleRemove(file); |
| | | emits("success", response, file, fileList); |
| | | }; |
| | | |
| | | const handleRemove = (file) => { |
| | | emits("remove", file); |
| | | }; |
| | | |
| | | defineExpose({ |
| | |
| | | :accept="accept" |
| | | :headers="headers" |
| | | :disabled="disabled" |
| | | :auto-upload="false" |
| | | :limit="1" |
| | | :auto-upload="autoUpload" |
| | | :limit="limit" |
| | | :drag="true" |
| | | :on-success="handleFileSuccess" |
| | | :on-remove="handleRemove" |
| | | > |
| | | <div class="el-upload__text"> |
| | | <el-icon class="el-icon--upload"><upload-filled /></el-icon> |
| | |
| | | </div> |
| | | </div> |
| | | <template #tip> |
| | | <div class="el-upload__tip text-center"> |
| | | <div v-if="showTip" class="el-upload__tip text-center"> |
| | | åªè½ä¸ä¼ xlsx/xlsæä»¶ï¼ä¸ä¸è¶
è¿10M |
| | | <el-button |
| | | type="primary" |
| | |
| | | const openModal = (e) => { |
| | | id.value = e; |
| | | modalOptions.value = { |
| | | title: e ? "ç¼è¾è®¾å¤å°è´¦" : "æ°å¢è®¾å¤å°è´¦", |
| | | title: e ? `ä¿®æ¹${options.title}` : `æ°å¢${options.title}`, |
| | | content: "ç¡®å®æ§è¡æ¤æä½åï¼", |
| | | confirmText: "ç¡®å®", |
| | | cancelText: "åæ¶", |
| | | ...options, |
| | | }; |
| | | visible.value = true; |
| | | }; |
| | |
| | | import { ref, reactive, watchEffect, unref } from "vue"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import { deepClone, isEqual } from "@/utils/index.js" |
| | | import { ElMessage } from 'element-plus' |
| | | |
| | | /** |
| | | * å页api |
| | |
| | | ...getFinalParams(), |
| | | current: pagination.currentPage, |
| | | size: pagination.pageSize |
| | | }).then(({ code, data, ...rest }) => { |
| | | }).then(({ code, data, msg, ...rest }) => { |
| | | if (code == 200) { |
| | | // pagination.currentPage = meta.current_page; |
| | | // pagination.pageSize = meta.per_page; |
| | |
| | | loading.value = false; |
| | | } else { |
| | | loading.value = false; |
| | | ElMessage({ message: data.msg, type: "error" }); |
| | | ElMessage({ message: msg, type: "error" }); |
| | | } |
| | | }); |
| | | } |
| | |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">æ°å¢å®¢æ·</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="info" plain icon="Upload" @click="handleImport">导å
¥</el-button> |
| | | <el-button type="info" plain icon="Upload" @click="handleImport" |
| | | >导å
¥</el-button |
| | | > |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable :column="tableColumn" :tableData="tableData" :page="page" :isSelection="true" :handleSelectionChange="handleSelectionChange" |
| | | :tableLoading="tableLoading" @pagination="pagination" :total="total"></PIMTable> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="total" |
| | | ></PIMTable> |
| | | </div> |
| | | <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢å®¢æ·ä¿¡æ¯' : 'ç¼è¾å®¢æ·ä¿¡æ¯'" width="70%" @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | :title="operationType === 'add' ? 'æ°å¢å®¢æ·ä¿¡æ¯' : 'ç¼è¾å®¢æ·ä¿¡æ¯'" |
| | | width="70%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form |
| | | :model="form" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="客æ·åç§°ï¼" prop="customerName"> |
| | | <el-input v-model="form.customerName" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.customerName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="纳ç¨äººè¯å«å·ï¼" prop="taxpayerIdentificationNumber"> |
| | | <el-input v-model="form.taxpayerIdentificationNumber" placeholder="请è¾å
¥" clearable/> |
| | | <el-form-item |
| | | label="纳ç¨äººè¯å«å·ï¼" |
| | | prop="taxpayerIdentificationNumber" |
| | | > |
| | | <el-input |
| | | v-model="form.taxpayerIdentificationNumber" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å
¬å¸å°åï¼" prop="companyAddress"> |
| | | <el-input v-model="form.companyAddress" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.companyAddress" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å
¬å¸çµè¯ï¼" prop="companyPhone"> |
| | | <el-input v-model="form.companyPhone" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.companyPhone" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è系人ï¼" prop="contactPerson"> |
| | | <el-input v-model="form.contactPerson" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.contactPerson" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="èç³»çµè¯ï¼" prop="contactPhone"> |
| | | <el-input v-model="form.contactPhone" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.contactPhone" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="é¶è¡åºæ¬æ·ï¼" prop="basicBankAccount"> |
| | | <el-input v-model="form.basicBankAccount" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.basicBankAccount" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="é¶è¡è´¦å·ï¼" prop="bankAccount"> |
| | | <el-input v-model="form.bankAccount" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.bankAccount" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="弿·è¡å·ï¼" prop="bankCode"> |
| | | <el-input v-model="form.bankCode" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.bankCode" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´æ¤äººï¼" prop="maintainer"> |
| | | <el-select v-model="form.maintainer" placeholder="è¯·éæ©" clearable disabled> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/> |
| | | <el-select |
| | | v-model="form.maintainer" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | > |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.nickName" |
| | | :label="item.nickName" |
| | | :value="item.nickName" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </template> |
| | | </el-dialog> |
| | | <!-- ç¨æ·å¯¼å
¥å¯¹è¯æ¡ --> |
| | | <el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body> |
| | | <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag> |
| | | <el-dialog |
| | | :title="upload.title" |
| | | v-model="upload.open" |
| | | width="400px" |
| | | append-to-body |
| | | > |
| | | <el-upload |
| | | ref="uploadRef" |
| | | :limit="1" |
| | | accept=".xlsx, .xls" |
| | | :headers="upload.headers" |
| | | :action="upload.url + '?updateSupport=' + upload.updateSupport" |
| | | :disabled="upload.isUploading" |
| | | :on-progress="handleFileUploadProgress" |
| | | :on-success="handleFileSuccess" |
| | | :auto-upload="false" |
| | | drag |
| | | > |
| | | <el-icon class="el-icon--upload"><upload-filled /></el-icon> |
| | | <div class="el-upload__text">å°æä»¶æå°æ¤å¤ï¼æ<em>ç¹å»ä¸ä¼ </em></div> |
| | | <template #tip> |
| | | <div class="el-upload__tip text-center"> |
| | | <span>ä»
å
许导å
¥xlsãxlsxæ ¼å¼æä»¶ã</span> |
| | | <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">ä¸è½½æ¨¡æ¿</el-link> |
| | | <el-link |
| | | type="primary" |
| | | :underline="false" |
| | | style="font-size: 12px; vertical-align: baseline" |
| | | @click="importTemplate" |
| | | >ä¸è½½æ¨¡æ¿</el-link |
| | | > |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue' |
| | | import { ref } from "vue"; |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {addCustomer, delCustomer, getCustomer, listCustomer, updateCustomer} from "@/api/basicData/customerFile.js"; |
| | | import { |
| | | addCustomer, |
| | | delCustomer, |
| | | getCustomer, |
| | | listCustomer, |
| | | updateCustomer, |
| | | } from "@/api/basicData/customerFile.js"; |
| | | import {ElMessageBox } from "element-plus"; |
| | | import {userListNoPage} from "@/api/system/user.js"; |
| | | import useUserStore from "@/store/modules/user" |
| | | import useUserStore from "@/store/modules/user"; |
| | | import {getToken} from "@/utils/auth.js"; |
| | | const { proxy } = getCurrentInstance() |
| | | const userStore = useUserStore() |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore(); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: '客æ·åç§°', |
| | | prop: 'customerName', |
| | | label: "客æ·åç§°", |
| | | prop: "customerName", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: '纳ç¨äººè¯å«ç ', |
| | | prop: 'taxpayerIdentificationNumber', |
| | | label: "纳ç¨äººè¯å«ç ", |
| | | prop: "taxpayerIdentificationNumber", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: 'å°ååèç³»æ¹å¼', |
| | | prop: 'addressPhone', |
| | | label: "å°ååèç³»æ¹å¼", |
| | | prop: "addressPhone", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: 'è系人', |
| | | prop: 'contactPerson' |
| | | label: "è系人", |
| | | prop: "contactPerson", |
| | | }, |
| | | { |
| | | label: 'èç³»çµè¯', |
| | | prop: 'contactPhone', |
| | | label: "èç³»çµè¯", |
| | | prop: "contactPhone", |
| | | }, |
| | | { |
| | | label: 'é¶è¡åºæ¬æ·', |
| | | prop: 'basicBankAccount', |
| | | label: "é¶è¡åºæ¬æ·", |
| | | prop: "basicBankAccount", |
| | | }, |
| | | { |
| | | label: 'é¶è¡è´¦å·', |
| | | prop: 'bankAccount', |
| | | label: "é¶è¡è´¦å·", |
| | | prop: "bankAccount", |
| | | }, |
| | | { |
| | | label: '弿·è¡å·', |
| | | prop: 'bankCode', |
| | | label: "弿·è¡å·", |
| | | prop: "bankCode", |
| | | }, |
| | | { |
| | | label: 'ç»´æ¤äºº', |
| | | prop: 'maintainer', |
| | | label: "ç»´æ¤äºº", |
| | | prop: "maintainer", |
| | | }, |
| | | { |
| | | label: 'ç»´æ¤æ¶é´', |
| | | prop: 'maintenanceTime', |
| | | label: "ç»´æ¤æ¶é´", |
| | | prop: "maintenanceTime", |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: 'center', |
| | | align: "center", |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openForm('edit', row); |
| | | openForm("edit", row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]) |
| | | const tableData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const userList = ref([]) |
| | | const tableLoading = ref(false) |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | }) |
| | | const total = ref(0) |
| | | }); |
| | | const total = ref(0); |
| | | |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref('') |
| | | const dialogFormVisible = ref(false) |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | customerName: '', |
| | | customerName: "", |
| | | }, |
| | | form: { |
| | | customerName: '', |
| | | taxpayerIdentificationNumber: '', |
| | | companyAddress: '', |
| | | companyPhone: '', |
| | | contactPerson: '', |
| | | contactPhone: '', |
| | | maintainer: '', |
| | | maintenanceTime: '', |
| | | basicBankAccount:'', |
| | | bankAccount:'', |
| | | bankCode:'' |
| | | customerName: "", |
| | | taxpayerIdentificationNumber: "", |
| | | companyAddress: "", |
| | | companyPhone: "", |
| | | contactPerson: "", |
| | | contactPhone: "", |
| | | maintainer: "", |
| | | maintenanceTime: "", |
| | | basicBankAccount: "", |
| | | bankAccount: "", |
| | | bankCode: "", |
| | | }, |
| | | rules: { |
| | | customerName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | taxpayerIdentificationNumber: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | taxpayerIdentificationNumber: [ |
| | | { required: true, message: "请è¾å
¥", trigger: "blur" }, |
| | | ], |
| | | companyAddress: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | companyPhone: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | contactPerson: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | contactPhone: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | maintainer: [{ required: false, message: "è¯·éæ©", trigger: "change" }], |
| | | maintenanceTime: [{ required: false, message: "è¯·éæ©", trigger: "change" }], |
| | | maintenanceTime: [ |
| | | { required: false, message: "è¯·éæ©", trigger: "change" }, |
| | | ], |
| | | basicBankAccount: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | bankAccount: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | bankCode: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | }); |
| | | const upload = reactive({ |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå±ï¼å®¢æ·å¯¼å
¥ï¼ |
| | | open: false, |
| | |
| | | // 设置ä¸ä¼ ç请æ±å¤´é¨ |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | // ä¸ä¼ çå°å |
| | | url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData" |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | | url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData", |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | listCustomer({...searchForm.value, ...page}).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.records |
| | | total.value = res.total |
| | | }) |
| | | } |
| | | tableLoading.value = true; |
| | | listCustomer({ ...searchForm.value, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | total.value = res.total; |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection |
| | | } |
| | | selectedRows.value = selection; |
| | | }; |
| | | /** æäº¤ä¸ä¼ æä»¶ */ |
| | | function submitFileForm() { |
| | | proxy.$refs["uploadRef"].submit() |
| | | proxy.$refs["uploadRef"].submit(); |
| | | } |
| | | /** 导å
¥æé®æä½ */ |
| | | function handleImport() { |
| | | upload.title = "客æ·å¯¼å
¥" |
| | | upload.open = true |
| | | upload.title = "客æ·å¯¼å
¥"; |
| | | upload.open = true; |
| | | } |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (type, row) => { |
| | | operationType.value = type |
| | | form.value = {} |
| | | form.value.maintainer = userStore.nickName |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | form.value.maintainer = userStore.nickName; |
| | | form.value.maintenanceTime = getCurrentDate(); |
| | | userListNoPage().then(res => { |
| | | userList.value = res.data |
| | | }) |
| | | if (type === 'edit') { |
| | | getCustomer(row.id).then(res => { |
| | | form.value = {...res.data} |
| | | }) |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | if (type === "edit") { |
| | | getCustomer(row.id).then((res) => { |
| | | form.value = { ...res.data }; |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true |
| | | } |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === "edit") { |
| | | submitEdit() |
| | | submitEdit(); |
| | | } else { |
| | | submitAdd() |
| | | submitAdd(); |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | // æäº¤æ°å¢ |
| | | const submitAdd = () => { |
| | | addCustomer(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | }) |
| | | } |
| | | addCustomer(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // æäº¤ä¿®æ¹ |
| | | const submitEdit = () => { |
| | | updateCustomer(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | }) |
| | | } |
| | | updateCustomer(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef") |
| | | dialogFormVisible.value = false |
| | | } |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm( |
| | | 'éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼', |
| | | '导åº', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | proxy.download("/basic/customer/export", {}, 'å®¢æ·æ¡£æ¡.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | } |
| | | .then(() => { |
| | | proxy.download("/basic/customer/export", {}, "å®¢æ·æ¡£æ¡.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = [] |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map(item => item.id); |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning('è¯·éæ©æ°æ®') |
| | | return |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | 'éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼', |
| | | 'å é¤æç¤º', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | tableLoading.value = true |
| | | delCustomer(ids).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | getList() |
| | | }).finally(() => { |
| | | tableLoading.value = false |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | delCustomer(ids) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }) |
| | | } |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, '0'); // æä»½ä»0å¼å§ |
| | | const day = String(today.getDate()).padStart(2, '0'); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); // æä»½ä»0å¼å§ |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | |
| | | getList() |
| | | getList(); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | </style> |
| | | <style scoped lang="scss"></style> |
| | |
| | | </el-button> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :handleSelectionChange="handleSelectionChange" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="total" |
| | |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :handleSelectionChange="handleSelectionChange" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="total" |
| | |
| | | </div> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="columns" |
| | | :tableData="dataList" |
| | | :page="{ |
| | |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm">æ°å¢å
¥è</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable :column="tableColumn" :tableData="tableData" :page="page" :isSelection="true" |
| | | :handleSelectionChange="handleSelectionChange" :tableLoading="tableLoading" @pagination="pagination" |
| | | :total="total"></PIMTable> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="total" |
| | | ></PIMTable> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | customerName: '', |
| | | customerName: "", |
| | | }, |
| | | form: { |
| | | salesLedgerId: '', |
| | | customerName: '', |
| | | salesman: '', |
| | | projectName: '', |
| | | productData: [] |
| | | salesLedgerId: "", |
| | | customerName: "", |
| | | salesman: "", |
| | | projectName: "", |
| | | productData: [], |
| | | }, |
| | | rules: { |
| | | salesLedgerId: [{ required: true, message: "è¯·éæ©", trigger: "change" }] |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | | salesLedgerId: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: 'ç¶æ', |
| | | prop: 'paymentDate', |
| | | dataType: 'tag', |
| | | label: "ç¶æ", |
| | | prop: "paymentDate", |
| | | dataType: "tag", |
| | | formatData: (params) => { |
| | | if (params == 0) { |
| | | return 'å¨è'; |
| | | return "å¨è"; |
| | | } else if (params == 1) { |
| | | return '离è'; |
| | | return "离è"; |
| | | } else { |
| | | return null |
| | | return null; |
| | | } |
| | | }, |
| | | formatType: (params) => { |
| | | if (params == 0) { |
| | | return 'primary'; |
| | | return "primary"; |
| | | } else if (params == 1) { |
| | | return 'danger'; |
| | | return "danger"; |
| | | } else { |
| | | return null |
| | | } |
| | | return null; |
| | | } |
| | | }, |
| | | { |
| | | label: 'åå·¥ç¼å·', |
| | | prop: 'supplierName', |
| | | }, |
| | | { |
| | | label: 'å§å', |
| | | prop: 'currentPaymentAmount', |
| | | label: "åå·¥ç¼å·", |
| | | prop: "supplierName", |
| | | }, |
| | | { |
| | | label: 'æ§å«', |
| | | prop: 'paymentMethod' |
| | | label: "å§å", |
| | | prop: "currentPaymentAmount", |
| | | }, |
| | | { |
| | | label: 'ç±è´¯', |
| | | prop: 'registrant' |
| | | label: "æ§å«", |
| | | prop: "paymentMethod", |
| | | }, |
| | | { |
| | | label: 'å²ä½', |
| | | prop: 'registrationtDate' |
| | | label: "ç±è´¯", |
| | | prop: "registrant", |
| | | }, |
| | | { |
| | | label: 'å®¶åºä½å', |
| | | prop: 'registrationtDate' |
| | | label: "å²ä½", |
| | | prop: "registrationtDate", |
| | | }, |
| | | { |
| | | label: '第ä¸å¦å', |
| | | prop: 'registrationtDate' |
| | | label: "å®¶åºä½å", |
| | | prop: "registrationtDate", |
| | | }, |
| | | { |
| | | label: 'ä¸ä¸', |
| | | prop: 'registrationtDate' |
| | | label: "第ä¸å¦å", |
| | | prop: "registrationtDate", |
| | | }, |
| | | { |
| | | label: '身份è¯å·', |
| | | prop: 'registrationtDate' |
| | | label: "ä¸ä¸", |
| | | prop: "registrationtDate", |
| | | }, |
| | | { |
| | | label: 'å¹´é¾', |
| | | prop: 'registrationtDate' |
| | | label: "身份è¯å·", |
| | | prop: "registrationtDate", |
| | | }, |
| | | { |
| | | label: 'èç³»çµè¯', |
| | | prop: 'registrationtDate' |
| | | label: "å¹´é¾", |
| | | prop: "registrationtDate", |
| | | }, |
| | | { |
| | | label: 'ç´§æ¥è系人', |
| | | prop: 'registrationtDate' |
| | | label: "èç³»çµè¯", |
| | | prop: "registrationtDate", |
| | | }, |
| | | { |
| | | label: 'èç³»çµè¯', |
| | | prop: 'registrationtDate' |
| | | label: "ç´§æ¥è系人", |
| | | prop: "registrationtDate", |
| | | }, |
| | | { |
| | | label: 'ååå¹´é', |
| | | prop: 'registrationtDate' |
| | | label: "èç³»çµè¯", |
| | | prop: "registrationtDate", |
| | | }, |
| | | { |
| | | label: 'ååå¼å§æ¥æ', |
| | | prop: 'registrationtDate' |
| | | label: "ååå¹´é", |
| | | prop: "registrationtDate", |
| | | }, |
| | | { |
| | | label: 'ååç»ææ¥æ', |
| | | prop: 'registrationtDate' |
| | | label: "ååå¼å§æ¥æ", |
| | | prop: "registrationtDate", |
| | | }, |
| | | ]) |
| | | const tableData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const tableLoading = ref(false) |
| | | { |
| | | label: "ååç»ææ¥æ", |
| | | prop: "registrationtDate", |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | |
| | | }); |
| | | const total = ref(0); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | ledgerListPage({...searchForm.value, ...page}).then(res => { |
| | | tableLoading.value = false |
| | | tableLoading.value = true; |
| | | ledgerListPage({ ...searchForm.value, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | total.value = res.total |
| | | }) |
| | | } |
| | | total.value = res.total; |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | console.log('selection', selection) |
| | | selectedRows.value = selection.filter(item => item.salesContractNo !== undefined); |
| | | } |
| | | console.log("selection", selection); |
| | | selectedRows.value = selection.filter( |
| | | (item) => item.salesContractNo !== undefined |
| | | ); |
| | | }; |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = () => { |
| | | |
| | | } |
| | | const openForm = () => {}; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | | <style scoped></style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="columns" |
| | | :tableData="dataList" |
| | | :tableLoading="loading" |
| | | > |
| | | </PIMTable> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { usePaginationApi } from "@/hooks/usePaginationApi"; |
| | | import { productList } from "@/api/procurementManagement/procurementLedger.js"; |
| | | |
| | | defineOptions({ |
| | | name: "æ¥ç¥¨ç»è®°æå 表", |
| | | }); |
| | | |
| | | const { |
| | | loading, |
| | | filters, |
| | | columns, |
| | | dataList, |
| | | pagination, |
| | | getTableData, |
| | | resetFilters, |
| | | } = usePaginationApi( |
| | | productList, |
| | | { |
| | | salesLedgerId: undefined, |
| | | type: 2, |
| | | }, |
| | | [ |
| | | { |
| | | label: "产å大类", |
| | | prop: "productCategory", |
| | | }, |
| | | { |
| | | label: "è§æ ¼åå·", |
| | | prop: "specificationModel", |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "æ°é", |
| | | prop: "quantity", |
| | | }, |
| | | { |
| | | label: "ç¨ç(%)", |
| | | prop: "taxRate", |
| | | }, |
| | | { |
| | | label: "å«ç¨åä»·(å
)", |
| | | prop: "taxInclusiveUnitPrice", |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "å«ç¨æ»ä»·(å
)", |
| | | prop: "taxInclusiveTotalPrice", |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "ä¸å«ç¨æ»ä»·(å
)", |
| | | prop: "taxExclusiveTotalPrice", |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "æ¬æ¬¡æ¥ç¥¨éé¢(å
)", |
| | | prop: "ticketsAmount", |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "æªæ¥ç¥¨æ°", |
| | | prop: "futureTickets", |
| | | }, |
| | | { |
| | | label: "æªæ¥ç¥¨éé¢(å
)", |
| | | prop: "futureTicketsAmount", |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | ], |
| | | {}, |
| | | {}, |
| | | (data) => { |
| | | dataList.value = data; |
| | | } |
| | | ); |
| | | |
| | | const getList = (id) => { |
| | | filters.salesLedgerId = id; |
| | | getTableData(); |
| | | }; |
| | | |
| | | defineExpose({ |
| | | getList, |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped></style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog :title="modalOptions.title" v-model="visible" width="70%"> |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="120px" |
| | | label-position="top" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éè´ååå·ï¼" prop="purchaseLedgerNo"> |
| | | <el-input v-model="form.purchaseLedgerNo" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éå®ååå·ï¼" prop="salesContractNo"> |
| | | <el-input |
| | | v-model="form.salesContractNo" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¾åºååç§°ï¼" prop="supplierName"> |
| | | <el-input |
| | | v-model="form.supplierName" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="项ç®åç§°ï¼" prop="projectName"> |
| | | <el-input |
| | | v-model="form.projectName" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票å·ï¼" prop="invoiceNumber"> |
| | | <el-input |
| | | v-model="form.invoiceNumber" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票éé¢(å
)ï¼" prop="invoiceAmount"> |
| | | <el-input |
| | | type="number" |
| | | :step="0.01" |
| | | :min="0" |
| | | v-model="form.invoiceAmount" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | :disabled="true" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½å
¥äººï¼" prop="issUer"> |
| | | <el-input |
| | | v-model="form.issUer" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¼ç¥¨æ¥æï¼" prop="entryDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.entryDate" |
| | | type="date" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸ä¼ éä»¶"> |
| | | <FileUpload |
| | | :showTip="false" |
| | | accept="*" |
| | | :autoUpload="true" |
| | | :action="action" |
| | | :headers="{ |
| | | Authorization: 'Bearer ' + getToken(), |
| | | }" |
| | | :limit="10" |
| | | @success="uploadSuccess" |
| | | @remove="removeFile" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-form-item label="产åä¿¡æ¯ï¼" prop="entryDate"> </el-form-item> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="columns" |
| | | :tableData="form.productData" |
| | | height="auto" |
| | | > |
| | | <template #ticketsNumRef="{ row }"> |
| | | <el-input-number |
| | | v-model="row.ticketsNum" |
| | | placeholder="è¯·éæ©" |
| | | :min="0" |
| | | :step="0.1" |
| | | clearable |
| | | style="width: 100%" |
| | | @change="invoiceNumBlur(row)" |
| | | /> |
| | | </template> |
| | | <template #ticketsAmountRef="{ row }"> |
| | | <el-input-number |
| | | v-model="row.ticketsAmount" |
| | | placeholder="è¯·éæ©" |
| | | :min="0" |
| | | :step="0.1" |
| | | clearable |
| | | style="width: 100%" |
| | | @change="invoiceAmountBlur(row)" |
| | | /> |
| | | </template> |
| | | </PIMTable> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button @click="closeModal">{{ modalOptions.cancelText }}</el-button> |
| | | <el-button type="primary" :loading="modalLoading" @click="submitForm"> |
| | | {{ modalOptions.confirmText }} |
| | | </el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, getCurrentInstance } from "vue"; |
| | | import { useModal } from "@/hooks/useModal"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import FileUpload from "@/components/Upload/FileUpload.vue"; |
| | | import { |
| | | getPurchaseNoById, |
| | | getInfo, |
| | | addOrUpdateRegistration, |
| | | } from "@/api/procurementManagement/invoiceEntry.js"; |
| | | import { getPurchaseById } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | |
| | | defineOptions({ |
| | | name: "æ¥ç¥¨ç»è®°æ¨¡ææ¡", |
| | | }); |
| | | |
| | | const userStore = useUserStore(); |
| | | const action = import.meta.env.VITE_APP_BASE_API + "/file/upload"; |
| | | const formRef = ref(); |
| | | const { proxy } = getCurrentInstance(); |
| | | const { form } = useFormData({ |
| | | purchaseLedgerNo: undefined, // éè´ååå· |
| | | salesContractNo: undefined, // éå®ååå· |
| | | supplierName: undefined, // ä¾åºååç§° |
| | | projectName: undefined, // 项ç®åç§° |
| | | invoiceNumber: undefined, // åç¥¨å· |
| | | invoiceAmount: undefined, // å票éé¢(å
) |
| | | issUerId: userStore.id, // å½å
¥äºº |
| | | issUer: userStore.nickName, // å½å
¥äºº |
| | | entryDate: undefined, // å¼ç¥¨æ¥æ |
| | | salesContractNoId: undefined, // å¼ç¥¨æ¥æ |
| | | productData: [], // è¡¨æ ¼ |
| | | tempFileIds: [], // æä»¶ |
| | | }); |
| | | |
| | | const rules = ref({ |
| | | invoiceNumber: [ |
| | | { required: true, message: "请è¾å
¥å票å·", trigger: "blur" }, |
| | | { type: "string" }, |
| | | ], |
| | | invoiceAmount: [ |
| | | { required: true, message: "请è¾å
¥å票éé¢", trigger: "blur" }, |
| | | ], |
| | | }); |
| | | |
| | | const { |
| | | id, |
| | | visible, |
| | | loading: modalLoading, |
| | | openModal, |
| | | modalOptions, |
| | | handleConfirm, |
| | | closeModal, |
| | | } = useModal({ |
| | | title: "æ¥ç¥¨ç»è®°", |
| | | }); |
| | | |
| | | const columns = [ |
| | | { |
| | | label: "产å大类", |
| | | prop: "productCategory", |
| | | }, |
| | | { |
| | | label: "è§æ ¼åå·", |
| | | prop: "specificationModel", |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | width: 80, |
| | | }, |
| | | { |
| | | label: "æ°é", |
| | | prop: "quantity", |
| | | width: 80, |
| | | }, |
| | | { |
| | | label: "ç¨ç(%)", |
| | | prop: "taxRate", |
| | | width: 80, |
| | | }, |
| | | { |
| | | label: "å½å
¥æ¥æ", |
| | | prop: "registerDate", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "å«ç¨åä»·(å
)", |
| | | prop: "taxInclusiveUnitPrice", |
| | | width: 150, |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "å«ç¨æ»ä»·(å
)", |
| | | prop: "taxInclusiveTotalPrice", |
| | | width: 150, |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "ä¸å«ç¨æ»ä»·(å
)", |
| | | prop: "taxExclusiveTotalPrice", |
| | | width: 150, |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "æ¬æ¬¡æ¥ç¥¨æ°", |
| | | prop: "ticketsNum", |
| | | dataType: "slot", |
| | | slot: "ticketsNumRef", |
| | | width: 180, |
| | | align: "center", |
| | | }, |
| | | { |
| | | label: "æ¬æ¬¡æ¥ç¥¨éé¢(å
)", |
| | | prop: "ticketsAmount", |
| | | dataType: "slot", |
| | | slot: "ticketsAmountRef", |
| | | width: 180, |
| | | align: "center", |
| | | }, |
| | | { |
| | | label: "æªæ¥ç¥¨æ°", |
| | | prop: "futureTickets", |
| | | }, |
| | | { |
| | | label: "æªæ¥ç¥¨éé¢(å
)", |
| | | prop: "futureTicketsAmount", |
| | | }, |
| | | ]; |
| | | |
| | | const getTableData = async (type, id) => { |
| | | if (type == "add") { |
| | | const { data } = await getPurchaseNoById({ id }); |
| | | form.purchaseLedgerNo = data.purchaseContractNumber; |
| | | form.invoiceAmount = data.invoiceAmount; |
| | | form.invoiceNumber = data.invoiceNumber; |
| | | form.entryDate = data.entryDate; |
| | | form.salesContractNoId = data.salesContractNoId; |
| | | |
| | | const { data: infoData } = await getInfo({ id }); |
| | | form.salesContractNo = infoData.salesContractNo; |
| | | form.projectName = infoData.projectName; |
| | | form.supplierName = infoData.supplierName; |
| | | form.productData = infoData.productData; |
| | | } else if (type == "edit") { |
| | | const data = await getPurchaseById({ id, type: 2 }); |
| | | form.purchaseLedgerNo = data.purchaseContractNumber; |
| | | form.invoiceAmount = data.invoiceAmount; |
| | | form.invoiceNumber = data.invoiceNumber; |
| | | form.salesContractNo = data.salesContractNo; |
| | | form.projectName = data.projectName; |
| | | form.supplierName = data.supplierName; |
| | | form.entryDate = data.entryDate; |
| | | form.productData = data.productData; |
| | | } |
| | | }; |
| | | |
| | | //æ¬æ¬¡æ¥ç¥¨æ°å¤±ç¦æä½ |
| | | const invoiceNumBlur = (row) => { |
| | | if (!row.ticketsNum || row.ticketsNum === "") { |
| | | row.ticketsNum = 0; |
| | | } |
| | | if (Number(row.ticketsNum) > Number(row.tempFutureTickets)) { |
| | | proxy.$modal.msgWarning("æ¬æ¬¡å¼ç¥¨æ°ä¸å¾å¤§äºæªå¼ç¥¨æ°"); |
| | | row.ticketsNum = 0; |
| | | return; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡æ¥ç¥¨éé¢ |
| | | row.ticketsAmount = row.ticketsNum * row.taxInclusiveUnitPrice; |
| | | // è®¡ç®æªæ¥ç¥¨æ° |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum; |
| | | // è®¡ç®æªæ¥ç¥¨éé¢ |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount; |
| | | calculateinvoiceAmount(); |
| | | }; |
| | | |
| | | // æ¬æ¬¡æ¥ç¥¨éé¢å¤±ç¦æä½ |
| | | const invoiceAmountBlur = (row) => { |
| | | if (!row.ticketsAmount) { |
| | | row.ticketsAmount = 0; |
| | | } |
| | | // è®¡ç®æ¯å¦è¶
è¿æ¥ç¥¨æ»éé¢ |
| | | if (row.ticketsAmount > row.tempFutureTicketsAmount) { |
| | | proxy.$modal.msgWarning("æ¬æ¬¡æ¥ç¥¨éé¢ä¸å¾å¤§äºæªæ¥ç¥¨éé¢"); |
| | | row.ticketsAmount = 0; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡æ¥ç¥¨æ° |
| | | row.ticketsNum = Number( |
| | | (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2) |
| | | ); |
| | | // è®¡ç®æªæ¥ç¥¨æ° |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum; |
| | | // è®¡ç®æªæ¥ç¥¨éé¢ |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount; |
| | | calculateinvoiceAmount(); |
| | | }; |
| | | |
| | | const calculateinvoiceAmount = () => { |
| | | let invoiceAmountTotal = 0; |
| | | form.productData.forEach((item) => { |
| | | if (item.ticketsAmount) { |
| | | invoiceAmountTotal += item.ticketsAmount; |
| | | } |
| | | }); |
| | | form.invoiceAmount = invoiceAmountTotal.toFixed(2); |
| | | }; |
| | | |
| | | const open = (type, eid) => { |
| | | openModal(); |
| | | getTableData(type, eid); |
| | | id.value = eid; |
| | | }; |
| | | |
| | | const uploadSuccess = (response) => { |
| | | form.tempFileIds.push(response.data.tempId); |
| | | console.log(form); |
| | | }; |
| | | |
| | | const removeFile = (file) => { |
| | | const { tempId } = file.response.data; |
| | | form.tempFileIds = form.tempFileIds.filter((item) => item !== tempId); |
| | | }; |
| | | |
| | | const submitForm = () => { |
| | | formRef.value.validate(async (valid, fields) => { |
| | | if (valid) { |
| | | modalLoading.value = true; |
| | | const { code } = await addOrUpdateRegistration({ |
| | | purchaseLedgerId: id.value, |
| | | purchaseContractNumber: form.purchaseLedgerNo, |
| | | invoiceNumber: form.invoiceNumber, |
| | | invoiceAmount: form.invoiceAmount, |
| | | salesContractNo: form.salesContractNo, |
| | | projectName: form.projectName, |
| | | productData: form.productData, |
| | | issUerId: form.issUerId, // å½å
¥äºº |
| | | issUer: form.issUer, // å½å
¥äºº |
| | | salesContractNoId: form.salesContractNoId, |
| | | supplierName: form.supplierName, |
| | | tempFileIds: form.tempFileIds, |
| | | }); |
| | | modalLoading.value = false; |
| | | if (code == 200) { |
| | | closeModal(); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | defineExpose({ |
| | | open, |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped></style> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">éè´ååå·ï¼</span> |
| | | <el-form :model="filters" :inline="true"> |
| | | <el-form-item label="éè´ååå·ï¼"> |
| | | <el-input |
| | | v-model="searchForm.purchaseContractNumber" |
| | | style="width: 240px" |
| | | v-model="filters.purchaseContractNumber" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | prefix-icon="Search" |
| | | @change="getTableData" |
| | | /> |
| | | <el-button |
| | | type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px" |
| | | > |
| | | æç´¢ |
| | | </el-button> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getTableData"> æç´¢ </el-button> |
| | | <el-button @click="resetFilters"> éç½® </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <div class="actions"> |
| | | <div></div> |
| | | <div> |
| | | <el-button type="primary" @click="handleAdd">æ°å¢ç»è®°</el-button> |
| | | <el-button type="primary" @click="handleAdd('add')"> |
| | | æ°å¢ç»è®° |
| | | </el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="(row) => row.id" |
| | | show-summary |
| | | :summary-method="summarizeMainTable" |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="columns" |
| | | :tableData="dataList" |
| | | :tableLoading="loading" |
| | | :isSelection="true" |
| | | :page="{ |
| | | current: pagination.currentPage, |
| | | size: pagination.pageSize, |
| | | total: pagination.total, |
| | | }" |
| | | :expand-row-keys="expandRowKeys" |
| | | @expand-change="expandChange" |
| | | height="calc(100vh - 18.5em)" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column type="expand"> |
| | | <template #default="props"> |
| | | <el-table |
| | | :data="props.row.children" |
| | | border |
| | | show-summary |
| | | :summary-method="summarizeChildrenTable" |
| | | <template #expand="{ row }"> |
| | | <ExpandTable ref="expandTableRef" /> |
| | | </template> |
| | | <template #operation="{ row }"> |
| | | <el-button |
| | | text |
| | | type="primary" |
| | | size="small" |
| | | @click="handleEdit('edit', row.id)" |
| | | > |
| | | <el-table-column |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | <el-table-column label="产å大类" prop="productCategory" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" /> |
| | | <el-table-column label="åä½" prop="unit" /> |
| | | <el-table-column label="æ°é" prop="quantity" /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" /> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="æ¬æ¬¡æ¥ç¥¨æ°" prop="ticketsNum" /> |
| | | <el-table-column |
| | | label="æ¬æ¬¡æ¥ç¥¨éé¢(å
)" |
| | | prop="ticketsAmount" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="æªæ¥ç¥¨æ°" prop="futureTickets" /> |
| | | <el-table-column |
| | | label="æªæ¥ç¥¨éé¢(å
)" |
| | | prop="futureTicketsAmount" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | </el-table> |
| | | ç¼è¾ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column |
| | | label="éè´ååå·" |
| | | prop="purchaseContractNumber" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="éå®ååå·" |
| | | prop="salesContractNo" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="ä¾åºååç§°" |
| | | prop="supplierName" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="项ç®åç§°" |
| | | prop="projectName" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="ååéé¢(å
)" |
| | | prop="contractAmount" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å·²å¼ç¥¨éé¢(å
)" |
| | | prop="receiptPaymentAmount" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å¾
å¼ç¥¨éé¢(å
)" |
| | | prop="unReceiptPaymentAmount" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <!-- <el-table-column fixed="right" label="æä½" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">ç¼è¾</el-button> |
| | | </template> |
| | | </el-table-column> --> |
| | | </el-table> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" |
| | | /> |
| | | </PIMTable> |
| | | </div> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | :title="operationType === 'add' ? 'æ°å¢æ¥ç¥¨ç»è®°' : 'ç¼è¾æ¥ç¥¨ç»è®°'" |
| | | width="80%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form |
| | | :model="form" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éè´ååå·ï¼" prop="purchaseLedgerNo"> |
| | | <el-input v-model="form.purchaseLedgerNo" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éå®ååå·ï¼" prop="salesContractNo"> |
| | | <el-input |
| | | v-model="form.salesContractNo" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¾åºååç§°ï¼" prop="supplierName"> |
| | | <el-input |
| | | v-model="form.supplierName" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="项ç®åç§°ï¼" prop="projectName"> |
| | | <el-input |
| | | v-model="form.projectName" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票å·ï¼" prop="invoiceNumber"> |
| | | <el-input |
| | | v-model="form.invoiceNumber" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票éé¢(å
)ï¼" prop="invoiceAmount"> |
| | | <el-input |
| | | type="number" |
| | | :step="0.01" |
| | | v-model="form.invoiceAmount" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½å
¥äººï¼" prop="issUer"> |
| | | <el-input |
| | | v-model="form.issUer" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¼ç¥¨æ¥æï¼" prop="issueDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.issueDate" |
| | | type="date" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <!-- <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½å
¥æ¥æï¼" prop="createTime"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.createTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> --> |
| | | <el-row> |
| | | <el-form-item label="产åä¿¡æ¯ï¼" prop="entryDate"> </el-form-item> |
| | | </el-row> |
| | | <el-table |
| | | :data="productData" |
| | | border |
| | | @selection-change="productSelected" |
| | | show-summary |
| | | style="width: 100%" |
| | | :summary-method="summarizeChildrenTable" |
| | | > |
| | | <el-table-column |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | <el-table-column label="产å大类" prop="productCategory" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" /> |
| | | <el-table-column label="åä½" prop="unit" width="70" /> |
| | | <el-table-column label="æ°é" prop="quantity" width="70" /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" width="80" /> |
| | | <el-table-column label="å½å
¥æ¥æ" prop="createTime" width="120" /> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | width="150" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | width="150" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | width="150" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="æ¬æ¬¡æ¥ç¥¨æ°" prop="ticketsNum" width="170"> |
| | | <template #default="scope"> |
| | | <el-input-number |
| | | v-model="scope.row.ticketsNum" |
| | | placeholder="è¯·éæ©" |
| | | :min="0" |
| | | :step="0.1" |
| | | clearable |
| | | style="width: 100%" |
| | | @change="invoiceNumBlur(scope.row)" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="æ¬æ¬¡æ¥ç¥¨éé¢(å
)" |
| | | prop="ticketsAmount" |
| | | :min="0" |
| | | :step="0.1" |
| | | :formatter="formattedNumber" |
| | | @change="invoiceAmountBlur" |
| | | width="170" |
| | | > |
| | | <template #default="scope"> |
| | | <el-input-number |
| | | v-model="scope.row.ticketsAmount" |
| | | placeholder="è¯·éæ©" |
| | | :min="0" |
| | | :step="0.1" |
| | | clearable |
| | | style="width: 100%" |
| | | @change="invoiceAmountBlur(scope.row)" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="æªæ¥ç¥¨æ°" |
| | | prop="futureTickets" |
| | | :=" |
| | | (row) => |
| | | row.futureTickets == null || row.futureTickets === '' |
| | | ? row.quantity |
| | | : row.futureTickets |
| | | " |
| | | > |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="æªæ¥ç¥¨éé¢(å
)" |
| | | prop="futureTicketsAmount" |
| | | :formatter=" |
| | | (row) => |
| | | row.futureTicketsAmount !== undefined && |
| | | row.futureTicketsAmount !== null && |
| | | row.futureTicketsAmount !== '' |
| | | ? row.futureTicketsAmount |
| | | : row.taxExclusiveTotalPrice |
| | | " |
| | | > |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <Modal ref="modalRef"></Modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ref } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import { productList } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | const userStore = useUserStore(); |
| | | import { usePaginationApi } from "@/hooks/usePaginationApi"; |
| | | import { gePurchaseListPage } from "@/api/procurementManagement/invoiceEntry.js"; |
| | | import { nextTick, onMounted, getCurrentInstance } from "vue"; |
| | | import ExpandTable from "./components/ExpandTable.vue"; |
| | | import Modal from "./components/Modal.vue"; |
| | | |
| | | defineOptions({ |
| | | name: "æ¥ç¥¨ç»è®°", |
| | | }); |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const productData = ref([]); |
| | | const expandRowKeys = ref([]); |
| | | const expandTableRef = ref(); |
| | | const modalRef = ref(); |
| | | const selectedRows = ref([]); |
| | | const productSelectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const purchaseLedgerList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }); |
| | | const total = ref(0); |
| | | const fileList = ref([]); |
| | | import { |
| | | addOrUpdateRegistration, |
| | | delRegistration, |
| | | |
| | | const { |
| | | loading, |
| | | filters, |
| | | columns, |
| | | dataList, |
| | | pagination, |
| | | getTableData, |
| | | resetFilters, |
| | | } = usePaginationApi( |
| | | gePurchaseListPage, |
| | | getInfo, |
| | | getProduct, |
| | | getPurchaseNoById, |
| | | getRegistrationById, |
| | | } from "@/api/procurementManagement/invoiceEntry.js"; |
| | | { |
| | | purchaseContractNumber: undefined, |
| | | }, |
| | | [ |
| | | { |
| | | type: "expand", |
| | | dataType: "slot", |
| | | slot: "expand", |
| | | }, |
| | | { |
| | | label: "éå®ååå·", |
| | | prop: "salesContractNo", |
| | | }, |
| | | { |
| | | label: "ä¾åºååç§°", |
| | | prop: "supplierName", |
| | | }, |
| | | { |
| | | label: "项ç®åç§°", |
| | | prop: "projectName", |
| | | }, |
| | | { |
| | | label: "ååéé¢(å
)", |
| | | prop: "contractAmount", |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "å·²å¼ç¥¨éé¢(å
)", |
| | | prop: "receiptPaymentAmount", |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "å¾
å¼ç¥¨éé¢(å
)", |
| | | prop: "unReceiptPaymentAmount", |
| | | formatData: (val) => { |
| | | return parseFloat(val).toFixed(2) ?? 0; |
| | | }, |
| | | }, |
| | | // { |
| | | // fixed: "right", |
| | | // label: "æä½", |
| | | // dataType: "slot", |
| | | // slot: "operation", |
| | | // align: "center", |
| | | // width: "200px", |
| | | // }, |
| | | ] |
| | | ); |
| | | |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | purchaseContractNumber: "", |
| | | }, |
| | | form: { |
| | | issueDate: "", // å¼ç¥¨æ¥æ |
| | | purchaseLedgerId: "", |
| | | purchaseLedgerNo: "", |
| | | issUerId: "", // å¼ç¥¨äººid |
| | | issUer: "", // å¼ç¥¨äººå§å |
| | | invoiceNumber: "", // åç¥¨å· |
| | | invoiceAmount: "", // å票éé¢ |
| | | createTime: "", // å½å
¥æ¥æ |
| | | }, |
| | | rules: { |
| | | invoiceNumber: [ |
| | | { required: true, message: "请è¾å
¥å票å·", trigger: "blur" }, |
| | | { type: "string" }, |
| | | ], |
| | | invoiceAmount: [ |
| | | { required: true, message: "请è¾å
¥å票éé¢", trigger: "blur" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | // 产å表åå¼¹æ¡æ°æ® |
| | | const productFormVisible = ref(false); |
| | | const productOperationType = ref(""); |
| | | const currentId = ref(""); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | gePurchaseListPage({ ...searchForm.value, ...page }) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | tableData.value.map((item) => { |
| | | item.children = []; |
| | | }); |
| | | total.value = res.total; |
| | | expandedRowKeys.value = []; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection.filter( |
| | | (item) => item.purchaseContractNumber !== undefined |
| | | ); |
| | | }; |
| | | const productSelected = (selectedRows) => { |
| | | productSelectedRows.value = selectedRows; |
| | | }; |
| | | const expandedRowKeys = ref([]); |
| | | // å±å¼è¡ |
| | | const expandChange = (row, expandedRows) => { |
| | | if (expandedRows.length > 0) { |
| | | expandedRowKeys.value = []; |
| | | try { |
| | | productList({ salesLedgerId: row.id, type: 2 }).then((res) => { |
| | | const index = tableData.value.findIndex((item) => item.id === row.id); |
| | | if (index > -1) { |
| | | tableData.value[index].children = res; |
| | | } |
| | | expandedRowKeys.value.push(row.id); |
| | | }); |
| | | } catch (error) { |
| | | console.log(error); |
| | | } |
| | | } else { |
| | | expandedRowKeys.value = []; |
| | | } |
| | | }; |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | ["contractAmount", "receiptPaymentAmount", "unReceiptPaymentAmount"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | } |
| | | ); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeChildrenTable = (param) => { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | [ |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | "ticketsNum", |
| | | "ticketsAmount", |
| | | "futureTickets", |
| | | "futureTicketsAmount", |
| | | ], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | } |
| | | ); |
| | | }; |
| | | |
| | | const handleAdd = () => { |
| | | const handleAdd = (type) => { |
| | | if (selectedRows.value.length !== 1) { |
| | | proxy.$modal.msgWarning("请å
éä¸ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | openForm("add", selectedRows.value[0]); |
| | | modalRef.value.open(type, selectedRows.value[0].id); |
| | | }; |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (type, row) => { |
| | | invoiceNumBlur(row); |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | productData.value = []; |
| | | fileList.value = []; |
| | | form.value.issUerId = userStore.id; |
| | | form.value.issUer = userStore.name; |
| | | form.value.issueDate = getNowFormatDate(); |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | // æ°å¢æ¶ä¼ å
¥å½åè¡idå¹¶æ¥è¯¢éè´ååå· |
| | | if (type === "add" && row && row.id) { |
| | | form.value.purchaseLedgerId = row.id; |
| | | getPurchaseNoById({ id: row.id }).then((res) => { |
| | | let result = res.data; |
| | | (purchaseLedgerList.value = result), |
| | | (form.value.purchaseLedgerNo = result.purchaseContractNumber); |
| | | form.value.invoiceAmount = result.invoiceAmount; |
| | | form.value.invoiceNumber = result.invoiceNumber; |
| | | setInfo(result.id); |
| | | }); |
| | | } else { |
| | | getProduct().then((res) => { |
| | | purchaseLedgerList.value = res; |
| | | }); |
| | | } |
| | | if (type === "edit") { |
| | | currentId.value = row.id; |
| | | getRegistrationById({ id: row.id }).then((res) => { |
| | | form.value = { ...res }; |
| | | productData.value = form.value.productData; |
| | | if (form.value.salesLedgerFiles) { |
| | | fileList.value = form.value.salesLedgerFiles; |
| | | } else { |
| | | fileList.value = []; |
| | | } |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // éæ©éè´ååå·èµå¼ |
| | | const setInfo = (value) => { |
| | | getInfo({ id: value }).then((res) => { |
| | | let result = res.data; |
| | | form.value.salesContractNo = result.salesContractNo; |
| | | form.value.projectName = result.projectName; |
| | | productData.value = result.productData; |
| | | form.value.supplierName = result.supplierName; |
| | | }); |
| | | }; |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | form.value.productData = proxy.HaveJson(productData.value); |
| | | addOrUpdateRegistration(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/purchase/registration/export", {}, "æ¥ç¥¨ç»è®°.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | delRegistration(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | //æ¬æ¬¡æ¥ç¥¨æ°å¤±ç¦æä½ |
| | | const invoiceNumBlur = (row) => { |
| | | if (!row.ticketsNum || row.ticketsNum === "") { |
| | | row.ticketsNum = 0; |
| | | } |
| | | if (Number(row.ticketsNum) > Number(row.tempFutureTickets)) { |
| | | proxy.$modal.msgWarning("æ¬æ¬¡å¼ç¥¨æ°ä¸å¾å¤§äºæªå¼ç¥¨æ°"); |
| | | row.ticketsNum = 0; |
| | | return; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡æ¥ç¥¨éé¢ |
| | | row.ticketsAmount = row.ticketsNum * row.taxInclusiveUnitPrice; |
| | | // è®¡ç®æªæ¥ç¥¨æ° |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum; |
| | | // è®¡ç®æªæ¥ç¥¨éé¢ |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount; |
| | | calculateinvoiceAmount(); |
| | | }; |
| | | // æ¬æ¬¡æ¥ç¥¨éé¢å¤±ç¦æä½ |
| | | const invoiceAmountBlur = (row) => { |
| | | if (!row.ticketsAmount) { |
| | | row.ticketsAmount = 0; |
| | | } |
| | | // è®¡ç®æ¯å¦è¶
è¿æ¥ç¥¨æ»éé¢ |
| | | if (row.ticketsAmount > row.tempFutureTicketsAmount) { |
| | | proxy.$modal.msgWarning("æ¬æ¬¡æ¥ç¥¨éé¢ä¸å¾å¤§äºæªæ¥ç¥¨éé¢"); |
| | | row.ticketsAmount = 0; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡æ¥ç¥¨æ° |
| | | row.ticketsNum = (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2); |
| | | // è®¡ç®æªæ¥ç¥¨æ° |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum; |
| | | // è®¡ç®æªæ¥ç¥¨éé¢ |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount; |
| | | calculateinvoiceAmount(); |
| | | const handleEdit = (type, id) => { |
| | | modalRef.value.open(type, id); |
| | | }; |
| | | |
| | | // è·åå½åæ¥æå½æ° |
| | | function getNowFormatDate() { |
| | | let date = new Date(), |
| | | year = date.getFullYear(), //è·å宿´ç年份(4ä½) |
| | | month = date.getMonth() + 1, //è·åå½åæä»½(0-11,0代表1æ) |
| | | strDate = date.getDate(); // è·åå½åæ¥(1-31) |
| | | if (month < 10) month = `0${month}`; // 妿æä»½æ¯ä¸ªä½æ°ï¼å¨åé¢è¡¥0 |
| | | if (strDate < 10) strDate = `0${strDate}`; // å¦ææ¥æ¯ä¸ªä½æ°ï¼å¨åé¢è¡¥0 |
| | | return `${year}-${month}-${strDate}`; |
| | | } |
| | | const handleOut = () => {}; |
| | | const handleDelete = () => {}; |
| | | |
| | | function calculateinvoiceAmount() { |
| | | console.log("productData", productData.value); |
| | | var invoiceAmountTotal = 0; |
| | | productData.value.forEach((item) => { |
| | | if (item.ticketsAmount) { |
| | | invoiceAmountTotal += item.ticketsAmount; |
| | | } |
| | | const expandChange = async (row, expandedRows) => { |
| | | await nextTick(); |
| | | expandTableRef.value.getList(row.id); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getTableData(); |
| | | }); |
| | | form.value.invoiceAmount = invoiceAmountTotal.toFixed(2); |
| | | } |
| | | |
| | | getList(); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| | | <style lang="scss" scoped> |
| | | .table_list { |
| | | margin-top: unset; |
| | | } |
| | | .actions { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin-bottom: 10px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">éè´ååå·ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.purchaseContractNumber" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | prefix-icon="Search" |
| | | /> |
| | | <el-button |
| | | type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px" |
| | | > |
| | | æç´¢ |
| | | </el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="handleAdd">æ°å¢ç»è®°</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="(row) => row.id" |
| | | show-summary |
| | | :summary-method="summarizeMainTable" |
| | | @expand-change="expandChange" |
| | | height="calc(100vh - 18.5em)" |
| | | > |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column type="expand"> |
| | | <template #default="props"> |
| | | <el-table |
| | | :data="props.row.children" |
| | | border |
| | | show-summary |
| | | :summary-method="summarizeChildrenTable" |
| | | > |
| | | <el-table-column |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | <el-table-column label="产å大类" prop="productCategory" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" /> |
| | | <el-table-column label="åä½" prop="unit" /> |
| | | <el-table-column label="æ°é" prop="quantity" /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" /> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="æ¬æ¬¡æ¥ç¥¨æ°" prop="ticketsNum" /> |
| | | <el-table-column |
| | | label="æ¬æ¬¡æ¥ç¥¨éé¢(å
)" |
| | | prop="ticketsAmount" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="æªæ¥ç¥¨æ°" prop="futureTickets" /> |
| | | <el-table-column |
| | | label="æªæ¥ç¥¨éé¢(å
)" |
| | | prop="futureTicketsAmount" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column |
| | | label="éè´ååå·" |
| | | prop="purchaseContractNumber" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="éå®ååå·" |
| | | prop="salesContractNo" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="ä¾åºååç§°" |
| | | prop="supplierName" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="项ç®åç§°" |
| | | prop="projectName" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="ååéé¢(å
)" |
| | | prop="contractAmount" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å·²å¼ç¥¨éé¢(å
)" |
| | | prop="receiptPaymentAmount" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å¾
å¼ç¥¨éé¢(å
)" |
| | | prop="unReceiptPaymentAmount" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | fixed="right" |
| | | label="æä½" |
| | | min-width="60" |
| | | align="center" |
| | | > |
| | | <template #default="scope"> |
| | | <el-button |
| | | text |
| | | type="primary" |
| | | size="small" |
| | | @click="openForm('edit', scope.row)" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" |
| | | /> |
| | | </div> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | :title="operationType === 'add' ? 'æ°å¢æ¥ç¥¨ç»è®°' : 'ç¼è¾æ¥ç¥¨ç»è®°'" |
| | | width="80%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form |
| | | :model="form" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éè´ååå·ï¼" prop="purchaseLedgerNo"> |
| | | <el-input v-model="form.purchaseLedgerNo" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éå®ååå·ï¼" prop="salesContractNo"> |
| | | <el-input |
| | | v-model="form.salesContractNo" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¾åºååç§°ï¼" prop="supplierName"> |
| | | <el-input |
| | | v-model="form.supplierName" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="项ç®åç§°ï¼" prop="projectName"> |
| | | <el-input |
| | | v-model="form.projectName" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票å·ï¼" prop="invoiceNumber"> |
| | | <el-input |
| | | v-model="form.invoiceNumber" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票éé¢(å
)ï¼" prop="invoiceAmount"> |
| | | <el-input |
| | | type="number" |
| | | :step="0.01" |
| | | v-model="form.invoiceAmount" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | :disabled="true" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½å
¥äººï¼" prop="issUer"> |
| | | <el-input |
| | | v-model="form.issUer" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¼ç¥¨æ¥æï¼" prop="issueDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.issueDate" |
| | | type="date" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸ä¼ éä»¶"> |
| | | <FileUpload :showTip="false" accept="*" :autoUpload="true" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <!-- <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½å
¥æ¥æï¼" prop="createTime"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.createTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> --> |
| | | <el-row> |
| | | <el-form-item label="产åä¿¡æ¯ï¼" prop="entryDate"> </el-form-item> |
| | | </el-row> |
| | | <el-table |
| | | :data="productData" |
| | | border |
| | | @selection-change="productSelected" |
| | | show-summary |
| | | style="width: 100%" |
| | | :summary-method="summarizeChildrenTable" |
| | | > |
| | | <el-table-column |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | <el-table-column label="产å大类" prop="productCategory" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" /> |
| | | <el-table-column label="åä½" prop="unit" width="70" /> |
| | | <el-table-column label="æ°é" prop="quantity" width="70" /> |
| | | <el-table-column label="ç¨ç(%)" prop="taxRate" width="80" /> |
| | | <el-table-column label="å½å
¥æ¥æ" prop="createTime" width="120" /> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | width="150" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | width="150" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | width="150" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="æ¬æ¬¡æ¥ç¥¨æ°" prop="ticketsNum" width="170"> |
| | | <template #default="scope"> |
| | | <el-input-number |
| | | v-model="scope.row.ticketsNum" |
| | | placeholder="è¯·éæ©" |
| | | :min="0" |
| | | :step="0.1" |
| | | clearable |
| | | style="width: 100%" |
| | | @change="invoiceNumBlur(scope.row)" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="æ¬æ¬¡æ¥ç¥¨éé¢(å
)" |
| | | prop="ticketsAmount" |
| | | :min="0" |
| | | :step="0.1" |
| | | :formatter="formattedNumber" |
| | | width="170" |
| | | > |
| | | <template #default="scope"> |
| | | <el-input-number |
| | | v-model="scope.row.ticketsAmount" |
| | | placeholder="è¯·éæ©" |
| | | :min="0" |
| | | :step="0.1" |
| | | clearable |
| | | style="width: 100%" |
| | | @change="invoiceAmountBlur(scope.row)" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="æªæ¥ç¥¨æ°" |
| | | prop="futureTickets" |
| | | :formatter=" |
| | | (row) => |
| | | row.futureTickets == null || row.futureTickets === '' |
| | | ? row.quantity |
| | | : row.futureTickets |
| | | " |
| | | > |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="æªæ¥ç¥¨éé¢(å
)" |
| | | prop="futureTicketsAmount" |
| | | :formatter=" |
| | | (row) => |
| | | row.futureTicketsAmount !== undefined && |
| | | row.futureTicketsAmount !== null && |
| | | row.futureTicketsAmount !== '' |
| | | ? row.futureTicketsAmount |
| | | : row.taxExclusiveTotalPrice |
| | | " |
| | | > |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { onMounted, ref } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import { productList } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import FileUpload from "@/components/Upload/FileUpload.vue"; |
| | | |
| | | const userStore = useUserStore(); |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const productData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const productSelectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const purchaseLedgerList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }); |
| | | const total = ref(0); |
| | | const fileList = ref([]); |
| | | import { |
| | | addOrUpdateRegistration, |
| | | delRegistration, |
| | | gePurchaseListPage, |
| | | getInfo, |
| | | getProduct, |
| | | getPurchaseNoById, |
| | | getRegistrationById, |
| | | } from "@/api/procurementManagement/invoiceEntry.js"; |
| | | |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | purchaseContractNumber: "", |
| | | }, |
| | | form: { |
| | | issueDate: "", // å¼ç¥¨æ¥æ |
| | | purchaseLedgerId: "", |
| | | purchaseLedgerNo: "", |
| | | issUerId: "", // å¼ç¥¨äººid |
| | | issUer: "", // å¼ç¥¨äººå§å |
| | | invoiceNumber: "", // åç¥¨å· |
| | | invoiceAmount: "", // å票éé¢ |
| | | createTime: "", // å½å
¥æ¥æ |
| | | }, |
| | | rules: { |
| | | invoiceNumber: [ |
| | | { required: true, message: "请è¾å
¥å票å·", trigger: "blur" }, |
| | | { type: "string" }, |
| | | ], |
| | | invoiceAmount: [ |
| | | { required: true, message: "请è¾å
¥å票éé¢", trigger: "blur" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | // 产å表åå¼¹æ¡æ°æ® |
| | | const productFormVisible = ref(false); |
| | | const productOperationType = ref(""); |
| | | const currentId = ref(""); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | gePurchaseListPage({ ...searchForm.value, ...page }) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | tableData.value.map((item) => { |
| | | item.children = []; |
| | | }); |
| | | total.value = res.total; |
| | | expandedRowKeys.value = []; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2) ?? 0; |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection.filter( |
| | | (item) => item.purchaseContractNumber !== undefined |
| | | ); |
| | | }; |
| | | const productSelected = (selectedRows) => { |
| | | productSelectedRows.value = selectedRows; |
| | | }; |
| | | const expandedRowKeys = ref([]); |
| | | // å±å¼è¡ |
| | | const expandChange = (row, expandedRows) => { |
| | | if (expandedRows.length > 0) { |
| | | expandedRowKeys.value = []; |
| | | try { |
| | | productList({ salesLedgerId: row.id, type: 2 }).then((res) => { |
| | | const index = tableData.value.findIndex((item) => item.id === row.id); |
| | | if (index > -1) { |
| | | tableData.value[index].children = res; |
| | | } |
| | | expandedRowKeys.value.push(row.id); |
| | | }); |
| | | } catch (error) { |
| | | console.log(error); |
| | | } |
| | | } else { |
| | | expandedRowKeys.value = []; |
| | | } |
| | | }; |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | ["contractAmount", "receiptPaymentAmount", "unReceiptPaymentAmount"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | } |
| | | ); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeChildrenTable = (param) => { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | [ |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | "ticketsNum", |
| | | "ticketsAmount", |
| | | "futureTickets", |
| | | "futureTicketsAmount", |
| | | ], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | } |
| | | ); |
| | | }; |
| | | |
| | | const handleAdd = () => { |
| | | if (selectedRows.value.length !== 1) { |
| | | proxy.$modal.msgWarning("请å
éä¸ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | openForm("add", selectedRows.value[0]); |
| | | }; |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (type, row) => { |
| | | invoiceNumBlur(row); |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | productData.value = []; |
| | | fileList.value = []; |
| | | form.value.issUerId = userStore.id; |
| | | form.value.issUer = userStore.name; |
| | | form.value.issueDate = getNowFormatDate(); |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | // æ°å¢æ¶ä¼ å
¥å½åè¡idå¹¶æ¥è¯¢éè´ååå· |
| | | if (type === "add" && row && row.id) { |
| | | form.value.purchaseLedgerId = row.id; |
| | | getPurchaseNoById({ id: row.id }).then((res) => { |
| | | let result = res.data; |
| | | purchaseLedgerList.value = result; |
| | | form.value.purchaseLedgerNo = result.purchaseContractNumber; |
| | | form.value.invoiceAmount = result.invoiceAmount; |
| | | form.value.invoiceNumber = result.invoiceNumber; |
| | | setInfo(result.id); |
| | | }); |
| | | } else { |
| | | getProduct().then((res) => { |
| | | purchaseLedgerList.value = res; |
| | | }); |
| | | } |
| | | if (type === "edit") { |
| | | currentId.value = row.id; |
| | | getRegistrationById({ id: row.id }).then((res) => { |
| | | const { code, data } = res; |
| | | if (code == 200) { |
| | | form.value.invoiceAmount = data.invoiceAmount; |
| | | productData.value = data.productData; |
| | | if (data.salesLedgerFiles) { |
| | | fileList.value = data.salesLedgerFiles; |
| | | } else { |
| | | fileList.value = []; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // éæ©éè´ååå·èµå¼ |
| | | const setInfo = (value) => { |
| | | getInfo({ id: value }).then((res) => { |
| | | let result = res.data; |
| | | form.value.salesContractNo = result.salesContractNo; |
| | | form.value.projectName = result.projectName; |
| | | productData.value = result.productData; |
| | | form.value.supplierName = result.supplierName; |
| | | }); |
| | | }; |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | form.value.productData = proxy.HaveJson(productData.value); |
| | | addOrUpdateRegistration(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/purchase/registration/export", {}, "æ¥ç¥¨ç»è®°.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | delRegistration(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | //æ¬æ¬¡æ¥ç¥¨æ°å¤±ç¦æä½ |
| | | const invoiceNumBlur = (row) => { |
| | | if (!row.ticketsNum || row.ticketsNum === "") { |
| | | row.ticketsNum = 0; |
| | | } |
| | | if (Number(row.ticketsNum) > Number(row.tempFutureTickets)) { |
| | | proxy.$modal.msgWarning("æ¬æ¬¡å¼ç¥¨æ°ä¸å¾å¤§äºæªå¼ç¥¨æ°"); |
| | | row.ticketsNum = 0; |
| | | return; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡æ¥ç¥¨éé¢ |
| | | row.ticketsAmount = row.ticketsNum * row.taxInclusiveUnitPrice; |
| | | // è®¡ç®æªæ¥ç¥¨æ° |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum; |
| | | // è®¡ç®æªæ¥ç¥¨éé¢ |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount; |
| | | calculateinvoiceAmount(); |
| | | }; |
| | | // æ¬æ¬¡æ¥ç¥¨éé¢å¤±ç¦æä½ |
| | | const invoiceAmountBlur = (row) => { |
| | | if (!row.ticketsAmount) { |
| | | row.ticketsAmount = 0; |
| | | } |
| | | // è®¡ç®æ¯å¦è¶
è¿æ¥ç¥¨æ»éé¢ |
| | | if (row.ticketsAmount > row.tempFutureTicketsAmount) { |
| | | proxy.$modal.msgWarning("æ¬æ¬¡æ¥ç¥¨éé¢ä¸å¾å¤§äºæªæ¥ç¥¨éé¢"); |
| | | row.ticketsAmount = 0; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡æ¥ç¥¨æ° |
| | | row.ticketsNum = (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2); |
| | | // è®¡ç®æªæ¥ç¥¨æ° |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum; |
| | | // è®¡ç®æªæ¥ç¥¨éé¢ |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount; |
| | | calculateinvoiceAmount(); |
| | | }; |
| | | |
| | | // è·åå½åæ¥æå½æ° |
| | | function getNowFormatDate() { |
| | | let date = new Date(), |
| | | year = date.getFullYear(), //è·å宿´ç年份(4ä½) |
| | | month = date.getMonth() + 1, //è·åå½åæä»½(0-11,0代表1æ) |
| | | strDate = date.getDate(); // è·åå½åæ¥(1-31) |
| | | if (month < 10) month = `0${month}`; // 妿æä»½æ¯ä¸ªä½æ°ï¼å¨åé¢è¡¥0 |
| | | if (strDate < 10) strDate = `0${strDate}`; // å¦ææ¥æ¯ä¸ªä½æ°ï¼å¨åé¢è¡¥0 |
| | | return `${year}-${month}-${strDate}`; |
| | | } |
| | | |
| | | function calculateinvoiceAmount() { |
| | | console.log("productData", productData.value); |
| | | var invoiceAmountTotal = 0; |
| | | productData.value.forEach((item) => { |
| | | if (item.ticketsAmount) { |
| | | invoiceAmountTotal += item.ticketsAmount; |
| | | } |
| | | }); |
| | | form.value.invoiceAmount = invoiceAmountTotal.toFixed(2); |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| | |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :isShowSummary="isShowSummarySon" |
| | | :summaryMethod="summarizeMainTable1" |
| | | :handleSelectionChange="handleSelectionChange" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="total" |
| | |
| | | </el-form> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :isShowSummary="isShowSummarySon" |
| | | :summaryMethod="summarizeMainTable1" |
| | | :handleSelectionChange="handleSelectionChange" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="total" |
| | |
| | | <el-col :span="10"> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumnSon" |
| | | :tableData="originalTableDataSon" |
| | | :isSelection="false" |
| | |
| | | </el-form> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="columns" |
| | | :tableLoading="loading" |
| | | :tableData="dataList" |
| | | :isSelection="true" |
| | | height="calc(100vh - 18.5em)" |
| | | :isShowSummary="true" |
| | | :summaryMethod="summarizeMainTable" |
| | | :page="{ |
| | | current: pagination.currentPage, |
| | | size: pagination.pageSize, |
| | | total: pagination.total, |
| | | }" |
| | | :handleSelectionChange="handleSelectionChange" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="onCurrentChange" |
| | | > |
| | | <!-- <template #operation> |
| | | <el-button type="primary" text @click="handleEdit" size="small"> |
| | | ç¼è¾ |
| | | </el-button> |
| | | </template> --> |
| | | </PIMTable> |
| | | </div> |
| | | </div> |
| | |
| | | } |
| | | ); |
| | | |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | [ |
| | | "taxInclusiveTotalPrice", |
| | | "ticketsAmount", |
| | | "unTicketsPrice", |
| | | "invoiceAmount", |
| | | ], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | } |
| | | ); |
| | | }; |
| | | |
| | | const handleSelectionChange = (val) => { |
| | | multipleVal.value = val; |
| | | }; |
| | |
| | | purchaseListPage({ ...searchForm.value, ...page }) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | tableData.value = res.data.records; |
| | | tableData.value.map((item) => { |
| | | item.children = []; |
| | | }); |
| | | total.value = res.total; |
| | | total.value = res.data.total; |
| | | expandedRowKeys.value = []; |
| | | }) |
| | | .catch(() => { |
| | |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable :column="tableColumn" :tableData="tableData" :page="page" |
| | | :tableLoading="tableLoading" @pagination="pagination" :total="total"></PIMTable> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="total" |
| | | ></PIMTable> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue' |
| | | import { ref } from "vue"; |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import { |
| | | registrationList, |
| | | } from "@/api/procurementManagement/paymentEntry.js"; |
| | | import { registrationList } from "@/api/procurementManagement/paymentEntry.js"; |
| | | const tableColumn = ref([ |
| | | { |
| | | label: '仿¬¾æ¥æ', |
| | | prop: 'paymentDate', |
| | | label: "仿¬¾æ¥æ", |
| | | prop: "paymentDate", |
| | | }, |
| | | { |
| | | label: 'ä¾åºååç§°', |
| | | prop: 'supplierName', |
| | | label: "ä¾åºååç§°", |
| | | prop: "supplierName", |
| | | }, |
| | | { |
| | | label: '仿¬¾éé¢', |
| | | prop: 'currentPaymentAmount', |
| | | label: "仿¬¾éé¢", |
| | | prop: "currentPaymentAmount", |
| | | }, |
| | | { |
| | | label: 'ç»è®°äºº', |
| | | prop: 'registrant' |
| | | label: "ç»è®°äºº", |
| | | prop: "registrant", |
| | | }, |
| | | { |
| | | label: 'ç»è®°æ¥æ', |
| | | prop: 'registrationtDate' |
| | | label: "ç»è®°æ¥æ", |
| | | prop: "registrationtDate", |
| | | }, |
| | | ]) |
| | | const tableData = ref([]) |
| | | const tableLoading = ref(false) |
| | | const purchaseLedgerList = ref([]) |
| | | const invoiceNumberList = ref([]) |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const purchaseLedgerList = ref([]); |
| | | const invoiceNumberList = ref([]); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | }) |
| | | const total = ref(0) |
| | | }); |
| | | const total = ref(0); |
| | | |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref('') |
| | | const dialogFormVisible = ref(false) |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierNameOrContractNo: '', |
| | | supplierNameOrContractNo: "", |
| | | }, |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = ({ current, limit }) => { |
| | | page.current = current; |
| | | page.size = limit; |
| | | getList() |
| | | } |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | registrationList({...searchForm.value, ...page}).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.rows |
| | | total.value = res.total |
| | | }) |
| | | } |
| | | getList() |
| | | tableLoading.value = true; |
| | | registrationList({ ...searchForm.value, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.rows; |
| | | total.value = res.total; |
| | | }); |
| | | }; |
| | | getList(); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | </style> |
| | | <style scoped lang="scss"></style> |
| | |
| | | </el-form> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="columns" |
| | | :tableLoading="loading" |
| | | :tableData="dataList" |
| | |
| | | </el-form> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="columns" |
| | | :tableData="dataList" |
| | | :page="{ |
| | |
| | | </el-form> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :isShowSummary="isShowSummarySon" |
| | | :summaryMethod="summarizeMainTable1" |
| | | :handleSelectionChange="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="total" |
| | | @pagination="pagination" |
| | | @selection-change="handleSelectionChange" |
| | | ></PIMTable> |
| | | </div> |
| | | </div> |