| | |
| | | "@vueuse/core": "10.11.0",
|
| | | "axios": "0.28.1",
|
| | | "clipboard": "2.0.11",
|
| | | "dayjs": "^1.11.13", |
| | | "echarts": "5.5.1",
|
| | | "element-plus": "2.7.6",
|
| | | "element-plus": "2.7.7", |
| | | "file-saver": "2.0.5",
|
| | | "fuse.js": "6.6.2",
|
| | | "js-beautify": "1.14.11",
|
| | |
| | | "jsencrypt": "3.3.2",
|
| | | "nprogress": "0.2.0",
|
| | | "pinia": "2.1.7",
|
| | | "sortablejs": "^1.15.6", |
| | | "splitpanes": "3.1.5",
|
| | | "vue": "3.4.31",
|
| | | "vue-cropper": "1.1.1",
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function getPurchaseList(query) { |
| | | return request({ |
| | | url: "/purchase/report/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | |
| | | // éå®å°è´¦é¡µé¢æ¥å£ |
| | | import request from '@/utils/request' |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function ledgerList(query) { |
| | | return request({ |
| | | url: '/sales/ledger/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/sales/ledger/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | // åè¡¨æ ¼æ¥è¯¢ |
| | | export function productList(query) { |
| | | return request({ |
| | | url: '/sales/product/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/sales/product/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | // æ¥è¯¢å®¢æ·åç§°å表 |
| | | export function customerList(query) { |
| | | return request({ |
| | | url: '/basic/customer/customerList', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/basic/customer/customerList", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | // æ°å¢ãä¿®æ¹éå®å°è´¦ |
| | | export function addOrUpdateSalesLedger(query) { |
| | | return request({ |
| | | url: '/sales/ledger/addOrUpdateSalesLedger', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | url: "/sales/ledger/addOrUpdateSalesLedger", |
| | | method: "post", |
| | | data: query, |
| | | }); |
| | | } |
| | | // å é¤éå®å°è´¦ |
| | | export function delLedger(query) { |
| | | return request({ |
| | | url: '/sales/ledger/delLedger', |
| | | method: 'delete', |
| | | data: query |
| | | }) |
| | | url: "/sales/ledger/delLedger", |
| | | method: "delete", |
| | | data: query, |
| | | }); |
| | | } |
| | | // æ¥è¯¢éå®å°è´¦è¯¦æ
|
| | | export function getSalesLedgerWithProducts(query) { |
| | | return request({ |
| | | url: '/sales/ledger/getSalesLedgerWithProducts', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/sales/ledger/getSalesLedgerWithProducts", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | // 宿¶ä¿®æ¹äº§åä¿¡æ¯ |
| | | export function addOrUpdateSalesLedgerProduct(query) { |
| | | return request({ |
| | | url: '/sales/product/addOrUpdateSalesLedgerProduct', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | url: "/sales/product/addOrUpdateSalesLedgerProduct", |
| | | method: "post", |
| | | data: query, |
| | | }); |
| | | } |
| | | // å é¤äº§å |
| | | export function delProduct(query) { |
| | | return request({ |
| | | url: '/sales/product/delProduct', |
| | | method: 'delete', |
| | | data: query |
| | | }) |
| | | url: "/sales/product/delProduct", |
| | | method: "delete", |
| | | data: query, |
| | | }); |
| | | } |
| | | // ä¸ä¼ éä»¶ |
| | | export function upload(query) { |
| | | return request({ |
| | | url: '/file/upload', |
| | | method: 'post', |
| | | url: "/file/upload", |
| | | method: "post", |
| | | data: query, |
| | | responseType: 'blob' |
| | | }) |
| | | responseType: "blob", |
| | | }); |
| | | } |
| | | // ç¼è¾æ¶å é¤éä»¶ |
| | | export function delLedgerFile(query) { |
| | | return request({ |
| | | url: '/sales/ledger/delLedgerFile', |
| | | method: 'delete', |
| | | url: "/sales/ledger/delLedgerFile", |
| | | method: "delete", |
| | | data: query, |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // éå®ä¸å页æ¥è¯¢ |
| | | export function ledgerListNoPage(query) { |
| | | return request({ |
| | | url: '/sales/ledger/listNoPage', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/sales/ledger/listNoPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function ledgerListPage(query) { |
| | | return request({ |
| | | url: '/sales/ledger/listPage', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | url: "/sales/ledger/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ ¹æ®éå®ååå·æ¥äº§åä¿¡æ¯ |
| | | export function getProductInfoByContractNo(query) { |
| | | return request({ |
| | | url: "/purchase/ledger/getProductBySalesNo", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | |
| | | </template>
|
| | |
|
| | | <script setup>
|
| | | import { getToken } from "@/utils/auth"
|
| | | import { isExternal } from "@/utils/validate"
|
| | | import Sortable from 'sortablejs'
|
| | | import { getToken } from "@/utils/auth";
|
| | | import { isExternal } from "@/utils/validate";
|
| | | 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: () => ["png", "jpg", "jpeg"]
|
| | | default: () => ["png", "jpg", "jpeg"],
|
| | | },
|
| | | // æ¯å¦æ¾ç¤ºæç¤º
|
| | | isShowTip: {
|
| | | type: Boolean,
|
| | | default: true
|
| | | default: true,
|
| | | },
|
| | | // æå¨æåº
|
| | | drag: {
|
| | | type: Boolean,
|
| | | default: true
|
| | | }
|
| | | })
|
| | | default: true,
|
| | | },
|
| | | });
|
| | |
|
| | | const { proxy } = getCurrentInstance()
|
| | | const emit = defineEmits()
|
| | | const number = ref(0)
|
| | | const uploadList = ref([])
|
| | | const dialogImageUrl = ref("")
|
| | | const dialogVisible = ref(false)
|
| | | const baseUrl = import.meta.env.VITE_APP_BASE_API
|
| | | const uploadImgUrl = 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 dialogImageUrl = ref("");
|
| | | const dialogVisible = ref(false);
|
| | | const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
| | | const uploadImgUrl = 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) {
|
| | | // é¦å
å°å¼è½¬ä¸ºæ°ç»
|
| | | 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") {
|
| | | if (item.indexOf(baseUrl) === -1 && !isExternal(item)) {
|
| | | item = { name: baseUrl + item, url: baseUrl + item }
|
| | | item = { name: baseUrl + item, url: baseUrl + item };
|
| | | } else {
|
| | | item = { name: item, url: item }
|
| | | item = { name: item, url: item };
|
| | | }
|
| | | }
|
| | | return item
|
| | | })
|
| | | return item;
|
| | | });
|
| | | } else {
|
| | | fileList.value = []
|
| | | return []
|
| | | fileList.value = [];
|
| | | return [];
|
| | | }
|
| | | },{ deep: true, immediate: true })
|
| | | },
|
| | | { deep: true, immediate: true }
|
| | | );
|
| | |
|
| | | // ä¸ä¼ åloadingå è½½
|
| | | function handleBeforeUpload(file) {
|
| | | let isImg = false
|
| | | let isImg = false;
|
| | | if (props.fileType.length) {
|
| | | let fileExtension = ""
|
| | | let fileExtension = "";
|
| | | if (file.name.lastIndexOf(".") > -1) {
|
| | | fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1)
|
| | | fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
|
| | | }
|
| | | isImg = props.fileType.some(type => {
|
| | | if (file.type.indexOf(type) > -1) return true
|
| | | if (fileExtension && fileExtension.indexOf(type) > -1) return true
|
| | | return false
|
| | | })
|
| | | isImg = props.fileType.some((type) => {
|
| | | if (file.type.indexOf(type) > -1) return true;
|
| | | if (fileExtension && fileExtension.indexOf(type) > -1) return true;
|
| | | return false;
|
| | | });
|
| | | } else {
|
| | | isImg = file.type.indexOf("image") > -1
|
| | | isImg = file.type.indexOf("image") > -1;
|
| | | }
|
| | | if (!isImg) {
|
| | | 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++
|
| | | proxy.$modal.loading("æ£å¨ä¸ä¼ å¾çï¼è¯·ç¨å...");
|
| | | number.value++;
|
| | | }
|
| | |
|
| | | // æä»¶ä¸ªæ°è¶
åº
|
| | | function handleExceed() {
|
| | | proxy.$modal.msgError(`ä¸ä¼ æä»¶æ°éä¸è½è¶
è¿ ${props.limit} 个!`)
|
| | | proxy.$modal.msgError(`ä¸ä¼ æä»¶æ°éä¸è½è¶
è¿ ${props.limit} 个!`);
|
| | | }
|
| | |
|
| | | // ä¸ä¼ æååè°
|
| | | 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.imageUpload.handleRemove(file)
|
| | | uploadedSuccessfully()
|
| | | number.value--;
|
| | | proxy.$modal.closeLoading();
|
| | | proxy.$modal.msgError(res.msg);
|
| | | proxy.$refs.imageUpload.handleRemove(file);
|
| | | uploadedSuccessfully();
|
| | | }
|
| | | }
|
| | |
|
| | | // å é¤å¾ç
|
| | | function handleDelete(file) {
|
| | | const findex = fileList.value.map(f => f.name).indexOf(file.name)
|
| | | const findex = fileList.value.map((f) => f.name).indexOf(file.name);
|
| | | if (findex > -1 && uploadList.value.length === number.value) {
|
| | | fileList.value.splice(findex, 1)
|
| | | emit("update:modelValue", listToString(fileList.value))
|
| | | return false
|
| | | fileList.value.splice(findex, 1);
|
| | | emit("update:modelValue", listToString(fileList.value));
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | // ä¸ä¼ ç»æå¤ç
|
| | | 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 handleUploadError() {
|
| | | proxy.$modal.msgError("ä¸ä¼ å¾ç失败")
|
| | | proxy.$modal.closeLoading()
|
| | | proxy.$modal.msgError("ä¸ä¼ å¾ç失败");
|
| | | proxy.$modal.closeLoading();
|
| | | }
|
| | |
|
| | | // é¢è§
|
| | | function handlePictureCardPreview(file) {
|
| | | dialogImageUrl.value = file.url
|
| | | dialogVisible.value = true
|
| | | dialogImageUrl.value = file.url;
|
| | | dialogVisible.value = true;
|
| | | }
|
| | |
|
| | | // 对象转ææå®å符串åé
|
| | | function listToString(list, separator) {
|
| | | let strs = ""
|
| | | separator = separator || ","
|
| | | let strs = "";
|
| | | separator = separator || ",";
|
| | | for (let i in list) {
|
| | | if (undefined !== list[i].url && list[i].url.indexOf("blob:") !== 0) {
|
| | | strs += list[i].url.replace(baseUrl, "") + separator
|
| | | strs += list[i].url.replace(baseUrl, "") + 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('.el-upload-list')
|
| | | const element = document.querySelector(".el-upload-list");
|
| | | Sortable.create(element, {
|
| | | 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">
|
| | |
| | | <template> |
| | | <el-table ref="multipleTable" v-loading="tableLoading" :border="border" :data="tableData" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" height="calc(100vh - 18.5em)" |
| | | :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" :show-summary="isShowSummary" |
| | | <el-table |
| | | ref="multipleTable" |
| | | v-loading="tableLoading" |
| | | :border="border" |
| | | :data="tableData" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" |
| | | height="calc(100vh - 18.5em)" |
| | | :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" |
| | | :show-summary="isShowSummary" |
| | | :summary-method="summaryMethod" |
| | | @selection-change="handleSelectionChange" class="lims-table"> |
| | | <el-table-column align="center" type="selection" width="55" v-if="isSelection"/> |
| | | @selection-change="handleSelectionChange" |
| | | class="lims-table" |
| | | > |
| | | <el-table-column |
| | | align="center" |
| | | type="selection" |
| | | width="55" |
| | | v-if="isSelection" |
| | | /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | |
| | | <el-table-column v-for="(item, index) in column" :key="index" :column-key="item.columnKey" |
| | | :filter-method="item.filterHandler" :filter-multiple="item.filterMultiple" :filtered-value="item.filteredValue" |
| | | :filters="item.filters" :fixed="item.fixed" :label="item.label" :prop="item.prop" show-overflow-tooltip |
| | | :align="item.align" :sortable="!!item.sortable" :type="item.type" :width="item.width"> |
| | | <template v-if="item.hasOwnProperty('colunmTemplate')" #[item.colunmTemplate]="scope"> |
| | | <slot v-if="item.theadSlot" :name="item.theadSlot" :index="scope.$index" :row="scope.row" /> |
| | | <el-table-column |
| | | v-for="(item, index) in column" |
| | | :key="index" |
| | | :column-key="item.columnKey" |
| | | :filter-method="item.filterHandler" |
| | | :filter-multiple="item.filterMultiple" |
| | | :filtered-value="item.filteredValue" |
| | | :filters="item.filters" |
| | | :fixed="item.fixed" |
| | | :label="item.label" |
| | | :prop="item.prop" |
| | | show-overflow-tooltip |
| | | :align="item.align" |
| | | :sortable="!!item.sortable" |
| | | :type="item.type" |
| | | :width="item.width" |
| | | > |
| | | <template |
| | | v-if="item.hasOwnProperty('colunmTemplate')" |
| | | #[item.colunmTemplate]="scope" |
| | | > |
| | | <slot |
| | | v-if="item.theadSlot" |
| | | :name="item.theadSlot" |
| | | :index="scope.$index" |
| | | :row="scope.row" |
| | | /> |
| | | </template> |
| | | |
| | | <template #default="scope"> |
| | | <!-- ææ§½ --> |
| | | <div v-if="item.dataType == 'slot'"> |
| | | <slot v-if="item.slot" :index="scope.$index" :name="item.slot" :row="scope.row" /> |
| | | <slot |
| | | v-if="item.slot" |
| | | :index="scope.$index" |
| | | :name="item.slot" |
| | | :row="scope.row" |
| | | /> |
| | | </div> |
| | | <!-- è¿åº¦æ¡ --> |
| | | <div v-else-if="item.dataType == 'progress'"> |
| | |
| | | </div> |
| | | <!-- å¾ç --> |
| | | <div v-else-if="item.dataType == 'image'"> |
| | | <img :src="javaApi + '/img/' + scope.row[item.prop]" alt="" |
| | | style="width: 40px; height: 40px; margin-top: 10px" /> |
| | | <img |
| | | :src="javaApi + '/img/' + scope.row[item.prop]" |
| | | alt="" |
| | | style="width: 40px; height: 40px; margin-top: 10px" |
| | | /> |
| | | </div> |
| | | |
| | | <!-- tag --> |
| | | <div v-else-if="item.dataType == 'tag'"> |
| | | <el-tag v-if="typeof dataTypeFn(scope.row[item.prop], item.formatData) === 'string'" |
| | | <el-tag |
| | | v-if=" |
| | | typeof dataTypeFn(scope.row[item.prop], item.formatData) === |
| | | 'string' |
| | | " |
| | | :title="formatters(scope.row[item.prop], item.formatData)" |
| | | :type="formatType(scope.row[item.prop], item.formatType)"> |
| | | :type="formatType(scope.row[item.prop], item.formatType)" |
| | | > |
| | | {{ formatters(scope.row[item.prop], item.formatData) }} |
| | | </el-tag> |
| | | |
| | | <el-tag v-for="(tag, index) in dataTypeFn(scope.row[item.prop], item.formatData)" |
| | | v-else-if="typeof dataTypeFn(scope.row[item.prop], item.formatData) === 'object'" :key="index" |
| | | :title="formatters(scope.row[item.prop], item.formatData)" :type="formatType(tag, item.formatType)"> |
| | | <el-tag |
| | | v-for="(tag, index) in dataTypeFn( |
| | | scope.row[item.prop], |
| | | item.formatData |
| | | )" |
| | | v-else-if=" |
| | | typeof dataTypeFn(scope.row[item.prop], item.formatData) === |
| | | 'object' |
| | | " |
| | | :key="index" |
| | | :title="formatters(scope.row[item.prop], item.formatData)" |
| | | :type="formatType(tag, item.formatType)" |
| | | > |
| | | {{ item.tagGroup ? tag[item.tagGroup.label] ?? tag : tag }} |
| | | </el-tag> |
| | | |
| | | <el-tag v-else :title="formatters(scope.row[item.prop], item.formatData)" |
| | | :type="formatType(scope.row[item.prop], item.formatType)"> |
| | | <el-tag |
| | | v-else |
| | | :title="formatters(scope.row[item.prop], item.formatData)" |
| | | :type="formatType(scope.row[item.prop], item.formatType)" |
| | | > |
| | | {{ formatters(scope.row[item.prop], item.formatData) }} |
| | | </el-tag> |
| | | </div> |
| | |
| | | <!-- æé® --> |
| | | <div v-else-if="item.dataType == 'action'"> |
| | | <template v-for="(o, key) in item.operation" :key="key"> |
| | | <el-button v-show="o.type != 'upload'" size="small" v-if="o.showHide ? o.showHide(scope.row) : true" |
| | | :disabled="o.disabled ? o.disabled(scope.row) : false" :plain="o.plain" type="primary" |
| | | :style="{ color: (o.name === 'å é¤' || o.name === 'delete') ? '#f56c6c' : o.color }" link |
| | | @click="o.clickFun(scope.row)" :key="key"> |
| | | <el-button |
| | | v-show="o.type != 'upload'" |
| | | size="small" |
| | | v-if="o.showHide ? o.showHide(scope.row) : true" |
| | | :disabled="o.disabled ? o.disabled(scope.row) : false" |
| | | :plain="o.plain" |
| | | type="primary" |
| | | :style="{ |
| | | color: |
| | | o.name === 'å é¤' || o.name === 'delete' |
| | | ? '#f56c6c' |
| | | : o.color, |
| | | }" |
| | | link |
| | | @click="o.clickFun(scope.row)" |
| | | :key="key" |
| | | > |
| | | {{ o.name }} |
| | | </el-button> |
| | | <el-upload :action="javaApi + o.url + '?id=' + (o.uploadIdFun ? o.uploadIdFun(scope.row) : scope.row.id)" |
| | | ref="uploadRef" size="small" :multiple="o.multiple ? o.multiple : false" :limit="1" |
| | | <el-upload |
| | | :action=" |
| | | javaApi + |
| | | o.url + |
| | | '?id=' + |
| | | (o.uploadIdFun ? o.uploadIdFun(scope.row) : scope.row.id) |
| | | " |
| | | ref="uploadRef" |
| | | size="small" |
| | | :multiple="o.multiple ? o.multiple : false" |
| | | :limit="1" |
| | | :disabled="o.disabled ? o.disabled(scope.row) : false" |
| | | :accept="o.accept ? o.accept : '.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'" |
| | | v-if="o.type == 'upload'" style="display: inline-block; width: 50px" |
| | | v-show="o.showHide ? o.showHide(scope.row) : true" :headers="uploadHeader" |
| | | :accept=" |
| | | o.accept |
| | | ? o.accept |
| | | : '.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' |
| | | " |
| | | v-if="o.type == 'upload'" |
| | | style="display: inline-block; width: 50px" |
| | | v-show="o.showHide ? o.showHide(scope.row) : true" |
| | | :headers="uploadHeader" |
| | | :before-upload="(file) => beforeUpload(file, scope.$index)" |
| | | :on-change="(file, fileList) => handleChange(file, fileList, scope.$index)" |
| | | :on-error="(error, file, fileList) => onError(error, file, fileList, scope.$index)" |
| | | :on-success="(response, file, fileList) => handleSuccessUp(response, file, fileList, scope.$index)" |
| | | :on-exceed="onExceed" :show-file-list="false"> |
| | | <el-button :size="o.size ? o.size : 'small'" link type="primary" |
| | | :disabled="o.disabled ? o.disabled(scope.row) : false">{{ o.name }}</el-button> |
| | | :on-change=" |
| | | (file, fileList) => handleChange(file, fileList, scope.$index) |
| | | " |
| | | :on-error=" |
| | | (error, file, fileList) => |
| | | onError(error, file, fileList, scope.$index) |
| | | " |
| | | :on-success=" |
| | | (response, file, fileList) => |
| | | handleSuccessUp(response, file, fileList, scope.$index) |
| | | " |
| | | :on-exceed="onExceed" |
| | | :show-file-list="false" |
| | | > |
| | | <el-button |
| | | :size="o.size ? o.size : 'small'" |
| | | link |
| | | type="primary" |
| | | :disabled="o.disabled ? o.disabled(scope.row) : false" |
| | | >{{ o.name }}</el-button |
| | | > |
| | | </el-upload> |
| | | </template> |
| | | </div> |
| | | <!-- å¯ç¹å»çæå --> |
| | | <div v-else-if="item.dataType == 'link'" class="cell link" style="width: 100%" |
| | | @click="goLink(scope.row, item.linkMethod)"> |
| | | <div |
| | | v-else-if="item.dataType == 'link'" |
| | | class="cell link" |
| | | style="width: 100%" |
| | | @click="goLink(scope.row, item.linkMethod)" |
| | | > |
| | | <span v-if="!item.formatData">{{ scope.row[item.prop] }}</span> |
| | | </div> |
| | | <!-- é»è®¤çº¯å±ç¤ºæ°æ® --> |
| | | <div v-else class="cell" style="width: 100%"> |
| | | <span v-if="!item.formatData">{{ scope.row[item.prop] }}</span> |
| | | <span v-else>{{ formatters(scope.row[item.prop], item.formatData) }}</span> |
| | | <span v-else>{{ |
| | | formatters(scope.row[item.prop], item.formatData) |
| | | }}</span> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" :layout="page.layout" :page="page.current" :limit="page.size" |
| | | @pagination="paginationSearch" /> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | :layout="page.layout" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationSearch" |
| | | /> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from './Pagination.vue' |
| | | import { ref, inject, getCurrentInstance } from "vue" |
| | | import { ElMessage } from "element-plus" |
| | | import pagination from "./Pagination.vue"; |
| | | import { ref, inject, getCurrentInstance } from "vue"; |
| | | import { ElMessage } from "element-plus"; |
| | | |
| | | // è·åå
¨å±ç uploadHeader |
| | | const { proxy } = getCurrentInstance() |
| | | const uploadHeader = proxy.uploadHeader |
| | | const javaApi = proxy.javaApi |
| | | const { proxy } = getCurrentInstance(); |
| | | const uploadHeader = proxy.uploadHeader; |
| | | const javaApi = proxy.javaApi; |
| | | |
| | | const emit = defineEmits(["pagination"]); |
| | | |
| | | // Filters |
| | | const typeFn = (val, row) => { |
| | | return typeof val === 'function' ? val(row) : val |
| | | } |
| | | return typeof val === "function" ? val(row) : val; |
| | | }; |
| | | |
| | | const formatters = (val, format) => { |
| | | return typeof format === 'function' ? format(val) : val |
| | | } |
| | | return typeof format === "function" ? format(val) : val; |
| | | }; |
| | | |
| | | // Propsï¼ä½¿ç¨ defineProps çé TS å½¢å¼ï¼ |
| | | const props = defineProps({ |
| | | tableLoading: { |
| | | type: Boolean, |
| | | default: false |
| | | default: false, |
| | | }, |
| | | handleSelectionChange: { |
| | | type: Function, |
| | | default: () => { } |
| | | default: () => {}, |
| | | }, |
| | | summaryMethod: { |
| | | type: Function, |
| | | default: () => { } |
| | | default: () => {}, |
| | | }, |
| | | rowClick: { |
| | | type: Function, |
| | | default: () => { } |
| | | default: () => {}, |
| | | }, |
| | | currentChange: { |
| | | type: Function, |
| | | default: () => { } |
| | | default: () => {}, |
| | | }, |
| | | border: { |
| | | type: Boolean, |
| | | default: true |
| | | default: true, |
| | | }, |
| | | isSelection: { |
| | | type: Boolean, |
| | |
| | | }, |
| | | highlightCurrentRow: { |
| | | type: Boolean, |
| | | default: false |
| | | default: false, |
| | | }, |
| | | headerCellStyle: { |
| | | type: Object, |
| | | default: () => ({}) |
| | | default: () => ({}), |
| | | }, |
| | | column: { |
| | | type: Array, |
| | | default: () => [] |
| | | default: () => [], |
| | | }, |
| | | rowClassName: { |
| | | type: Function, |
| | | default: () => '' |
| | | default: () => "", |
| | | }, |
| | | rowStyle: { |
| | | type: [Object, Function], |
| | | default: () => ({}) |
| | | default: () => ({}), |
| | | }, |
| | | tableData: { |
| | | type: Array, |
| | | default: () => [] |
| | | default: () => [], |
| | | }, |
| | | rowKey: { |
| | | type: String, |
| | | default: undefined |
| | | default: undefined, |
| | | }, |
| | | page: { |
| | | type: Object, |
| | |
| | | total: 0, |
| | | current: 0, |
| | | size: 10, |
| | | layout: 'total, sizes, prev, pager, next, jumper' |
| | | }) |
| | | layout: "total, sizes, prev, pager, next, jumper", |
| | | }), |
| | | }, |
| | | total: { |
| | | type: Number, |
| | | default: 0 |
| | | } |
| | | }) |
| | | default: 0, |
| | | }, |
| | | }); |
| | | |
| | | // Data |
| | | const uploadRefs = ref([]) |
| | | const currentFiles = ref({}) |
| | | const uploadKeys = ref({}) |
| | | const uploadRefs = ref([]); |
| | | const currentFiles = ref({}); |
| | | const uploadKeys = ref({}); |
| | | |
| | | const indexMethod = (index) => { |
| | | return (props.page.current - 1) * props.page.size + index + 1 |
| | | } |
| | | return (props.page.current - 1) * props.page.size + index + 1; |
| | | }; |
| | | |
| | | // ç¹å» link äºä»¶ |
| | | const goLink = (row, linkMethod) => { |
| | | if (!linkMethod) { |
| | | return ElMessage.warning("请é
ç½® link äºä»¶") |
| | | return ElMessage.warning("请é
ç½® link äºä»¶"); |
| | | } |
| | | const parentMethod = getParentMethod(linkMethod) |
| | | if (typeof parentMethod === 'function') { |
| | | parentMethod(row) |
| | | const parentMethod = getParentMethod(linkMethod); |
| | | if (typeof parentMethod === "function") { |
| | | parentMethod(row); |
| | | } else { |
| | | console.warn(`ç¶ç»ä»¶ä¸æªæ¾å°æ¹æ³: ${linkMethod}`) |
| | | console.warn(`ç¶ç»ä»¶ä¸æªæ¾å°æ¹æ³: ${linkMethod}`); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | // è·åç¶ç»ä»¶æ¹æ³ï¼ç¤ºä¾å®ç°ï¼ |
| | | const getParentMethod = (methodName) => { |
| | | const parentMethods = inject('parentMethods', {}) |
| | | return parentMethods[methodName] |
| | | } |
| | | const parentMethods = inject("parentMethods", {}); |
| | | return parentMethods[methodName]; |
| | | }; |
| | | |
| | | const dataTypeFn = (val, format) => { |
| | | if (typeof format === "function") { |
| | | return format(val) |
| | | } else return val |
| | | } |
| | | return format(val); |
| | | } else return val; |
| | | }; |
| | | |
| | | const formatType = (val, format) => { |
| | | if (typeof format === "function") { |
| | | return format(val) |
| | | } else return "" |
| | | } |
| | | return format(val); |
| | | } else return ""; |
| | | }; |
| | | |
| | | // æä»¶ååå¤ç |
| | | const handleChange = (file, fileList, index) => { |
| | | if (fileList.length > 1) { |
| | | const earliestFile = fileList[0] |
| | | uploadRefs.value[index]?.handleRemove(earliestFile) |
| | | const earliestFile = fileList[0]; |
| | | uploadRefs.value[index]?.handleRemove(earliestFile); |
| | | } |
| | | currentFiles.value[index] = file |
| | | } |
| | | currentFiles.value[index] = file; |
| | | }; |
| | | |
| | | // æä»¶ä¸ä¼ åæ ¡éª |
| | | const beforeUpload = (rawFile, index) => { |
| | | currentFiles.value[index] = {} |
| | | currentFiles.value[index] = {}; |
| | | if (rawfile.size > 1024 * 1024 * 10 * 10) { |
| | | ElMessage.error('ä¸ä¼ æä»¶ä¸è¶
è¿10M') |
| | | return false |
| | | ElMessage.error("ä¸ä¼ æä»¶ä¸è¶
è¿10M"); |
| | | return false; |
| | | } |
| | | return true |
| | | } |
| | | return true; |
| | | }; |
| | | |
| | | // ä¸ä¼ æå |
| | | const handleSuccessUp = (response, file, fileList, index) => { |
| | | if (response.code == 200) { |
| | | if (uploadRefs[index]) { |
| | | uploadRefs[index].clearFiles() |
| | | uploadRefs[index].clearFiles(); |
| | | } |
| | | currentFiles[index] = file |
| | | ElMessage.success("ä¸ä¼ æå") |
| | | resetUploadComponent(index) |
| | | currentFiles[index] = file; |
| | | ElMessage.success("ä¸ä¼ æå"); |
| | | resetUploadComponent(index); |
| | | } else { |
| | | ElMessage.error(response.message) |
| | | ElMessage.error(response.message); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | const resetUploadComponent = (index) => { |
| | | uploadKeys[index] = Date.now() |
| | | } |
| | | uploadKeys[index] = Date.now(); |
| | | }; |
| | | |
| | | // ä¸ä¼ 失败 |
| | | const onError = (error, file, fileList, index) => { |
| | | ElMessage.error('æä»¶ä¸ä¼ 失败ï¼è¯·éè¯') |
| | | ElMessage.error("æä»¶ä¸ä¼ 失败ï¼è¯·éè¯"); |
| | | if (uploadRefs.value[index]) { |
| | | uploadRefs.value[index].clearFiles() |
| | | uploadRefs.value[index].clearFiles(); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | // æä»¶æ°éè¶
éæç¤º |
| | | const onExceed = () => { |
| | | ElMessage.warning('è¶
åºæä»¶ä¸ªæ°') |
| | | } |
| | | ElMessage.warning("è¶
åºæä»¶ä¸ªæ°"); |
| | | }; |
| | | |
| | | const paginationSearch = ({ page, limit }) => { |
| | | emit("pagination", { page: page, limit: limit }); |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup> |
| | | import { ref } from "vue"; |
| | | |
| | | defineOptions({ |
| | | name: "æä»¶ä¸ä¼ ç»ä»¶", |
| | | }); |
| | | |
| | | const props = defineProps({ |
| | | downloadTemplate: Function, |
| | | showTips: Boolean, |
| | | accept: { |
| | | type: String, |
| | | default: ".xls, .xlsx", |
| | | }, |
| | | headers: Object, |
| | | action: String, |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | }); |
| | | const emits = defineEmits(["success", "error"]); |
| | | |
| | | const uploadRef = ref(); |
| | | const fileList = ref([]); |
| | | |
| | | const uploadApi = () => { |
| | | uploadRef.value.submit(); |
| | | }; |
| | | |
| | | const handleFileSuccess = (response, file, fileList) => { |
| | | upload.open = false; |
| | | upload.isUploading = false; |
| | | uploadRef.value.handleRemove(file); |
| | | emits("success", response, file, fileList); |
| | | }; |
| | | |
| | | defineExpose({ |
| | | fileList, |
| | | uploadApi, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <el-upload |
| | | ref="uploadRef" |
| | | v-model:file-list="fileList" |
| | | drag |
| | | multiple |
| | | :action="action" |
| | | :accept="accept" |
| | | :headers="headers" |
| | | :disabled="disabled" |
| | | :auto-upload="false" |
| | | :limit="1" |
| | | :drag="true" |
| | | :on-success="handleFileSuccess" |
| | | > |
| | | <div class="el-upload__text"> |
| | | <el-icon class="el-icon--upload"><upload-filled /></el-icon> |
| | | <div class="el-upload__text"> |
| | | å°æä»¶æå°æ¤å¤ï¼æ |
| | | <em>ç¹å»å¯¼å
¥æ°æ®</em> |
| | | </div> |
| | | </div> |
| | | <template #tip> |
| | | <div class="el-upload__tip text-center"> |
| | | åªè½ä¸ä¼ xlsx/xlsæä»¶ï¼ä¸ä¸è¶
è¿10M |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | class="reset-margin" |
| | | @click="props.downloadTemplate()" |
| | | > |
| | | <span style="font-size: 12px; font-weight: normal">ä¸è½½æ¨¡æ¿</span> |
| | | </el-button> |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | | </template> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export { default as FileUpload } from "./FileUpload.vue"; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { reactive } from "vue"; |
| | | import { deepClone } from "@/utils/index.js" |
| | | |
| | | export default function useFormData(initData) { |
| | | const form = reactive(deepClone(initData, true)); |
| | | |
| | | function resetForm() { |
| | | const initData2 = JSON.parse(JSON.stringify(initData)); |
| | | Object.keys(initData).forEach(key => { |
| | | form[key] = initData2[key]; |
| | | }); |
| | | } |
| | | |
| | | return { form, resetForm }; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { ref, reactive, watchEffect, unref } from "vue"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import { deepClone, isEqual } from "@/utils/index.js" |
| | | |
| | | /** |
| | | * å页api |
| | | * @param api æ¥å£ |
| | | * @param initalFilters åå§åç鿡件 |
| | | * @param sorters |
| | | * @param filterTransformer |
| | | */ |
| | | export function usePaginationApi( |
| | | api, |
| | | initalFilters, |
| | | columns, |
| | | sorters, |
| | | filterTransformer, |
| | | cb |
| | | ) { |
| | | const dataList = ref([]); |
| | | const { form: filters, resetForm } = useFormData(initalFilters); |
| | | let lastFilters = deepClone(initalFilters); |
| | | const sorter = reactive(sorters || {}); |
| | | const others = ref({}); |
| | | const loading = ref(true); |
| | | const paginationAlign = ref("right"); |
| | | |
| | | /** å页é
ç½® */ |
| | | const pagination = reactive({ |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | pageSizes: [10, 15, 20], |
| | | total: 0, |
| | | align: "right", |
| | | background: true |
| | | }); |
| | | |
| | | /** å è½½å¨ç»é
ç½® */ |
| | | const loadingConfig = reactive({ |
| | | text: "æ£å¨å 载第ä¸é¡µ...", |
| | | viewBox: "-10, -10, 50, 50", |
| | | spinner: ` |
| | | <path class="path" d=" |
| | | M 30 15 |
| | | L 28 17 |
| | | M 25.61 25.61 |
| | | A 15 15, 0, 0, 1, 15 30 |
| | | A 15 15, 0, 1, 1, 27.99 7.5 |
| | | L 15 15 |
| | | " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/> |
| | | ` |
| | | // svg: "", |
| | | // background: rgba() |
| | | }); |
| | | |
| | | function getFinalParams() { |
| | | const finalFilters = {}; |
| | | const beforeParams = unref(filters); |
| | | if (filterTransformer) { |
| | | Object.keys(beforeParams).forEach(key => { |
| | | if (filterTransformer[key]) { |
| | | Object.assign( |
| | | finalFilters, |
| | | filterTransformer[key](beforeParams[key], beforeParams) |
| | | ); |
| | | } else { |
| | | finalFilters[key] = beforeParams[key]; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | return filterTransformer |
| | | ? { ...finalFilters, ...sorter } |
| | | : { ...beforeParams, ...sorter }; |
| | | } |
| | | |
| | | async function getTableData() { |
| | | // å¦æè¿æ¬¡å䏿¬¡çfilterä¸åï¼é£ä¹å°±é置页ç |
| | | if (!isEqual(unref(filters), lastFilters)) { |
| | | pagination.currentPage = 1; |
| | | lastFilters = deepClone(unref(filters)); |
| | | } |
| | | loading.value = true; |
| | | api({ |
| | | ...getFinalParams(), |
| | | current: pagination.currentPage, |
| | | size: pagination.pageSize |
| | | }).then(({ code, data, ...rest }) => { |
| | | if (code == 200) { |
| | | // pagination.currentPage = meta.current_page; |
| | | // pagination.pageSize = meta.per_page; |
| | | pagination.total = data.total; |
| | | others.value = rest; |
| | | dataList.value = data.records; |
| | | cb && cb(data); |
| | | loading.value = false; |
| | | } else { |
| | | loading.value = false; |
| | | ElMessage({ message: data.msg, type: "error" }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function onSizeChange(val) { |
| | | pagination.pageSize = val; |
| | | pagination.currentPage = 1; |
| | | getTableData(); |
| | | } |
| | | |
| | | function onCurrentChange(val) { |
| | | loadingConfig.text = `æ£å¨å 载第${val}页...`; |
| | | loading.value = true; |
| | | getTableData(); |
| | | } |
| | | function resetFilters() { |
| | | resetForm(); |
| | | pagination.currentPage = 1; |
| | | getTableData(); |
| | | } |
| | | |
| | | watchEffect(() => { |
| | | pagination.align = paginationAlign.value |
| | | }); |
| | | |
| | | // onMounted(() => { |
| | | // getTableData(); |
| | | // }); |
| | | |
| | | return { |
| | | loading, |
| | | columns, |
| | | dataList, |
| | | pagination, |
| | | loadingConfig, |
| | | paginationAlign, |
| | | filters, |
| | | sorter, |
| | | others, |
| | | onSizeChange, |
| | | onCurrentChange, |
| | | getTableData, |
| | | resetFilters |
| | | }; |
| | | } |
| | |
| | | import { parseTime } from './ruoyi'
|
| | | import { parseTime } from "./ruoyi";
|
| | |
|
| | | /**
|
| | | * è¡¨æ ¼æ¶é´æ ¼å¼å
|
| | | */
|
| | | export function formatDate(cellValue) {
|
| | | if (cellValue == null || cellValue == "") return ""
|
| | | var date = new Date(cellValue) |
| | | var year = date.getFullYear()
|
| | | var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
|
| | | var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() |
| | | var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours() |
| | | var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() |
| | | var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
|
| | | return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
|
| | | if (cellValue == null || cellValue == "") return "";
|
| | | var date = new Date(cellValue);
|
| | | var year = date.getFullYear();
|
| | | var month =
|
| | | date.getMonth() + 1 < 10
|
| | | ? "0" + (date.getMonth() + 1)
|
| | | : date.getMonth() + 1;
|
| | | var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
| | | var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
| | | var minutes =
|
| | | date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
| | | var seconds =
|
| | | date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
| | | return (
|
| | | year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds
|
| | | );
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @returns {string}
|
| | | */
|
| | | export function formatTime(time, option) {
|
| | | if (('' + time).length === 10) {
|
| | | time = parseInt(time) * 1000
|
| | | if (("" + time).length === 10) {
|
| | | time = parseInt(time) * 1000;
|
| | | } else {
|
| | | time = +time
|
| | | time = +time;
|
| | | }
|
| | | const d = new Date(time)
|
| | | const now = Date.now()
|
| | | const d = new Date(time);
|
| | | const now = Date.now();
|
| | |
|
| | | const diff = (now - d) / 1000
|
| | | const diff = (now - d) / 1000;
|
| | |
|
| | | if (diff < 30) {
|
| | | return 'åå'
|
| | | return "åå";
|
| | | } else if (diff < 3600) {
|
| | | // less 1 hour
|
| | | return Math.ceil(diff / 60) + 'åéå'
|
| | | return Math.ceil(diff / 60) + "åéå";
|
| | | } else if (diff < 3600 * 24) {
|
| | | return Math.ceil(diff / 3600) + 'å°æ¶å'
|
| | | return Math.ceil(diff / 3600) + "å°æ¶å";
|
| | | } else if (diff < 3600 * 24 * 2) {
|
| | | return '1天å'
|
| | | return "1天å";
|
| | | }
|
| | | if (option) {
|
| | | return parseTime(time, option)
|
| | | return parseTime(time, option);
|
| | | } else {
|
| | | return (
|
| | | d.getMonth() +
|
| | | 1 +
|
| | | 'æ' +
|
| | | "æ" +
|
| | | d.getDate() +
|
| | | 'æ¥' +
|
| | | "æ¥" +
|
| | | d.getHours() +
|
| | | 'æ¶' +
|
| | | "æ¶" +
|
| | | d.getMinutes() +
|
| | | 'å'
|
| | | )
|
| | | "å"
|
| | | );
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | * @returns {Object}
|
| | | */
|
| | | export function getQueryObject(url) {
|
| | | url = url == null ? window.location.href : url
|
| | | const search = url.substring(url.lastIndexOf('?') + 1)
|
| | | const obj = {}
|
| | | const reg = /([^?&=]+)=([^?&=]*)/g
|
| | | url = url == null ? window.location.href : url;
|
| | | const search = url.substring(url.lastIndexOf("?") + 1);
|
| | | const obj = {};
|
| | | const reg = /([^?&=]+)=([^?&=]*)/g;
|
| | | search.replace(reg, (rs, $1, $2) => {
|
| | | const name = decodeURIComponent($1)
|
| | | let val = decodeURIComponent($2)
|
| | | val = String(val)
|
| | | obj[name] = val
|
| | | return rs
|
| | | })
|
| | | return obj
|
| | | const name = decodeURIComponent($1);
|
| | | let val = decodeURIComponent($2);
|
| | | val = String(val);
|
| | | obj[name] = val;
|
| | | return rs;
|
| | | });
|
| | | return obj;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | export function byteLength(str) {
|
| | | // returns the byte length of an utf8 string
|
| | | let s = str.length
|
| | | let s = str.length;
|
| | | for (var i = str.length - 1; i >= 0; i--) {
|
| | | const code = str.charCodeAt(i)
|
| | | if (code > 0x7f && code <= 0x7ff) s++
|
| | | else if (code > 0x7ff && code <= 0xffff) s += 2
|
| | | if (code >= 0xDC00 && code <= 0xDFFF) i--
|
| | | const code = str.charCodeAt(i);
|
| | | if (code > 0x7f && code <= 0x7ff) s++;
|
| | | else if (code > 0x7ff && code <= 0xffff) s += 2;
|
| | | if (code >= 0xdc00 && code <= 0xdfff) i--;
|
| | | }
|
| | | return s
|
| | | return s;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @returns {Array}
|
| | | */
|
| | | export function cleanArray(actual) {
|
| | | const newArray = []
|
| | | const newArray = [];
|
| | | for (let i = 0; i < actual.length; i++) {
|
| | | if (actual[i]) {
|
| | | newArray.push(actual[i])
|
| | | newArray.push(actual[i]);
|
| | | }
|
| | | }
|
| | | return newArray
|
| | | return newArray;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @returns {Array}
|
| | | */
|
| | | export function param(json) {
|
| | | if (!json) return ''
|
| | | if (!json) return "";
|
| | | return cleanArray(
|
| | | Object.keys(json).map(key => {
|
| | | if (json[key] === undefined) return ''
|
| | | return encodeURIComponent(key) + '=' + encodeURIComponent(json[key])
|
| | | Object.keys(json).map((key) => {
|
| | | if (json[key] === undefined) return "";
|
| | | return encodeURIComponent(key) + "=" + encodeURIComponent(json[key]);
|
| | | })
|
| | | ).join('&')
|
| | | ).join("&");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @returns {Object}
|
| | | */
|
| | | export function param2Obj(url) {
|
| | | const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
|
| | | const search = decodeURIComponent(url.split("?")[1]).replace(/\+/g, " ");
|
| | | if (!search) {
|
| | | return {}
|
| | | return {};
|
| | | }
|
| | | const obj = {}
|
| | | const searchArr = search.split('&')
|
| | | searchArr.forEach(v => {
|
| | | const index = v.indexOf('=')
|
| | | const obj = {};
|
| | | const searchArr = search.split("&");
|
| | | searchArr.forEach((v) => {
|
| | | const index = v.indexOf("=");
|
| | | if (index !== -1) {
|
| | | const name = v.substring(0, index)
|
| | | const val = v.substring(index + 1, v.length)
|
| | | obj[name] = val
|
| | | const name = v.substring(0, index);
|
| | | const val = v.substring(index + 1, v.length);
|
| | | obj[name] = val;
|
| | | }
|
| | | })
|
| | | return obj
|
| | | });
|
| | | return obj;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @returns {string}
|
| | | */
|
| | | export function html2Text(val) {
|
| | | const div = document.createElement('div')
|
| | | div.innerHTML = val
|
| | | return div.textContent || div.innerText
|
| | | const div = document.createElement("div");
|
| | | div.innerHTML = val;
|
| | | return div.textContent || div.innerText;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @returns {Object}
|
| | | */
|
| | | export function objectMerge(target, source) {
|
| | | if (typeof target !== 'object') {
|
| | | target = {}
|
| | | if (typeof target !== "object") {
|
| | | target = {};
|
| | | }
|
| | | if (Array.isArray(source)) {
|
| | | return source.slice()
|
| | | return source.slice();
|
| | | }
|
| | | Object.keys(source).forEach(property => {
|
| | | const sourceProperty = source[property]
|
| | | if (typeof sourceProperty === 'object') {
|
| | | target[property] = objectMerge(target[property], sourceProperty)
|
| | | Object.keys(source).forEach((property) => {
|
| | | const sourceProperty = source[property];
|
| | | if (typeof sourceProperty === "object") {
|
| | | target[property] = objectMerge(target[property], sourceProperty);
|
| | | } else {
|
| | | target[property] = sourceProperty
|
| | | target[property] = sourceProperty;
|
| | | }
|
| | | })
|
| | | return target
|
| | | });
|
| | | return target;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | export function toggleClass(element, className) {
|
| | | if (!element || !className) {
|
| | | return
|
| | | return;
|
| | | }
|
| | | let classString = element.className
|
| | | const nameIndex = classString.indexOf(className)
|
| | | let classString = element.className;
|
| | | const nameIndex = classString.indexOf(className);
|
| | | if (nameIndex === -1) {
|
| | | classString += '' + className
|
| | | classString += "" + className;
|
| | | } else {
|
| | | classString =
|
| | | classString.substr(0, nameIndex) +
|
| | | classString.substr(nameIndex + className.length)
|
| | | classString.substr(nameIndex + className.length);
|
| | | }
|
| | | element.className = classString
|
| | | element.className = classString;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @returns {Date}
|
| | | */
|
| | | export function getTime(type) {
|
| | | if (type === 'start') {
|
| | | return new Date().getTime() - 3600 * 1000 * 24 * 90
|
| | | if (type === "start") {
|
| | | return new Date().getTime() - 3600 * 1000 * 24 * 90;
|
| | | } else {
|
| | | return new Date(new Date().toDateString())
|
| | | return new Date(new Date().toDateString());
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | * @return {*}
|
| | | */
|
| | | export function debounce(func, wait, immediate) {
|
| | | let timeout, args, context, timestamp, result
|
| | | let timeout, args, context, timestamp, result;
|
| | |
|
| | | const later = function() {
|
| | | // æ®ä¸ä¸æ¬¡è§¦åæ¶é´é´é
|
| | | const last = +new Date() - timestamp
|
| | | const last = +new Date() - timestamp;
|
| | |
|
| | | // 䏿¬¡è¢«å
è£
彿°è¢«è°ç¨æ¶é´é´é last å°äºè®¾å®æ¶é´é´é wait
|
| | | if (last < wait && last > 0) {
|
| | | timeout = setTimeout(later, wait - last)
|
| | | timeout = setTimeout(later, wait - last);
|
| | | } else {
|
| | | timeout = null
|
| | | timeout = null;
|
| | | // å¦æè®¾å®ä¸ºimmediate===trueï¼å 为å¼å§è¾¹çå·²ç»è°ç¨è¿äºæ¤å¤æ éè°ç¨
|
| | | if (!immediate) {
|
| | | result = func.apply(context, args)
|
| | | if (!timeout) context = args = null
|
| | | result = func.apply(context, args);
|
| | | if (!timeout) context = args = null;
|
| | | }
|
| | | }
|
| | | }
|
| | | };
|
| | |
|
| | | return function(...args) {
|
| | | context = this
|
| | | timestamp = +new Date()
|
| | | const callNow = immediate && !timeout
|
| | | context = this;
|
| | | timestamp = +new Date();
|
| | | const callNow = immediate && !timeout;
|
| | | // 妿延æ¶ä¸åå¨ï¼éæ°è®¾å®å»¶æ¶
|
| | | if (!timeout) timeout = setTimeout(later, wait)
|
| | | if (!timeout) timeout = setTimeout(later, wait);
|
| | | if (callNow) {
|
| | | result = func.apply(context, args)
|
| | | context = args = null
|
| | | result = func.apply(context, args);
|
| | | context = args = null;
|
| | | }
|
| | |
|
| | | return result
|
| | | }
|
| | | return result;
|
| | | };
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @returns {Object}
|
| | | */
|
| | | export function deepClone(source) {
|
| | | if (!source && typeof source !== 'object') {
|
| | | throw new Error('error arguments', 'deepClone')
|
| | | if (!source && typeof source !== "object") {
|
| | | throw new Error("error arguments", "deepClone");
|
| | | }
|
| | | const targetObj = source.constructor === Array ? [] : {}
|
| | | Object.keys(source).forEach(keys => {
|
| | | if (source[keys] && typeof source[keys] === 'object') {
|
| | | targetObj[keys] = deepClone(source[keys])
|
| | | const targetObj = source.constructor === Array ? [] : {};
|
| | | Object.keys(source).forEach((keys) => {
|
| | | if (source[keys] && typeof source[keys] === "object") {
|
| | | targetObj[keys] = deepClone(source[keys]);
|
| | | } else {
|
| | | targetObj[keys] = source[keys]
|
| | | targetObj[keys] = source[keys];
|
| | | }
|
| | | })
|
| | | return targetObj
|
| | | });
|
| | | return targetObj;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @returns {Array}
|
| | | */
|
| | | export function uniqueArr(arr) {
|
| | | return Array.from(new Set(arr))
|
| | | return Array.from(new Set(arr));
|
| | | }
|
| | |
|
| | | /**
|
| | | * @returns {string}
|
| | | */
|
| | | export function createUniqueString() {
|
| | | const timestamp = +new Date() + ''
|
| | | const randomNum = parseInt((1 + Math.random()) * 65536) + ''
|
| | | return (+(randomNum + timestamp)).toString(32)
|
| | | const timestamp = +new Date() + "";
|
| | | const randomNum = parseInt((1 + Math.random()) * 65536) + "";
|
| | | return (+(randomNum + timestamp)).toString(32);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @returns {boolean}
|
| | | */
|
| | | export function hasClass(ele, cls) {
|
| | | return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'))
|
| | | return !!ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)"));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param {string} cls
|
| | | */
|
| | | export function addClass(ele, cls) {
|
| | | if (!hasClass(ele, cls)) ele.className += ' ' + cls
|
| | | if (!hasClass(ele, cls)) ele.className += " " + cls;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | export function removeClass(ele, cls) {
|
| | | if (hasClass(ele, cls)) {
|
| | | const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)')
|
| | | ele.className = ele.className.replace(reg, ' ')
|
| | | const reg = new RegExp("(\\s|^)" + cls + "(\\s|$)");
|
| | | ele.className = ele.className.replace(reg, " ");
|
| | | }
|
| | | }
|
| | |
|
| | | export function makeMap(str, expectsLowerCase) {
|
| | | const map = Object.create(null)
|
| | | const list = str.split(',')
|
| | | const map = Object.create(null);
|
| | | const list = str.split(",");
|
| | | for (let i = 0; i < list.length; i++) {
|
| | | map[list[i]] = true
|
| | | map[list[i]] = true;
|
| | | }
|
| | | return expectsLowerCase
|
| | | ? val => map[val.toLowerCase()]
|
| | | : val => map[val]
|
| | | return expectsLowerCase ? (val) => map[val.toLowerCase()] : (val) => map[val];
|
| | | }
|
| | |
|
| | | export const exportDefault = 'export default '
|
| | | export const exportDefault = "export default ";
|
| | |
|
| | | export const beautifierConf = {
|
| | | html: {
|
| | | indent_size: '2',
|
| | | indent_char: ' ',
|
| | | max_preserve_newlines: '-1',
|
| | | indent_size: "2",
|
| | | indent_char: " ",
|
| | | max_preserve_newlines: "-1",
|
| | | preserve_newlines: false,
|
| | | keep_array_indentation: false,
|
| | | break_chained_methods: false,
|
| | | indent_scripts: 'separate',
|
| | | brace_style: 'end-expand',
|
| | | indent_scripts: "separate",
|
| | | brace_style: "end-expand",
|
| | | space_before_conditional: true,
|
| | | unescape_strings: false,
|
| | | jslint_happy: false,
|
| | | end_with_newline: true,
|
| | | wrap_line_length: '110',
|
| | | wrap_line_length: "110",
|
| | | indent_inner_html: true,
|
| | | comma_first: false,
|
| | | e4x: true,
|
| | | indent_empty_lines: true
|
| | | indent_empty_lines: true,
|
| | | },
|
| | | js: {
|
| | | indent_size: '2',
|
| | | indent_char: ' ',
|
| | | max_preserve_newlines: '-1',
|
| | | indent_size: "2",
|
| | | indent_char: " ",
|
| | | max_preserve_newlines: "-1",
|
| | | preserve_newlines: false,
|
| | | keep_array_indentation: false,
|
| | | break_chained_methods: false,
|
| | | indent_scripts: 'normal',
|
| | | brace_style: 'end-expand',
|
| | | indent_scripts: "normal",
|
| | | brace_style: "end-expand",
|
| | | space_before_conditional: true,
|
| | | unescape_strings: false,
|
| | | jslint_happy: true,
|
| | | end_with_newline: true,
|
| | | wrap_line_length: '110',
|
| | | wrap_line_length: "110",
|
| | | indent_inner_html: true,
|
| | | comma_first: false,
|
| | | e4x: true,
|
| | | indent_empty_lines: true
|
| | | }
|
| | | }
|
| | | indent_empty_lines: true,
|
| | | },
|
| | | };
|
| | |
|
| | | // é¦åæ¯å¤§å°
|
| | | export function titleCase(str) {
|
| | | return str.replace(/( |^)[a-z]/g, L => L.toUpperCase())
|
| | | return str.replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
|
| | | }
|
| | |
|
| | | // ä¸å转驼峰
|
| | | export function camelCase(str) {
|
| | | return str.replace(/_[a-z]/g, str1 => str1.substr(-1).toUpperCase())
|
| | | return str.replace(/_[a-z]/g, (str1) => str1.substr(-1).toUpperCase());
|
| | | }
|
| | |
|
| | | export function isNumberStr(str) {
|
| | | return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
|
| | | return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str);
|
| | | }
|
| | |
|
| | | export function isEqual(obj1, obj2) {
|
| | | return JSON.stringify(obj1) === JSON.stringify(obj2);
|
| | | }
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-button type="info" plain icon="Upload" @click="handleImport"> |
| | | 导å
¥ |
| | | </el-button> |
| | | <el-dialog v-model="upload.open" :title="upload.title"> |
| | | <FileUpload |
| | | ref="fileUploadRef" |
| | | accept=".xlsx, .xls" |
| | | :headers="upload.headers" |
| | | :action="upload.url + '?updateSupport=' + upload.updateSupport" |
| | | :disabled="upload.isUploading" |
| | | @success="handleFileSuccess" |
| | | /> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitFileForm">ç¡® å®</el-button> |
| | | <el-button @click="upload.open = false">å æ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { reactive } from "vue"; |
| | | import { getToken } from "@/utils/auth.js"; |
| | | import { FileUpload } from "@/components/Upload"; |
| | | import { ElMessage } from "element-plus"; |
| | | |
| | | defineOptions({ |
| | | name: "产åç»´æ¤å¯¼å
¥", |
| | | }); |
| | | |
| | | const emits = defineEmits(["uploadSuccess"]); |
| | | const fileUploadRef = ref(); |
| | | const upload = reactive({ |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå±ï¼ä¾åºå导å
¥ï¼ |
| | | open: false, |
| | | // å¼¹åºå±æ é¢ï¼ä¾åºå导å
¥ï¼ |
| | | title: "", |
| | | // æ¯å¦ç¦ç¨ä¸ä¼ |
| | | isUploading: false, |
| | | // 设置ä¸ä¼ ç请æ±å¤´é¨ |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | // ä¸ä¼ çå°å |
| | | url: import.meta.env.VITE_APP_BASE_API + "/system/supplier/import", |
| | | }); |
| | | // ç¹å»å¯¼å
¥ |
| | | const handleImport = () => { |
| | | upload.open = true; |
| | | upload.title = "产å导å
¥"; |
| | | }; |
| | | |
| | | const submitFileForm = () => { |
| | | fileUploadRef.value.uploadApi(); |
| | | }; |
| | | |
| | | const handleFileSuccess = (response) => { |
| | | const { code, msg } = response; |
| | | if (code == 200) { |
| | | ElMessage({ message: "导å
¥æå", type: "success" }); |
| | | upload.open = false; |
| | | emits("uploadSuccess"); |
| | | } else { |
| | | ElMessage({ message: msg, type: "error" }); |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | clearable |
| | | prefix-icon="Search" |
| | | /> |
| | | <el-button type="primary" @click="openProDia('addOne')" style="margin-left: 10px">æ°å¢äº§å大类</el-button> |
| | | <el-button |
| | | type="primary" |
| | | @click="openProDia('addOne')" |
| | | style="margin-left: 10px" |
| | | >æ°å¢äº§å大类</el-button |
| | | > |
| | | </div> |
| | | <div ref="containerRef"> |
| | | <el-tree ref="tree" v-loading="treeLoad" :data="list" @node-click="handleNodeClick" |
| | | :expand-on-click-node="false" default-expand-all |
| | | :default-expanded-keys="expandedKeys" :draggable="true" :filter-node-method="filterNode" |
| | | :props="{ children: 'children', label: 'label' }" highlight-current node-key="id" |
| | | style="height: calc(100vh - 190px);overflow-y: scroll;scrollbar-width: none;"> |
| | | <el-tree |
| | | ref="tree" |
| | | v-loading="treeLoad" |
| | | :data="list" |
| | | @node-click="handleNodeClick" |
| | | :expand-on-click-node="false" |
| | | default-expand-all |
| | | :default-expanded-keys="expandedKeys" |
| | | :draggable="true" |
| | | :filter-node-method="filterNode" |
| | | :props="{ children: 'children', label: 'label' }" |
| | | highlight-current |
| | | node-key="id" |
| | | style=" |
| | | height: calc(100vh - 190px); |
| | | overflow-y: scroll; |
| | | scrollbar-width: none; |
| | | " |
| | | > |
| | | <template #default="{ node, data }"> |
| | | <div class="custom-tree-node"> |
| | | <span>{{ node.label }}</span> |
| | | <div> |
| | | <el-button type="primary" link @click="openProDia('edit', data)"> |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | @click="openProDia('edit', data)" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button type="primary" link @click="openProDia('add', data)"> |
| | |
| | | </div> |
| | | <div class="right"> |
| | | <div style="margin-bottom: 10px" v-if="isShowButton"> |
| | | <el-button type="primary" @click="openModelDia('add')">æ°å¢è§æ ¼åå·</el-button> |
| | | <el-button type="danger" @click="handleDelete" style="margin-left: 10px" plain>å é¤</el-button> |
| | | <el-button type="primary" @click="openModelDia('add')"> |
| | | æ°å¢è§æ ¼åå· |
| | | </el-button> |
| | | <ImportExcel @uploadSuccess="getModelList" /> |
| | | <el-button |
| | | type="danger" |
| | | @click="handleDelete" |
| | | style="margin-left: 10px" |
| | | plain |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | </div> |
| | | <PIMTable :column="tableColumn" :tableData="tableData" :page="page" :isSelection="true" :handleSelectionChange="handleSelectionChange" |
| | | :tableLoading="tableLoading" @pagination="pagination" :total="total"></PIMTable> |
| | | <PIMTable |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :handleSelectionChange="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="total" |
| | | ></PIMTable> |
| | | </div> |
| | | <el-dialog v-model="productDia" title="产å" width="400px"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-form |
| | | :model="form" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="产ååç§°ï¼" prop="productName"> |
| | | <el-input v-model="form.productName" placeholder="请è¾å
¥äº§ååç§°" clearable/> |
| | | <el-input |
| | | v-model="form.productName" |
| | | placeholder="请è¾å
¥äº§ååç§°" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog v-model="modelDia" title="è§æ ¼åå·" width="400px" @close="closeModelDia"> |
| | | <el-form :model="modelForm" label-width="140px" label-position="top" :rules="modelRules" ref="modelFormRef"> |
| | | <el-dialog |
| | | v-model="modelDia" |
| | | title="è§æ ¼åå·" |
| | | width="400px" |
| | | @close="closeModelDia" |
| | | > |
| | | <el-form |
| | | :model="modelForm" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="modelRules" |
| | | ref="modelFormRef" |
| | | > |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="è§æ ¼åå·ï¼" prop="model"> |
| | | <el-input v-model="modelForm.model" placeholder="请è¾å
¥è§æ ¼åå·" clearable/> |
| | | <el-input |
| | | v-model="modelForm.model" |
| | | placeholder="请è¾å
¥è§æ ¼åå·" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åä½ï¼" prop="unit"> |
| | | <el-input v-model="modelForm.unit" placeholder="请è¾å
¥åä½" clearable/> |
| | | <el-input |
| | | v-model="modelForm.unit" |
| | | placeholder="请è¾å
¥åä½" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | import { |
| | | addOrEditProduct, |
| | | addOrEditProductModel, |
| | | delProduct, delProductModel, |
| | | delProduct, |
| | | delProductModel, |
| | | modelListPage, |
| | | productTreeList |
| | | productTreeList, |
| | | } from "@/api/basicData/product.js"; |
| | | const { proxy } = getCurrentInstance() |
| | | const tree = ref(null) |
| | | const containerRef = ref(null) |
| | | import ImportExcel from "./ImportExcel/index.vue"; |
| | | |
| | | const productDia = ref(false) |
| | | const modelDia = ref(false) |
| | | const modelOperationType = ref('') |
| | | const search = ref('') |
| | | const currentId = ref('') |
| | | const currentParentId = ref('') |
| | | const operationType = ref('') |
| | | const treeLoad = ref(false) |
| | | const list = ref([]) |
| | | const expandedKeys = ref([]) |
| | | const { proxy } = getCurrentInstance(); |
| | | const tree = ref(null); |
| | | const containerRef = ref(null); |
| | | |
| | | const productDia = ref(false); |
| | | const modelDia = ref(false); |
| | | const modelOperationType = ref(""); |
| | | const search = ref(""); |
| | | const currentId = ref(""); |
| | | const currentParentId = ref(""); |
| | | const operationType = ref(""); |
| | | const treeLoad = ref(false); |
| | | const list = ref([]); |
| | | const expandedKeys = ref([]); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: 'è§æ ¼åå·', |
| | | prop: 'model', |
| | | label: "è§æ ¼åå·", |
| | | prop: "model", |
| | | }, |
| | | { |
| | | label: 'åä½', |
| | | prop: 'unit', |
| | | label: "åä½", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: 'center', |
| | | align: "center", |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openModelDia('edit', row); |
| | | openModelDia("edit", row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]) |
| | | const tableData = ref([]) |
| | | const tableLoading = ref(false) |
| | | const isShowButton = ref(false) |
| | | const total = ref(0) |
| | | const selectedRows = ref([]) |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const isShowButton = ref(false); |
| | | const total = ref(0); |
| | | const selectedRows = ref([]); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | }) |
| | | }); |
| | | const data = reactive({ |
| | | form: { |
| | | productName: '', |
| | | productName: "", |
| | | }, |
| | | rules: { |
| | | productName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | }, |
| | | modelForm: { |
| | | model: '', |
| | | unit: '', |
| | | model: "", |
| | | unit: "", |
| | | }, |
| | | modelRules: { |
| | | model: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | unit: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | } |
| | | }) |
| | | const { form, rules, modelForm, modelRules } = toRefs(data) |
| | | }, |
| | | }); |
| | | const { form, rules, modelForm, modelRules } = toRefs(data); |
| | | // æ¥è¯¢äº§åæ |
| | | const getProductTreeList = () => { |
| | | treeLoad.value = true; |
| | | productTreeList().then(res => { |
| | | list.value = res |
| | | productTreeList() |
| | | .then((res) => { |
| | | list.value = res; |
| | | list.value.forEach((a) => { |
| | | expandedKeys.value.push(a.label); |
| | | }); |
| | | treeLoad.value = false; |
| | | }).catch(err => { |
| | | treeLoad.value = false; |
| | | }) |
| | | } |
| | | .catch((err) => { |
| | | treeLoad.value = false; |
| | | }); |
| | | }; |
| | | // è¿æ»¤äº§åæ |
| | | const searchFilter = () => { |
| | | proxy.$refs.tree.filter(search.value); |
| | | } |
| | | }; |
| | | // æå¼äº§åå¼¹æ¡ |
| | | const openProDia = (type, data) => { |
| | | operationType.value = type; |
| | | productDia.value = true |
| | | form.value.productName = '' |
| | | if (type === 'edit') { |
| | | form.value.productName = data.productName |
| | | productDia.value = true; |
| | | form.value.productName = ""; |
| | | if (type === "edit") { |
| | | form.value.productName = data.productName; |
| | | } |
| | | } |
| | | }; |
| | | // æå¼è§æ ¼åå·å¼¹æ¡ |
| | | const openModelDia = (type, data) => { |
| | | modelOperationType.value = type; |
| | | modelDia.value = true |
| | | modelForm.value.model = '' |
| | | modelForm.value.model = '' |
| | | modelForm.value.id = '' |
| | | if (type === 'edit') { |
| | | modelForm.value = {...data} |
| | | modelDia.value = true; |
| | | modelForm.value.model = ""; |
| | | modelForm.value.model = ""; |
| | | modelForm.value.id = ""; |
| | | if (type === "edit") { |
| | | modelForm.value = { ...data }; |
| | | } |
| | | } |
| | | }; |
| | | // æäº¤äº§ååç§°ä¿®æ¹ |
| | | const submitForm = () => { |
| | | proxy.$refs.formRef.validate(valid => { |
| | | proxy.$refs.formRef.validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === 'add') { |
| | | form.value.parentId = currentId.value |
| | | form.value.id = '' |
| | | } else if (operationType.value === 'addOne') { |
| | | form.value.id = '' |
| | | form.value.parentId = '' |
| | | if (operationType.value === "add") { |
| | | form.value.parentId = currentId.value; |
| | | form.value.id = ""; |
| | | } else if (operationType.value === "addOne") { |
| | | form.value.id = ""; |
| | | form.value.parentId = ""; |
| | | } else { |
| | | form.value.id = currentId.value |
| | | form.value.parentId = '' |
| | | form.value.id = currentId.value; |
| | | form.value.parentId = ""; |
| | | } |
| | | addOrEditProduct(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeProDia() |
| | | getProductTreeList() |
| | | }) |
| | | addOrEditProduct(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeProDia(); |
| | | getProductTreeList(); |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | // å
³é产åå¼¹æ¡ |
| | | const closeProDia = () => { |
| | | proxy.$refs.formRef.resetFields(); |
| | | productDia.value = false; |
| | | } |
| | | }; |
| | | // å é¤äº§å |
| | | const remove = (node, data) => { |
| | | let ids = [] |
| | | ids.push(data.id) |
| | | ElMessageBox.confirm( |
| | | 'éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼', |
| | | 'å é¤æç¤º', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | tableLoading.value = true |
| | | delProduct(ids).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | getProductTreeList() |
| | | }).finally(() => { |
| | | tableLoading.value = false |
| | | let ids = []; |
| | | ids.push(data.id); |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | delProduct(ids) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getProductTreeList(); |
| | | }) |
| | | } |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // éæ©äº§å |
| | | const handleNodeClick = (val, node, el) => { |
| | | // 夿æ¯å¦ä¸ºå¶åèç¹ |
| | | isShowButton.value = !(val.children && val.children.length > 0); |
| | | // åªæå¶åèç¹ææ§è¡ä»¥ä¸é»è¾ |
| | | currentId.value = val.id |
| | | currentParentId.value = val.parentId |
| | | getModelList() |
| | | } |
| | | |
| | | currentId.value = val.id; |
| | | currentParentId.value = val.parentId; |
| | | getModelList(); |
| | | }; |
| | | |
| | | // æäº¤è§æ ¼åå·ä¿®æ¹ |
| | | const submitModelForm = () => { |
| | | proxy.$refs.modelFormRef.validate(valid => { |
| | | proxy.$refs.modelFormRef.validate((valid) => { |
| | | if (valid) { |
| | | modelForm.value.productId = currentId.value |
| | | addOrEditProductModel(modelForm.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeModelDia() |
| | | getModelList() |
| | | }) |
| | | modelForm.value.productId = currentId.value; |
| | | addOrEditProductModel(modelForm.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeModelDia(); |
| | | getModelList(); |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | // å
³éåå·å¼¹æ¡ |
| | | const closeModelDia = () => { |
| | | proxy.$refs.modelFormRef.resetFields(); |
| | | modelDia.value = false; |
| | | } |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection |
| | | } |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | // æ¥è¯¢è§æ ¼åå· |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getModelList() |
| | | } |
| | | getModelList(); |
| | | }; |
| | | const getModelList = () => { |
| | | tableLoading.value = true |
| | | modelListPage({id: currentId.value, |
| | | tableLoading.value = true; |
| | | modelListPage({ |
| | | id: currentId.value, |
| | | current: page.current, |
| | | size: page.size, |
| | | } |
| | | ).then(res => { |
| | | console.log('res',res) |
| | | tableData.value = res.records |
| | | total.value = res.total |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | }).then((res) => { |
| | | console.log("res", res); |
| | | tableData.value = res.records; |
| | | total.value = res.total; |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | // å é¤è§æ ¼åå· |
| | | 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 |
| | | delProductModel(ids).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | getModelList() |
| | | }).finally(() => { |
| | | tableLoading.value = false |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | delProductModel(ids) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getModelList(); |
| | | }) |
| | | } |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // è°ç¨treeè¿æ»¤æ¹æ³ 䏿è±è¿æ»¤ |
| | | const filterNode = (value, data, node) => { |
| | | if (!value) {ãããã//å¦ææ°æ®ä¸ºç©ºï¼åè¿åtrue,æ¾ç¤ºææçæ°æ®é¡¹ |
| | | return true |
| | | if (!value) { |
| | | //å¦ææ°æ®ä¸ºç©ºï¼åè¿åtrue,æ¾ç¤ºææçæ°æ®é¡¹ |
| | | return true; |
| | | } |
| | | // æ¥è¯¢å表æ¯å¦æå¹é
æ°æ®ï¼å°å¼å°åï¼å¹é
è±ææ°æ® |
| | | let val = value.toLowerCase() |
| | | return chooseNode(val, data, node) // è°ç¨è¿æ»¤äºå±æ¹æ³ |
| | | } |
| | | let val = value.toLowerCase(); |
| | | return chooseNode(val, data, node); // è°ç¨è¿æ»¤äºå±æ¹æ³ |
| | | }; |
| | | // è¿æ»¤ç¶èç¹ / åèç¹ (妿è¾å
¥çåæ°æ¯ç¶èç¹ä¸è½å¹é
ï¼åè¿å该èç¹ä»¥åå
¶ä¸çææåèç¹ï¼å¦æåæ°æ¯åèç¹ï¼åè¿å该èç¹çç¶èç¹ãnameæ¯ä¸æå符ï¼enNameæ¯è±æå符. |
| | | const chooseNode = (value, data, node) => { |
| | | if (data.label.indexOf(value) !== -1) { |
| | | return true |
| | | return true; |
| | | } |
| | | const level = node.level |
| | | const level = node.level; |
| | | // å¦æä¼ å
¥çèç¹æ¬èº«å°±æ¯ä¸çº§èç¹å°±ä¸ç¨æ ¡éªäº |
| | | if (level === 1) { |
| | | return false |
| | | return false; |
| | | } |
| | | // å
åå½åèç¹çç¶èç¹ |
| | | let parentData = node.parent |
| | | let parentData = node.parent; |
| | | // éåå½åèç¹çç¶èç¹ |
| | | let index = 0 |
| | | let index = 0; |
| | | while (index < level - 1) { |
| | | // 妿å¹é
å°ç´æ¥è¿åï¼æ¤å¤name弿¯ä¸æå符ï¼enNameæ¯è±æå符ã夿å¹é
ä¸è±æè¿æ»¤ |
| | | if (parentData.data.label.indexOf(value) !== -1) { |
| | | return true |
| | | return true; |
| | | } |
| | | // å¦åçè¯åå¾ä¸ä¸å±åå¹é
|
| | | parentData = parentData.parent |
| | | index++ |
| | | parentData = parentData.parent; |
| | | index++; |
| | | } |
| | | // 没å¹é
å°è¿åfalse |
| | | return false |
| | | } |
| | | getProductTreeList() |
| | | return false; |
| | | }; |
| | | getProductTreeList(); |
| | | </script> |
| | | |
| | | <style scoped> |
| | |
| | | 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 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 |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :handleSelectionChange="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="supplierName"> |
| | | <el-input v-model="form.supplierName" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.supplierName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="纳ç¨äººè¯å«å·ï¼" prop="taxpayerIdentificationNum"> |
| | | <el-input v-model="form.taxpayerIdentificationNum" placeholder="请è¾å
¥" clearable/> |
| | | <el-form-item |
| | | label="纳ç¨äººè¯å«å·ï¼" |
| | | prop="taxpayerIdentificationNum" |
| | | > |
| | | <el-input |
| | | v-model="form.taxpayerIdentificationNum" |
| | | 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="bankAccountName"> |
| | | <el-input v-model="form.bankAccountName" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.bankAccountName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è´¦å·ï¼" prop="bankAccountNum"> |
| | | <el-input v-model="form.bankAccountNum" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.bankAccountNum" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è系人ï¼" prop="contactUserName"> |
| | | <el-input v-model="form.contactUserName" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.contactUserName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="èç³»çµè¯ï¼" prop="contactUserPhone"> |
| | | <el-input v-model="form.contactUserPhone" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.contactUserPhone" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´æ¤äººï¼" prop="maintainUserId"> |
| | | <el-select v-model="form.maintainUserId" placeholder="è¯·éæ©" clearable disabled> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.userId"/> |
| | | <el-select |
| | | v-model="form.maintainUserId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | > |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.nickName" |
| | | :label="item.nickName" |
| | | :value="item.userId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </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 { delSupplier} from "@/api/basicData/supplierManageFile.js"; |
| | | import {ElMessageBox } from "element-plus"; |
| | | import {userListNoPage} from "@/api/system/user.js"; |
| | | import {addSupplier,getSupplier,listSupplier,updateSupplier} from "@/api/basicData/supplierManageFile.js"; |
| | | import useUserStore from "@/store/modules/user" |
| | | import { |
| | | addSupplier, |
| | | getSupplier, |
| | | listSupplier, |
| | | updateSupplier, |
| | | } from "@/api/basicData/supplierManageFile.js"; |
| | | 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: 'supplierName', |
| | | label: "ä¾åºååç§°", |
| | | prop: "supplierName", |
| | | width: 250, |
| | | }, |
| | | { |
| | | label: 'å
¬å¸å°å', |
| | | prop: 'companyAddress', |
| | | label: "å
¬å¸å°å", |
| | | prop: "companyAddress", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: 'èç³»æ¹å¼', |
| | | prop: 'companyPhone' |
| | | label: "èç³»æ¹å¼", |
| | | prop: "companyPhone", |
| | | }, |
| | | { |
| | | label: '弿·è¡', |
| | | prop: 'bankAccountName' |
| | | label: "弿·è¡", |
| | | prop: "bankAccountName", |
| | | }, |
| | | { |
| | | label: 'è´¦å·', |
| | | prop: 'bankAccountNum' |
| | | label: "è´¦å·", |
| | | prop: "bankAccountNum", |
| | | }, |
| | | { |
| | | label: 'è系人', |
| | | prop: 'contactUserName', |
| | | label: "è系人", |
| | | prop: "contactUserName", |
| | | }, |
| | | { |
| | | label: 'èç³»çµè¯', |
| | | prop: 'contactUserPhone', |
| | | label: "èç³»çµè¯", |
| | | prop: "contactUserPhone", |
| | | }, |
| | | { |
| | | label: 'ç»´æ¤äºº', |
| | | prop: 'maintainUserName', |
| | | label: "ç»´æ¤äºº", |
| | | prop: "maintainUserName", |
| | | }, |
| | | |
| | | { |
| | | label: 'ç»´æ¤æ¶é´', |
| | | prop: 'maintainTime', |
| | | label: "ç»´æ¤æ¶é´", |
| | | prop: "maintainTime", |
| | | }, |
| | | { |
| | | 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: { |
| | | supplierName: '', |
| | | supplierName: "", |
| | | }, |
| | | form: { |
| | | supplierName: '', |
| | | taxpayerIdentificationNum: '', |
| | | companyAddress: '', |
| | | companyPhone: '', |
| | | bankAccountName:'', |
| | | bankAccountNum:'', |
| | | contactUserName: '', |
| | | contactUserPhone: '', |
| | | maintainUserId: '', |
| | | maintainTime: '', |
| | | supplierName: "", |
| | | taxpayerIdentificationNum: "", |
| | | companyAddress: "", |
| | | companyPhone: "", |
| | | bankAccountName: "", |
| | | bankAccountNum: "", |
| | | contactUserName: "", |
| | | contactUserPhone: "", |
| | | maintainUserId: "", |
| | | maintainTime: "", |
| | | }, |
| | | rules: { |
| | | supplierName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | taxpayerIdentificationNum: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | taxpayerIdentificationNum: [ |
| | | { required: true, message: "请è¾å
¥", trigger: "blur" }, |
| | | ], |
| | | companyAddress: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | companyPhone: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | bankAccountName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | |
| | | contactUserPhone: [{ required: false, message: "请è¾å
¥", trigger: "blur" }], |
| | | maintainUserId: [{ required: false, message: "è¯·éæ©", trigger: "change" }], |
| | | maintainTime: [{ required: false, message: "è¯·éæ©", trigger: "change" }], |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | | }, |
| | | }); |
| | | 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(); |
| | | }; |
| | | /** æäº¤ä¸ä¼ æä»¶ */ |
| | | function submitFileForm() { |
| | | proxy.$refs["uploadRef"].submit() |
| | | proxy.$refs["uploadRef"].submit(); |
| | | } |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | listSupplier({...searchForm.value, ...page}).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | total.value = res.data.total |
| | | }) |
| | | } |
| | | tableLoading.value = true; |
| | | listSupplier({ ...searchForm.value, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | total.value = res.data.total; |
| | | }); |
| | | }; |
| | | const upload = reactive({ |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå±ï¼ä¾åºå导å
¥ï¼ |
| | | open: false, |
| | |
| | | // 设置ä¸ä¼ ç请æ±å¤´é¨ |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | // ä¸ä¼ çå°å |
| | | url: import.meta.env.VITE_APP_BASE_API + "/system/supplier/import" |
| | | }) |
| | | url: import.meta.env.VITE_APP_BASE_API + "/system/supplier/import", |
| | | }); |
| | | /** 导å
¥æé®æä½ */ |
| | | function handleImport() { |
| | | upload.title = "ä¾åºå导å
¥" |
| | | upload.open = true |
| | | upload.title = "ä¾åºå导å
¥"; |
| | | upload.open = true; |
| | | } |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection |
| | | } |
| | | selectedRows.value = selection; |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (type, row) => { |
| | | operationType.value = type |
| | | form.value = {} |
| | | form.value.maintainUserId = userStore.id |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | form.value.maintainUserId = userStore.id; |
| | | form.value.maintainTime = getCurrentDate(); |
| | | userListNoPage().then(res => { |
| | | userList.value = res.data |
| | | }) |
| | | if (type === 'edit') { |
| | | getSupplier(row.id).then(res => { |
| | | form.value = {...res.data} |
| | | }) |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | if (type === "edit") { |
| | | getSupplier(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 = () => { |
| | | addSupplier(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | }) |
| | | } |
| | | addSupplier(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // æäº¤ä¿®æ¹ |
| | | const submitEdit = () => { |
| | | updateSupplier(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | }) |
| | | } |
| | | updateSupplier(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("/system/supplier/export", {}, 'ä¾åºåæ¡£æ¡.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | } |
| | | .then(() => { |
| | | proxy.download("/system/supplier/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 |
| | | delSupplier(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; |
| | | delSupplier(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() |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | </style> |
| | | <style scoped lang="scss"></style> |
| | |
| | | <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> |
| | | <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> |
| | |
| | | </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 |
| | | :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 |
| | | :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="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="ticketsAmount" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="æªæ¥ç¥¨æ°" prop="futureTickets" /> |
| | | <el-table-column label="æªæ¥ç¥¨éé¢(å
)" prop="futureTicketsAmount" :formatter="formattedNumber" /> |
| | | <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="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 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" /> |
| | | <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-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-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éå®ååå·ï¼" prop="salesContractNo"> |
| | | <el-input v-model="form.salesContractNo" placeholder="èªå¨å¡«å
" clearable disabled /> |
| | | <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-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-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-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-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 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 disabled style="width: 100%" v-model="form.issueDate" type="date" clearable /> |
| | | <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" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-form-item label="产åä¿¡æ¯ï¼" prop="entryDate"> |
| | | </el-form-item> |
| | | <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 |
| | | :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="å«ç¨åä»·(å
)" 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="å«ç¨åä»·(å
)" |
| | | 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)" /> |
| | | <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"> |
| | | <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)" /> |
| | | <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 |
| | | 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 |
| | | 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> |
| | | |
| | | <script setup> |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { ref } from 'vue' |
| | | 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() |
| | | 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) |
| | | import useUserStore from "@/store/modules/user"; |
| | | 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([]) |
| | | }); |
| | | const total = ref(0); |
| | | const fileList = ref([]); |
| | | import { |
| | | addOrUpdateRegistration, |
| | | delRegistration, |
| | |
| | | getInfo, |
| | | getProduct, |
| | | getPurchaseNoById, |
| | | getRegistrationById |
| | | getRegistrationById, |
| | | } from "@/api/procurementManagement/invoiceEntry.js"; |
| | | |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref('') |
| | | const dialogFormVisible = ref(false) |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | purchaseContractNumber: '', |
| | | purchaseContractNumber: "", |
| | | }, |
| | | form: { |
| | | issueDate:"",// å¼ç¥¨æ¥æ |
| | | purchaseLedgerId: '', |
| | | purchaseLedgerNo: '', |
| | | issUerId: '', // å¼ç¥¨äººid |
| | | issUer: '' ,// å¼ç¥¨äººå§å |
| | | 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) |
| | | 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 productFormVisible = ref(false); |
| | | const productOperationType = ref(""); |
| | | const currentId = ref(""); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | gePurchaseListPage({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false |
| | | tableLoading.value = true; |
| | | gePurchaseListPage({ ...searchForm.value, ...page }) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | tableData.value.map(item => { |
| | | item.children = [] |
| | | tableData.value.map((item) => { |
| | | item.children = []; |
| | | }); |
| | | total.value = res.total; |
| | | expandedRowKeys.value = []; |
| | | }) |
| | | total.value = res.total |
| | | expandedRowKeys.value = [] |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | .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); |
| | | } |
| | | selectedRows.value = selection.filter( |
| | | (item) => item.purchaseContractNumber !== undefined |
| | | ); |
| | | }; |
| | | const productSelected = (selectedRows) => { |
| | | productSelectedRows.value = selectedRows |
| | | } |
| | | const expandedRowKeys = ref([]) |
| | | productSelectedRows.value = selectedRows; |
| | | }; |
| | | const expandedRowKeys = ref([]); |
| | | // å±å¼è¡ |
| | | const expandChange = (row, expandedRows) => { |
| | | if (expandedRows.length > 0) { |
| | | expandedRowKeys.value = [] |
| | | expandedRowKeys.value = []; |
| | | try { |
| | | productList({ salesLedgerId: row.id, type: 2 }).then(res => { |
| | | const index = tableData.value.findIndex(item => item.id === row.id); |
| | | 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) |
| | | }) |
| | | expandedRowKeys.value.push(row.id); |
| | | }); |
| | | } catch (error) { |
| | | console.log(error) |
| | | console.log(error); |
| | | } |
| | | } else { |
| | | expandedRowKeys.value = [] |
| | | expandedRowKeys.value = []; |
| | | } |
| | | } |
| | | }; |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['contractAmount'], { |
| | | return proxy.summarizeTable(param, ["contractAmount"], { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | }); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeChildrenTable = (param) => { |
| | | return proxy.summarizeTable(param, ['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice', 'ticketsNum', 'ticketsAmount', 'futureTickets', 'futureTicketsAmount'], { |
| | | 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('请å
éä¸ä¸æ¡æ°æ®'); |
| | | proxy.$modal.msgWarning("请å
éä¸ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | openForm('add', selectedRows.value[0]); |
| | | } |
| | | 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 |
| | | }) |
| | | 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; |
| | | 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) |
| | | }) |
| | | setInfo(result.id); |
| | | }); |
| | | } else { |
| | | getProduct().then(res => { |
| | | purchaseLedgerList.value = res |
| | | }) |
| | | getProduct().then((res) => { |
| | | purchaseLedgerList.value = res; |
| | | }); |
| | | } |
| | | if (type === 'edit') { |
| | | if (type === "edit") { |
| | | currentId.value = row.id; |
| | | getRegistrationById({ id: row.id }).then(res => { |
| | | form.value = { ...res } |
| | | productData.value = form.value.productData |
| | | getRegistrationById({ id: row.id }).then((res) => { |
| | | form.value = { ...res }; |
| | | productData.value = form.value.productData; |
| | | if (form.value.salesLedgerFiles) { |
| | | fileList.value = form.value.salesLedgerFiles |
| | | fileList.value = form.value.salesLedgerFiles; |
| | | } else { |
| | | fileList.value = [] |
| | | fileList.value = []; |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true |
| | | } |
| | | 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 |
| | | }) |
| | | } |
| | | 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 => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | form.value.productData = proxy.HaveJson(productData.value) |
| | | addOrUpdateRegistration(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | }) |
| | | 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 |
| | | } |
| | | 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("已忶") |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | } |
| | | .then(() => { |
| | | proxy.download("/purchase/registration/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(() => { |
| | | delRegistration(ids).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | getList() |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | .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 (!row.ticketsNum || row.ticketsNum === "") { |
| | | row.ticketsNum = 0; |
| | | } |
| | | if (Number(row.ticketsNum) > Number(row.tempFutureTickets)) { |
| | | proxy.$modal.msgWarning('æ¬æ¬¡å¼ç¥¨æ°ä¸å¾å¤§äºæªå¼ç¥¨æ°') |
| | | row.ticketsNum = 0 |
| | | return |
| | | proxy.$modal.msgWarning("æ¬æ¬¡å¼ç¥¨æ°ä¸å¾å¤§äºæªå¼ç¥¨æ°"); |
| | | row.ticketsNum = 0; |
| | | return; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡æ¥ç¥¨éé¢ |
| | | row.ticketsAmount = row.ticketsNum * row.taxInclusiveUnitPrice |
| | | row.ticketsAmount = row.ticketsNum * row.taxInclusiveUnitPrice; |
| | | // è®¡ç®æªæ¥ç¥¨æ° |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum; |
| | | // è®¡ç®æªæ¥ç¥¨éé¢ |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount |
| | | calculateinvoiceAmount() |
| | | } |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount; |
| | | calculateinvoiceAmount(); |
| | | }; |
| | | // æ¬æ¬¡æ¥ç¥¨éé¢å¤±ç¦æä½ |
| | | const invoiceAmountBlur = (row) => { |
| | | if(!row.ticketsAmount){ |
| | | row.ticketsAmount = 0 |
| | | row.ticketsAmount = 0; |
| | | } |
| | | // è®¡ç®æ¯å¦è¶
è¿æ¥ç¥¨æ»éé¢ |
| | | if(row.ticketsAmount > row.tempFutureTicketsAmount){ |
| | | proxy.$modal.msgWarning('æ¬æ¬¡æ¥ç¥¨éé¢ä¸å¾å¤§äºæªæ¥ç¥¨éé¢') |
| | | row.ticketsAmount = 0 |
| | | proxy.$modal.msgWarning("æ¬æ¬¡æ¥ç¥¨éé¢ä¸å¾å¤§äºæªæ¥ç¥¨éé¢"); |
| | | row.ticketsAmount = 0; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡æ¥ç¥¨æ° |
| | | row.ticketsNum = (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2) |
| | | row.ticketsNum = (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2); |
| | | // è®¡ç®æªæ¥ç¥¨æ° |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum; |
| | | // è®¡ç®æªæ¥ç¥¨éé¢ |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount |
| | | calculateinvoiceAmount() |
| | | } |
| | | 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}` |
| | | 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 => { |
| | | console.log("productData", productData.value); |
| | | var invoiceAmountTotal = 0; |
| | | productData.value.forEach((item) => { |
| | | if(item.ticketsAmount){ |
| | | invoiceAmountTotal += item.ticketsAmount |
| | | invoiceAmountTotal += item.ticketsAmount; |
| | | } |
| | | }) |
| | | form.value.invoiceAmount = invoiceAmountTotal.toFixed(2) |
| | | |
| | | }); |
| | | form.value.invoiceAmount = invoiceAmountTotal.toFixed(2); |
| | | } |
| | | |
| | | getList() |
| | | getList(); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <el-form :inline="true" :model="searchForm" style="width: 100%"> |
| | | <el-row justify="space-between"> |
| | | <el-col :span="20"> |
| | | <el-form-item label="ä¾åºååç§°/ååå·"> |
| | | <el-input |
| | | v-model="searchForm.supplierNameOrContractNo" |
| | | style="width: 240px" |
| | | placeholder="è¾å
¥ä¾åºååç§°/ååå·æç´¢" |
| | | clearable |
| | | prefix-icon="Search" |
| | | @change="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="䏿¾ç¤ºå¾
忬¾"> |
| | | <el-checkbox |
| | | v-model="searchForm.status" |
| | | :label="0" |
| | | @change="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery"> æç´¢ </el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item style="float: right; margin-right: unset"> |
| | | <el-button type="primary" @click="openForm('add')"> |
| | | æ°å¢ä»æ¬¾ |
| | | </el-button> |
| | | <el-button type="danger" plain @click="handleDelete"> |
| | | å é¤ |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <!-- <div> |
| | | <span class="search_title">ä¾åºååç§°/ååå·ï¼</span> |
| | | <el-input v-model="searchForm.supplierNameOrContractNo" style="width: 240px" placeholder="è¾å
¥ä¾åºååç§°/ååå·æç´¢" |
| | | @change="handleQuery" clearable :prefix-icon="Search" /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | <el-input |
| | | v-model="searchForm.supplierNameOrContractNo" |
| | | 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="openForm('add')">æ°å¢ä»æ¬¾</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> --> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable :column="tableColumn" :tableData="tableData" :page="page" :isSelection="true" |
| | | <PIMTable |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :isShowSummary="isShowSummarySon" |
| | | :summaryMethod="summarizeMainTable1" |
| | | :handleSelectionChange="handleSelectionChange" :tableLoading="tableLoading" @pagination="pagination" |
| | | :total="total"></PIMTable> |
| | | :handleSelectionChange="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="total" |
| | | ></PIMTable> |
| | | </div> |
| | | <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? 'æ°å¢ä»æ¬¾ç»è®°' : 'ç¼è¾ä»æ¬¾ç»è®°'" width="60%" |
| | | @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="60%" |
| | | @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="purchaseContractNumber"> |
| | | <el-input v-model="form.purchaseContractNumber" placeholder="èªå¨å¡«å
" clearable disabled /> |
| | | <el-input |
| | | v-model="form.purchaseContractNumber" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | 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-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-input |
| | | v-model="form.supplierName" |
| | | 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 disabled /> |
| | | <el-input |
| | | v-model="form.invoiceNumber" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票éé¢(å
)ï¼" prop="invoiceAmount"> |
| | | <el-input type="number" :step="0.01" v-model="form.invoiceAmount" placeholder="èªå¨å¡«å
" clearable disabled /> |
| | | <el-input |
| | | type="number" |
| | | :step="0.01" |
| | | v-model="form.invoiceAmount" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¬æ¬¡ä»æ¬¾éé¢ï¼" prop="currentPaymentAmount"> |
| | | <el-input type="number" :step="0.01" v-model="form.currentPaymentAmount" placeholder="请è¾å
¥" clearable /> |
| | | <el-input |
| | | type="number" |
| | | :step="0.01" |
| | | v-model="form.currentPaymentAmount" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="仿¬¾æ¹å¼ï¼" prop="paymentMethod"> |
| | | <el-select v-model="form.paymentMethod" placeholder="è¯·éæ©" clearable> |
| | | <el-select |
| | | v-model="form.paymentMethod" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | > |
| | | <el-option label="çµæ±" value="çµæ±" /> |
| | | <el-option label="æ¿å
" value="æ¿å
" /> |
| | | </el-select> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»è®°äººï¼" prop="registrant"> |
| | | <el-input v-model="form.registrant" placeholder="请è¾å
¥" clearable disabled /> |
| | | <el-input |
| | | v-model="form.registrant" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="仿¬¾æ¥æï¼" prop="paymentDate"> |
| | | <el-date-picker disabled style="width: 100%" v-model="form.paymentDate" value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" type="date" placeholder="è¯·éæ©" clearable /> |
| | | <el-date-picker |
| | | disabled |
| | | style="width: 100%" |
| | | v-model="form.paymentDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»è®°æ¥æï¼" prop="registrationtDate"> |
| | | <el-input v-model="form.registrationtDate" placeholder="请è¾å
¥" clearable disabled /> |
| | | <el-input |
| | | v-model="form.registrationtDate" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue' |
| | | import { ref } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | import { |
| | | byPurchaseId, |
| | | paymentRegistrationAdd, paymentRegistrationDel, |
| | | paymentRegistrationAdd, |
| | | paymentRegistrationDel, |
| | | paymentRegistrationEdit, |
| | | getTicketNo |
| | | getTicketNo, |
| | | } from "@/api/procurementManagement/paymentEntry.js"; |
| | | import {invoiceListPage} from "@/api/procurementManagement/procurementInvoiceLedger.js" |
| | | const { proxy } = getCurrentInstance() |
| | | import { invoiceListPage } from "@/api/procurementManagement/procurementInvoiceLedger.js"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: 'éè´ååå·', |
| | | prop: 'purchaseContractNumber', |
| | | label: "éè´ååå·", |
| | | prop: "purchaseContractNumber", |
| | | }, |
| | | { |
| | | label: 'éå®ååå·', |
| | | prop: 'salesContractNo', |
| | | label: "éå®ååå·", |
| | | prop: "salesContractNo", |
| | | }, |
| | | { |
| | | label: 'ä¾åºååç§°', |
| | | prop: 'supplierName', |
| | | label: "ä¾åºååç§°", |
| | | prop: "supplierName", |
| | | }, |
| | | { |
| | | label: 'å票å·', |
| | | prop: 'invoiceNumber' |
| | | label: "å票å·", |
| | | prop: "invoiceNumber", |
| | | }, |
| | | { |
| | | label: 'å票éé¢(å
)', |
| | | prop: 'invoiceAmount', |
| | | label: "å票éé¢(å
)", |
| | | prop: "invoiceAmount", |
| | | formatData: (params) => { |
| | | return parseFloat(params).toFixed(2); |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | label: '已仿¬¾éé¢(å
)', |
| | | prop: 'paymentAmountTotal', |
| | | label: "已仿¬¾éé¢(å
)", |
| | | prop: "paymentAmountTotal", |
| | | formatData: (params) => { |
| | | return parseFloat(params).toFixed(2); |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | label: 'å¾
仿¬¾éé¢(å
)', |
| | | prop: 'unPaymentAmountTotal', |
| | | label: "å¾
仿¬¾éé¢(å
)", |
| | | prop: "unPaymentAmountTotal", |
| | | formatData: (params) => { |
| | | return parseFloat(params).toFixed(2); |
| | | } |
| | | }, |
| | | ]) |
| | | const tableData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const tableLoading = ref(false) |
| | | const invoiceNumberList = ref([]) |
| | | const userStore = useUserStore() |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const invoiceNumberList = ref([]); |
| | | const userStore = useUserStore(); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | 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: "", |
| | | status: false, |
| | | }, |
| | | form: { |
| | | purchaseContractNumber:'', |
| | | purchaseLedgerId: '', |
| | | salesContractNo: '', |
| | | supplierName: '', |
| | | invoiceNumber: '', |
| | | invoiceAmount: '', |
| | | taxRate: '', |
| | | currentPaymentAmount: '', |
| | | paymentMethod: '', |
| | | registrant: '', |
| | | registrantId: '', |
| | | paymentDate: '', |
| | | purchaseContractNumber: "", |
| | | purchaseLedgerId: "", |
| | | salesContractNo: "", |
| | | supplierName: "", |
| | | invoiceNumber: "", |
| | | invoiceAmount: "", |
| | | taxRate: "", |
| | | currentPaymentAmount: "", |
| | | paymentMethod: "", |
| | | registrant: "", |
| | | registrantId: "", |
| | | paymentDate: "", |
| | | registrationtDate: "", |
| | | }, |
| | | rules: { |
| | | purchaseLedgerId: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | currentPaymentAmount: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | purchaseLedgerId: [ |
| | | { required: true, message: "è¯·éæ©", trigger: "change" }, |
| | | ], |
| | | currentPaymentAmount: [ |
| | | { required: true, message: "请è¾å
¥", trigger: "blur" }, |
| | | ], |
| | | paymentMethod: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | invoiceNumber: [{ required: true, message: "è¯·éæ©éè´ååå·", trigger: "change" }], |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | | invoiceNumber: [ |
| | | { required: true, message: "è¯·éæ©éè´ååå·", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | const { form: searchForm, resetForm } = useFormData(data.searchForm); |
| | | const isShowSummarySon = ref(true); |
| | | |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeMainTable1 = (param) => { |
| | | return proxy.summarizeTable(param, ['invoiceAmount', 'paymentAmountTotal', 'unPaymentAmountTotal'], { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | ["invoiceAmount", "paymentAmountTotal", "unPaymentAmountTotal"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | }); |
| | | } |
| | | ); |
| | | }; |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | 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 |
| | | invoiceListPage({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.records |
| | | total.value = res.total |
| | | }) |
| | | } |
| | | tableLoading.value = true; |
| | | invoiceListPage({ ...searchForm, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | total.value = res.total; |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection |
| | | } |
| | | selectedRows.value = selection; |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (type, row) => { |
| | | if(selectedRows.value.length !== 1 ) { |
| | | proxy.$message.error("è¯·éæ©ä¸æ¡åç¥¨æ°æ®") |
| | | return |
| | | proxy.$message.error("è¯·éæ©ä¸æ¡åç¥¨æ°æ®"); |
| | | return; |
| | | } |
| | | operationType.value = type |
| | | form.value = {} |
| | | form.value = {...selectedRows.value[0]} |
| | | form.value.ticketRegistrationId = selectedRows.value[0].id |
| | | form.value.id = null |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | form.value = { ...selectedRows.value[0] }; |
| | | form.value.ticketRegistrationId = selectedRows.value[0].id; |
| | | form.value.id = null; |
| | | // æ¥è¯¢éè´ååå· |
| | | form.value.registrationtDate = getCurrentDate(); |
| | | form.value.paymentDate = getCurrentDate(); |
| | | form.value.registrant = userStore.name |
| | | dialogFormVisible.value = true |
| | | } |
| | | form.value.registrant = userStore.name; |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // éæ©å票å·ä»¥åç»å票éé¢èµå¼ |
| | | const setInvoiceAmount = (value) => { |
| | | if (value) { |
| | | invoiceNumberList.value.forEach(item => { |
| | | invoiceNumberList.value.forEach((item) => { |
| | | if (item.invoiceNumber === value) { |
| | | form.value.invoiceAmount = item.invoiceAmount |
| | | form.value.ticketRegistrationId = item.id |
| | | form.value.invoiceAmount = item.invoiceAmount; |
| | | form.value.ticketRegistrationId = item.id; |
| | | } |
| | | }) |
| | | }); |
| | | } else { |
| | | form.value.invoiceAmount = '' |
| | | form.value.invoiceAmount = ""; |
| | | } |
| | | } |
| | | }; |
| | | // éæ©éè´ååå·èµå¼ |
| | | const setInfo = (value) => { |
| | | getTicketNo({ id: value }).then((res) => { |
| | | invoiceNumberList.value = res.data |
| | | }) |
| | | invoiceNumberList.value = res.data; |
| | | }); |
| | | if (value) { |
| | | byPurchaseId(value).then(res => { |
| | | form.value.salesContractNo = res.data.salesContractNo |
| | | form.value.supplierName = res.data.supplierName |
| | | form.value.taxRate = res.data.taxRate |
| | | form.value.supplierId = res.data.supplierId |
| | | }) |
| | | byPurchaseId(value).then((res) => { |
| | | form.value.salesContractNo = res.data.salesContractNo; |
| | | form.value.supplierName = res.data.supplierName; |
| | | form.value.taxRate = res.data.taxRate; |
| | | form.value.supplierId = res.data.supplierId; |
| | | }); |
| | | } else { |
| | | form.value.salesContractNo = '' |
| | | form.value.supplierName = '' |
| | | form.value.taxRate = '' |
| | | form.value.supplierId = '' |
| | | form.value.salesContractNo = ""; |
| | | form.value.supplierName = ""; |
| | | form.value.taxRate = ""; |
| | | form.value.supplierId = ""; |
| | | } |
| | | } |
| | | }; |
| | | // æäº¤è¡¨å |
| | | 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 = () => { |
| | | paymentRegistrationAdd(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | }) |
| | | } |
| | | paymentRegistrationAdd(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // æäº¤ä¿®æ¹ |
| | | const submitEdit = () => { |
| | | paymentRegistrationEdit(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | }) |
| | | } |
| | | paymentRegistrationEdit(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef") |
| | | dialogFormVisible.value = false |
| | | } |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | // å é¤ |
| | | 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 |
| | | paymentRegistrationDel(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; |
| | | paymentRegistrationDel(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"> |
| | | .table_list { |
| | | margin-top: unset; |
| | | } |
| | | </style> |
| | |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" /> |
| | | <el-table-column |
| | | v-for="(item, index) in tableColumn" |
| | | :key="index" |
| | | :column-key="item.columnKey" |
| | | :filter-method="item.filterHandler" |
| | | :filter-multiple="item.filterMultiple" |
| | | :filtered-value="item.filteredValue" |
| | | :filters="item.filters" |
| | | :fixed="item.fixed" |
| | | :label="item.label" |
| | | :prop="item.prop" |
| | | label="å票éé¢(å
)" |
| | | prop="invoiceAmount" |
| | | show-overflow-tooltip |
| | | :align="item.align" |
| | | :sortable="!!item.sortable" |
| | | :type="item.type" |
| | | :width="item.width" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="仿¬¾éé¢(å
)" |
| | | prop="paymentAmount" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="åºä»éé¢(å
)" |
| | | prop="payableAmount" |
| | | show-overflow-tooltip |
| | | > |
| | | <template #default="{ row, column }"> |
| | | <el-text type="danger"> |
| | | {{ formattedNumber(row, column, row.payableAmount) }} |
| | | </el-text> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination |
| | |
| | | :tableLoading="tableLoadingSon" |
| | | :isShowSummary="isShowSummarySon" |
| | | :summaryMethod="summarizeMainTable1" |
| | | ></PIMTable> |
| | | > |
| | | <template #payableAmountSlot="{ row }"> |
| | | <el-text type="danger"> |
| | | {{ parseFloat(row.payableAmount).toFixed(2) }} |
| | | </el-text> |
| | | </template> |
| | | </PIMTable> |
| | | <pagination |
| | | v-show="sonTotal > 0" |
| | | :total="sonTotal" |
| | |
| | | <script setup> |
| | | import { ref, toRefs } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { paymentLedgerList,paymentRecordList } from "@/api/procurementManagement/paymentLedger.js"; |
| | | import { |
| | | paymentLedgerList, |
| | | paymentRecordList, |
| | | } from "@/api/procurementManagement/paymentLedger.js"; |
| | | import Pagination from "../../../components/PIMTable/Pagination.vue"; |
| | | |
| | | const tableColumn = ref([ |
| | |
| | | const sonTotal = ref(0); |
| | | const isShowSummary = ref(true); |
| | | const { searchForm } = toRefs(data); |
| | | const currentSupplierId = ref('') |
| | | const currentSupplierId = ref(""); |
| | | const rowClick = (row) => { |
| | | currentSupplierId.value = row.supplierId; |
| | | getPaymenRecordtList(row.supplierId) |
| | | getPaymenRecordtList(row.supplierId); |
| | | }; |
| | | // 忍¡å |
| | | const tableColumnSon = ref([ |
| | |
| | | prop: "invoiceAmount", |
| | | formatData: (params) => { |
| | | return parseFloat(params).toFixed(2); |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | label: "仿¬¾éé¢(å
)", |
| | | prop: "currentPaymentAmount", |
| | | formatData: (params) => { |
| | | return parseFloat(params).toFixed(2); |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | label: "åºä»éé¢(å
)", |
| | | prop: "payableAmount", |
| | | formatData: (params) => { |
| | | return parseFloat(params).toFixed(2); |
| | | } |
| | | dataType: "slot", |
| | | slot: "payableAmountSlot", |
| | | }, |
| | | ]); |
| | | const tableDataSon = ref([]); |
| | |
| | | const isShowSummarySon = ref(true); |
| | | const detailPageNum = ref(1); |
| | | const detailPageSize = ref(10); |
| | | const { proxy } = getCurrentInstance() |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['invoiceAmount', 'paymentAmount', 'payableAmount'], { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | ["invoiceAmount", "paymentAmount", "payableAmount"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | }); |
| | | } |
| | | ); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeMainTable1 = (param) => { |
| | | let summarizeTable = proxy.summarizeTable(param, ['invoiceAmount', 'currentPaymentAmount'], { |
| | | let summarizeTable = proxy.summarizeTable( |
| | | param, |
| | | ["invoiceAmount", "currentPaymentAmount"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | }); |
| | | if(originalTableDataSon.value.length > 0) { |
| | | summarizeTable[summarizeTable.length -1] = originalTableDataSon.value[originalTableDataSon.value.length - 1].payableAmount.toFixed(2) |
| | | }else { |
| | | summarizeTable[summarizeTable.length -1] = 0.00 |
| | | } |
| | | return summarizeTable |
| | | ); |
| | | if (originalTableDataSon.value.length > 0) { |
| | | summarizeTable[summarizeTable.length - 1] = |
| | | originalTableDataSon.value[ |
| | | originalTableDataSon.value.length - 1 |
| | | ].payableAmount.toFixed(2); |
| | | } else { |
| | | summarizeTable[summarizeTable.length - 1] = 0.0; |
| | | } |
| | | return summarizeTable; |
| | | }; |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | |
| | | total.value = result.total || 0; |
| | | if(tableData.value.length > 0) { |
| | | getPaymenRecordtList(tableData.value[0].supplierId); |
| | | currentSupplierId.value = tableData.value[0].supplierId |
| | | currentSupplierId.value = tableData.value[0].supplierId; |
| | | } |
| | | |
| | | }); |
| | | }; |
| | | |
| | | const getPaymenRecordtList = (supplierId) => { |
| | | tableLoadingSon.value = true; |
| | | paymentRecordList(supplierId).then(res => { |
| | | paymentRecordList(supplierId) |
| | | .then((res) => { |
| | | tableLoadingSon.value = false; |
| | | tableDataSon.value = res.data |
| | | tableDataSon.value = res.data; |
| | | handlePagination({ page: 1, limit: sonPage.size }); |
| | | sonTotal.value = res.data.length |
| | | }).catch((e) => { |
| | | tableLoadingSon.value = false; |
| | | sonTotal.value = res.data.length; |
| | | }) |
| | | } |
| | | .catch((e) => { |
| | | tableLoadingSon.value = false; |
| | | }); |
| | | }; |
| | | const handlePagination = ({ page, limit }) => { |
| | | sonPage.current = page; |
| | | sonPage.size = limit; |
| | |
| | | const end = start + limit; |
| | | |
| | | originalTableDataSon.value = tableDataSon.value.slice(start, end); |
| | | } |
| | | }; |
| | | |
| | | const sonPaginationSearch = (pagination) => { |
| | | // æ¥æ¶å页å¨åæ° { page, limit } |
| | | handlePagination(pagination); |
| | | } |
| | | }; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | if (column.property !== 'supplierName') { |
| | | if (column.property !== "supplierName") { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | } else { |
| | | return cellValue |
| | | return cellValue; |
| | | } |
| | | }; |
| | | getList(); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | .el-pagination { |
| | | width: 100%; |
| | | height: 55px; |
| | |
| | | v-model="searchForm.issueDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | type="daterange" |
| | | start-placeholder="å¼å§æ¶é´" |
| | | end-placeholder="ç»ææ¶é´" |
| | | clearable |
| | | @change="changeDateRange" |
| | | @clear="clearRange" |
| | | /> |
| | | <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 @click="handleOut">导åº</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" border v-loading="tableLoading" |
| | | :expand-row-keys="expandedRowKeys" :row-key="row => row.id" show-summary :summary-method="summarizeMainTable" |
| | | @expand-change="expandChange" height="calc(100vh - 18.5em)"> |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | :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" label="åºå·" type="index" 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 |
| | | :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="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="ticketsAmount" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="æªæ¥ç¥¨æ°" prop="futureTickets" /> |
| | | <el-table-column label="æªæ¥ç¥¨éé¢(å
)" prop="futureTicketsAmount" :formatter="formattedNumber" /> |
| | | <el-table-column |
| | | label="æªæ¥ç¥¨éé¢(å
)" |
| | | prop="futureTicketsAmount" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | | <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="invoiceNumber" show-overflow-tooltip /> |
| | | <el-table-column label="ååéé¢(å
)" prop="invoiceAmount" show-overflow-tooltip :formatter="formattedNumber" /> |
| | | <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="invoiceNumber" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="ååéé¢(å
)" |
| | | prop="invoiceAmount" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="å¼ç¥¨äºº" prop="issUer" show-overflow-tooltip /> |
| | | <el-table-column label="å¼ç¥¨æ¥æ" prop="issueDate" show-overflow-tooltip /> |
| | | <el-table-column |
| | | label="å¼ç¥¨æ¥æ" |
| | | prop="issueDate" |
| | | show-overflow-tooltip |
| | | /> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" :limit="page.size" @pagination="paginationChange" /> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { ref } from 'vue' |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ref } from "vue"; |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {ElMessageBox } from "element-plus"; |
| | | import {productRecordList} from "@/api/procurementManagement/procurementInvoiceLedger.js"; |
| | | import { |
| | | invoiceListPage |
| | | } from "@/api/procurementManagement/procurementInvoiceLedger.js"; |
| | | const { proxy } = getCurrentInstance() |
| | | const tableData = ref([]) |
| | | const tableLoading = ref(false) |
| | | import { invoiceListPage } from "@/api/procurementManagement/procurementInvoiceLedger.js"; |
| | | import dayjs from "dayjs"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | }); |
| | | const total = ref(0); |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const data = reactive({ |
| | | searchForm: { |
| | | purchaseContractNumber: '', |
| | | supplierName: '', |
| | | issueDate:'' |
| | | purchaseContractNumber: "", |
| | | supplierName: "", |
| | | issueDate: [ |
| | | dayjs().startOf("month").format("YYYY-MM-DD"), |
| | | dayjs().endOf("month").format("YYYY-MM-DD"), |
| | | ], |
| | | issueDateStart: dayjs().startOf("month").format("YYYY-MM-DD"), |
| | | issueDateEnd: dayjs().endOf("month").format("YYYY-MM-DD"), |
| | | }, |
| | | form: { |
| | | issueDate:"",// å¼ç¥¨æ¥æ |
| | | purchaseLedgerId: '', |
| | | purchaseLedgerNo: '', |
| | | issUerId: '', // å¼ç¥¨äººid |
| | | issUer: '' ,// å¼ç¥¨äººå§å |
| | | purchaseLedgerId: "", |
| | | purchaseLedgerNo: "", |
| | | issUerId: "", // å¼ç¥¨äººid |
| | | issUer: "", // å¼ç¥¨äººå§å |
| | | }, |
| | | rules: { |
| | | purchaseLedgerId: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | } |
| | | }) |
| | | const { searchForm } = toRefs(data) |
| | | purchaseLedgerId: [ |
| | | { required: true, message: "è¯·éæ©", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | invoiceListPage({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.records |
| | | tableData.value.map(item => { |
| | | item.children = [] |
| | | tableLoading.value = true; |
| | | const { issueDate, ...rest } = searchForm.value; |
| | | invoiceListPage({ ...rest, ...page }) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | tableData.value.map((item) => { |
| | | item.children = []; |
| | | }); |
| | | total.value = res.total; |
| | | expandedRowKeys.value = []; |
| | | }) |
| | | total.value = res.total |
| | | expandedRowKeys.value = [] |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const expandedRowKeys = ref([]) |
| | | const expandedRowKeys = ref([]); |
| | | // å±å¼è¡ |
| | | const expandChange = (row, expandedRows) => { |
| | | if (expandedRows.length > 0) { |
| | | expandedRowKeys.value = [] |
| | | expandedRowKeys.value = []; |
| | | try { |
| | | productRecordList({ id: row.id }).then(res => { |
| | | const index = tableData.value.findIndex(item => item.id === row.id); |
| | | productRecordList({ id: row.id }).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) |
| | | }) |
| | | expandedRowKeys.value.push(row.id); |
| | | }); |
| | | } catch (error) { |
| | | console.log(error) |
| | | console.log(error); |
| | | } |
| | | } else { |
| | | expandedRowKeys.value = [] |
| | | expandedRowKeys.value = []; |
| | | } |
| | | } |
| | | }; |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['invoiceAmount'], { |
| | | return proxy.summarizeTable(param, ["invoiceAmount"], { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | }); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeChildrenTable = (param) => { |
| | | return proxy.summarizeTable(param, ['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice', 'ticketsNum', 'ticketsAmount', 'futureTickets', 'futureTicketsAmount'], { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | [ |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | "ticketsNum", |
| | | "ticketsAmount", |
| | | "futureTickets", |
| | | "futureTicketsAmount", |
| | | ], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | }); |
| | | } |
| | | ); |
| | | }; |
| | | |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm( |
| | | 'éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼', |
| | | '导åº', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | proxy.download("/purchase/registration/export", {}, 'æ¥ç¥¨ç»è®°.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/purchase/registration/export", {}, "æ¥ç¥¨ç»è®°.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | const changeDateRange = (date) => { |
| | | if (date) { |
| | | searchForm.receiptPaymentDateStart = date[0]; |
| | | searchForm.receiptPaymentDateEnd = date[1]; |
| | | getList(); |
| | | } |
| | | getList() |
| | | }; |
| | | |
| | | const clearRange = () => { |
| | | searchForm.value.issueDate = []; |
| | | searchForm.value.issueDateStart = undefined; |
| | | searchForm.value.issueDateEnd = undefined; |
| | | getList(); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| | |
| | | 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> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" border v-loading="tableLoading" |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="row => row.id" |
| | | :row-key="(row) => row.id" |
| | | show-summary |
| | | :summary-method="summarizeMainTable" |
| | | @expand-change="expandChange" |
| | | height="calc(100vh - 18.5em)"> |
| | | 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 |
| | | <el-table |
| | | :data="props.row.children" |
| | | border |
| | | show-summary |
| | | :summary-method="summarizeChildrenTable"> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | :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="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | :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="recorderName" show-overflow-tooltip/> |
| | | <el-table-column label="å½å
¥æ¥æ" prop="entryDate" show-overflow-tooltip/> |
| | | <el-table-column fixed="right" label="æä½" min-width="60" align="center"> |
| | | <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="recorderName" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="å½å
¥æ¥æ" |
| | | prop="entryDate" |
| | | show-overflow-tooltip |
| | | /> |
| | | <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> |
| | | <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" /> |
| | | <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="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="purchaseContractNumber"> |
| | | <el-input v-model="form.purchaseContractNumber" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.purchaseContractNumber" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="éå®ååå·ï¼" prop="salesLedgerId"> |
| | | <el-select v-model="form.salesLedgerId" placeholder="è¯·éæ©" clearable @change="salesLedgerChange"> |
| | | <el-option v-for="item in salesContractList" :key="item.id" :label="item.salesContractNo" :value="item.id"/> |
| | | <el-select |
| | | v-model="form.salesLedgerId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | @change="salesLedgerChange" |
| | | > |
| | | <el-option |
| | | v-for="item in salesContractList" |
| | | :key="item.id" |
| | | :label="item.salesContractNo" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¾åºååç§°ï¼" prop="supplierId"> |
| | | <el-select v-model="form.supplierId" placeholder="è¯·éæ©" clearable> |
| | | <el-option v-for="item in supplierList" :key="item.id" :label="item.supplierName" :value="item.id"/> |
| | | <el-select |
| | | v-model="form.supplierId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in supplierList" |
| | | :key="item.id" |
| | | :label="item.supplierName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="项ç®åç§°ï¼" prop="projectName"> |
| | | <el-input v-model="form.projectName" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.projectName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½å
¥äººï¼" prop="recorderId"> |
| | | <el-select v-model="form.recorderId" placeholder="è¯·éæ©" clearable disabled> |
| | | <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId"/> |
| | | <el-select |
| | | v-model="form.recorderId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | > |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.userId" |
| | | :label="item.nickName" |
| | | :value="item.userId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </el-row> |
| | | <el-row> |
| | | <el-form-item label="产åä¿¡æ¯ï¼" prop="entryDate"> |
| | | <el-button type="primary" @click="openProductForm('add')">æ·»å </el-button> |
| | | <el-button plain type="danger" @click="deleteProduct">å é¤</el-button> |
| | | <el-button type="primary" @click="openProductForm('add')" |
| | | >æ·»å </el-button |
| | | > |
| | | <el-button plain type="danger" @click="deleteProduct" |
| | | >å é¤</el-button |
| | | > |
| | | </el-form-item> |
| | | </el-row> |
| | | <el-table :data="productData" border @selection-change="productSelected" show-summary :summary-method="summarizeProTable"> |
| | | <el-table |
| | | :data="productData" |
| | | border |
| | | @selection-change="productSelected" |
| | | show-summary |
| | | :summary-method="summarizeProTable" |
| | | > |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <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="70" /> |
| | | <el-table-column label="å«ç¨åä»·(å
)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" width="150"/> |
| | | <el-table-column label="å«ç¨æ»ä»·(å
)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" width="150"/> |
| | | <el-table-column label="ä¸å«ç¨æ»ä»·(å
)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" width="150"/> |
| | | <el-table-column fixed="right" label="æä½" min-width="60" align="center"> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" |
| | | /> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" |
| | | /> |
| | | <el-table-column |
| | | fixed="right" |
| | | label="æä½" |
| | | min-width="60" |
| | | align="center" |
| | | > |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openProductForm('edit', scope.row, scope.$index);">ç¼è¾</el-button> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="openProductForm('edit', scope.row, scope.$index)" |
| | | >ç¼è¾</el-button |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="夿³¨Â·ï¼" prop="remark"> |
| | | <el-input v-model="form.remark" placeholder="请è¾å
¥" clearable type="textarea" :rows="2"/> |
| | | <el-input |
| | | v-model="form.remark" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | type="textarea" |
| | | :rows="2" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-button type="primary">ä¸ä¼ </el-button> |
| | | <template #tip> |
| | | <div class="el-upload__tip"> |
| | | æä»¶æ ¼å¼æ¯æ docï¼docxï¼xlsï¼xlsxï¼pptï¼pptxï¼pdfï¼txtï¼xmlï¼jpgï¼jpegï¼pngï¼gifï¼bmpï¼rarï¼zipï¼7z |
| | | æä»¶æ ¼å¼æ¯æ |
| | | docï¼docxï¼xlsï¼xlsxï¼pptï¼pptxï¼pdfï¼txtï¼xmlï¼jpgï¼jpegï¼pngï¼gifï¼bmpï¼rarï¼zipï¼7z |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog v-model="productFormVisible" :title="productOperationType === 'add' ? 'æ°å¢äº§å' : 'ç¼è¾äº§å'" width="40%" @close="closeProductDia"> |
| | | <el-form :model="productForm" label-width="140px" label-position="top" :rules="productRules" ref="productFormRef"> |
| | | <el-dialog |
| | | v-model="productFormVisible" |
| | | :title="productOperationType === 'add' ? 'æ°å¢äº§å' : 'ç¼è¾äº§å'" |
| | | width="40%" |
| | | @close="closeProductDia" |
| | | > |
| | | <el-form |
| | | :model="productForm" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="productRules" |
| | | ref="productFormRef" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="产å大类ï¼" prop="productId"> |
| | | <el-tree-select |
| | | v-model="productForm.productId" |
| | | placeholder="è¯·éæ©" clearable |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | check-strictly |
| | | @change="getModels" |
| | | :data="productOptions" |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="è§æ ¼åå·ï¼" prop="productModelId"> |
| | | <el-select v-model="productForm.productModelId" placeholder="è¯·éæ©" clearable @change="getProductModel"> |
| | | <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id"/> |
| | | <el-select |
| | | v-model="productForm.productModelId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | @change="getProductModel" |
| | | > |
| | | <el-option |
| | | v-for="item in modelOptions" |
| | | :key="item.id" |
| | | :label="item.model" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åä½ï¼" prop="unit"> |
| | | <el-input v-model="productForm.unit" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="productForm.unit" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ°éï¼" prop="quantity"> |
| | | <el-input v-model="productForm.quantity" placeholder="请è¾å
¥" clearable @change="mathNum"/> |
| | | <el-input |
| | | v-model="productForm.quantity" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | @change="mathNum" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å«ç¨åä»·(å
)ï¼" prop="taxInclusiveUnitPrice"> |
| | | <el-input-number v-model="productForm.taxInclusiveUnitPrice" :precision="2" :step="0.1" clearable style="width: 100%" @change="mathNum"/> |
| | | <el-input-number |
| | | v-model="productForm.taxInclusiveUnitPrice" |
| | | :precision="2" |
| | | :step="0.1" |
| | | clearable |
| | | style="width: 100%" |
| | | @change="mathNum" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç¨ç(%)ï¼" prop="taxRate"> |
| | | <el-select v-model="productForm.taxRate" placeholder="è¯·éæ©" clearable @change="mathNum"> |
| | | <el-select |
| | | v-model="productForm.taxRate" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | @change="mathNum" |
| | | > |
| | | <el-option label="1" value="1"/> |
| | | <el-option label="6" value="6"/> |
| | | <el-option label="13" value="13"/> |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å«ç¨æ»ä»·(å
)ï¼" prop="taxInclusiveTotalPrice"> |
| | | <el-input-number v-model="productForm.taxInclusiveTotalPrice" :precision="2" :step="0.1" clearable style="width: 100%" disabled/> |
| | | <el-input-number |
| | | v-model="productForm.taxInclusiveTotalPrice" |
| | | :precision="2" |
| | | :step="0.1" |
| | | clearable |
| | | style="width: 100%" |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸å«ç¨æ»ä»·(å
)ï¼" prop="taxExclusiveTotalPrice"> |
| | | <el-form-item |
| | | label="ä¸å«ç¨æ»ä»·(å
)ï¼" |
| | | prop="taxExclusiveTotalPrice" |
| | | > |
| | | <el-input v-model="productForm.taxExclusiveTotalPrice" disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票类åï¼" prop="invoiceType"> |
| | | <el-select v-model="productForm.invoiceType" placeholder="è¯·éæ©" clearable> |
| | | <el-select |
| | | v-model="productForm.invoiceType" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | > |
| | | <el-option label="墿®ç¥¨" value="墿®ç¥¨"/> |
| | | <el-option label="å¢ä¸ç¥¨" value="å¢ä¸ç¥¨"/> |
| | | </el-select> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { getToken } from "@/utils/auth" |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { ref } from 'vue' |
| | | import { getToken } from "@/utils/auth"; |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ref, onMounted } from "vue"; |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {ElMessageBox } from "element-plus"; |
| | | import {userListNoPage} from "@/api/system/user.js"; |
| | | import { |
| | | getSalesLedgerWithProducts, addOrUpdateSalesLedgerProduct, delProduct, delLedgerFile |
| | | getSalesLedgerWithProducts, |
| | | addOrUpdateSalesLedgerProduct, |
| | | delProduct, |
| | | delLedgerFile, |
| | | getProductInfoByContractNo, |
| | | } from "@/api/salesManagement/salesLedger.js"; |
| | | import { |
| | | addOrEditPurchase, |
| | | delPurchase, |
| | | getSalesNo, |
| | | purchaseListPage, |
| | | productList, getPurchaseById, getOptions |
| | | productList, |
| | | getPurchaseById, |
| | | getOptions, |
| | | } from "@/api/procurementManagement/procurementLedger.js"; |
| | | const { proxy } = getCurrentInstance() |
| | | const tableData = ref([]) |
| | | const productData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const productSelectedRows = ref([]) |
| | | const modelOptions = ref([]) |
| | | const userList = ref([]) |
| | | const productOptions = ref([]) |
| | | const salesContractList = ref([]) |
| | | const supplierList = ref([]) |
| | | const tableLoading = ref(false) |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const productData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const productSelectedRows = ref([]); |
| | | const modelOptions = ref([]); |
| | | const userList = ref([]); |
| | | const productOptions = ref([]); |
| | | const salesContractList = ref([]); |
| | | const supplierList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | const fileList = ref([]) |
| | | import useUserStore from "@/store/modules/user" |
| | | }); |
| | | const total = ref(0); |
| | | const fileList = ref([]); |
| | | import useUserStore from "@/store/modules/user"; |
| | | import {modelList, productTreeList} from "@/api/basicData/product.js"; |
| | | |
| | | const userStore = useUserStore() |
| | | const userStore = useUserStore(); |
| | | |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref('') |
| | | const dialogFormVisible = ref(false) |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | purchaseContractNumber: '', |
| | | purchaseContractNumber: "", |
| | | }, |
| | | form: { |
| | | purchaseContractNumber: '', |
| | | salesLedgerId: '', |
| | | projectName: '', |
| | | recorderId: '', |
| | | entryDate: '', |
| | | purchaseContractNumber: "", |
| | | salesLedgerId: "", |
| | | projectName: "", |
| | | recorderId: "", |
| | | entryDate: "", |
| | | productData: [], |
| | | supplierName: '', |
| | | supplierId: '', |
| | | supplierName: "", |
| | | supplierId: "", |
| | | }, |
| | | rules: { |
| | | purchaseContractNumber: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | purchaseContractNumber: [ |
| | | { required: true, message: "请è¾å
¥", trigger: "blur" }, |
| | | ], |
| | | projectName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | supplierId: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | // 产å表åå¼¹æ¡æ°æ® |
| | | const productFormVisible = ref(false) |
| | | const productOperationType = ref('') |
| | | const productOperationIndex = ref('') |
| | | const currentId = ref('') |
| | | const productFormVisible = ref(false); |
| | | const productOperationType = ref(""); |
| | | const productOperationIndex = ref(""); |
| | | const currentId = ref(""); |
| | | const productFormData = reactive({ |
| | | productForm: { |
| | | productId: '', |
| | | productCategory: '', |
| | | productModelId: '', |
| | | specificationModel: '', |
| | | unit: '', |
| | | quantity: '', |
| | | taxInclusiveUnitPrice: '', |
| | | taxRate: '', |
| | | taxInclusiveTotalPrice: '', |
| | | taxExclusiveTotalPrice: '', |
| | | invoiceType: '', |
| | | productId: "", |
| | | productCategory: "", |
| | | productModelId: "", |
| | | specificationModel: "", |
| | | unit: "", |
| | | quantity: "", |
| | | taxInclusiveUnitPrice: "", |
| | | taxRate: "", |
| | | taxInclusiveTotalPrice: "", |
| | | taxExclusiveTotalPrice: "", |
| | | invoiceType: "", |
| | | }, |
| | | productRules: { |
| | | productId: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | productModelId: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | unit: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | quantity: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | taxInclusiveUnitPrice: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | taxInclusiveUnitPrice: [ |
| | | { required: true, message: "请è¾å
¥", trigger: "blur" }, |
| | | ], |
| | | taxRate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | taxInclusiveTotalPrice: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | taxExclusiveTotalPrice: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | taxInclusiveTotalPrice: [ |
| | | { required: true, message: "请è¾å
¥", trigger: "blur" }, |
| | | ], |
| | | taxExclusiveTotalPrice: [ |
| | | { required: true, message: "请è¾å
¥", trigger: "blur" }, |
| | | ], |
| | | invoiceType: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | } |
| | | }) |
| | | const { productForm, productRules } = toRefs(productFormData) |
| | | }, |
| | | }); |
| | | const { productForm, productRules } = toRefs(productFormData); |
| | | const upload = reactive({ |
| | | // ä¸ä¼ çå°å |
| | | url: import.meta.env.VITE_APP_BASE_API + "/file/upload", |
| | | // 设置ä¸ä¼ ç请æ±å¤´é¨ |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | }) |
| | | }); |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeChildrenTable = (param) => { |
| | | return proxy.summarizeTable(param, ['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice', 'ticketsNum', 'ticketsAmount', 'futureTickets', 'futureTicketsAmount'], { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | [ |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | "ticketsNum", |
| | | "ticketsAmount", |
| | | "futureTickets", |
| | | "futureTicketsAmount", |
| | | ], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | }); |
| | | } |
| | | ); |
| | | }; |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | purchaseListPage({...searchForm.value, ...page}).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.records |
| | | tableData.value.map(item => { |
| | | item.children = [] |
| | | tableLoading.value = true; |
| | | purchaseListPage({ ...searchForm.value, ...page }) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | tableData.value.map((item) => { |
| | | item.children = []; |
| | | }); |
| | | total.value = res.total; |
| | | expandedRowKeys.value = []; |
| | | }) |
| | | total.value = res.total |
| | | expandedRowKeys.value = [] |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection |
| | | } |
| | | selectedRows.value = selection; |
| | | }; |
| | | const productSelected = (selectedRows) => { |
| | | productSelectedRows.value = selectedRows |
| | | } |
| | | const expandedRowKeys = ref([]) |
| | | productSelectedRows.value = selectedRows; |
| | | }; |
| | | const expandedRowKeys = ref([]); |
| | | // å±å¼è¡ |
| | | const expandChange = (row, expandedRows) => { |
| | | if (expandedRows.length > 0) { |
| | | expandedRowKeys.value = [] |
| | | expandedRowKeys.value = []; |
| | | try { |
| | | productList({salesLedgerId: row.id, type: 2}).then(res => { |
| | | const index = tableData.value.findIndex(item => item.id === row.id); |
| | | 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) |
| | | }) |
| | | expandedRowKeys.value.push(row.id); |
| | | }); |
| | | } catch (error) { |
| | | console.log(error) |
| | | console.log(error); |
| | | } |
| | | } else { |
| | | expandedRowKeys.value = [] |
| | | expandedRowKeys.value = []; |
| | | } |
| | | } |
| | | }; |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['contractAmount']); |
| | | return proxy.summarizeTable(param, ["contractAmount"]); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeProTable = (param) => { |
| | | return proxy.summarizeTable(param, ['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']); |
| | | return proxy.summarizeTable(param, [ |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | ]); |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (type, row) => { |
| | | operationType.value = type |
| | | form.value = {} |
| | | productData.value = [] |
| | | fileList.value = [] |
| | | userListNoPage().then(res => { |
| | | userList.value = res.data |
| | | }) |
| | | getSalesNo().then(res => { |
| | | salesContractList.value = res |
| | | }) |
| | | getOptions().then(res => { |
| | | supplierList.value = res.data |
| | | }) |
| | | form.value.recorderId = userStore.id |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | productData.value = []; |
| | | fileList.value = []; |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | getSalesNo().then((res) => { |
| | | salesContractList.value = res; |
| | | }); |
| | | getOptions().then((res) => { |
| | | supplierList.value = res.data; |
| | | }); |
| | | form.value.recorderId = userStore.id; |
| | | form.value.entryDate = getCurrentDate(); |
| | | if (type === 'edit') { |
| | | if (type === "edit") { |
| | | currentId.value = row.id; |
| | | getPurchaseById({id: row.id, type: 2}).then(res => { |
| | | form.value = {...res} |
| | | productData.value = form.value.productData |
| | | getPurchaseById({ id: row.id, type: 2 }).then((res) => { |
| | | form.value = { ...res }; |
| | | productData.value = form.value.productData; |
| | | if(form.value.salesLedgerFiles) { |
| | | fileList.value = form.value.salesLedgerFiles |
| | | fileList.value = form.value.salesLedgerFiles; |
| | | } else { |
| | | fileList.value = [] |
| | | fileList.value = []; |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true |
| | | } |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // ä¸ä¼ åæ ¡æ£ |
| | | function handleBeforeUpload(file) { |
| | | // æ ¡æ£æä»¶å¤§å° |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | proxy.$modal.msgError('ä¸ä¼ æä»¶å¤§å°ä¸è½è¶
è¿10MB!') |
| | | return false |
| | | proxy.$modal.msgError("ä¸ä¼ æä»¶å¤§å°ä¸è½è¶
è¿10MB!"); |
| | | return false; |
| | | } |
| | | proxy.$modal.loading("æ£å¨ä¸ä¼ æä»¶ï¼è¯·ç¨å...") |
| | | return true |
| | | proxy.$modal.loading("æ£å¨ä¸ä¼ æä»¶ï¼è¯·ç¨å..."); |
| | | return true; |
| | | } |
| | | // ä¸ä¼ 失败 |
| | | function handleUploadError(err) { |
| | | proxy.$modal.msgError("ä¸ä¼ æä»¶å¤±è´¥") |
| | | proxy.$modal.closeLoading() |
| | | proxy.$modal.msgError("ä¸ä¼ æä»¶å¤±è´¥"); |
| | | proxy.$modal.closeLoading(); |
| | | } |
| | | // ä¸ä¼ æååè° |
| | | function handleUploadSuccess(res, file, uploadFiles) { |
| | | proxy.$modal.closeLoading() |
| | | proxy.$modal.closeLoading(); |
| | | if (res.code === 200) { |
| | | file.tempId = res.data.tempId |
| | | proxy.$modal.msgSuccess("ä¸ä¼ æå") |
| | | file.tempId = res.data.tempId; |
| | | proxy.$modal.msgSuccess("ä¸ä¼ æå"); |
| | | } else { |
| | | proxy.$modal.msgError(res.msg) |
| | | proxy.$refs.fileUpload.handleRemove(file) |
| | | proxy.$modal.msgError(res.msg); |
| | | proxy.$refs.fileUpload.handleRemove(file); |
| | | } |
| | | } |
| | | // ç§»é¤æä»¶ |
| | | function handleRemove (file) { |
| | | console.log('handleRemove', file.id) |
| | | if (operationType.value === 'edit') { |
| | | let ids = [] |
| | | ids.push(file.id) |
| | | delLedgerFile(ids).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | }) |
| | | console.log("handleRemove", file.id); |
| | | if (operationType.value === "edit") { |
| | | let ids = []; |
| | | ids.push(file.id); |
| | | delLedgerFile(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | }); |
| | | } |
| | | } |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (productData.value.length > 0) { |
| | | form.value.productData = proxy.HaveJson(productData.value) |
| | | form.value.productData = proxy.HaveJson(productData.value); |
| | | } else { |
| | | proxy.$modal.msgWarning('请添å 产åä¿¡æ¯') |
| | | return |
| | | proxy.$modal.msgWarning("请添å 产åä¿¡æ¯"); |
| | | return; |
| | | } |
| | | let tempFileIds = [] |
| | | let tempFileIds = []; |
| | | if (fileList.value.length > 0) { |
| | | tempFileIds = fileList.value.map(item => item.tempId) |
| | | tempFileIds = fileList.value.map((item) => item.tempId); |
| | | } |
| | | form.value.tempFileIds = tempFileIds |
| | | form.value.type = 2 |
| | | addOrEditPurchase(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | }) |
| | | form.value.tempFileIds = tempFileIds; |
| | | form.value.type = 2; |
| | | addOrEditPurchase(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef") |
| | | dialogFormVisible.value = false |
| | | } |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | // æå¼äº§åå¼¹æ¡ |
| | | const openProductForm = (type, row, index) => { |
| | | productOperationType.value = type |
| | | productOperationIndex.value = index |
| | | productForm.value = {} |
| | | proxy.resetForm("productFormRef") |
| | | if (type === 'edit') { |
| | | productForm.value = {...row} |
| | | productOperationType.value = type; |
| | | productOperationIndex.value = index; |
| | | productForm.value = {}; |
| | | proxy.resetForm("productFormRef"); |
| | | if (type === "edit") { |
| | | productForm.value = { ...row }; |
| | | } |
| | | productFormVisible.value = true |
| | | getProductOptions() |
| | | } |
| | | productFormVisible.value = true; |
| | | getProductOptions(); |
| | | }; |
| | | const getProductOptions = () => { |
| | | productTreeList().then(res => { |
| | | productOptions.value = convertIdToValue(res) |
| | | }) |
| | | } |
| | | productTreeList().then((res) => { |
| | | productOptions.value = convertIdToValue(res); |
| | | }); |
| | | }; |
| | | const getModels =(value) => { |
| | | productForm.value.productCategory = findNodeById(productOptions.value, value) |
| | | modelList({id: value}).then(res => { |
| | | modelOptions.value = res |
| | | }) |
| | | } |
| | | productForm.value.productCategory = findNodeById(productOptions.value, value); |
| | | modelList({ id: value }).then((res) => { |
| | | modelOptions.value = res; |
| | | }); |
| | | }; |
| | | const getProductModel =(value) => { |
| | | const index = modelOptions.value.findIndex(item => item.id === value); |
| | | const index = modelOptions.value.findIndex((item) => item.id === value); |
| | | if (index !== -1) { |
| | | productForm.value.specificationModel = modelOptions.value[index].model; |
| | | productForm.value.unit = modelOptions.value[index].unit; |
| | | } else { |
| | | productForm.value.specificationModel = null; |
| | | productForm.value.unit = null |
| | | productForm.value.unit = null; |
| | | } |
| | | } |
| | | }; |
| | | const findNodeById = (nodes, productId) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].value === productId) { |
| | |
| | | return null; // æ²¡ææ¾å°èç¹ï¼è¿ånull |
| | | }; |
| | | function convertIdToValue(data) { |
| | | return data.map(item => { |
| | | return data.map((item) => { |
| | | const { id, children, ...rest } = item; |
| | | const newItem = { |
| | | ...rest, |
| | | value: id // å° id æ¹ä¸º value |
| | | value: id, // å° id æ¹ä¸º value |
| | | }; |
| | | if (children && children.length > 0) { |
| | | newItem.children = convertIdToValue(children); |
| | |
| | | } |
| | | // æäº¤äº§å表å |
| | | const submitProduct = () => { |
| | | proxy.$refs["productFormRef"].validate(valid => { |
| | | proxy.$refs["productFormRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === "edit") { |
| | | submitProductEdit() |
| | | submitProductEdit(); |
| | | } else { |
| | | if (productOperationType.value === 'add') { |
| | | productData.value.push({...productForm.value}) |
| | | console.log('productData.value---', productData.value) |
| | | if (productOperationType.value === "add") { |
| | | productData.value.push({ ...productForm.value }); |
| | | console.log("productData.value---", productData.value); |
| | | } else { |
| | | productData.value[productOperationIndex.value] = {...productForm.value} |
| | | productData.value[productOperationIndex.value] = { |
| | | ...productForm.value, |
| | | }; |
| | | } |
| | | closeProductDia() |
| | | closeProductDia(); |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | const submitProductEdit = () => { |
| | | productForm.value.salesLedgerId = currentId.value |
| | | productForm.value.type = 2 |
| | | addOrUpdateSalesLedgerProduct(productForm.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeProductDia() |
| | | getPurchaseById({id: currentId.value, type: 2}).then(res => { |
| | | productData.value = res.productData |
| | | }) |
| | | }) |
| | | } |
| | | productForm.value.salesLedgerId = currentId.value; |
| | | productForm.value.type = 2; |
| | | addOrUpdateSalesLedgerProduct(productForm.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeProductDia(); |
| | | getPurchaseById({ id: currentId.value, type: 2 }).then((res) => { |
| | | productData.value = res.productData; |
| | | }); |
| | | }); |
| | | }; |
| | | // å é¤äº§å |
| | | const deleteProduct = () => { |
| | | if (productSelectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning('è¯·éæ©æ°æ®') |
| | | return |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | if (operationType.value === 'add') { |
| | | productSelectedRows.value.forEach(selectedRow => { |
| | | const index = productData.value.findIndex(product => product.id === selectedRow.id); |
| | | if (operationType.value === "add") { |
| | | productSelectedRows.value.forEach((selectedRow) => { |
| | | const index = productData.value.findIndex( |
| | | (product) => product.id === selectedRow.id |
| | | ); |
| | | if (index !== -1) { |
| | | productData.value.splice(index, 1); |
| | | } |
| | | }); |
| | | } else { |
| | | let ids = [] |
| | | let ids = []; |
| | | if (productSelectedRows.value.length > 0) { |
| | | ids = productSelectedRows.value.map(item => item.id); |
| | | ids = productSelectedRows.value.map((item) => item.id); |
| | | } |
| | | ElMessageBox.confirm( |
| | | 'éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼', |
| | | '导åº', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | delProduct(ids).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | closeProductDia() |
| | | getSalesLedgerWithProducts({id: currentId.value, type: 2}).then(res => { |
| | | productData.value = res.productData |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | }) |
| | | |
| | | .then(() => { |
| | | delProduct(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | closeProductDia(); |
| | | getSalesLedgerWithProducts({ id: currentId.value, type: 2 }).then( |
| | | (res) => { |
| | | productData.value = res.productData; |
| | | } |
| | | ); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | } |
| | | }; |
| | | // å
³é产åå¼¹æ¡ |
| | | const closeProductDia = () => { |
| | | proxy.resetForm("productFormRef") |
| | | productFormVisible.value = false |
| | | } |
| | | proxy.resetForm("productFormRef"); |
| | | productFormVisible.value = false; |
| | | }; |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm( |
| | | 'éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼', |
| | | '导åº', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | proxy.download("/purchase/ledger/export", {}, 'éè´å°è´¦.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | } |
| | | .then(() => { |
| | | proxy.download("/purchase/ledger/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(() => { |
| | | delPurchase(ids).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å") |
| | | getList() |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | .then(() => { |
| | | delPurchase(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }); |
| | | }) |
| | | } |
| | | .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}`; |
| | | } |
| | | const mathNum = () => { |
| | | console.log('productForm.value',productForm.value) |
| | | console.log("productForm.value", productForm.value); |
| | | if(!productForm.value.taxInclusiveUnitPrice){ |
| | | return |
| | | return; |
| | | } |
| | | if(!productForm.value.quantity){ |
| | | return |
| | | return; |
| | | } |
| | | // å«ç¨æ»ä»·è®¡ç® |
| | | productForm.value.taxInclusiveTotalPrice = proxy.calculateTaxIncludeTotalPrice(productForm.value.taxInclusiveUnitPrice, productForm.value.quantity) |
| | | productForm.value.taxInclusiveTotalPrice = |
| | | proxy.calculateTaxIncludeTotalPrice( |
| | | productForm.value.taxInclusiveUnitPrice, |
| | | productForm.value.quantity |
| | | ); |
| | | if(productForm.value.taxRate){ |
| | | // ä¸å«ç¨æ»ä»·è®¡ç® |
| | | productForm.value.taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(productForm.value.taxInclusiveTotalPrice, productForm.value.taxRate) |
| | | productForm.value.taxExclusiveTotalPrice = |
| | | proxy.calculateTaxExclusiveTotalPrice( |
| | | productForm.value.taxInclusiveTotalPrice, |
| | | productForm.value.taxRate |
| | | ); |
| | | } |
| | | } |
| | | }; |
| | | // éå®ååéæ©æ¹åæ¹æ³ |
| | | const salesLedgerChange = (row) => { |
| | | console.log('row',row) |
| | | var index = salesContractList.value.findIndex(item => item.id == row); |
| | | console.log('index',index) |
| | | const salesLedgerChange = async (row) => { |
| | | console.log("row", row); |
| | | var index = salesContractList.value.findIndex((item) => item.id == row); |
| | | console.log("index", index); |
| | | if(index > -1){ |
| | | form.value.projectName = salesContractList.value[index].projectName |
| | | form.value.projectName = salesContractList.value[index].projectName; |
| | | await querygProductInfoByContractNo(); |
| | | } |
| | | }; |
| | | |
| | | const querygProductInfoByContractNo = async () => { |
| | | const { code, data } = await getProductInfoByContractNo({ |
| | | contractNo: form.value.salesLedgerId, |
| | | }); |
| | | if (code == 200) { |
| | | productData.value = data; |
| | | } |
| | | getList() |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | </style> |
| | | <style scoped lang="scss"></style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form class="search_form" :inline="true" label-width="80px"> |
| | | <el-form-item label="客æ·åç§°"> |
| | | <el-input v-model="filters.customerName" placeholder="请è¾å
¥å®¢æ·åç§°" /> |
| | | </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 class="table_list"> |
| | | <PIMTable |
| | | :column="columns" |
| | | :tableLoading="loading" |
| | | :tableData="dataList" |
| | | :page="{ |
| | | current: pagination.currentPage, |
| | | size: pagination.pageSize, |
| | | }" |
| | | @pagination="onCurrentChange" |
| | | ></PIMTable> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { usePaginationApi } from "@/hooks/usePaginationApi"; |
| | | import { getPurchaseList } from "@/api/procurementManagement/projectProfit"; |
| | | import { onMounted } from "vue"; |
| | | |
| | | defineOptions({ |
| | | name: "项ç®å©æ¶¦", |
| | | }); |
| | | |
| | | const { |
| | | loading, |
| | | filters, |
| | | columns, |
| | | dataList, |
| | | pagination, |
| | | getTableData, |
| | | resetFilters, |
| | | onCurrentChange, |
| | | } = usePaginationApi( |
| | | getPurchaseList, |
| | | { |
| | | customerName: undefined, |
| | | }, |
| | | [ |
| | | { |
| | | label: "éå®ååå·", |
| | | align: "center", |
| | | prop: "customerContractNo", |
| | | }, |
| | | { |
| | | label: "客æ·åç§°", |
| | | align: "center", |
| | | prop: "customerName", |
| | | }, |
| | | { |
| | | label: "项ç®åç§°", |
| | | align: "center", |
| | | prop: "projectName", |
| | | }, |
| | | { |
| | | label: "ååéé¢", |
| | | align: "center", |
| | | prop: "contractAmount", |
| | | }, |
| | | { |
| | | label: "éè´éé¢", |
| | | align: "center", |
| | | prop: "purchaseAmount", |
| | | }, |
| | | { |
| | | label: "婿¶¦", |
| | | align: "center", |
| | | prop: "balance", |
| | | }, |
| | | { |
| | | label: "婿¶¦ç", |
| | | align: "center", |
| | | prop: "balanceRatio", |
| | | }, |
| | | { |
| | | label: "å¢å¼ç¨", |
| | | align: "center", |
| | | prop: "balanceAmount", |
| | | }, |
| | | ] |
| | | ); |
| | | |
| | | onMounted(() => { |
| | | getTableData(); |
| | | }); |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .table_list { |
| | | margin-top: unset; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">客æ·åç§°/ååå·ï¼</span> |
| | | <el-form :inline="true" :model="searchForm"> |
| | | <el-form-item label="客æ·åç§°/ååå·"> |
| | | <el-input |
| | | v-model="searchForm.searchText" |
| | | style="width: 240px" |
| | |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | <span class="search_title" style="margin-left: 10px">å¼ç¥¨æ¥æï¼</span> |
| | | </el-form-item> |
| | | <el-form-item label="å¼ç¥¨æ¥æ"> |
| | | <el-date-picker |
| | | style="width: 240px" |
| | | v-model="searchForm.invoiceDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | type="daterange" |
| | | start-placeholder="å¼å§æ¶é´" |
| | | end-placeholder="ç»ææ¶é´" |
| | | clearable |
| | | @change="changeDateRange" |
| | | @clear="clearRange" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button @click="handleOut" type="primary" style="width: 100px">导åº</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery"> æç´¢ </el-button> |
| | | <el-button @click="resetForm"> éç½® </el-button> |
| | | <el-button @click="handleOut" type="primary">导åº</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" border v-loading="tableLoading" |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :row-key="row => row.id" |
| | | :row-key="(row) => row.id" |
| | | show-summary |
| | | :summary-method="summarizeMainTable" |
| | | height="calc(100vh - 18.5em)"> |
| | | height="calc(100vh - 18.5em)" |
| | | > |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="éå®ååå·" prop="salesContractNo" show-overflow-tooltip/> |
| | | <el-table-column label="客æ·ååå·" prop="customerContractNo" show-overflow-tooltip/> |
| | | <el-table-column label="客æ·åç§°" prop="customerName" show-overflow-tooltip/> |
| | | <el-table-column |
| | | label="éå®ååå·" |
| | | prop="salesContractNo" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="客æ·ååå·" |
| | | prop="customerContractNo" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="客æ·åç§°" |
| | | prop="customerName" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column label="产å大类" prop="productCategory" /> |
| | | <el-table-column label="è§æ ¼åå·" prop="specificationModel" /> |
| | | <el-table-column label="å票å·" prop="invoiceNo" show-overflow-tooltip/> |
| | | <el-table-column label="å票éé¢(å
)" prop="invoiceTotal" show-overflow-tooltip :formatter="formattedNumber"/> |
| | | <el-table-column |
| | | label="å票å·" |
| | | prop="invoiceNo" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="å票éé¢(å
)" |
| | | prop="invoiceTotal" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="ç¨ç" prop="taxRate" show-overflow-tooltip/> |
| | | <el-table-column label="å¼ç¥¨äºº" prop="invoicePerson" show-overflow-tooltip/> |
| | | <el-table-column label="å¼ç¥¨æ¥æ" prop="invoiceDate" show-overflow-tooltip/> |
| | | <el-table-column label="å票" prop="invoiceFileName" show-overflow-tooltip> |
| | | <el-table-column |
| | | label="å¼ç¥¨äºº" |
| | | prop="invoicePerson" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="å¼ç¥¨æ¥æ" |
| | | prop="invoiceDate" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="å票" |
| | | prop="invoiceFileName" |
| | | show-overflow-tooltip |
| | | > |
| | | <template #default="scope"> |
| | | <span v-if="scope.row.invoiceFileName">{{ scope.row.invoiceFileName }}</span> |
| | | <el-button v-else link type="primary" @click="handleDownload(scope.row)">ä¸ä¼ </el-button> |
| | | <span v-if="scope.row.invoiceFileName">{{ |
| | | scope.row.invoiceFileName |
| | | }}</span> |
| | | <el-button |
| | | v-else |
| | | link |
| | | type="primary" |
| | | @click="handleDownload(scope.row)" |
| | | >ä¸ä¼ </el-button |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" label="æä½" width="150" align="center" > |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm(scope.row);">ç¼è¾</el-button> |
| | | <el-button link type="primary" size="small" @click="delInvoiceLedger(scope.row);">å é¤</el-button> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="openForm(scope.row)" |
| | | >ç¼è¾</el-button |
| | | > |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="delInvoiceLedger(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" /> |
| | | <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="å¼ç¥¨å°è´¦é¡µé¢" width="70%" @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | title="å¼ç¥¨å°è´¦é¡µé¢" |
| | | 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="salesContractNo"> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="客æ·åç§°ï¼" prop="customerName"> |
| | | <el-input v-model="form.customerName" placeholder="èªå¨å¡«å
" clearable disabled/> |
| | | <el-input |
| | | v-model="form.customerName" |
| | | placeholder="èªå¨å¡«å
" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票å·ï¼" prop="invoiceNo"> |
| | | <el-input v-model="form.invoiceNo" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | v-model="form.invoiceNo" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票éé¢(å
)ï¼" prop="invoiceTotal"> |
| | | <el-input type="number" :step="0.01" v-model="form.invoiceTotal" placeholder="请è¾å
¥" clearable/> |
| | | <el-input |
| | | type="number" |
| | | :step="0.01" |
| | | v-model="form.invoiceTotal" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¼ç¥¨äººï¼" prop="invoicePerson"> |
| | | <el-input v-model="form.invoicePerson" placeholder="请è¾å
¥" clearable disabled/> |
| | | <el-input |
| | | v-model="form.invoicePerson" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-button type="primary">ä¸ä¼ </el-button> |
| | | <template #tip> |
| | | <!-- æä»¶æ ¼å¼æ¯æ docï¼docxï¼xlsï¼xlsxï¼pptï¼pptxï¼pdfï¼txtï¼xmlï¼jpgï¼jpegï¼pngï¼gifï¼bmpï¼rarï¼zipï¼7z--> |
| | | <div class="el-upload__tip"> |
| | | æä»¶æ ¼å¼æ¯æ pdf |
| | | </div> |
| | | <div class="el-upload__tip">æä»¶æ ¼å¼æ¯æ pdf</div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | |
| | | > |
| | | <el-button type="primary">ä¸ä¼ </el-button> |
| | | <template #tip> |
| | | <div class="el-upload__tip"> |
| | | æä»¶æ ¼å¼ä»
æ¯æ pdf |
| | | </div> |
| | | <div class="el-upload__tip">æä»¶æ ¼å¼ä»
æ¯æ pdf</div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { ref } from 'vue' |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ref } from "vue"; |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {ElMessageBox } from "element-plus"; |
| | | import { getToken } from "@/utils/auth" |
| | | import { getToken } from "@/utils/auth"; |
| | | import { |
| | | invoiceLedgerSaveOrUpdate, |
| | | invoiceLedgerProductInfo, |
| | | commitFile, |
| | | registrationProductPage, delInvoiceLedgerByRegProductId |
| | | registrationProductPage, |
| | | delInvoiceLedgerByRegProductId, |
| | | } from "../../../api/salesManagement/invoiceLedger.js"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | const { proxy } = getCurrentInstance() |
| | | const tableData = ref([]) |
| | | const productData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const tableLoading = ref(false) |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import dayjs from "dayjs"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const productData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | const fileList = ref([]) |
| | | const dialogFormVisible = ref(false) |
| | | }); |
| | | const total = ref(0); |
| | | const fileList = ref([]); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | searchText: '', |
| | | invoiceDate:'' |
| | | searchText: "", |
| | | invoiceDate: [ |
| | | dayjs().startOf("month").format("YYYY-MM-DD"), |
| | | dayjs().endOf("month").format("YYYY-MM-DD"), |
| | | ], |
| | | invoiceDateStart: dayjs().startOf("month").format("YYYY-MM-DD"), |
| | | invoiceDateEnd: dayjs().endOf("month").format("YYYY-MM-DD"), |
| | | }, |
| | | form: { |
| | | salesLedgerId: '', |
| | | customerId: '', |
| | | invoiceNo: '', |
| | | invoiceTotal: '', |
| | | taxRate: '', |
| | | invoicePerson: '', |
| | | invoiceDate: '', |
| | | customerName:'', |
| | | fileList:[] |
| | | salesLedgerId: "", |
| | | customerId: "", |
| | | invoiceNo: "", |
| | | invoiceTotal: "", |
| | | taxRate: "", |
| | | invoicePerson: "", |
| | | invoiceDate: "", |
| | | customerName: "", |
| | | fileList: [], |
| | | }, |
| | | rules: { |
| | | salesLedgerId: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | |
| | | invoicePerson: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | invoiceDate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | customerName: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | | const currentId = ref('') |
| | | const userStore = useUserStore() |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | const { form: searchForm, resetForm } = useFormData(data.searchForm); |
| | | const currentId = ref(""); |
| | | const userStore = useUserStore(); |
| | | const upload = reactive({ |
| | | // ä¸ä¼ çå°å |
| | | url: import.meta.env.VITE_APP_BASE_API + "/invoiceLedger/uploadFile", |
| | | // 设置ä¸ä¼ ç请æ±å¤´é¨ |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | }) |
| | | const matchFileType = ref(['pdf']) |
| | | const uploadModal = ref(false) |
| | | }); |
| | | const matchFileType = ref(["pdf"]); |
| | | const uploadModal = ref(false); |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | }; |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | registrationProductPage({...searchForm.value, ...page}).then(res => { |
| | | tableLoading.value = false |
| | | tableLoading.value = true; |
| | | const { invoiceDate, ...rest } = searchForm; |
| | | registrationProductPage({ ...rest, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | total.value = res.data.total; |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection |
| | | } |
| | | selectedRows.value = selection; |
| | | }; |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['invoiceTotal'], { |
| | | return proxy.summarizeTable(param, ["invoiceTotal"], { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | }); |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (row) => { |
| | | form.value = {} |
| | | productData.value = [] |
| | | fileList.value = [] |
| | | form.value = {}; |
| | | productData.value = []; |
| | | fileList.value = []; |
| | | currentId.value = row.id; |
| | | |
| | | invoiceLedgerProductInfo({id: row.id}).then(res => { |
| | | form.value = {...res.data} |
| | | invoiceLedgerProductInfo({ id: row.id }).then((res) => { |
| | | form.value = { ...res.data }; |
| | | fileList.value = res.data.fileList; |
| | | if(!form.value.invoicePerson){ |
| | | form.value.invoicePerson = userStore.nickName |
| | | form.value.invoicePerson = userStore.nickName; |
| | | form.value.entryDate = getCurrentDate(); |
| | | } |
| | | if(!form.value.invoiceDate){ |
| | | form.value.invoiceDate = getCurrentDate(); |
| | | } |
| | | }) |
| | | dialogFormVisible.value = true |
| | | } |
| | | }); |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // ä¸ä¼ å¤ä¸ªæä»¶å°±è¦ç忥ç |
| | | const handleExceed = (files) => { |
| | | proxy.$refs["fileUpload"].clearFiles(); |
| | |
| | | }; |
| | | // ä¸ä¼ åæ ¡æ£ |
| | | function handleBeforeUpload(file) { |
| | | console.log('file',file) |
| | | console.log("file", file); |
| | | // æ ¡æ£æä»¶å¤§å° |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | proxy.$modal.msgError('ä¸ä¼ æä»¶å¤§å°ä¸è½è¶
è¿10MB!') |
| | | return false |
| | | proxy.$modal.msgError("ä¸ä¼ æä»¶å¤§å°ä¸è½è¶
è¿10MB!"); |
| | | return false; |
| | | } |
| | | // 夿æä»¶æ ¼å¼æ¯å¦ç¬¦å |
| | | const fileType = file.name.split('.').pop().toLowerCase(); |
| | | const fileType = file.name.split(".").pop().toLowerCase(); |
| | | if(!matchFileType.value.includes(fileType)) { |
| | | proxy.$modal.msgError('æä»¶æ ¼å¼ä¸å¹é
') |
| | | return false |
| | | proxy.$modal.msgError("æä»¶æ ¼å¼ä¸å¹é
"); |
| | | return false; |
| | | } |
| | | proxy.$modal.loading("æ£å¨ä¸ä¼ æä»¶ï¼è¯·ç¨å...") |
| | | return true |
| | | proxy.$modal.loading("æ£å¨ä¸ä¼ æä»¶ï¼è¯·ç¨å..."); |
| | | return true; |
| | | } |
| | | // ä¸ä¼ 失败 |
| | | function handleUploadError(err) { |
| | | proxy.$modal.msgError("ä¸ä¼ æä»¶å¤±è´¥") |
| | | proxy.$modal.closeLoading() |
| | | proxy.$modal.msgError("ä¸ä¼ æä»¶å¤±è´¥"); |
| | | proxy.$modal.closeLoading(); |
| | | } |
| | | // ä¸ä¼ æååè° |
| | | function handleUploadSuccess(res, file, uploadFiles) { |
| | | proxy.$modal.closeLoading() |
| | | proxy.$modal.closeLoading(); |
| | | if (res.code === 200) { |
| | | proxy.$refs["fileUpload"].handleRemove(file) |
| | | fileList.value.push(res.data) |
| | | proxy.$modal.msgSuccess("ä¸ä¼ æå") |
| | | proxy.$refs["fileUpload"].handleRemove(file); |
| | | fileList.value.push(res.data); |
| | | proxy.$modal.msgSuccess("ä¸ä¼ æå"); |
| | | } else { |
| | | proxy.$modal.msgError(res.msg) |
| | | proxy.$refs.fileUpload.handleRemove(file) |
| | | proxy.$modal.msgError(res.msg); |
| | | proxy.$refs.fileUpload.handleRemove(file); |
| | | } |
| | | } |
| | | // ç§»é¤æä»¶ |
| | | function handleRemove (file) { |
| | | let index = fileList.value.findIndex(item => item.url === file.url) |
| | | let index = fileList.value.findIndex((item) => item.url === file.url); |
| | | if(index > -1) { |
| | | fileList.value.splice(index, 1) |
| | | fileList.value.splice(index, 1); |
| | | } |
| | | } |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | form.value.fileList = fileList.value; |
| | | invoiceLedgerSaveOrUpdate(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | }) |
| | | invoiceLedgerSaveOrUpdate(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("/invoiceLedger/export", {}, 'å¼ç¥¨å°è´¦.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | } |
| | | .then(() => { |
| | | proxy.download("/invoiceLedger/export", {}, "å¼ç¥¨å°è´¦.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // æå¼éä»¶ä¸ä¼ å¼¹çª |
| | | const handleDownload = (val) => { |
| | | fileList.value = [] |
| | | uploadModal.value = true |
| | | currentId.value = val.id |
| | | } |
| | | fileList.value = []; |
| | | uploadModal.value = true; |
| | | currentId.value = val.id; |
| | | }; |
| | | |
| | | // 确认æä»¶ä¸ä¼ |
| | | const commiInvoicetFile = () => { |
| | | const object = { |
| | | fileList: fileList.value, |
| | | id: currentId.value, |
| | | } |
| | | commitFile(object).then(res => { |
| | | }; |
| | | commitFile(object).then((res) => { |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | uploadModal.value = false |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | uploadModal.value = false; |
| | | } |
| | | getList(); |
| | | currentId.value = '' |
| | | fileList.value = [] |
| | | }) |
| | | } |
| | | currentId.value = ""; |
| | | fileList.value = []; |
| | | }); |
| | | }; |
| | | // å é¤å¼ç¥¨å°è´¦ |
| | | const delInvoiceLedger = (row) => { |
| | | ElMessageBox.confirm( |
| | | '该å票å°è´¦å°è¢«å é¤,æ¯å¦ç¡®è®¤å é¤', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | delInvoiceLedgerByRegProductId(row.id).then(res => { |
| | | getList() |
| | | ElMessageBox.confirm("该å票å°è´¦å°è¢«å é¤,æ¯å¦ç¡®è®¤å é¤", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | .then(() => { |
| | | delInvoiceLedgerByRegProductId(row.id).then((res) => { |
| | | getList(); |
| | | }); |
| | | }) |
| | | } |
| | | .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}`; |
| | | } |
| | | const changeDateRange = (date) => { |
| | | if (date) { |
| | | searchForm.invoiceDateStart = date[0]; |
| | | searchForm.invoiceDateEnd = date[1]; |
| | | getList(); |
| | | } |
| | | }; |
| | | |
| | | getList() |
| | | const clearRange = () => { |
| | | searchForm.invoiceDate = []; |
| | | searchForm.invoiceDateStart = undefined; |
| | | searchForm.invoiceDateEnd = undefined; |
| | | getList(); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | .table_list { |
| | | margin-top: unset; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">å¼ç¥¨ç»è®°ï¼</span> |
| | | <el-form :inline="true" :model="searchForm"> |
| | | <el-form-item label="å¼ç¥¨ç»è®°"> |
| | | <el-input |
| | | v-model="searchForm.customerName" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥åç§°æç´¢" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" |
| | | @change="handleQuery" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm">æ°å¢ç»è®°</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item label="æªå¼ç¥¨é颿¯å¦ä¸º0"> |
| | | <el-select v-model="searchForm.status" style="width: 90px" clearable> |
| | | <el-option label="å¦" :value="0" /> |
| | | <el-option label="æ¯" :value="1" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="客æ·ååå·"> |
| | | <el-input |
| | | v-model="searchForm.customerContractNo" |
| | | placeholder="请è¾å
¥å®¢æ·ååå·" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="项ç®åç§°"> |
| | | <el-input |
| | | v-model="searchForm.projectName" |
| | | placeholder="请è¾å
¥é¡¹ç®åç§°" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery"> æç´¢ </el-button> |
| | | <el-button @click="resetForm"> éç½® </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" border v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | <el-button type="primary" @click="openForm" style="margin-bottom: 8px"> |
| | | æ°å¢ç»è®° |
| | | </el-button> |
| | | <el-table |
| | | :data="tableData" |
| | | :border="true" |
| | | height="calc(100vh - 21em)" |
| | | v-loading="tableLoading" |
| | | :expand-row-keys="expandedRowKeys" |
| | | :row-key="row => row.id" |
| | | :row-key="(row) => row.id" |
| | | show-summary |
| | | :summary-method="summarizeMainTable" |
| | | @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 |
| | | <el-table |
| | | :data="props.row.children" |
| | | border |
| | | show-summary |
| | | :summary-method="summarizeChildrenTable"> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | :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="70" /> |
| | | <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="invoiceNum" :formatter="formattedNumber" /> |
| | | <el-table-column label="å¼ç¥¨éé¢(å
)" prop="invoiceAmount" :formatter="formattedNumber" /> |
| | | <el-table-column label="æªå¼ç¥¨æ°" prop="noInvoiceNum" :formatter="formattedNumber" /> |
| | | <el-table-column label="æªå¼ç¥¨éé¢(å
)" prop="noInvoiceAmount" :formatter="formattedNumber"/> |
| | | <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="invoiceNum" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å¼ç¥¨éé¢(å
)" |
| | | prop="invoiceAmount" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="æªå¼ç¥¨æ°" |
| | | prop="noInvoiceNum" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="æªå¼ç¥¨éé¢(å
)" |
| | | prop="noInvoiceAmount" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="éå®ååå·" prop="salesContractNo" show-overflow-tooltip/> |
| | | <el-table-column label="客æ·ååå·" prop="customerContractNo" show-overflow-tooltip/> |
| | | <el-table-column label="客æ·åç§°" prop="customerName" show-overflow-tooltip/> |
| | | <el-table-column |
| | | label="éå®ååå·" |
| | | prop="salesContractNo" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="客æ·ååå·" |
| | | prop="customerContractNo" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="客æ·åç§°" |
| | | prop="customerName" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column label="ä¸å¡å" prop="salesman" 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="invoiceTotal" show-overflow-tooltip :formatter="formattedNumber"/> |
| | | <el-table-column label="æªå¼ç¥¨éé¢(å
)" prop="noInvoiceAmountTotal" show-overflow-tooltip :formatter="formattedNumber"/> |
| | | <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="invoiceTotal" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="æªå¼ç¥¨éé¢(å
)" show-overflow-tooltip> |
| | | <template #default="{ row, column }"> |
| | | <el-text type="danger"> |
| | | {{ formattedNumber(row, column, row.noInvoiceAmountTotal) }} |
| | | </el-text> |
| | | </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" /> |
| | | <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="æ°å¢å¼ç¥¨ç»è®°é¡µé¢" width="85%" @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | title="æ°å¢å¼ç¥¨ç»è®°é¡µé¢" |
| | | width="85%" |
| | | @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="salesContractNo"> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="客æ·åç§°ï¼" prop="customerName"> |
| | | <el-input v-model="form.customerName" placeholder="èªå¨å¡«å
" disabled></el-input> |
| | | <el-input |
| | | v-model="form.customerName" |
| | | placeholder="èªå¨å¡«å
" |
| | | disabled |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸å¡åï¼" prop="salesman"> |
| | | <el-input v-model="form.salesman" placeholder="èªå¨å¡«å
" disabled/> |
| | | <el-input |
| | | v-model="form.salesman" |
| | | placeholder="èªå¨å¡«å
" |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="项ç®åç§°ï¼" prop="projectName"> |
| | | <el-input v-model="form.projectName" placeholder="èªå¨å¡«å
" disabled/> |
| | | <el-input |
| | | v-model="form.projectName" |
| | | placeholder="èªå¨å¡«å
" |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-form-item label="产åä¿¡æ¯ï¼" prop="entryDate"> |
| | | </el-form-item> |
| | | <el-form-item label="产åä¿¡æ¯ï¼" prop="entryDate"> </el-form-item> |
| | | </el-row> |
| | | <el-table :data="productData" border show-summary :summary-method="summarizeChildrenTable"> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table |
| | | :data="productData" |
| | | 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" width="70" /> |
| | | <el-table-column label="ç¨ç" prop="taxRate" width="70" /> |
| | | <el-table-column label="å«ç¨åä»·(å
)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="å«ç¨æ»ä»·(å
)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="ä¸å«ç¨æ»ä»·(å
)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" width="150" /> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" |
| | | /> |
| | | <el-table-column label="æ¬æ¬¡å¼ç¥¨æ°" prop="currentInvoiceNum"> |
| | | <template #default="scope"> |
| | | <el-input type="number" :step="0.1" min="0" v-model="scope.row.currentInvoiceNum" @blur="invoiceNumBlur(scope.row)"></el-input> |
| | | <el-input |
| | | type="number" |
| | | :step="0.1" |
| | | min="0" |
| | | v-model="scope.row.currentInvoiceNum" |
| | | @blur="invoiceNumBlur(scope.row)" |
| | | ></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æ¬æ¬¡å¼ç¥¨éé¢(å
)" prop="currentInvoiceAmount" width="150"> |
| | | <el-table-column |
| | | label="æ¬æ¬¡å¼ç¥¨éé¢(å
)" |
| | | prop="currentInvoiceAmount" |
| | | width="150" |
| | | > |
| | | <template #default="scope"> |
| | | <el-input type="number" :step="0.01" min="0" v-model="scope.row.currentInvoiceAmount" @blur="invoiceAmountBlur(scope.row)" ></el-input> |
| | | <el-input |
| | | type="number" |
| | | :step="0.01" |
| | | min="0" |
| | | v-model="scope.row.currentInvoiceAmount" |
| | | @blur="invoiceAmountBlur(scope.row)" |
| | | ></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æªå¼ç¥¨æ°" prop="noInvoiceNum" > |
| | | <template #default="scope"> |
| | | <el-input type="number" min="0" disabled v-model="scope.row.noInvoiceNum"></el-input> |
| | | <el-input |
| | | type="number" |
| | | min="0" |
| | | disabled |
| | | v-model="scope.row.noInvoiceNum" |
| | | ></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æªå¼ç¥¨éé¢(å
)" prop="noInvoiceAmount" width="150" > |
| | | <el-table-column |
| | | label="æªå¼ç¥¨éé¢(å
)" |
| | | prop="noInvoiceAmount" |
| | | width="150" |
| | | > |
| | | <template #default="scope"> |
| | | <el-input type="number" min="0" disabled v-model="scope.row.noInvoiceAmount" :precision="2" :step="0.01"></el-input> |
| | | <el-input |
| | | type="number" |
| | | min="0" |
| | | disabled |
| | | v-model="scope.row.noInvoiceAmount" |
| | | :precision="2" |
| | | :step="0.01" |
| | | ></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { ref } from 'vue' |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ref } from "vue"; |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {ElMessageBox } from "element-plus"; |
| | | // import {userListNoPage} from "@/api/system/user.js"; |
| | |
| | | ledgerListPage, |
| | | productList, |
| | | } from "@/api/salesManagement/salesLedger.js"; |
| | | import { |
| | | invoiceRegistrationSave, |
| | | } from "@/api/salesManagement/invoiceRegistration.js"; |
| | | const { proxy } = getCurrentInstance() |
| | | const tableData = ref([]) |
| | | const productData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const tableLoading = ref(false) |
| | | import { invoiceRegistrationSave } from "@/api/salesManagement/invoiceRegistration.js"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const productData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | 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: "", |
| | | status: 0, |
| | | customerContractNo: undefined, // 客æ·ååå· |
| | | projectName: undefined, // 项ç®åç§° |
| | | }, |
| | | 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 { form, rules } = toRefs(data); |
| | | const { form: searchForm, resetForm } = useFormData(data.searchForm); |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | if (cellValue == 0) { |
| | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const paginationChange = (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, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | total.value = res.total |
| | | expandedRowKeys.value = [] |
| | | }) |
| | | } |
| | | total.value = res.total; |
| | | expandedRowKeys.value = []; |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | console.log('selection', selection) |
| | | selectedRows.value = selection.filter(item => item.salesContractNo !== undefined); |
| | | } |
| | | const expandedRowKeys = ref([]) |
| | | console.log("selection", selection); |
| | | selectedRows.value = selection.filter( |
| | | (item) => item.salesContractNo !== undefined |
| | | ); |
| | | }; |
| | | const expandedRowKeys = ref([]); |
| | | // å±å¼è¡ |
| | | const expandChange = (row, expandedRows) => { |
| | | if (expandedRows.length > 0) { |
| | | expandedRowKeys.value = [] |
| | | expandedRowKeys.value = []; |
| | | try { |
| | | productList({salesLedgerId: row.id, |
| | | type: 1 }).then(res => { |
| | | const index = tableData.value.findIndex(item => item.id === row.id); |
| | | productList({ salesLedgerId: row.id, type: 1 }).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) |
| | | }) |
| | | expandedRowKeys.value.push(row.id); |
| | | }); |
| | | } catch (error) { |
| | | console.log(error) |
| | | console.log(error); |
| | | } |
| | | } else { |
| | | expandedRowKeys.value = [] |
| | | expandedRowKeys.value = []; |
| | | } |
| | | } |
| | | }; |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['contractAmount','noInvoiceAmountTotal','invoiceTotal']); |
| | | return proxy.summarizeTable(param, [ |
| | | "contractAmount", |
| | | "noInvoiceAmountTotal", |
| | | "invoiceTotal", |
| | | ]); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeChildrenTable = (param) => { |
| | | return proxy.summarizeTable(param, ['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice','invoiceNum','invoiceAmount','noInvoiceNum','noInvoiceAmount']); |
| | | } |
| | | return proxy.summarizeTable(param, [ |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | "invoiceNum", |
| | | "invoiceAmount", |
| | | "currentInvoiceAmount", |
| | | "noInvoiceNum", |
| | | "noInvoiceAmount", |
| | | ]); |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = () => { |
| | | // 夿æ¯å¦å¤é |
| | | if(selectedRows.value.length != 1) { |
| | | proxy.$modal.msgError("è¯·éæ©ä¸æ¡åå") |
| | | proxy.$modal.msgError("è¯·éæ©ä¸æ¡åå"); |
| | | return; |
| | | } |
| | | form.value = {} |
| | | productData.value = [] |
| | | getSalesLedgerWithProducts({id: selectedRows.value[0].id}).then(res => { |
| | | form.value = {...res} |
| | | productData.value = form.value.productData.map(item => { |
| | | return item |
| | | }) |
| | | dialogFormVisible.value = true |
| | | console.log('productData.value ',productData.value ) |
| | | }) |
| | | |
| | | } |
| | | form.value = {}; |
| | | productData.value = []; |
| | | getSalesLedgerWithProducts({ id: selectedRows.value[0].id }).then((res) => { |
| | | form.value = { ...res }; |
| | | productData.value = form.value.productData.map((item) => { |
| | | return item; |
| | | }); |
| | | dialogFormVisible.value = true; |
| | | console.log("productData.value ", productData.value); |
| | | }); |
| | | }; |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | form.value.productData = proxy.HaveJson(productData.value) |
| | | invoiceRegistrationSave(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | }) |
| | | form.value.productData = proxy.HaveJson(productData.value); |
| | | invoiceRegistrationSave(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("/invoiceRegistration/export", {}, 'å¼ç¥¨ç»è®°ä¿¡æ¯.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已忶") |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | } |
| | | .then(() => { |
| | | proxy.download("/invoiceRegistration/export", {}, "å¼ç¥¨ç»è®°ä¿¡æ¯.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | //æ¬æ¬¡å¼ç¥¨å¤±ç¦æä½ |
| | | const invoiceNumBlur = (row) => { |
| | | if(!row.currentInvoiceNum){ |
| | | row.currentInvoiceNum = 0 |
| | | row.currentInvoiceNum = 0; |
| | | } |
| | | if(row.currentInvoiceNum > row.tempNoInvoiceNum){ |
| | | proxy.$modal.msgWarning('æ¬æ¬¡å¼ç¥¨æ°ä¸å¾å¤§äºæªå¼ç¥¨æ°') |
| | | row.currentInvoiceNum = 0 |
| | | proxy.$modal.msgWarning("æ¬æ¬¡å¼ç¥¨æ°ä¸å¾å¤§äºæªå¼ç¥¨æ°"); |
| | | row.currentInvoiceNum = 0; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡å¼ç¥¨éé¢ |
| | | row.currentInvoiceAmount = (row.currentInvoiceNum * row.taxInclusiveUnitPrice).toFixed(2) |
| | | row.currentInvoiceAmount = ( |
| | | row.currentInvoiceNum * row.taxInclusiveUnitPrice |
| | | ).toFixed(2); |
| | | // è®¡ç®æªå¼ç¥¨æ° |
| | | row.noInvoiceNum = (row.originalNoInvoiceNum - row.currentInvoiceNum).toFixed(2) |
| | | row.noInvoiceNum = (row.originalNoInvoiceNum - row.currentInvoiceNum).toFixed( |
| | | 2 |
| | | ); |
| | | // è®¡ç®æªå¼ç¥¨éé¢ |
| | | row.noInvoiceAmount = (row.tempnoInvoiceAmount - row.currentInvoiceAmount).toFixed(2) |
| | | } |
| | | row.noInvoiceAmount = ( |
| | | row.tempnoInvoiceAmount - row.currentInvoiceAmount |
| | | ).toFixed(2); |
| | | }; |
| | | // æ¬æ¬¡å¼ç¥¨éé¢å¤±ç¦æä½ |
| | | const invoiceAmountBlur = (row) => { |
| | | if(!row.currentInvoiceAmount){ |
| | | row.currentInvoiceAmount = 0 |
| | | row.currentInvoiceAmount = 0; |
| | | } |
| | | // è®¡ç®æ¯å¦è¶
è¿å¼ç¥¨æ»éé¢ |
| | | if(row.currentInvoiceAmount > row.tempnoInvoiceAmount){ |
| | | proxy.$modal.msgWarning('æ¬æ¬¡å¼ç¥¨éé¢ä¸å¾å¤§äºæªå¼ç¥¨éé¢') |
| | | row.currentInvoiceAmount = 0 |
| | | proxy.$modal.msgWarning("æ¬æ¬¡å¼ç¥¨éé¢ä¸å¾å¤§äºæªå¼ç¥¨éé¢"); |
| | | row.currentInvoiceAmount = 0; |
| | | } |
| | | // è®¡ç®æ¬æ¬¡å¼ç¥¨æ° |
| | | row.currentInvoiceNum = (row.currentInvoiceAmount / row.taxInclusiveUnitPrice).toFixed(2) |
| | | console.log('row.currentInvoiceNum ',row.currentInvoiceNum ) |
| | | console.log(' row.originalNoInvoiceNum ', row.originalNoInvoiceNum ) |
| | | row.currentInvoiceNum = ( |
| | | row.currentInvoiceAmount / row.taxInclusiveUnitPrice |
| | | ).toFixed(2); |
| | | console.log("row.currentInvoiceNum ", row.currentInvoiceNum); |
| | | console.log(" row.originalNoInvoiceNum ", row.originalNoInvoiceNum); |
| | | // è®¡ç®æªå¼ç¥¨æ° |
| | | row.noInvoiceNum = (row.originalNoInvoiceNum - row.currentInvoiceNum).toFixed(2) |
| | | row.noInvoiceNum = (row.originalNoInvoiceNum - row.currentInvoiceNum).toFixed( |
| | | 2 |
| | | ); |
| | | // è®¡ç®æªå¼ç¥¨éé¢ |
| | | row.noInvoiceAmount = (row.tempnoInvoiceAmount - row.currentInvoiceAmount).toFixed(2) |
| | | } |
| | | row.noInvoiceAmount = ( |
| | | row.tempnoInvoiceAmount - row.currentInvoiceAmount |
| | | ).toFixed(2); |
| | | }; |
| | | |
| | | getList() |
| | | getList(); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | .table_list { |
| | | margin-top: unset; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">忬¾ç»è®°ï¼</span> |
| | | <el-form :inline="true" :model="searchForm" style="width: 100%"> |
| | | <el-row justify="space-between"> |
| | | <el-col :span="20"> |
| | | <el-form-item label="忬¾ç»è®°"> |
| | | <el-input |
| | | v-model="searchForm.searchText" |
| | | style="width: 240px" |
| | | placeholder="è¾å
¥å®¢æ·åç§°/ååå·æç´¢" |
| | | @change="handleQuery" |
| | | clearable |
| | | prefix-icon="Search" |
| | | @change="handleQuery" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">æ°å¢å款</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item label="䏿¾ç¤ºå¾
忬¾"> |
| | | <el-checkbox |
| | | v-model="searchForm.status" |
| | | :label="0" |
| | | @change="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery"> æç´¢ </el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item style="float: right; margin-right: unset"> |
| | | <el-button type="primary" @click="openForm('add')"> |
| | | æ°å¢å款 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" border v-loading="tableLoading" |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | :row-key="row => row.id" |
| | | :row-key="(row) => row.id" |
| | | show-summary |
| | | :summary-method="summarizeMainTable" |
| | | :expand-row-keys="expandedRowKeys" |
| | | @expand-change="expandChange" |
| | | height="calc(100vh - 18.5em)"> |
| | | 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 |
| | | <el-table |
| | | :data="props.row.children" |
| | | border |
| | | show-summary |
| | | :summary-method="summarizeChildrenTable"> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | :summary-method="summarizeChildrenTable" |
| | | > |
| | | <el-table-column |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | <el-table-column label="忬¾æ¥æ" prop="receiptPaymentDate" /> |
| | | <el-table-column label="忬¾éé¢" prop="receiptPaymentAmount"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.receiptPaymentAmount" :disabled="!scope.row.editType"></el-input> |
| | | <el-input |
| | | v-model="scope.row.receiptPaymentAmount" |
| | | :disabled="!scope.row.editType" |
| | | ></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="忬¾æ¹å¼" prop="receiptPaymentType" > |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.receiptPaymentType" placeholder="è¯·éæ©" clearable :disabled="!scope.row.editType"> |
| | | <el-option v-for="item in receipt_payment_type" :key="item.value" :label="item.label" :value="item.value"/> |
| | | <el-select |
| | | v-model="scope.row.receiptPaymentType" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | :disabled="!scope.row.editType" |
| | | > |
| | | <el-option |
| | | v-for="item in receipt_payment_type" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <el-table-column label="ç»è®°æ¥æ" prop="createTime" /> |
| | | <el-table-column label="æä½" width="150"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="changeEditType(scope.row)" v-if="!scope.row.editType">ç¼è¾</el-button> |
| | | <el-button link type="primary" size="small" @click="saveReceiptPayment(scope.row)" v-if="scope.row.editType">ä¿å</el-button> |
| | | <el-button link type="primary" size="small" @click="delReceiptRecord(scope.row)">å é¤</el-button> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="changeEditType(scope.row)" |
| | | v-if="!scope.row.editType" |
| | | >ç¼è¾</el-button |
| | | > |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="saveReceiptPayment(scope.row)" |
| | | v-if="scope.row.editType" |
| | | >ä¿å</el-button |
| | | > |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="delReceiptRecord(scope.row)" |
| | | >å é¤</el-button |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="éå®ååå·" prop="salesContractNo" show-overflow-tooltip/> |
| | | <el-table-column label="客æ·ååå·" prop="customerContractNo" show-overflow-tooltip/> |
| | | <el-table-column label="客æ·åç§°" prop="customerName" show-overflow-tooltip/> |
| | | <el-table-column label="产å大类" prop="productCategory" show-overflow-tooltip/> |
| | | <el-table-column label="å票å·" prop="invoiceNo" show-overflow-tooltip/> |
| | | <el-table-column label="å票éé¢(å
)" prop="invoiceTotal" show-overflow-tooltip :formatter="formattedNumber"/> |
| | | <el-table-column |
| | | label="éå®ååå·" |
| | | prop="salesContractNo" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="客æ·ååå·" |
| | | prop="customerContractNo" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="客æ·åç§°" |
| | | prop="customerName" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="项ç®åç§°" |
| | | prop="customerName" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="产å大类" |
| | | prop="productCategory" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="å票å·" |
| | | prop="invoiceNo" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="å票éé¢(å
)" |
| | | prop="invoiceTotal" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="ç¨ç" prop="taxRate" show-overflow-tooltip/> |
| | | <el-table-column label="忬¾éé¢(å
)" prop="receiptPaymentAmountTotal" show-overflow-tooltip :formatter="formattedNumber"/> |
| | | <el-table-column label="å¾
忬¾éé¢(å
)" prop="noReceiptAmount" show-overflow-tooltip :formatter="formattedNumber"/> |
| | | <el-table-column |
| | | label="忬¾éé¢(å
)" |
| | | prop="receiptPaymentAmountTotal" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="å¾
忬¾éé¢(å
)" |
| | | prop="noReceiptAmount" |
| | | show-overflow-tooltip |
| | | > |
| | | <template #default="{ row, column }"> |
| | | <el-text type="danger"> |
| | | {{ formattedNumber(row, column, row.noReceiptAmount) }} |
| | | </el-text> |
| | | </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" /> |
| | | <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="æ°å¢å票å·é¡µé¢" width="70%" @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | title="æ°å¢å票å·é¡µé¢" |
| | | 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="salesContractNo"> |
| | | <el-input v-model="form.salesContractNo" placeholder="èªå¨å¡«å
" disabled /> |
| | | <el-input |
| | | v-model="form.salesContractNo" |
| | | placeholder="èªå¨å¡«å
" |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="客æ·åç§°ï¼" prop="customerName"> |
| | | <el-input v-model="form.customerName" placeholder="èªå¨å¡«å
" disabled /> |
| | | <el-input |
| | | v-model="form.customerName" |
| | | placeholder="èªå¨å¡«å
" |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票å·ï¼" prop="invoiceNo"> |
| | | <el-input v-model="form.invoiceNo" placeholder="èªå¨å¡«å
" disabled/> |
| | | <el-input |
| | | v-model="form.invoiceNo" |
| | | placeholder="èªå¨å¡«å
" |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å票éé¢(å
)ï¼" prop="invoiceTotal"> |
| | | <el-input type="number" v-model="form.invoiceTotal" placeholder="èªå¨å¡«å
" :step="0.01" disabled/> |
| | | <el-input |
| | | type="number" |
| | | v-model="form.invoiceTotal" |
| | | placeholder="èªå¨å¡«å
" |
| | | :step="0.01" |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç¨çï¼" prop="taxRate"> |
| | | <el-input type="number" v-model="form.taxRate" placeholder="èªå¨å¡«å
" :step="0.01" disabled/> |
| | | <el-input |
| | | type="number" |
| | | v-model="form.taxRate" |
| | | placeholder="èªå¨å¡«å
" |
| | | :step="0.01" |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¬æ¬¡å款éé¢ï¼" prop="receiptPaymentAmount"> |
| | | <el-input type="number" min="0" v-model="form.receiptPaymentAmount" placeholder="请è¾å
¥" :step="0.01" clearable/> |
| | | <el-input |
| | | type="number" |
| | | min="0" |
| | | v-model="form.receiptPaymentAmount" |
| | | placeholder="请è¾å
¥" |
| | | :step="0.01" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="忬¾å½¢å¼ï¼" prop="receiptPaymentType"> |
| | | <el-select v-model="form.receiptPaymentType" placeholder="è¯·éæ©" clearable> |
| | | <el-option v-for="item in receipt_payment_type" :key="item.value" :label="item.label" :value="item.value"/> |
| | | <el-select |
| | | v-model="form.receiptPaymentType" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in receipt_payment_type" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»è®°äººï¼" prop="registrant"> |
| | | <el-input v-model="form.registrant" placeholder="请è¾å
¥" clearable disabled/> |
| | | <el-input |
| | | v-model="form.registrant" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { ref } from 'vue' |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { ref } from "vue"; |
| | | import { |
| | | receiptPaymentSaveOrUpdate, |
| | | bindInvoiceNoRegPage, |
| | | invoiceInfo, |
| | | receiptPaymentHistoryListNoPage, |
| | | receiptPaymentDel |
| | | receiptPaymentDel, |
| | | } from "../../../api/salesManagement/receiptPayment.js"; |
| | | import useUserStore from '@/store/modules/user' |
| | | import { ElMessage,ElMessageBox } from 'element-plus' |
| | | const userStore = useUserStore() |
| | | const { proxy } = getCurrentInstance() |
| | | const tableData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const tableLoading = ref(false) |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | |
| | | const userStore = useUserStore(); |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | const expandedRowKeys = ref([]) |
| | | }); |
| | | const total = ref(0); |
| | | const expandedRowKeys = ref([]); |
| | | |
| | | // ç¨æ·ä¿¡æ¯è¡¨åå¼¹æ¡æ°æ® |
| | | const dialogFormVisible = ref(false) |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | searchText: '', |
| | | searchText: "", |
| | | status: false, |
| | | }, |
| | | form: { |
| | | salesContractNo: '', |
| | | customerName: '', |
| | | invoiceNo: '', |
| | | invoiceTotal: '', |
| | | taxRate: '', |
| | | receiptPaymentAmount: '', |
| | | receiptPaymentType: '', |
| | | registrant: '', |
| | | receiptPaymentDate: '' |
| | | salesContractNo: "", |
| | | customerName: "", |
| | | invoiceNo: "", |
| | | invoiceTotal: "", |
| | | taxRate: "", |
| | | receiptPaymentAmount: "", |
| | | receiptPaymentType: "", |
| | | registrant: "", |
| | | receiptPaymentDate: "", |
| | | }, |
| | | rules: { |
| | | salesContractNo: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | |
| | | invoiceNo: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | invoiceTotal: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | taxRate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | receiptPaymentAmount: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | receiptPaymentType: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | receiptPaymentAmount: [ |
| | | { required: true, message: "è¯·éæ©", trigger: "change" }, |
| | | ], |
| | | receiptPaymentType: [ |
| | | { required: true, message: "è¯·éæ©", trigger: "change" }, |
| | | ], |
| | | registrant: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | receiptPaymentDate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | | const { receipt_payment_type } = proxy.useDict("receipt_payment_type") |
| | | receiptPaymentDate: [ |
| | | { required: true, message: "è¯·éæ©", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | const { form: searchForm, resetForm } = useFormData(data.searchForm); |
| | | const { receipt_payment_type } = proxy.useDict("receipt_payment_type"); |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | expandedRowKeys.value = [] |
| | | tableLoading.value = true |
| | | bindInvoiceNoRegPage({...searchForm.value, ...page}).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | total.value = res.data.total |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | expandedRowKeys.value = []; |
| | | tableLoading.value = true; |
| | | bindInvoiceNoRegPage({ ...searchForm, ...page }) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | total.value = res.data.total; |
| | | }) |
| | | } |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | // å±å¼è¡ |
| | | const expandChange = (row, expandedRows) => { |
| | | if (expandedRows.length > 0) { |
| | | expandedRowKeys.value = [] |
| | | expandedRowKeys.value = []; |
| | | try { |
| | | receiptPaymentHistoryListNoPage({invoiceLedgerId: row.id, |
| | | type: 1 }).then(res => { |
| | | const index = tableData.value.findIndex(item => item.id === row.id); |
| | | receiptPaymentHistoryListNoPage({ |
| | | invoiceLedgerId: row.id, |
| | | type: 1, |
| | | }).then((res) => { |
| | | const index = tableData.value.findIndex((item) => item.id === row.id); |
| | | if (index > -1) { |
| | | if(res?.length > 0) { |
| | | res.forEach(item => { |
| | | item.editType = false |
| | | }) |
| | | res.forEach((item) => { |
| | | item.editType = false; |
| | | }); |
| | | } |
| | | tableData.value[index].children = res; |
| | | } |
| | | expandedRowKeys.value.push(row.id) |
| | | }) |
| | | expandedRowKeys.value.push(row.id); |
| | | }); |
| | | } catch (error) { |
| | | console.log(error) |
| | | console.log(error); |
| | | } |
| | | } else { |
| | | expandedRowKeys.value = [] |
| | | expandedRowKeys.value = []; |
| | | } |
| | | } |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | console.log('selection', selection) |
| | | selectedRows.value = selection.filter(item => item.customerContractNo !== null); |
| | | } |
| | | console.log("selection", selection); |
| | | selectedRows.value = selection.filter( |
| | | (item) => item.customerContractNo !== null |
| | | ); |
| | | }; |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['invoiceTotal', 'receiptPaymentAmountTotal', 'noReceiptAmount'], { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | ["invoiceTotal", "receiptPaymentAmountTotal", "noReceiptAmount"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | }); |
| | | } |
| | | ); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeChildrenTable = (param) => { |
| | | return proxy.summarizeTable(param, ['receiptPaymentAmount']); |
| | | } |
| | | return proxy.summarizeTable(param, ["receiptPaymentAmount"]); |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = () => { |
| | | form.value = {} |
| | | form.value = {}; |
| | | if(selectedRows.value.length !== 1) { |
| | | proxy.$modal.msgError("è¯·éæ©ä¸æ¡æ°æ®") |
| | | return |
| | | proxy.$modal.msgError("è¯·éæ©ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | // |
| | | console.log('(selectedRows.value',selectedRows.value) |
| | | console.log("(selectedRows.value", selectedRows.value); |
| | | if(selectedRows.value[0].noReceiptAmount === 0){ |
| | | proxy.$modal.msgError("å¾
忬¾éé¢ä¸º0å
") |
| | | return |
| | | proxy.$modal.msgError("å¾
忬¾éé¢ä¸º0å
"); |
| | | return; |
| | | } |
| | | invoiceInfo({id: selectedRows.value[0].id}).then(res => { |
| | | form.value = {...res.data} |
| | | form.value.invoiceLedgerId = form.value.id |
| | | form.value.id = '' |
| | | form.value.registrant = userStore.nickName |
| | | }) |
| | | dialogFormVisible.value = true |
| | | } |
| | | invoiceInfo({ id: selectedRows.value[0].id }).then((res) => { |
| | | form.value = { ...res.data }; |
| | | form.value.invoiceLedgerId = form.value.id; |
| | | form.value.id = ""; |
| | | form.value.registrant = userStore.nickName; |
| | | }); |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | receiptPaymentSaveOrUpdate(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå") |
| | | closeDia() |
| | | getList() |
| | | }) |
| | | receiptPaymentSaveOrUpdate(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef") |
| | | dialogFormVisible.value = false |
| | | } |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | |
| | | // å é¤åæ¬¾è®°å½ |
| | | const delReceiptRecord = (row) => { |
| | | console.log('row',row) |
| | | console.log("row", row); |
| | | ElMessageBox.confirm("确认å é¤è¯¥è®°å½åï¼", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | |
| | | }) |
| | | .then(async () => { |
| | | try { |
| | | let ids = [] |
| | | ids.push(row.id) |
| | | let ids = []; |
| | | ids.push(row.id); |
| | | await receiptPaymentDel(ids); |
| | | ElMessage.success("å 餿å"); |
| | | getList(); |
| | |
| | | .catch(() => { |
| | | ElMessage.info("已忶å é¤"); |
| | | }); |
| | | |
| | | } |
| | | }; |
| | | |
| | | // ç¼è¾ä¿®æ¹ç¶æ |
| | | const changeEditType = (row) => { |
| | | row.editType = !row.editType |
| | | } |
| | | row.editType = !row.editType; |
| | | }; |
| | | |
| | | // ä¿å忬¾è®°å½ |
| | | const saveReceiptPayment = (row) => { |
| | | let updateData = { |
| | | id:row.id, |
| | | receiptPaymentType: row.receiptPaymentType, |
| | | receiptPaymentAmount: row.receiptPaymentAmount |
| | | } |
| | | receiptPaymentSaveOrUpdate(updateData).then(res => { |
| | | row.editType = !row.editType |
| | | }) |
| | | } |
| | | receiptPaymentAmount: row.receiptPaymentAmount, |
| | | }; |
| | | receiptPaymentSaveOrUpdate(updateData).then((res) => { |
| | | row.editType = !row.editType; |
| | | }); |
| | | }; |
| | | |
| | | getList() |
| | | getList(); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | .table_list { |
| | | margin-top: unset; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">客æ·åç§°ï¼</span> |
| | | <el-input v-model="searchForm.searchText" 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-form :model="searchForm" :inline="true"> |
| | | <el-form-item label="客æ·åç§°"> |
| | | <el-input |
| | | v-model="searchForm.searchText" |
| | | style="width: 240px" |
| | | placeholder="è¾å
¥å®¢æ·åç§°æç´¢" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="忬¾æ¥æ"> |
| | | <el-date-picker |
| | | v-model="searchForm.receiptPaymentDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="daterange" |
| | | start-placeholder="å¼å§æ¶é´" |
| | | end-placeholder="ç»ææ¶é´" |
| | | clearable |
| | | @change="changeDateRange" |
| | | @clear="clearRange" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery"> æç´¢ </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class="table_list"> |
| | | <PIMTable :column="tableColumn" :tableData="tableData" :page="page" :isSelection="true" |
| | | <PIMTable |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :isShowSummary="isShowSummarySon" |
| | | :summaryMethod="summarizeMainTable1" |
| | | :handleSelectionChange="handleSelectionChange" :tableLoading="tableLoading" @pagination="pagination" |
| | | :total="total"></PIMTable> |
| | | :handleSelectionChange="handleSelectionChange" |
| | | :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 { |
| | | receiptPaymentHistoryListPage |
| | | } from "@/api/salesManagement/receiptPayment.js"; |
| | | const { proxy } = getCurrentInstance() |
| | | import { receiptPaymentHistoryListPage } from "@/api/salesManagement/receiptPayment.js"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import dayjs from "dayjs"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: '忬¾æ¥æ', |
| | | prop: 'receiptPaymentDate', |
| | | label: "忬¾æ¥æ", |
| | | prop: "receiptPaymentDate", |
| | | }, |
| | | { |
| | | label: '客æ·åç§°', |
| | | prop: 'customerName', |
| | | label: "客æ·åç§°", |
| | | prop: "customerName", |
| | | }, |
| | | { |
| | | label: '忬¾éé¢', |
| | | prop: 'receiptPaymentAmount', |
| | | label: "忬¾éé¢ï¼å
ï¼", |
| | | prop: "receiptPaymentAmount", |
| | | formatData: (params) => { |
| | | return parseFloat(params).toFixed(2); |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | label: '忬¾æ¹å¼', |
| | | prop: 'receiptPaymentType', |
| | | dataType: 'tag', |
| | | label: "忬¾æ¹å¼", |
| | | prop: "receiptPaymentType", |
| | | dataType: "tag", |
| | | formatData: (params) => { |
| | | if (params == 0) { |
| | | return 'çµæ±'; |
| | | return "çµæ±"; |
| | | } else if (params == 1) { |
| | | return 'æ¿å
'; |
| | | return "æ¿å
"; |
| | | } else { |
| | | return null |
| | | return null; |
| | | } |
| | | }, |
| | | formatType: (params) => { |
| | | return "info" |
| | | } |
| | | return "info"; |
| | | }, |
| | | }, |
| | | { |
| | | label: 'ç»è®°äºº', |
| | | prop: 'registrant' |
| | | label: "ç»è®°äºº", |
| | | prop: "registrant", |
| | | }, |
| | | { |
| | | label: 'ç»è®°æ¥æ', |
| | | prop: 'createTime' |
| | | } |
| | | ]) |
| | | const tableData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const tableLoading = ref(false) |
| | | label: "ç»è®°æ¥æ", |
| | | prop: "createTime", |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | const data = reactive({ |
| | | searchForm: { |
| | | searchText: '', |
| | | }, |
| | | }) |
| | | const { searchForm } = toRefs(data) |
| | | const { receipt_payment_type } = proxy.useDict("receipt_payment_type") |
| | | }); |
| | | const total = ref(0); |
| | | |
| | | const { form: searchForm } = useFormData({ |
| | | searchText: undefined, |
| | | receiptPaymentDate: [ |
| | | dayjs().startOf("month").format("YYYY-MM-DD"), |
| | | dayjs().endOf("month").format("YYYY-MM-DD"), |
| | | ], |
| | | receiptPaymentDateStart: dayjs().startOf("month").format("YYYY-MM-DD"), |
| | | receiptPaymentDateEnd: dayjs().endOf("month").format("YYYY-MM-DD"), |
| | | }); |
| | | const { receipt_payment_type } = proxy.useDict("receipt_payment_type"); |
| | | const isShowSummarySon = ref(true); |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | 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 |
| | | receiptPaymentHistoryListPage({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.records |
| | | total.value = res.total |
| | | }) |
| | | } |
| | | tableLoading.value = true; |
| | | const { receiptPaymentDate, ...rest } = searchForm; |
| | | receiptPaymentHistoryListPage({ ...rest, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | total.value = res.total; |
| | | }); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeMainTable1 = (param) => { |
| | | return proxy.summarizeTable(param, ['receiptPaymentAmount'], { |
| | | return proxy.summarizeTable(param, ["receiptPaymentAmount"], { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | const changeDateRange = (date) => { |
| | | if (date) { |
| | | searchForm.receiptPaymentDateStart = date[0]; |
| | | searchForm.receiptPaymentDateEnd = date[1]; |
| | | getList(); |
| | | } |
| | | getList() |
| | | }; |
| | | |
| | | const clearRange = () => { |
| | | searchForm.receiptPaymentDate = []; |
| | | searchForm.receiptPaymentDateStart = undefined; |
| | | searchForm.receiptPaymentDateEnd = undefined; |
| | | getList(); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| | | <style scoped lang="scss"> |
| | | .table_list { |
| | | margin-top: unset; |
| | | } |
| | | </style> |
| | |
| | | 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 style="display: flex"> |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" border v-loading="tableLoading" |
| | | :row-key="row => row.id" |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | v-loading="tableLoading" |
| | | :row-key="(row) => row.id" |
| | | show-summary |
| | | :summary-method="summarizeMainTable" |
| | | @row-click = "rowClickMethod" |
| | | height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="客æ·åç§°" prop="customerName" show-overflow-tooltip/> |
| | | <el-table-column label="å¼ç¥¨éé¢(å
)" prop="invoiceTotal" 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"/> |
| | | height="calc(100vh - 18.5em)" |
| | | > |
| | | <el-table-column |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | <el-table-column |
| | | label="客æ·åç§°" |
| | | prop="customerName" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="å¼ç¥¨éé¢(å
)" |
| | | prop="invoiceTotal" |
| | | 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 |
| | | > |
| | | <template #default="{ row, column }"> |
| | | <el-text type="danger"> |
| | | {{ formattedNumber(row, column, row.unReceiptPaymentAmount) }} |
| | | </el-text> |
| | | </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" /> |
| | | <pagination |
| | | v-show="total > 0" |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" |
| | | :limit="page.size" |
| | | @pagination="paginationChange" |
| | | /> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table :data="receiptRecord" border |
| | | :row-key="row => row.id" |
| | | <el-table |
| | | :data="receiptRecord" |
| | | border |
| | | :row-key="(row) => row.id" |
| | | show-summary |
| | | :summary-method="summarizeMainTable1" |
| | | height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="åçæ¥æ" prop="happenTime" show-overflow-tooltip/> |
| | | <el-table-column label="å¼ç¥¨éé¢(å
)" prop="invoiceAmount" show-overflow-tooltip :formatter="formattedNumber"/> |
| | | <el-table-column label="忬¾éé¢(å
)" prop="receiptAmount" show-overflow-tooltip :formatter="formattedNumber"/> |
| | | <el-table-column label="åºæ¶éé¢(å
)" prop="unReceiptAmount" show-overflow-tooltip :formatter="formattedNumber"/> |
| | | height="calc(100vh - 18.5em)" |
| | | > |
| | | <el-table-column |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | <el-table-column |
| | | label="åçæ¥æ" |
| | | prop="happenTime" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="å¼ç¥¨éé¢(å
)" |
| | | prop="invoiceAmount" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="忬¾éé¢(å
)" |
| | | prop="receiptAmount" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | label="åºæ¶éé¢(å
)" |
| | | prop="unReceiptAmount" |
| | | show-overflow-tooltip |
| | | > |
| | | <template #default="{ row, column }"> |
| | | <el-text type="danger"> |
| | | {{ formattedNumber(row, column, row.unReceiptAmount) }} |
| | | </el-text> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="recordTotal > 0" :total="recordTotal" layout="total, sizes, prev, pager, next, jumper" :page="recordPage.current" |
| | | :limit="recordPage.size" @pagination="recordPaginationChange" /> |
| | | <pagination |
| | | v-show="recordTotal > 0" |
| | | :total="recordTotal" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="recordPage.current" |
| | | :limit="recordPage.size" |
| | | @pagination="recordPaginationChange" |
| | | /> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue' |
| | | import { |
| | | invoiceLedgerSalesAccount, |
| | | } from "../../../api/salesManagement/invoiceLedger.js"; |
| | | import { |
| | | customerInteractions |
| | | } from "../../../api/salesManagement/receiptPayment.js"; |
| | | import { ref } from "vue"; |
| | | import { invoiceLedgerSalesAccount } from "../../../api/salesManagement/invoiceLedger.js"; |
| | | import { customerInteractions } from "../../../api/salesManagement/receiptPayment.js"; |
| | | import Pagination from "../../../components/PIMTable/Pagination.vue"; |
| | | const { proxy } = getCurrentInstance() |
| | | const tableData = ref([]) |
| | | const receiptRecord = ref([]) |
| | | const tableLoading = ref(false) |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const receiptRecord = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | }); |
| | | const recordPage = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | const recordTotal = ref(0) |
| | | }); |
| | | const total = ref(0); |
| | | const recordTotal = ref(0); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | searchText: '', |
| | | invoiceDate:'' |
| | | } |
| | | }) |
| | | const customerId = ref('') |
| | | const { searchForm } = toRefs(data) |
| | | const originReceiptRecord = ref([]) |
| | | searchText: "", |
| | | invoiceDate: "", |
| | | }, |
| | | }); |
| | | const customerId = ref(""); |
| | | const { searchForm } = toRefs(data); |
| | | const originReceiptRecord = ref([]); |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const paginationChange = (obj) => { |
| | | console.log('paginationChange', current,limit) |
| | | console.log("paginationChange", current, limit); |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | invoiceLedgerSalesAccount({...searchForm.value, ...page}).then(res => { |
| | | tableLoading.value = false |
| | | tableLoading.value = true; |
| | | invoiceLedgerSalesAccount({ ...searchForm.value, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | total.value = res.data.total; |
| | | if(tableData.value.length > 0) { |
| | | recordPage.current = 1 |
| | | customerId.value = tableData.value[0].id |
| | | recordPage.current = 1; |
| | | customerId.value = tableData.value[0].id; |
| | | receiptPaymentList(customerId.value); |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | }; |
| | | // 主表åè®¡æ¹æ³ |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['invoiceTotal', 'receiptPaymentAmount', 'unReceiptPaymentAmount'], { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | ["invoiceTotal", "receiptPaymentAmount", "unReceiptPaymentAmount"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | }); |
| | | } |
| | | ); |
| | | }; |
| | | // å表åè®¡æ¹æ³ |
| | | const summarizeMainTable1 = (param) => { |
| | | var summarizeTable = proxy.summarizeTable(param, ['invoiceAmount', 'receiptAmount'], { |
| | | var summarizeTable = proxy.summarizeTable( |
| | | param, |
| | | ["invoiceAmount", "receiptAmount"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | futureTickets: { noDecimal: true }, // ä¸ä¿çå°æ° |
| | | }); |
| | | console.log('summarizeTable',summarizeTable) |
| | | // åæåä¸è¡æ°æ® |
| | | if(receiptRecord.value?.length > 0) { |
| | | summarizeTable[summarizeTable.length - 1] = receiptRecord.value[receiptRecord.value.length - 1].unReceiptAmount.toFixed(2); |
| | | }else { |
| | | summarizeTable[summarizeTable.length - 1] = 0.00 |
| | | } |
| | | |
| | | return summarizeTable |
| | | ); |
| | | // åæåä¸è¡æ°æ®; |
| | | if (receiptRecord.value?.length > 0) { |
| | | const index = tableData.value.findIndex( |
| | | (item) => item.id == customerId.value |
| | | ); |
| | | summarizeTable[summarizeTable.length - 1] = |
| | | tableData.value[index].unReceiptPaymentAmount.toFixed(2); |
| | | } else { |
| | | summarizeTable[summarizeTable.length - 1] = 0.0; |
| | | } |
| | | // const sb = tableData.findIndex((item) => item.id == customerId.value); |
| | | // console.log(sb); |
| | | return summarizeTable; |
| | | }; |
| | | |
| | | const receiptPaymentList = (id) => { |
| | | const param = { |
| | | customerId:id |
| | | } |
| | | console.log('param', param) |
| | | customerInteractions(param).then(res => { |
| | | customerId: id, |
| | | }; |
| | | console.log("param", param); |
| | | customerInteractions(param).then((res) => { |
| | | originReceiptRecord.value = res.data; |
| | | handlePagination({ page: 1, limit: recordPage.size }); |
| | | recordTotal.value = res.data.length; |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // æ±æ¬¾è®°å½å表å页 |
| | | const recordPaginationChange = (pagination) => { |
| | | handlePagination(pagination); |
| | | } |
| | | }; |
| | | |
| | | const rowClickMethod = (row) => { |
| | | customerId.value = row.id; |
| | | receiptPaymentList(customerId.value); |
| | | } |
| | | }; |
| | | |
| | | const handlePagination = ({ page, limit }) => { |
| | | recordPage.current = page; |
| | |
| | | const end = start + limit; |
| | | |
| | | receiptRecord.value = originReceiptRecord.value.slice(start, end); |
| | | } |
| | | }; |
| | | |
| | | |
| | | getList() |
| | | getList(); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | .table_list { |
| | | width: 50%; |
| | | } |
| | | |
| | | </style> |
| | |
| | | <template>
|
| | | <div class="app-container">
|
| | | <el-row :gutter="20" style="height: calc(100vh - 8em)">
|
| | | <splitpanes :horizontal="appStore.device === 'mobile'" class="default-theme">
|
| | | <splitpanes
|
| | | :horizontal="appStore.device === 'mobile'"
|
| | | class="default-theme"
|
| | | >
|
| | | <!--é¨é¨æ°æ®-->
|
| | | <pane size="16">
|
| | | <el-col style="padding: 10px">
|
| | | <div class="head-container">
|
| | | <el-input v-model="deptName" placeholder="请è¾å
¥é¨é¨åç§°" clearable prefix-icon="Search" style="margin-bottom: 20px" />
|
| | | <el-input
|
| | | v-model="deptName"
|
| | | placeholder="请è¾å
¥é¨é¨åç§°"
|
| | | clearable
|
| | | prefix-icon="Search"
|
| | | style="margin-bottom: 20px"
|
| | | />
|
| | | </div>
|
| | | <div class="head-container">
|
| | | <el-tree :data="deptOptions" :props="{ label: 'label', children: 'children' }" :expand-on-click-node="false" :filter-node-method="filterNode" ref="deptTreeRef" node-key="id" highlight-current default-expand-all @node-click="handleNodeClick" />
|
| | | <el-tree
|
| | | :data="deptOptions"
|
| | | :props="{ label: 'label', children: 'children' }"
|
| | | :expand-on-click-node="false"
|
| | | :filter-node-method="filterNode"
|
| | | ref="deptTreeRef"
|
| | | node-key="id"
|
| | | highlight-current
|
| | | default-expand-all
|
| | | @node-click="handleNodeClick"
|
| | | />
|
| | | </div>
|
| | | </el-col>
|
| | | </pane>
|
| | | <!--ç¨æ·æ°æ®-->
|
| | | <pane size="84">
|
| | | <el-col style="padding: 10px">
|
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
| | | <el-form
|
| | | :model="queryParams"
|
| | | ref="queryRef"
|
| | | :inline="true"
|
| | | v-show="showSearch"
|
| | | label-width="68px"
|
| | | >
|
| | | <el-form-item label="ç»å½è´¦å·" prop="userName">
|
| | | <el-input v-model="queryParams.userName" placeholder="请è¾å
¥ç»å½è´¦å·" clearable style="width: 240px" @keyup.enter="handleQuery" />
|
| | | <el-input
|
| | | v-model="queryParams.userName"
|
| | | placeholder="请è¾å
¥ç»å½è´¦å·"
|
| | | clearable
|
| | | style="width: 240px"
|
| | | @keyup.enter="handleQuery"
|
| | | />
|
| | | </el-form-item>
|
| | | <el-form-item label="ææºå·ç " prop="phonenumber">
|
| | | <el-input v-model="queryParams.phonenumber" placeholder="请è¾å
¥ææºå·ç " clearable style="width: 240px" @keyup.enter="handleQuery" />
|
| | | <el-input
|
| | | v-model="queryParams.phonenumber"
|
| | | placeholder="请è¾å
¥ææºå·ç "
|
| | | clearable
|
| | | style="width: 240px"
|
| | | @keyup.enter="handleQuery"
|
| | | />
|
| | | </el-form-item>
|
| | | <el-form-item label="ç¶æ" prop="status">
|
| | | <el-select v-model="queryParams.status" placeholder="ç¨æ·ç¶æ" clearable style="width: 240px">
|
| | | <el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
| | | <el-select
|
| | | v-model="queryParams.status"
|
| | | placeholder="ç¨æ·ç¶æ"
|
| | | clearable
|
| | | style="width: 240px"
|
| | | >
|
| | | <el-option
|
| | | v-for="dict in sys_normal_disable"
|
| | | :key="dict.value"
|
| | | :label="dict.label"
|
| | | :value="dict.value"
|
| | | />
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | <el-form-item label="å建æ¶é´" style="width: 308px">
|
| | | <el-date-picker v-model="dateRange" value-format="YYYY-MM-DD" type="daterange" range-separator="-" start-placeholder="å¼å§æ¥æ" end-placeholder="ç»ææ¥æ"></el-date-picker>
|
| | | <el-date-picker
|
| | | v-model="dateRange"
|
| | | value-format="YYYY-MM-DD"
|
| | | type="daterange"
|
| | | range-separator="-"
|
| | | start-placeholder="å¼å§æ¥æ"
|
| | | end-placeholder="ç»ææ¥æ"
|
| | | ></el-date-picker>
|
| | | </el-form-item>
|
| | | <el-form-item>
|
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button>
|
| | | <el-button type="primary" icon="Search" @click="handleQuery"
|
| | | >æç´¢</el-button
|
| | | >
|
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button>
|
| | | </el-form-item>
|
| | | </el-form>
|
| | |
|
| | | <el-row :gutter="10" class="mb8">
|
| | | <el-col :span="1.5">
|
| | | <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:user:add']">æ°å¢</el-button>
|
| | | <el-button
|
| | | type="primary"
|
| | | plain
|
| | | icon="Plus"
|
| | | @click="handleAdd"
|
| | | v-hasPermi="['system:user:add']"
|
| | | >æ°å¢</el-button
|
| | | >
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate" v-hasPermi="['system:user:edit']">ä¿®æ¹</el-button>
|
| | | <el-button
|
| | | type="success"
|
| | | plain
|
| | | icon="Edit"
|
| | | :disabled="single"
|
| | | @click="handleUpdate"
|
| | | v-hasPermi="['system:user:edit']"
|
| | | >ä¿®æ¹</el-button
|
| | | >
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:user:remove']">å é¤</el-button>
|
| | | <el-button
|
| | | type="danger"
|
| | | plain
|
| | | icon="Delete"
|
| | | :disabled="multiple"
|
| | | @click="handleDelete"
|
| | | v-hasPermi="['system:user:remove']"
|
| | | >å é¤</el-button
|
| | | >
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:user:import']">导å
¥</el-button>
|
| | | <el-button
|
| | | type="info"
|
| | | plain
|
| | | icon="Upload"
|
| | | @click="handleImport"
|
| | | v-hasPermi="['system:user:import']"
|
| | | >导å
¥</el-button
|
| | | >
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:user:export']">导åº</el-button>
|
| | | <el-button
|
| | | type="warning"
|
| | | plain
|
| | | icon="Download"
|
| | | @click="handleExport"
|
| | | v-hasPermi="['system:user:export']"
|
| | | >导åº</el-button
|
| | | >
|
| | | </el-col>
|
| | | <right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
| | | <right-toolbar
|
| | | v-model:showSearch="showSearch"
|
| | | @queryTable="getList"
|
| | | :columns="columns"
|
| | | ></right-toolbar>
|
| | | </el-row>
|
| | |
|
| | | <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
| | | <el-table
|
| | | v-loading="loading"
|
| | | :data="userList"
|
| | | @selection-change="handleSelectionChange"
|
| | | >
|
| | | <el-table-column type="selection" width="50" align="center" />
|
| | | <el-table-column label="ç¨æ·ç¼å·" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
|
| | | <el-table-column label="ç»å½è´¦å·" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="ç¨æ·æµç§°" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="é¨é¨" align="center" key="deptNames" prop="deptNames" v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="ææºå·ç " align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
|
| | | <el-table-column label="ç¶æ" align="center" key="status" v-if="columns[5].visible">
|
| | | <el-table-column
|
| | | label="ç¨æ·ç¼å·"
|
| | | align="center"
|
| | | key="userId"
|
| | | prop="userId"
|
| | | v-if="columns[0].visible"
|
| | | />
|
| | | <el-table-column
|
| | | label="ç»å½è´¦å·"
|
| | | align="center"
|
| | | key="userName"
|
| | | prop="userName"
|
| | | v-if="columns[1].visible"
|
| | | :show-overflow-tooltip="true"
|
| | | />
|
| | | <el-table-column
|
| | | label="ç¨æ·æµç§°"
|
| | | align="center"
|
| | | key="nickName"
|
| | | prop="nickName"
|
| | | v-if="columns[2].visible"
|
| | | :show-overflow-tooltip="true"
|
| | | />
|
| | | <el-table-column
|
| | | label="é¨é¨"
|
| | | align="center"
|
| | | key="deptNames"
|
| | | prop="deptNames"
|
| | | v-if="columns[3].visible"
|
| | | :show-overflow-tooltip="true"
|
| | | />
|
| | | <el-table-column
|
| | | label="ææºå·ç "
|
| | | align="center"
|
| | | key="phonenumber"
|
| | | prop="phonenumber"
|
| | | v-if="columns[4].visible"
|
| | | width="120"
|
| | | />
|
| | | <el-table-column
|
| | | label="ç¶æ"
|
| | | align="center"
|
| | | key="status"
|
| | | v-if="columns[5].visible"
|
| | | >
|
| | | <template #default="scope">
|
| | | <el-switch
|
| | | v-model="scope.row.status"
|
| | |
| | | ></el-switch>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
| | | <el-table-column
|
| | | label="å建æ¶é´"
|
| | | align="center"
|
| | | prop="createTime"
|
| | | v-if="columns[6].visible"
|
| | | width="160"
|
| | | >
|
| | | <template #default="scope">
|
| | | <span>{{ parseTime(scope.row.createTime) }}</span>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column label="æä½" align="center" width="150" class-name="small-padding fixed-width">
|
| | | <el-table-column
|
| | | label="æä½"
|
| | | align="center"
|
| | | width="150"
|
| | | class-name="small-padding fixed-width"
|
| | | >
|
| | | <template #default="scope">
|
| | | <el-tooltip content="ä¿®æ¹" placement="top" v-if="scope.row.userId !== 1">
|
| | | <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']"></el-button>
|
| | | <el-tooltip
|
| | | content="ä¿®æ¹"
|
| | | placement="top"
|
| | | v-if="scope.row.userId !== 1"
|
| | | >
|
| | | <el-button
|
| | | link
|
| | | type="primary"
|
| | | icon="Edit"
|
| | | @click="handleUpdate(scope.row)"
|
| | | v-hasPermi="['system:user:edit']"
|
| | | ></el-button>
|
| | | </el-tooltip>
|
| | | <el-tooltip content="å é¤" placement="top" v-if="scope.row.userId !== 1">
|
| | | <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']"></el-button>
|
| | | <el-tooltip
|
| | | content="å é¤"
|
| | | placement="top"
|
| | | v-if="scope.row.userId !== 1"
|
| | | >
|
| | | <el-button
|
| | | link
|
| | | type="primary"
|
| | | icon="Delete"
|
| | | @click="handleDelete(scope.row)"
|
| | | v-hasPermi="['system:user:remove']"
|
| | | ></el-button>
|
| | | </el-tooltip>
|
| | | <el-tooltip content="éç½®å¯ç " placement="top" v-if="scope.row.userId !== 1">
|
| | | <el-button link type="primary" icon="Key" @click="handleResetPwd(scope.row)" v-hasPermi="['system:user:resetPwd']"></el-button>
|
| | | <el-tooltip
|
| | | content="éç½®å¯ç "
|
| | | placement="top"
|
| | | v-if="scope.row.userId !== 1"
|
| | | >
|
| | | <el-button
|
| | | link
|
| | | type="primary"
|
| | | icon="Key"
|
| | | @click="handleResetPwd(scope.row)"
|
| | | v-hasPermi="['system:user:resetPwd']"
|
| | | ></el-button>
|
| | | </el-tooltip>
|
| | | <el-tooltip content="åé
è§è²" placement="top" v-if="scope.row.userId !== 1">
|
| | | <el-button link type="primary" icon="CircleCheck" @click="handleAuthRole(scope.row)" v-hasPermi="['system:user:edit']"></el-button>
|
| | | <el-tooltip
|
| | | content="åé
è§è²"
|
| | | placement="top"
|
| | | v-if="scope.row.userId !== 1"
|
| | | >
|
| | | <el-button
|
| | | link
|
| | | type="primary"
|
| | | icon="CircleCheck"
|
| | | @click="handleAuthRole(scope.row)"
|
| | | v-hasPermi="['system:user:edit']"
|
| | | ></el-button>
|
| | | </el-tooltip>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | | <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
| | | <pagination
|
| | | v-show="total > 0"
|
| | | :total="total"
|
| | | v-model:page="queryParams.pageNum"
|
| | | v-model:limit="queryParams.pageSize"
|
| | | @pagination="getList"
|
| | | />
|
| | | </el-col>
|
| | | </pane>
|
| | | </splitpanes>
|
| | |
| | | <el-row>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="ç¨æ·æµç§°" prop="nickName">
|
| | | <el-input v-model="form.nickName" placeholder="请è¾å
¥ç¨æ·æµç§°" maxlength="30" />
|
| | | <el-input
|
| | | v-model="form.nickName"
|
| | | placeholder="请è¾å
¥ç¨æ·æµç§°"
|
| | | maxlength="30"
|
| | | />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | |
| | | :render-after-expand="false"
|
| | | show-checkbox
|
| | | multiple
|
| | | placeholder="è¯·éæ©å½å±å
¬å¸" />
|
| | | placeholder="è¯·éæ©å½å±å
¬å¸"
|
| | | />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | </el-row>
|
| | | <el-row>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="ææºå·ç " prop="phonenumber">
|
| | | <el-input v-model="form.phonenumber" placeholder="请è¾å
¥ææºå·ç " maxlength="11" />
|
| | | <el-input
|
| | | v-model="form.phonenumber"
|
| | | placeholder="请è¾å
¥ææºå·ç "
|
| | | maxlength="11"
|
| | | />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="é®ç®±" prop="email">
|
| | | <el-input v-model="form.email" placeholder="请è¾å
¥é®ç®±" maxlength="50" />
|
| | | <el-input
|
| | | v-model="form.email"
|
| | | placeholder="请è¾å
¥é®ç®±"
|
| | | maxlength="50"
|
| | | />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | </el-row>
|
| | | <el-row>
|
| | | <el-col :span="12">
|
| | | <el-form-item v-if="form.userId == undefined" label="ç»å½è´¦å·" prop="userName">
|
| | | <el-input v-model="form.userName" placeholder="请è¾å
¥ç»å½è´¦å·" maxlength="30" />
|
| | | <el-form-item
|
| | | v-if="form.userId == undefined"
|
| | | label="ç»å½è´¦å·"
|
| | | prop="userName"
|
| | | >
|
| | | <el-input
|
| | | v-model="form.userName"
|
| | | placeholder="请è¾å
¥ç»å½è´¦å·"
|
| | | maxlength="30"
|
| | | />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item v-if="form.userId == undefined" label="ç¨æ·å¯ç " prop="password">
|
| | | <el-input v-model="form.password" placeholder="请è¾å
¥ç¨æ·å¯ç " type="password" maxlength="20" show-password />
|
| | | <el-form-item
|
| | | v-if="form.userId == undefined"
|
| | | label="ç¨æ·å¯ç "
|
| | | prop="password"
|
| | | >
|
| | | <el-input
|
| | | v-model="form.password"
|
| | | placeholder="请è¾å
¥ç¨æ·å¯ç "
|
| | | type="password"
|
| | | maxlength="20"
|
| | | show-password
|
| | | />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | </el-row>
|
| | |
| | | <el-col :span="12">
|
| | | <el-form-item label="ç¨æ·æ§å«">
|
| | | <el-select v-model="form.sex" placeholder="è¯·éæ©">
|
| | | <el-option v-for="dict in sys_user_sex" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
| | | <el-option
|
| | | v-for="dict in sys_user_sex"
|
| | | :key="dict.value"
|
| | | :label="dict.label"
|
| | | :value="dict.value"
|
| | | ></el-option>
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="ç¶æ">
|
| | | <el-radio-group v-model="form.status">
|
| | | <el-radio v-for="dict in sys_normal_disable" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
|
| | | <el-radio
|
| | | v-for="dict in sys_normal_disable"
|
| | | :key="dict.value"
|
| | | :value="dict.value"
|
| | | >{{ dict.label }}</el-radio
|
| | | >
|
| | | </el-radio-group>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | |
| | | <el-col :span="12">
|
| | | <el-form-item label="å²ä½">
|
| | | <el-select v-model="form.postIds" multiple placeholder="è¯·éæ©">
|
| | | <el-option v-for="item in postOptions" :key="item.postId" :label="item.postName" :value="item.postId" :disabled="item.status == 1"></el-option>
|
| | | <el-option
|
| | | v-for="item in postOptions"
|
| | | :key="item.postId"
|
| | | :label="item.postName"
|
| | | :value="item.postId"
|
| | | :disabled="item.status == 1"
|
| | | ></el-option>
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="è§è²">
|
| | | <el-select v-model="form.roleIds" multiple placeholder="è¯·éæ©">
|
| | | <el-option v-for="item in roleOptions" :key="item.roleId" :label="item.roleName" :value="item.roleId" :disabled="item.status == 1"></el-option>
|
| | | <el-option
|
| | | v-for="item in roleOptions"
|
| | | :key="item.roleId"
|
| | | :label="item.roleName"
|
| | | :value="item.roleId"
|
| | | :disabled="item.status == 1"
|
| | | ></el-option>
|
| | | </el-select>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | |
| | | <el-row>
|
| | | <el-col :span="24">
|
| | | <el-form-item label="夿³¨">
|
| | | <el-input v-model="form.remark" type="textarea" placeholder="请è¾å
¥å
容"></el-input>
|
| | | <el-input
|
| | | v-model="form.remark"
|
| | | type="textarea"
|
| | | placeholder="请è¾å
¥å
容"
|
| | | ></el-input>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | </el-row>
|
| | |
| | | </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">
|
| | | <div class="el-upload__tip">
|
| | | <el-checkbox v-model="upload.updateSupport" />æ¯å¦æ´æ°å·²ç»åå¨çç¨æ·æ°æ®
|
| | | <el-checkbox
|
| | | v-model="upload.updateSupport"
|
| | | />æ¯å¦æ´æ°å·²ç»åå¨çç¨æ·æ°æ®
|
| | | </div>
|
| | | <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 name="User">
|
| | | import { getToken } from "@/utils/auth"
|
| | | import useAppStore from '@/store/modules/app'
|
| | | import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect } from "@/api/system/user"
|
| | | import { Splitpanes, Pane } from "splitpanes"
|
| | | import "splitpanes/dist/splitpanes.css"
|
| | | import { getToken } from "@/utils/auth";
|
| | | import useAppStore from "@/store/modules/app";
|
| | | import {
|
| | | changeUserStatus,
|
| | | listUser,
|
| | | resetUserPwd,
|
| | | delUser,
|
| | | getUser,
|
| | | updateUser,
|
| | | addUser,
|
| | | deptTreeSelect,
|
| | | } from "@/api/system/user";
|
| | | import { Splitpanes, Pane } from "splitpanes";
|
| | | import "splitpanes/dist/splitpanes.css";
|
| | |
|
| | | const router = useRouter()
|
| | | const appStore = useAppStore()
|
| | | const { proxy } = getCurrentInstance()
|
| | | const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex")
|
| | | const router = useRouter();
|
| | | const appStore = useAppStore();
|
| | | const { proxy } = getCurrentInstance();
|
| | | const { sys_normal_disable, sys_user_sex } = proxy.useDict(
|
| | | "sys_normal_disable",
|
| | | "sys_user_sex"
|
| | | );
|
| | |
|
| | | const userList = ref([])
|
| | | const open = ref(false)
|
| | | const loading = ref(true)
|
| | | const showSearch = ref(true)
|
| | | const ids = ref([])
|
| | | const single = ref(true)
|
| | | const multiple = ref(true)
|
| | | const total = ref(0)
|
| | | const title = ref("")
|
| | | const dateRange = ref([])
|
| | | const deptName = ref("")
|
| | | const deptOptions = ref(undefined)
|
| | | const enabledDeptOptions = ref(undefined)
|
| | | const initPassword = ref(undefined)
|
| | | const postOptions = ref([])
|
| | | const roleOptions = ref([])
|
| | | const userList = ref([]);
|
| | | const open = ref(false);
|
| | | const loading = ref(true);
|
| | | const showSearch = ref(true);
|
| | | const ids = ref([]);
|
| | | const single = ref(true);
|
| | | const multiple = ref(true);
|
| | | const total = ref(0);
|
| | | const title = ref("");
|
| | | const dateRange = ref([]);
|
| | | const deptName = ref("");
|
| | | const deptOptions = ref(undefined);
|
| | | const enabledDeptOptions = ref(undefined);
|
| | | const initPassword = ref(undefined);
|
| | | const postOptions = ref([]);
|
| | | const roleOptions = ref([]);
|
| | | /*** ç¨æ·å¯¼å
¥åæ° */
|
| | | const upload = reactive({
|
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå±ï¼ç¨æ·å¯¼å
¥ï¼
|
| | |
| | | // 设置ä¸ä¼ ç请æ±å¤´é¨
|
| | | headers: { Authorization: "Bearer " + getToken() },
|
| | | // ä¸ä¼ çå°å
|
| | | url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData"
|
| | | })
|
| | | url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData",
|
| | | });
|
| | | // åæ¾éä¿¡æ¯
|
| | | const columns = ref([
|
| | | { key: 0, label: `ç¨æ·ç¼å·`, visible: true },
|
| | |
| | | { key: 3, label: `é¨é¨`, visible: true },
|
| | | { key: 4, label: `ææºå·ç `, visible: true },
|
| | | { key: 5, label: `ç¶æ`, visible: true },
|
| | | { key: 6, label: `å建æ¶é´`, visible: true }
|
| | | ])
|
| | | { key: 6, label: `å建æ¶é´`, visible: true },
|
| | | ]);
|
| | |
|
| | | const data = reactive({
|
| | | form: {},
|
| | |
| | | userName: undefined,
|
| | | phonenumber: undefined,
|
| | | status: undefined,
|
| | | deptId: undefined
|
| | | deptId: undefined,
|
| | | },
|
| | | rules: {
|
| | | userName: [{ required: true, message: "ç»å½è´¦å·ä¸è½ä¸ºç©º", trigger: "blur" }, { min: 2, max: 20, message: "ç»å½è´¦å·é¿åº¦å¿
é¡»ä»äº 2 å 20 ä¹é´", trigger: "blur" }],
|
| | | nickName: [{ required: true, message: "ç¨æ·æµç§°ä¸è½ä¸ºç©º", trigger: "blur" }],
|
| | | userName: [
|
| | | { required: true, message: "ç»å½è´¦å·ä¸è½ä¸ºç©º", trigger: "blur" },
|
| | | {
|
| | | min: 2,
|
| | | max: 20,
|
| | | message: "ç»å½è´¦å·é¿åº¦å¿
é¡»ä»äº 2 å 20 ä¹é´",
|
| | | trigger: "blur",
|
| | | },
|
| | | ],
|
| | | nickName: [
|
| | | { required: true, message: "ç¨æ·æµç§°ä¸è½ä¸ºç©º", trigger: "blur" },
|
| | | ],
|
| | | deptIds: [{ required: true, message: "å
¬å¸ä¸è½ä¸ºç©º", trigger: "change" }],
|
| | | password: [{ required: true, message: "ç¨æ·å¯ç ä¸è½ä¸ºç©º", trigger: "blur" }, { min: 5, max: 20, message: "ç¨æ·å¯ç é¿åº¦å¿
é¡»ä»äº 5 å 20 ä¹é´", trigger: "blur" }, { pattern: /^[^<>"'|\\]+$/, message: "ä¸è½å
å«éæ³å符ï¼< > \" ' \\\ |", trigger: "blur" }],
|
| | | email: [{ type: "email", message: "请è¾å
¥æ£ç¡®çé®ç®±å°å", trigger: ["blur", "change"] }],
|
| | | phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请è¾å
¥æ£ç¡®çææºå·ç ", trigger: "blur" }]
|
| | | }
|
| | | })
|
| | | password: [
|
| | | { required: true, message: "ç¨æ·å¯ç ä¸è½ä¸ºç©º", trigger: "blur" },
|
| | | {
|
| | | min: 5,
|
| | | max: 20,
|
| | | message: "ç¨æ·å¯ç é¿åº¦å¿
é¡»ä»äº 5 å 20 ä¹é´",
|
| | | trigger: "blur",
|
| | | },
|
| | | {
|
| | | pattern: /^[^<>"'|\\]+$/,
|
| | | message: "ä¸è½å
å«éæ³å符ï¼< > \" ' \\\ |",
|
| | | trigger: "blur",
|
| | | },
|
| | | ],
|
| | | email: [
|
| | | {
|
| | | type: "email",
|
| | | message: "请è¾å
¥æ£ç¡®çé®ç®±å°å",
|
| | | trigger: ["blur", "change"],
|
| | | },
|
| | | ],
|
| | | phonenumber: [
|
| | | {
|
| | | pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
| | | message: "请è¾å
¥æ£ç¡®çææºå·ç ",
|
| | | trigger: "blur",
|
| | | },
|
| | | ],
|
| | | },
|
| | | });
|
| | |
|
| | | const { queryParams, form, rules } = toRefs(data)
|
| | | const { queryParams, form, rules } = toRefs(data);
|
| | |
|
| | | /** éè¿æ¡ä»¶è¿æ»¤èç¹ */
|
| | | const filterNode = (value, data) => {
|
| | | if (!value) return true
|
| | | return data.label.indexOf(value) !== -1
|
| | | }
|
| | | if (!value) return true;
|
| | | return data.label.indexOf(value) !== -1;
|
| | | };
|
| | |
|
| | | /** æ ¹æ®åç§°çéé¨é¨æ */
|
| | | watch(deptName, val => {
|
| | | proxy.$refs["deptTreeRef"].filter(val)
|
| | | })
|
| | | watch(deptName, (val) => {
|
| | | proxy.$refs["deptTreeRef"].filter(val);
|
| | | });
|
| | |
|
| | | /** æ¥è¯¢ç¨æ·å表 */
|
| | | function getList() {
|
| | | loading.value = true
|
| | | listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => {
|
| | | loading.value = false
|
| | | userList.value = res.rows
|
| | | total.value = res.total
|
| | | })
|
| | | loading.value = true;
|
| | | listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(
|
| | | (res) => {
|
| | | loading.value = false;
|
| | | userList.value = res.rows;
|
| | | total.value = res.total;
|
| | | }
|
| | | );
|
| | | }
|
| | |
|
| | | /** æ¥è¯¢é¨é¨ä¸ææ ç»æ */
|
| | | function getDeptTree() {
|
| | | deptTreeSelect().then(response => {
|
| | | deptOptions.value = response.data
|
| | | enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data)))
|
| | | })
|
| | | deptTreeSelect().then((response) => {
|
| | | deptOptions.value = response.data;
|
| | | enabledDeptOptions.value = filterDisabledDept(
|
| | | JSON.parse(JSON.stringify(response.data))
|
| | | );
|
| | | });
|
| | | }
|
| | |
|
| | | /** è¿æ»¤ç¦ç¨çé¨é¨ */
|
| | | function filterDisabledDept(deptList) {
|
| | | return deptList.filter(dept => {
|
| | | return deptList.filter((dept) => {
|
| | | if (dept.disabled) {
|
| | | return false
|
| | | return false;
|
| | | }
|
| | | if (dept.children && dept.children.length) {
|
| | | dept.children = filterDisabledDept(dept.children)
|
| | | dept.children = filterDisabledDept(dept.children);
|
| | | }
|
| | | return true
|
| | | })
|
| | | return true;
|
| | | });
|
| | | }
|
| | |
|
| | | /** èç¹åå»äºä»¶ */
|
| | | function handleNodeClick(data) {
|
| | | queryParams.value.deptId = data.id
|
| | | handleQuery()
|
| | | queryParams.value.deptId = data.id;
|
| | | handleQuery();
|
| | | }
|
| | |
|
| | | /** æç´¢æé®æä½ */
|
| | | function handleQuery() {
|
| | | queryParams.value.pageNum = 1
|
| | | getList()
|
| | | queryParams.value.pageNum = 1;
|
| | | getList();
|
| | | }
|
| | |
|
| | | /** éç½®æé®æä½ */
|
| | | function resetQuery() {
|
| | | dateRange.value = []
|
| | | proxy.resetForm("queryRef")
|
| | | queryParams.value.deptId = undefined
|
| | | proxy.$refs.deptTreeRef.setCurrentKey(null)
|
| | | handleQuery()
|
| | | dateRange.value = [];
|
| | | proxy.resetForm("queryRef");
|
| | | queryParams.value.deptId = undefined;
|
| | | proxy.$refs.deptTreeRef.setCurrentKey(null);
|
| | | handleQuery();
|
| | | }
|
| | |
|
| | | /** å é¤æé®æä½ */
|
| | | function handleDelete(row) {
|
| | | const userIds = row.userId || ids.value
|
| | | proxy.$modal.confirm('æ¯å¦ç¡®è®¤å é¤ç¨æ·ç¼å·ä¸º"' + userIds + '"çæ°æ®é¡¹ï¼').then(function () {
|
| | | return delUser(userIds)
|
| | | }).then(() => {
|
| | | getList()
|
| | | proxy.$modal.msgSuccess("å 餿å")
|
| | | }).catch(() => {})
|
| | | const userIds = row.userId || ids.value;
|
| | | proxy.$modal
|
| | | .confirm('æ¯å¦ç¡®è®¤å é¤ç¨æ·ç¼å·ä¸º"' + userIds + '"çæ°æ®é¡¹ï¼')
|
| | | .then(function () {
|
| | | return delUser(userIds);
|
| | | })
|
| | | .then(() => {
|
| | | getList();
|
| | | proxy.$modal.msgSuccess("å 餿å");
|
| | | })
|
| | | .catch(() => {});
|
| | | }
|
| | |
|
| | | /** å¯¼åºæé®æä½ */
|
| | | function handleExport() {
|
| | | proxy.download("system/user/export", {
|
| | | proxy.download(
|
| | | "system/user/export",
|
| | | {
|
| | | ...queryParams.value,
|
| | | },`user_${new Date().getTime()}.xlsx`)
|
| | | },
|
| | | `user_${new Date().getTime()}.xlsx`
|
| | | );
|
| | | }
|
| | |
|
| | | /** ç¨æ·ç¶æä¿®æ¹ */
|
| | | function handleStatusChange(row) {
|
| | | let text = row.status === "0" ? "å¯ç¨" : "åç¨"
|
| | | proxy.$modal.confirm('确认è¦"' + text + '""' + row.userName + '"ç¨æ·å?').then(function () {
|
| | | return changeUserStatus(row.userId, row.status)
|
| | | }).then(() => {
|
| | | proxy.$modal.msgSuccess(text + "æå")
|
| | | }).catch(function () {
|
| | | row.status = row.status === "0" ? "1" : "0"
|
| | | let text = row.status === "0" ? "å¯ç¨" : "åç¨";
|
| | | proxy.$modal
|
| | | .confirm('确认è¦"' + text + '""' + row.userName + '"ç¨æ·å?')
|
| | | .then(function () {
|
| | | return changeUserStatus(row.userId, row.status);
|
| | | })
|
| | | .then(() => {
|
| | | proxy.$modal.msgSuccess(text + "æå");
|
| | | })
|
| | | .catch(function () {
|
| | | row.status = row.status === "0" ? "1" : "0";
|
| | | });
|
| | | }
|
| | |
|
| | | /** æ´å¤æä½ */
|
| | | function handleCommand(command, row) {
|
| | | switch (command) {
|
| | | case "handleResetPwd":
|
| | | handleResetPwd(row)
|
| | | break
|
| | | handleResetPwd(row);
|
| | | break;
|
| | | case "handleAuthRole":
|
| | | handleAuthRole(row)
|
| | | break
|
| | | handleAuthRole(row);
|
| | | break;
|
| | | default:
|
| | | break
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | /** 跳转è§è²åé
*/
|
| | | function handleAuthRole(row) {
|
| | | const userId = row.userId
|
| | | router.push("/system/user-auth/role/" + userId)
|
| | | const userId = row.userId;
|
| | | router.push("/system/user-auth/role/" + userId);
|
| | | }
|
| | |
|
| | | /** éç½®å¯ç æé®æä½ */
|
| | | function handleResetPwd(row) {
|
| | | proxy.$prompt('请è¾å
¥"' + row.userName + '"çæ°å¯ç ', "æç¤º", {
|
| | | proxy
|
| | | .$prompt('请è¾å
¥"' + row.userName + '"çæ°å¯ç ', "æç¤º", {
|
| | | confirmButtonText: "ç¡®å®",
|
| | | cancelButtonText: "åæ¶",
|
| | | closeOnClickModal: false,
|
| | |
| | | inputErrorMessage: "ç¨æ·å¯ç é¿åº¦å¿
é¡»ä»äº 5 å 20 ä¹é´",
|
| | | inputValidator: (value) => {
|
| | | if (/<|>|"|'|\||\\/.test(value)) {
|
| | | return "ä¸è½å
å«éæ³å符ï¼< > \" ' \\\ |"
|
| | | return "ä¸è½å
å«éæ³å符ï¼< > \" ' \\\ |";
|
| | | }
|
| | | },
|
| | | }).then(({ value }) => {
|
| | | resetUserPwd(row.userId, value).then(response => {
|
| | | proxy.$modal.msgSuccess("ä¿®æ¹æåï¼æ°å¯ç æ¯ï¼" + value)
|
| | | })
|
| | | }).catch(() => {})
|
| | | .then(({ value }) => {
|
| | | resetUserPwd(row.userId, value).then((response) => {
|
| | | proxy.$modal.msgSuccess("ä¿®æ¹æåï¼æ°å¯ç æ¯ï¼" + value);
|
| | | });
|
| | | })
|
| | | .catch(() => {});
|
| | | }
|
| | |
|
| | | /** éæ©æ¡æ° */
|
| | | function handleSelectionChange(selection) {
|
| | | ids.value = selection.map(item => item.userId)
|
| | | single.value = selection.length != 1
|
| | | multiple.value = !selection.length
|
| | | ids.value = selection.map((item) => item.userId);
|
| | | single.value = selection.length != 1;
|
| | | multiple.value = !selection.length;
|
| | | }
|
| | |
|
| | | /** 导å
¥æé®æä½ */
|
| | | function handleImport() {
|
| | | upload.title = "ç¨æ·å¯¼å
¥"
|
| | | upload.open = true
|
| | | upload.title = "ç¨æ·å¯¼å
¥";
|
| | | upload.open = true;
|
| | | }
|
| | |
|
| | | /** ä¸è½½æ¨¡æ¿æä½ */
|
| | | function importTemplate() {
|
| | | proxy.download("system/user/importTemplate", {
|
| | | }, `user_template_${new Date().getTime()}.xlsx`)
|
| | | proxy.download(
|
| | | "system/user/importTemplate",
|
| | | {},
|
| | | `user_template_${new Date().getTime()}.xlsx`
|
| | | );
|
| | | }
|
| | |
|
| | | /**æä»¶ä¸ä¼ ä¸å¤ç */
|
| | | const handleFileUploadProgress = (event, file, fileList) => {
|
| | | upload.isUploading = true
|
| | | }
|
| | | upload.isUploading = true;
|
| | | };
|
| | |
|
| | | /** æä»¶ä¸ä¼ æåå¤ç */
|
| | | const handleFileSuccess = (response, file, fileList) => {
|
| | | upload.open = false
|
| | | upload.isUploading = false
|
| | | proxy.$refs["uploadRef"].handleRemove(file)
|
| | | proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导å
¥ç»æ", { dangerouslyUseHTMLString: true })
|
| | | getList()
|
| | | }
|
| | | upload.open = false;
|
| | | upload.isUploading = false;
|
| | | proxy.$refs["uploadRef"].handleRemove(file);
|
| | | proxy.$alert(
|
| | | "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
| | | response.msg +
|
| | | "</div>",
|
| | | "导å
¥ç»æ",
|
| | | { dangerouslyUseHTMLString: true }
|
| | | );
|
| | | getList();
|
| | | };
|
| | |
|
| | | /** æäº¤ä¸ä¼ æä»¶ */
|
| | | function submitFileForm() {
|
| | | proxy.$refs["uploadRef"].submit()
|
| | | proxy.$refs["uploadRef"].submit();
|
| | | }
|
| | |
|
| | | /** éç½®æä½è¡¨å */
|
| | |
| | | status: "0",
|
| | | remark: undefined,
|
| | | postIds: [],
|
| | | roleIds: []
|
| | | }
|
| | | proxy.resetForm("userRef")
|
| | | roleIds: [],
|
| | | };
|
| | | proxy.resetForm("userRef");
|
| | | }
|
| | |
|
| | | /** åæ¶æé® */
|
| | | function cancel() {
|
| | | open.value = false
|
| | | reset()
|
| | | open.value = false;
|
| | | reset();
|
| | | }
|
| | |
|
| | | /** æ°å¢æé®æä½ */
|
| | | function handleAdd() {
|
| | | reset()
|
| | | getUser().then(response => {
|
| | | postOptions.value = response.posts
|
| | | roleOptions.value = response.roles
|
| | | open.value = true
|
| | | title.value = "æ·»å ç¨æ·"
|
| | | form.value.password = initPassword.value
|
| | | })
|
| | | reset();
|
| | | getUser().then((response) => {
|
| | | postOptions.value = response.posts;
|
| | | roleOptions.value = response.roles;
|
| | | open.value = true;
|
| | | title.value = "æ·»å ç¨æ·";
|
| | | form.value.password = initPassword.value;
|
| | | });
|
| | | }
|
| | |
|
| | | /** ä¿®æ¹æé®æä½ */
|
| | | function handleUpdate(row) {
|
| | | reset()
|
| | | const userId = row.userId || ids.value
|
| | | getUser(userId).then(response => {
|
| | | form.value = response.data
|
| | | postOptions.value = response.posts
|
| | | roleOptions.value = response.roles
|
| | | form.value.postIds = response.postIds
|
| | | form.value.roleIds = response.roleIds
|
| | | form.value.deptIds = response.deptIds
|
| | | open.value = true
|
| | | title.value = "ä¿®æ¹ç¨æ·"
|
| | | form.password = ""
|
| | | })
|
| | | reset();
|
| | | const userId = row.userId || ids.value;
|
| | | getUser(userId).then((response) => {
|
| | | form.value = response.data;
|
| | | postOptions.value = response.posts;
|
| | | roleOptions.value = response.roles;
|
| | | form.value.postIds = response.postIds;
|
| | | form.value.roleIds = response.roleIds;
|
| | | form.value.deptIds = response.deptIds;
|
| | | open.value = true;
|
| | | title.value = "ä¿®æ¹ç¨æ·";
|
| | | form.password = "";
|
| | | });
|
| | | }
|
| | |
|
| | | /** æäº¤æé® */
|
| | | function submitForm() {
|
| | | proxy.$refs["userRef"].validate(valid => {
|
| | | proxy.$refs["userRef"].validate((valid) => {
|
| | | if (valid) {
|
| | | if (form.value.userId != undefined) {
|
| | | updateUser(form.value).then(response => {
|
| | | proxy.$modal.msgSuccess("ä¿®æ¹æå")
|
| | | open.value = false
|
| | | getList()
|
| | | })
|
| | | updateUser(form.value).then((response) => {
|
| | | proxy.$modal.msgSuccess("ä¿®æ¹æå");
|
| | | open.value = false;
|
| | | getList();
|
| | | });
|
| | | } else {
|
| | | addUser(form.value).then(response => {
|
| | | proxy.$modal.msgSuccess("æ°å¢æå")
|
| | | open.value = false
|
| | | getList()
|
| | | })
|
| | | addUser(form.value).then((response) => {
|
| | | proxy.$modal.msgSuccess("æ°å¢æå");
|
| | | open.value = false;
|
| | | getList();
|
| | | });
|
| | | }
|
| | | }
|
| | | })
|
| | | });
|
| | | }
|
| | |
|
| | | getDeptTree()
|
| | | getList()
|
| | | getDeptTree();
|
| | | getList();
|
| | | </script>
|
| | |
| | | import path from 'path'
|
| | | import createVitePlugins from './vite/plugins'
|
| | |
|
| | | const baseUrl = 'http://127.0.0.1:7003' // å端æ¥å£
|
| | |
|
| | | // https://vitejs.dev/config/
|
| | | export default defineConfig(({ mode, command }) => {
|
| | | const env = loadEnv(mode, process.cwd())
|
| | | const { VITE_APP_ENV } = env
|
| | | const baseUrl = VITE_APP_ENV == 'development' |
| | | ? 'http://192.168.10.2:7003' // å¼åç¯å¢å端æ¥å£
|
| | | : 'http://114.132.189.42:7004' // ç产ç¯å¢å端æ¥å£
|
| | |
|
| | | return {
|
| | | // é¨ç½²ç产ç¯å¢åå¼åç¯å¢ä¸çURLã
|
| | | // é»è®¤æ
åµä¸ï¼vite ä¼åè®¾ä½ çåºç¨æ¯è¢«é¨ç½²å¨ä¸ä¸ªååçæ ¹è·¯å¾ä¸
|