联调基础模块信息-》供应商-》客户信息-》煤种信息
采购信息 联调
| | |
| | | // ç
¤è´¨ç»´æ¤ |
| | | // ç
¤ç§ä¿¡æ¯ |
| | | import request from '@/utils/request' |
| | | |
| | | // æ¥è¯¢ç
¤è´¨ç»´æ¤å表 |
| | | // æ¥è¯¢ç
¤ç§ä¿¡æ¯å表 |
| | | export function getCoalInfo(query) { |
| | | return request({ |
| | | url: '/coalInfo/list', |
| | |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢æç¼è¾ç
¤è´¨ç»´æ¤ |
| | | // æ°å¢æç¼è¾ç
¤ç§ä¿¡æ¯ |
| | | export function addOrEditCoalInfo(query) { |
| | | return request({ |
| | | url: '/coalInfo/addOrEditCoalInfo', |
| | |
| | | data: query |
| | | }) |
| | | } |
| | | // å é¤ç
¤ç§ä¿¡æ¯æ°æ® |
| | | export function delCoalInfo(query) { |
| | | return request({ |
| | | url: '/coalInfo/delCoalInfo', |
| | | method: 'delete', |
| | | data: query |
| | | }) |
| | | } |
| | | |
| | |
| | | data: query |
| | | }) |
| | | } |
| | | |
| | | // å é¤ç
¤è´¨ç»´æ¤æ°æ® |
| | | export function delCoalQuality(query){ |
| | | return request({ |
| | | url: '/coalQuality/delCoalQuality', |
| | | method: 'delete', |
| | | data: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // 客æ·ä¿¡æ¯ |
| | | import request from '@/utils/request' |
| | | |
| | | // è·å客æ·ä¿¡æ¯å表 |
| | | export function getCustomerList(query) { |
| | | return request({ |
| | | url: '/customer/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | // æ°å¢æç¼è¾å®¢æ·ä¿¡æ¯å表 |
| | | export function addOrEditCustomer(query){ |
| | | return request({ |
| | | url: '/customer/addOrEditCustomer', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | | // å é¤å®¢æ·ä¿¡æ¯å表 |
| | | export function delCustomer(query){ |
| | | return request({ |
| | | url: '/customer/delCustomer', |
| | | method: 'delete', |
| | | data: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // éè´ç®¡ç |
| | | import request from '@/utils/request' |
| | | |
| | | // æ¥è¯¢éè´ç®¡çå表 |
| | | export function purchaseRegistration(query) { |
| | | return request({ |
| | | url: '/purchaseRegistration/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢ç¼è¾éè´ç®¡ç |
| | | export function addOrEditPR(query) { |
| | | return request({ |
| | | url: '/purchaseRegistration/addOrEditPR', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | | // å é¤éè´ç®¡ç |
| | | export function delPR(query) { |
| | | return request({ |
| | | url: '/purchaseRegistration/delPR', |
| | | method: 'delete', |
| | | data: query |
| | | }) |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // è·åè·¯ç± |
| | | export const testUserList = () => { |
| | | return request({ |
| | | url: '/test/user/list', |
| | | method: 'get' |
| | | }) |
| | | } |
| | |
| | | <template> |
| | | <el-table |
| | | v-loading="loading" |
| | | :data="tableData" |
| | | :border="border" |
| | | :show-selection="showSelection" |
| | | :max-height="maxHeight" |
| | | :header-cell-style="{ background: '#EBEEF5', color: '#3D3D3D' }" |
| | | @selection-change="handleSelectionChange" |
| | | @row-click="handleRowClick" |
| | | @row-dblclick="handleRowDblClick" |
| | | @cell-click="handleCellClick" |
| | | :max-width="maxWidth" |
| | | @export="handleExport" |
| | | > |
| | | <el-table-column v-if="showSelection" type="selection" width="55" align="center" /> |
| | | <el-table-column v-if="showIndex" label="åºå·" type="index" width="60" align="center" /> |
| | | <template v-for="col in columns" :key="col.prop"> |
| | | <el-table-column |
| | | v-bind="col" |
| | | :show-overflow-tooltip="shouldShowTooltip(col, tableData)" |
| | | :formatter="(row, column, cellValue) => cellValue == null || cellValue === '' ? '--' : cellValue" |
| | | align="center" |
| | | > |
| | | <template v-if="col.slot" #default> |
| | | <slot></slot> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | <!-- æä½å --> |
| | | <el-table-column v-if="showOperations" :label="operationsLabel" :width="operationsWidth" fixed="right" align="center"> |
| | | <template #default="scope"> |
| | | <slot name="operations" :row="scope.row"> |
| | | <el-button |
| | | v-if="operations.includes('edit')" |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="handleEdit(scope.row)" |
| | | >ç¼è¾</el-button> |
| | | <!-- <el-button--> |
| | | <!-- v-if="operations.includes('delete')"--> |
| | | <!-- link--> |
| | | <!-- type="danger"--> |
| | | <!-- size="small"--> |
| | | <!-- @click="handleDelete(scope.row)"--> |
| | | <!-- >å é¤</el-button>--> |
| | | </slot> |
| | | <el-table v-loading="loading" :data="tableData" :border="border" :show-selection="showSelection" :max-height="maxHeight" |
| | | :header-cell-style="{ background: '#EBEEF5', color: '#3D3D3D' }" @selection-change="handleSelectionChange" |
| | | @row-click="handleRowClick" @row-dblclick="handleRowDblClick" @cell-click="handleCellClick" :max-width="maxWidth" |
| | | @export="handleExport"> |
| | | <el-table-column v-if="showSelection" type="selection" width="55" align="center" /> |
| | | <el-table-column v-if="showIndex" label="åºå·" type="index" width="60" align="center" /> <template |
| | | v-for="col in columns" :key="col.prop"> |
| | | <el-table-column v-bind="col" :show-overflow-tooltip="shouldShowTooltip(col, tableData)" |
| | | :formatter="col.formatter || defaultFormatter" align="center"> |
| | | <template v-if="col.slot" #default> |
| | | <slot></slot> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </template> |
| | | </template> |
| | | <!-- æä½å --> |
| | | <el-table-column v-if="showOperations" :label="operationsLabel" :width="operationsWidth" fixed="right" align="center"> |
| | | <template #default="scope"> |
| | | <slot name="operations" :row="scope.row"> |
| | | <el-button v-if="operations.includes('edit')" link type="primary" size="small" |
| | | @click="handleEdit(scope.row)">ç¼è¾</el-button> |
| | | <!-- <el-button--> |
| | | <!-- v-if="operations.includes('delete')"--> |
| | | <!-- link--> |
| | | <!-- type="danger"--> |
| | | <!-- size="small"--> |
| | | <!-- @click="handleDelete(scope.row)"--> |
| | | <!-- >å é¤</el-button>--> |
| | | </slot> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { defineEmits } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | const props = defineProps({ |
| | | // æå¤§å®½åº¦ |
| | | maxWidth: { |
| | | type: [String, Number], |
| | | default: 'auto' |
| | | }, |
| | | handleCellClick: { |
| | | type: Function, |
| | | default: () => {} |
| | | }, |
| | | handleRowClick: { |
| | | type: Function, |
| | | default: () => {} |
| | | }, |
| | | handleExport: { |
| | | type: Function, |
| | | default: () => {} |
| | | }, |
| | | handleRowDblClick: { |
| | | type: Function, |
| | | default: () => {} |
| | | }, |
| | | // é«åº¦ |
| | | maxHeight: { |
| | | type: [String, Number], |
| | | default: 'auto' |
| | | }, |
| | | // å è½½ç¶æ |
| | | loading: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | // border |
| | | border: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | // è¡¨æ ¼æ°æ® |
| | | tableData: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | // æ¯å¦æ¾ç¤ºéæ©å |
| | | showSelection: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | // æ¯å¦æ¾ç¤ºåºå·å |
| | | showIndex: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | // åé
ç½® |
| | | columns: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | // æ¯å¦æ¾ç¤ºæä½å |
| | | showOperations: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | // æä½åæ ç¾ |
| | | operationsLabel: { |
| | | type: String, |
| | | default: 'æä½' |
| | | }, |
| | | // æä½å宽度 |
| | | operationsWidth: { |
| | | type: [String, Number], |
| | | default: 100 |
| | | }, |
| | | // æ¾ç¤ºåªäºæä½æé® |
| | | operations: { |
| | | type: Array, |
| | | default: () => ['edit', 'delete', 'export'] |
| | | }, |
| | | // å é¤ç¡®è®¤ä¿¡æ¯ |
| | | deleteConfirmText: { |
| | | type: String, |
| | | default: '确认å é¤è¯¥è®°å½ï¼' |
| | | } |
| | | }) |
| | | // æ£æ¥åæ¯å¦éè¦æ¾ç¤ºtooltip |
| | | const shouldShowTooltip = (col, data) => { |
| | | import { defineEmits } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | const props = defineProps({ |
| | | // æå¤§å®½åº¦ |
| | | maxWidth: { |
| | | type: [String, Number], |
| | | default: 'auto' |
| | | }, |
| | | handleCellClick: { |
| | | type: Function, |
| | | default: () => { } |
| | | }, |
| | | handleRowClick: { |
| | | type: Function, |
| | | default: () => { } |
| | | }, |
| | | handleExport: { |
| | | type: Function, |
| | | default: () => { } |
| | | }, |
| | | handleRowDblClick: { |
| | | type: Function, |
| | | default: () => { } |
| | | }, |
| | | // é«åº¦ |
| | | maxHeight: { |
| | | type: [String, Number], |
| | | default: 'auto' |
| | | }, |
| | | // å è½½ç¶æ |
| | | loading: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | // border |
| | | border: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | // è¡¨æ ¼æ°æ® |
| | | tableData: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | // æ¯å¦æ¾ç¤ºéæ©å |
| | | showSelection: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | // æ¯å¦æ¾ç¤ºåºå·å |
| | | showIndex: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | // åé
ç½® |
| | | columns: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | // æ¯å¦æ¾ç¤ºæä½å |
| | | showOperations: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | // æä½åæ ç¾ |
| | | operationsLabel: { |
| | | type: String, |
| | | default: 'æä½' |
| | | }, |
| | | // æä½å宽度 |
| | | operationsWidth: { |
| | | type: [String, Number], |
| | | default: 100 |
| | | }, |
| | | // æ¾ç¤ºåªäºæä½æé® |
| | | operations: { |
| | | type: Array, |
| | | default: () => ['edit', 'delete', 'export'] |
| | | }, |
| | | // å é¤ç¡®è®¤ä¿¡æ¯ |
| | | deleteConfirmText: { |
| | | type: String, |
| | | default: '确认å é¤è¯¥è®°å½ï¼' |
| | | } |
| | | }) |
| | | // æ£æ¥åæ¯å¦éè¦æ¾ç¤ºtooltip |
| | | const shouldShowTooltip = (col, data) => { |
| | | // 妿åé
ç½®ä¸æç¡®è®¾ç½®äºshowOverflowTooltipï¼ä½¿ç¨è¯¥è®¾ç½® |
| | | if (col.hasOwnProperty('showOverflowTooltip')) { |
| | | return col.showOverflowTooltip; |
| | | } |
| | | // å¦ææ²¡æpropï¼ç´æ¥è¿åfalse |
| | | if (!col.prop) return false; |
| | | // æ£æ¥è¯¥åå¨æææ°æ®ä¸æ¯å¦æéç©ºå¼ |
| | | // æ£æ¥è¯¥åå¨æææ°æ®ä¸æ¯å¦æé空å¼ï¼é»è®¤æ¾ç¤ºtooltip |
| | | return data.some(row => row[col.prop] != null && row[col.prop] !== ''); |
| | | }; |
| | | |
| | | // é»è®¤çæ ¼å¼å彿° |
| | | const defaultFormatter = (row, column, cellValue) => { |
| | | return cellValue == null || cellValue === '' || cellValue === 0 ? '--' : cellValue; |
| | | }; |
| | | |
| | | // å¤çéæ©ååãç¼è¾ãå é¤åå¯¼åºæä½ |
| | | const emit = defineEmits(['selection-change', 'edit', 'delete', 'export']) |
| | | const handleSelectionChange = (selection) => { |
| | | emit('selection-change', selection) |
| | | } |
| | | const handleEdit = (row) => { |
| | | emit('edit', row) |
| | | } |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm( |
| | | props.deleteConfirmText, |
| | | 'è¦å', |
| | | { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | } |
| | | ).then(() => { |
| | | emit('delete', row) |
| | | }).catch(() => {}) |
| | | } |
| | | |
| | | const handleExport = (row) => { |
| | | emit('export', row) |
| | | } |
| | | </script> |
| | | const emit = defineEmits(['selection-change', 'edit', 'delete', 'export']) |
| | | const handleSelectionChange = (selection) => { |
| | | emit('selection-change', selection) |
| | | } |
| | | const handleEdit = (row) => { |
| | | emit('edit', row) |
| | | } |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm( |
| | | props.deleteConfirmText, |
| | | 'è¦å', |
| | | { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | } |
| | | ).then(() => { |
| | | emit('delete', row) |
| | | }).catch(() => { }) |
| | | } |
| | | |
| | | const handleExport = (row) => { |
| | | emit('export', row) |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .el-table { |
| | | .el-table { |
| | | margin: 20px 0 !important; |
| | | } |
| | | |
| | |
| | | overflow-x: auto; |
| | | } |
| | | } |
| | | </style> |
| | | |
| | | /* æ¯æå°ååæ¢è¡æ¾ç¤º */ |
| | | :deep(.el-table .cell) { |
| | | white-space: normal !important; |
| | | word-break: break-all; |
| | | line-height: 1.4; |
| | | } |
| | | |
| | | /* 为å°åå设置æå°é«åº¦ä»¥å®¹çº³å¤è¡ææ¬ */ |
| | | :deep(.el-table td) { |
| | | padding: 8px 0; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div> |
| | | <el-form :inline="true" :model="queryParams" class="search-form"> |
| | | <el-form-item label="ä¾åºååç§°"> |
| | | <el-input v-model="queryParams.searchAll" placeholder="请è¾å
¥å
³é®è¯" clearable /> |
| | | <div> <el-form :inline="true" :model="queryParams" class="search-form" > |
| | | <el-form-item label="æç´¢" v-if="tabName === 'supplier' || tabName === 'customer'"> |
| | | <el-input v-model="queryParams.searchAll" placeholder="ä¾åºå/è¯å«ç /详ç»å°å" clearable /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="æç´¢" v-if="tabName === 'coal' || tabName === 'coalQualityMaintenance'"> |
| | | <el-input v-model="queryParams.searchAll" placeholder="请è¾å
¥æç´¢ä¿¡æ¯" clearable /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getList">æ¥è¯¢</el-button> |
| | | <el-button type="primary" @click="search">æ¥è¯¢</el-button> |
| | | <el-button @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | <el-row :gutter="24" class="table-toolbar"> |
| | | <el-button type="primary" :icon="Plus" @click="handleAdd">æ°å»º</el-button> |
| | | <el-button type="danger" :icon="Delete" @click="handleDelete">å é¤</el-button> |
| | | <el-button type="info" :icon="Download" @click="handleExport">导åº</el-button> |
| | | <el-button type="info" :icon="Download" @click="handleExport" v-show="tabName === 'supplier' || tabName === 'customer'">导åº</el-button> |
| | | </el-row> |
| | | <!-- è¡¨æ ¼ç»ä»¶ --> |
| | | <div> |
| | | <data-table :loading="loading" :table-data="tableData" :columns="columns" |
| | | @selection-change="handleSelectionChange" @edit="handleEdit" :show-selection="true" :border="true" /> |
| | | </div> <pagination v-if="total>0" :page="pageNum" :limit="pageSizes" :total="total" @pagination="handPagination" |
| | | </div> |
| | | <pagination v-if="total>0" :page="pageNum" :limit="pageSizes" :total="total" @pagination="handPagination" |
| | | :layout="'total, prev, pager, next, jumper'" /> |
| | | <Supplier v-if="tabName === 'supplier'" v-model:supplierDialogFormVisible="dialogFormVisible" :form="form" |
| | | :title="title" @submit="handleSubmit" @beforeClose="handleBeforeClose" |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted } from "vue"; |
| | | import { ref, reactive, onMounted, computed } from "vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { Plus, Edit, Delete, Download } from "@element-plus/icons-vue"; |
| | | import DataTable from "@/components/Table/ETable.vue"; |
| | |
| | | import coalQualityMaintenance from "./mould/coalQualityMaintenance.vue"; |
| | | const { proxy } = getCurrentInstance() |
| | | import { getSupply, addOrEditSupply, delSupply } from "@/api/basicInformation/supplier.js"; |
| | | import { getCoalInfo, addOrEditCoalInfo } from "@/api/basicInformation/coal.js"; |
| | | import { getCoalQuality, addOrEditCoalQuality } from "@/api/basicInformation/coalQualityMaintenance.js"; |
| | | import { getCoalInfo, delCoalInfo } from "@/api/basicInformation/coal.js"; |
| | | import { getCoalQuality, delCoalQuality } from "@/api/basicInformation/coalQualityMaintenance.js"; |
| | | import { testUserList } from "@/api/tool/publicInterface.js"; |
| | | import { getAreaOptions } from "@/api/system/area.js"; |
| | | import { getCustomerList, delCustomer } from "@/api/basicInformation/customer.js"; |
| | | |
| | | // å¼¹çª |
| | | const coalQualityMaintenanceDialogFormVisible = ref(false); |
| | | const customerDialogFormVisible = ref(false); |
| | |
| | | const form = ref({}); |
| | | const title = ref(""); |
| | | const copyForm = ref({}); |
| | | // ç¨æ·åè¡¨æ°æ® |
| | | const userList = ref([]); |
| | | // ç¨æ·æ å°è¡¨ï¼ç¨äºå¿«éæ¥æ¾ |
| | | const userMap = ref({}); |
| | | // å°åæ å°è¡¨ï¼ç¨äºå¿«éæ¥æ¾å°ååç§° |
| | | const addressMap = ref({}); |
| | | // å½åæ ç¾ |
| | | const tabName = ref("supplier"); |
| | | // ç¶æåé |
| | |
| | | const selectedRows = ref([]); |
| | | // æ¥è¯¢åæ° |
| | | const queryParams = reactive({ |
| | | searchText: "", |
| | | supplierName: "", |
| | | identifyNumber: "", |
| | | address: "", |
| | | }); |
| | | onMounted(() => { |
| | | handleTabClick({ props: { name: "supplier" } }); |
| | | // å°åéæ©æ°æ® |
| | | const addressSelectOptions = ref([]); |
| | | const fetchAreaOptions = async () => { |
| | | addressSelectOptions.value = []; |
| | | const res = await getAreaOptions(); |
| | | if (res.code === 200) { |
| | | addressSelectOptions.value = res.data; |
| | | buildAddressMap(res.data); // æå»ºå°åæ å°è¡¨ |
| | | } |
| | | } |
| | | |
| | | // æå»ºå°åæ å°è¡¨ï¼ç¨äºå¿«éæ¥æ¾å°ååç§° |
| | | const buildAddressMap = (areaData) => { |
| | | const buildMap = (list, pathList = []) => { |
| | | list.forEach(item => { |
| | | const currentPath = [...pathList, item.label]; |
| | | addressMap.value[item.id] = { |
| | | name: item.label, |
| | | fullPath: currentPath.join(' / ') |
| | | }; |
| | | if (item.children && item.children.length > 0) { |
| | | buildMap(item.children, currentPath); |
| | | } |
| | | }); |
| | | }; |
| | | buildMap(areaData); |
| | | }; |
| | | |
| | | // å°åæ ¼å¼å彿° |
| | | const formatAddressArray = (addressIds) => { |
| | | // 妿å°åæ å°è¡¨è¿æ²¡æåå¤å¥½ï¼æ¾ç¤º -- |
| | | if (!addressMap.value || Object.keys(addressMap.value).length === 0||!addressIds || !Array.isArray(addressIds) || addressIds.length === 0 || addressIds.every(id => !id)) { |
| | | return '--'; |
| | | } |
| | | |
| | | const addressNames = addressIds.map(id => { |
| | | return addressMap.value[id]?.name || '--'; |
| | | }); |
| | | |
| | | // 妿ææå°ååç§°é½æ¯ '--'ï¼åè¿å '--' |
| | | if (addressNames.every(name => name === '--')) { |
| | | return '--'; |
| | | } |
| | | |
| | | return addressNames.filter(name => name !== '--').join(' / '); |
| | | }; |
| | | // è·åç¨æ·åè¡¨æ°æ® |
| | | const getUserList = async () => { |
| | | try { |
| | | const res = await testUserList(); |
| | | if (res && res.data) { |
| | | userList.value = res.data; |
| | | userList.value.forEach(user => { |
| | | userMap.value[user.userId] = user.username; |
| | | }); |
| | | console.log('ç¨æ·æ å°è¡¨:', userMap.value); |
| | | } |
| | | } catch (error) { |
| | | console.error('è·åç¨æ·å表失败:', error); |
| | | } |
| | | }; |
| | | |
| | | onMounted(async () => { |
| | | await handleTabClick({ props: { name: "supplier" } }); |
| | | await fetchAreaOptions(); // å
è·åå°åéæ©æ°æ®å¹¶æå»ºæ å°è¡¨ |
| | | await getUserList(); // è·åç¨æ·å表 |
| | | }); |
| | | const columns = ref(); |
| | | // æ ç¾é¡µæ°æ® |
| | |
| | | const addOrEdit = ref("add"); |
| | | // è¡¨æ ¼æ°æ® |
| | | const tableData = ref([]); |
| | | // æ¥è¯¢æ¹æ³ |
| | | const handleQuery = () => { |
| | | |
| | | }; |
| | | // supplier ä¾åºåæ°æ® |
| | | const supplierColumns = ref([ |
| | | { prop: "supplierName", label: "ä¾åºååç§°", minWidth: 200 }, |
| | | { prop: "taxpayerId", label: "ç»ä¸äººè¯å«å·", minWidth: 120 }, |
| | | { prop: "businessAddress", label: "ç»è¥å°å", minWidth: 150 }, |
| | | { prop: "bids", label: "详ç»å°å", minWidth: 150 }, |
| | | { prop: "supplierName", label: "ä¾åºååç§°", minWidth: 100 }, |
| | | { prop: "taxpayerId", label: "ç»ä¸äººè¯å«å·", minWidth: 170 }, { |
| | | prop: "bids", |
| | | label: "ç»è¥å°å", |
| | | minWidth: 150, |
| | | showOverflowTooltip: true, |
| | | formatter: (row, column, cellValue) => { |
| | | let arr = [ |
| | | row.bprovinceId, |
| | | row.bcityId, |
| | | row.bdistrictId, |
| | | ] |
| | | return formatAddressArray(arr); |
| | | } |
| | | }, |
| | | { prop: "businessAddress", label: "ç»è¥è¯¦ç»å°å", minWidth: 150 }, |
| | | { prop: "bankAccount", label: "弿·è¡", minWidth: 120 }, |
| | | { prop: "bankName", label: "é¶è¡è´¦å·", minWidth: 150 }, |
| | | { prop: "contactPerson", label: "è系人", minWidth: 100 }, |
| | | { prop: "contactAddress", label: "èç³»å°å", minWidth: 150 }, |
| | | { prop: "maintainer", label: "ç»´æ¤äºº", minWidth: 100 }, |
| | | { prop: "createTime", label: "ç»´æ¤æ¥æ", minWidth: 100 }, |
| | | { prop: "contactPerson", label: "è系人", minWidth: 100 }, |
| | | { |
| | | prop: "cids", |
| | | label: "è系人å°å", |
| | | minWidth: 150, |
| | | showOverflowTooltip: true, |
| | | formatter: (row, column, cellValue) => { |
| | | let arr = [ |
| | | row.cprovinceId, |
| | | row.ccityId, |
| | | row.cdistrictId, |
| | | ] |
| | | return formatAddressArray(arr); |
| | | } |
| | | },{ prop: "contactAddress", label: "è系人详ç»å°å", minWidth: 120 }, |
| | | // { |
| | | // prop: "maintainerId", |
| | | // label: "ç»´æ¤äºº", |
| | | // minWidth: 80, |
| | | // formatter: (row, column, cellValue) => { |
| | | // // å¦æç¨æ·æ å°è¡¨è¿æ²¡æåå¤å¥½ï¼æ¾ç¤º -- |
| | | // if (!userMap.value || Object.keys(userMap.value).length === 0) { |
| | | // return '--'; |
| | | // } |
| | | // // 妿å¼ä¸ºç©ºænullï¼æ¾ç¤º -- |
| | | // if (cellValue === null || cellValue === undefined || cellValue === '') { |
| | | // return '--'; |
| | | // } |
| | | // // å¦æç¨æ·æ å°è¡¨ä¸æå¯¹åºçç¨æ·åï¼è¿åç¨æ·å |
| | | // if (userMap.value[cellValue]) { |
| | | // return userMap.value[cellValue]; |
| | | // } |
| | | // // å¦ææ²¡æå¹é
çç¨æ·ï¼æ¾ç¤º -- |
| | | // return '--'; |
| | | // } |
| | | // }, |
| | | { prop: "createTime", label: "ç»´æ¤æ¥æ", minWidth: 120 }, |
| | | ]); |
| | | // customer å®¢æ·æ°æ® |
| | | const customerColumns = ref([ |
| | | { prop: "customerName", label: "客æ·åç§°", minWidth: 200 }, |
| | | { prop: "identifyNumber", label: "ç»ä¸äººè¯å«å·", minWidth: 120 }, |
| | | { prop: "address", label: "ç»è¥å°å", minWidth: 150 }, |
| | | { prop: "detailedaddress", label: "详ç»å°å", minWidth: 150 }, |
| | | { prop: "bank", label: "弿·è¡", minWidth: 120 }, |
| | | { prop: "bankAccount", label: "é¶è¡è´¦å·", minWidth: 150 }, |
| | | { prop: "contacts", label: "è系人", minWidth: 100 }, |
| | | { prop: "contactAddress", label: "èç³»å°å", minWidth: 150 }, |
| | | { prop: "maintainer", label: "ç»´æ¤äºº", minWidth: 100 }, |
| | | { prop: "maintainDate", label: "ç»´æ¤æ¥æ", minWidth: 100 }, |
| | | { prop: "customerName", label: "客æ·åç§°", minWidth: 100 }, |
| | | { prop: "taxpayerId", label: "ç»ä¸äººè¯å«å·", minWidth: 120 }, |
| | | { |
| | | prop: "bids", |
| | | label: "ç»è¥å°å", |
| | | minWidth: 150, |
| | | showOverflowTooltip: true, |
| | | formatter: (row, column, cellValue) => { |
| | | console.log(row, column, cellValue); |
| | | let arr = [ |
| | | row.businessProvinceId, |
| | | row.businessCityId, |
| | | row.businessDistrictId, |
| | | ] |
| | | return formatAddressArray(arr); |
| | | } |
| | | }, |
| | | { prop: "businessAddress", label: "详ç»å°å", minWidth: 150 }, |
| | | { prop: "bankName", label: "弿·è¡", minWidth: 120 }, |
| | | { prop: "bankAccount", label: "é¶è¡è´¦å·", minWidth: 150 }, |
| | | { prop: "contactPerson", label: "è系人", minWidth: 100 }, |
| | | { prop: "contactPhone", label: "è系人çµè¯", minWidth: 100 }, |
| | | { |
| | | prop: "cids", |
| | | label: "è系人å°å", |
| | | minWidth: 150, |
| | | showOverflowTooltip: true, |
| | | formatter: (row, column, cellValue) => { |
| | | let arr = [ |
| | | row.provinceId, |
| | | row.cityId, |
| | | row.districtId, |
| | | ] |
| | | return formatAddressArray(arr); |
| | | } |
| | | }, |
| | | { prop: "contactAddress", label: "è系人详ç»å°å", minWidth: 150 }, |
| | | { prop: "updateTime", label: "ç»´æ¤æ¥æ", minWidth: 100 }, |
| | | ]); |
| | | // coal ç
¤ç§æ°æ® |
| | | const coalColumns = ref([ |
| | | { prop: "coalName", label: "ç
¤ç§åç§°", minWidth: 200 }, |
| | | { prop: "maintainerId", label: "ç»´æ¤äºº", minWidth: 120 }, |
| | | { prop: "coal", label: "ç
¤ç§åç§°", minWidth: 200 }, { |
| | | prop: "maintainerId", |
| | | label: "ç»´æ¤äºº", |
| | | minWidth: 120, |
| | | formatter: (row, column, cellValue) => { |
| | | // å¦æç¨æ·æ å°è¡¨è¿æ²¡æåå¤å¥½ï¼æ¾ç¤º -- |
| | | if (!userMap.value || Object.keys(userMap.value).length === 0) { |
| | | return '--'; |
| | | } |
| | | // 妿å¼ä¸ºç©ºænullï¼æ¾ç¤º -- |
| | | if (cellValue === null || cellValue === undefined || cellValue === '') { |
| | | return '--'; |
| | | } |
| | | // å¦æç¨æ·æ å°è¡¨ä¸æå¯¹åºçç¨æ·åï¼è¿åç¨æ·å |
| | | if (userMap.value[cellValue]) { |
| | | return userMap.value[cellValue]; |
| | | } |
| | | // å¦ææ²¡æå¹é
çç¨æ·ï¼æ¾ç¤º -- |
| | | return '--'; |
| | | } |
| | | }, |
| | | { prop: "maintenanceDate", label: "ç»´æ¤æ¥æ", minWidth: 150 }, |
| | | ]); |
| | | // coalQualityMaintenance ç
¤è´¨ç»´æ¤æ°æ® |
| | |
| | | queryParams[key] = ""; |
| | | } |
| | | }); |
| | | getList() |
| | | }; |
| | | // æ°å¢ |
| | | const handleAdd = () => { |
| | |
| | | }; |
| | | // å页 |
| | | const handPagination = (val) => { |
| | | console.log("å页忰ï¼", val); |
| | | pageNum.value = val.page; |
| | | pageSizes.value = val.limit; |
| | | getList(); |
| | | }; |
| | | // æäº¤è¡¨å |
| | | const handleSubmit = async (val) => { |
| | | console.log(val) |
| | | if (val.code !== 200) { |
| | | ElMessage.error("æä½å¤±è´¥ï¼" + result.msg); |
| | | console.log(val); |
| | | if (val.result.code !== 200) { |
| | | ElMessage.error("æä½å¤±è´¥ï¼" + val.result.msg); |
| | | return; |
| | | } |
| | | ElMessage.success("æ°å¢æåï¼" + result.msg); |
| | | ElMessage.success(val.title + val.result.msg); |
| | | dialogFormVisible.value = false; |
| | | getList(); |
| | | }; |
| | | const handleDialogFormVisible = (value) => { |
| | | dialogFormVisible.value = value; |
| | |
| | | // ç¼è¾ |
| | | const handleEdit = (row) => { |
| | | form.value = JSON.parse(JSON.stringify(row)); |
| | | if(form.value.bprovinceId && form.value.bdistrictId && form.value.bcityId ){ |
| | | form.value.bids = [ |
| | | row.bprovinceId, |
| | | row.bcityId, |
| | | row.bdistrictId, |
| | | ]; |
| | | } |
| | | if(form.value.cprovinceId && form.value.cdistrictId && form.value.ccityId ){ |
| | | form.value.cids = [ |
| | | row.cprovinceId, |
| | | row.ccityId, |
| | | row.cdistrictId, |
| | | ]; |
| | | } |
| | | if(form.value.businessCityId && form.value.businessDistrictId && form.value.businessProvinceId) { |
| | | form.value.bids = [ |
| | | row.businessProvinceId, |
| | | row.businessCityId, |
| | | row.businessDistrictId, |
| | | ]; |
| | | } |
| | | if(form.value.cityId && form.value.districtId && form.value.provinceId) { |
| | | form.value.cids = [ |
| | | row.provinceId, |
| | | row.cityId, |
| | | row.districtId, |
| | | ]; |
| | | } |
| | | addOrEdit.value = "edit"; |
| | | handleAddEdit(tabName.value); |
| | | }; |
| | |
| | | selectedRows.value.forEach(element => { |
| | | return arr.push(element.id); |
| | | }); |
| | | console.log("éä¸çæ°æ®IDï¼", arr); |
| | | ElMessageBox.confirm("ç¡®å®å é¤éä¸çæ°æ®åï¼", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | |
| | | }) |
| | | .then(async () => { |
| | | try { |
| | | let res = await delSupply(arr) |
| | | console.log(res) |
| | | selectedRows.value = []; |
| | | getlist() |
| | | } catch { |
| | | let res; |
| | | if( tabName.value === "supplier" ) { |
| | | res = await delSupply(arr); |
| | | } else if (tabName.value === "coal") { |
| | | res = await delCoalInfo(arr); |
| | | } else if (tabName.value === "coalQualityMaintenance") { |
| | | res = await delCoalQuality(arr); |
| | | } else if( tabName.value === "customer") { |
| | | res = await delCustomer(arr); |
| | | } |
| | | if(res.code !== 200 && res.meg == "æä½æå") { |
| | | ElMessage.error("å é¤å¤±è´¥ï¼" + res.msg); |
| | | return; |
| | | } |
| | | ElMessage.success("å 餿å"); |
| | | await getList(); |
| | | } catch (e) { |
| | | console.error(e); |
| | | ElMessage.error("å é¤å¤±è´¥ï¼è¯·ç¨ååè¯"); |
| | | return; |
| | | } finally { |
| | | selectedRows.value = []; |
| | | } |
| | | }).catch(() => { |
| | | ElMessage.info("已忶å 餿ä½"); |
| | |
| | | dialogFormVisible.value = false; |
| | | form.value = {}; |
| | | }; |
| | | const handleExport = (row) => { |
| | | proxy.download("system/post/export", { |
| | | const handleExport = () => { |
| | | if(tabName.value === "supplier") { |
| | | Export("/supply/export", "ä¾åºåä¿¡æ¯"); |
| | | } else if (tabName.value === "customer") { |
| | | Export("/customer/export", "客æ·ä¿¡æ¯"); |
| | | } else if (tabName.value === "coal") { |
| | | Export("/supply/export", "ç
¤ç§ä¿¡æ¯"); |
| | | } else if (tabName.value === "coalQualityMaintenance") { |
| | | Export("/supply/export", "ç
¤è´¨ç»´æ¤ä¿¡æ¯"); |
| | | |
| | | } |
| | | } |
| | | const Export = (api,name) => { |
| | | proxy.download(api, { |
| | | ...queryParams.value |
| | | }, `post_${new Date().getTime()}.xlsx`) |
| | | ElMessage.success("å¯¼åºæ°æ®ï¼" + row.supplierName); |
| | | }, `${name}${new Date().getTime()}.xlsx`) |
| | | ElMessage.success("å¯¼åºæ°æ®ï¼" + name); |
| | | }; |
| | | // éæ©æ¥å£ |
| | | const selectInterface = () => { |
| | |
| | | searchAll: queryParams.searchAll, |
| | | }); |
| | | } else if (tabName.value === "customer") { |
| | | return getSupply({ |
| | | return getCustomerList({ |
| | | current: pageNum.value, |
| | | pageSize: pageSizes.value, |
| | | ...queryParams |
| | | searchAll: queryParams.searchAll, |
| | | }); |
| | | } else if (tabName.value === "coal") { |
| | | console.log(addOrEdit.value) |
| | | return getCoalInfo(); |
| | | return getCoalInfo({ |
| | | current: pageNum.value, |
| | | pageSize: pageSizes.value, |
| | | searchAll: queryParams.searchAll, |
| | | }); |
| | | } else if (tabName.value === "coalQualityMaintenance") { |
| | | return getCoalQuality({ |
| | | current: pageNum.value, |
| | | pageSize: pageSizes.value, |
| | | ...queryParams |
| | | searchAll: queryParams.searchAll, |
| | | }); |
| | | } |
| | | } |
| | | const search = () => { |
| | | pageNum.value = 1; // é置页ç |
| | | getList(); |
| | | }; |
| | | // è·ååè¡¨æ°æ® |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | /* if (Object.keys(addressMap.value).length === 0) { |
| | | await fetchAreaOptions(); |
| | | } */ |
| | | let { data, code } = await selectInterface() |
| | | console.log(data) |
| | | if(code !== 200) { |
| | | ElMessage.error("è·åæ°æ®å¤±è´¥ï¼" + data.msg); |
| | | loading.value = false; |
| | | return; |
| | | } |
| | | tableData.value = data.records; |
| | | total.value = data.total; |
| | | loading.value = false; |
| | |
| | | width="500" |
| | | :close-on-click-modal="false" |
| | | :before-close="handleClose" |
| | | > |
| | | <el-form |
| | | > <el-form |
| | | ref="formRef" |
| | | style="max-width: 600px; margin: 0 auto" |
| | | :model="formData" |
| | | :rules="rules" |
| | | label-width="auto" |
| | | label-width="120px" |
| | | > |
| | | <el-form-item label="ç
¤ç§åç§°" prop="coal"> |
| | | <el-input |
| | | v-model="formData.coal" |
| | | placeholder="请è¾å
¥ç
¤ç§åç§°" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»´æ¤äººå§å" prop="maintainerId"> |
| | | </el-form-item> <el-form-item label="ç»´æ¤äººå§å" prop="maintainerId"> |
| | | <el-input |
| | | v-model="formData.maintainerId" |
| | | placeholder="请è¾å
¥ç»´æ¤äººå§å" |
| | | :value="userStore.name || ''" |
| | | placeholder="ç»´æ¤äººå§å" |
| | | disabled |
| | | /> |
| | | </el-form-item> <el-form-item label="ç»´æ¤æ¥æ" prop="maintenanceDate"> |
| | | <el-input |
| | | :value="getCurrentDate()" |
| | | placeholder="ç»´æ¤æ¥æ" |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»´æ¤æ¥æ" prop="maintenanceDate"> |
| | | <el-input v-model="formData.maintenanceDate" placeholder="请è¾å
¥é¶è¡è´¦æ·" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-button type="primary" @click="submitForm"> |
| | | ç¡®å® |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, watch ,defineProps } from 'vue' |
| | | import { ref, watch, defineProps, reactive, onMounted } from 'vue' |
| | | import { addOrEditCoalInfo } from '@/api/basicInformation/coal' |
| | | import useUserStore from '@/store/modules/user' |
| | | |
| | | const userStore = useUserStore() |
| | | |
| | | const props = defineProps({ |
| | | beforeClose: { |
| | |
| | | }, |
| | | }) |
| | | |
| | | const emit = defineEmits(['submit', 'handleBeforeClose','update:coalDialogFormVisible']) |
| | | // å¨ç»ä»¶æè½½æ¶è·åç¨æ·ä¿¡æ¯ |
| | | onMounted(async () => { |
| | | // 妿store䏿²¡æç¨æ·ä¿¡æ¯ï¼åè·åç¨æ·ä¿¡æ¯ |
| | | if (!userStore.name) { |
| | | try { |
| | | await userStore.getInfo() |
| | | console.log('ç¨æ·ä¿¡æ¯:', { |
| | | id: userStore.id, |
| | | name: userStore.name, |
| | | nickName: userStore.nickName |
| | | }) |
| | | // èªå¨å¡«å
ç»´æ¤äººID |
| | | if (props.addOrEdit === 'add') { |
| | | formData.value.maintainerId = userStore.id |
| | | } |
| | | } catch (error) { |
| | | console.error('è·åç¨æ·ä¿¡æ¯å¤±è´¥:', error) |
| | | } |
| | | } else { |
| | | console.log('ç¨æ·ä¿¡æ¯:', { |
| | | id: userStore.id, |
| | | name: userStore.name, |
| | | nickName: userStore.nickName |
| | | }) |
| | | // èªå¨å¡«å
ç»´æ¤äººID |
| | | if (props.addOrEdit === 'add') { |
| | | formData.value.maintainerId = userStore.id |
| | | } |
| | | } |
| | | }) |
| | | |
| | | const emit = defineEmits(['submit', 'handleBeforeClose','update:coalDialogFormVisible']) |
| | | // 表åå¼ç¨ |
| | | const formRef = ref(null) |
| | | // è¡¨åæ°æ® |
| | |
| | | // çå¬å¤é¨ä¼ å
¥çè¡¨åæ°æ®åå |
| | | watch(() => props.form, (newVal) => { |
| | | formData.value = { ...newVal } |
| | | // å¦ææ¯æ°å¢æ¨¡å¼ï¼è®¾ç½®ç»´æ¤äºº |
| | | if (props.addOrEdit === 'add' && userStore.id) { |
| | | formData.value.maintainerId = userStore.id |
| | | } |
| | | }, { deep: true }) |
| | | |
| | | // çå¬å
é¨å¼¹çªç¶æåå |
| | |
| | | if (!formRef.value) return |
| | | await formRef.value.validate(async (valid, fields) => { |
| | | if (valid) { |
| | | formData.value.maintenanceDate = "2023-10-01" // ç¤ºä¾æ¥æ |
| | | delete formData.value.createTime |
| | | delete formData.value.updateTime |
| | | delete formData.value.maintainerName // å 餿¾ç¤ºç¨çåæ®µï¼åªä¿çID |
| | | |
| | | // ç¡®ä¿maintainerIdæå¼ |
| | | if (!formData.value.maintainerId) { |
| | | formData.value.maintainerId = userStore.id |
| | | } |
| | | |
| | | // è®¾ç½®ç»´æ¤æ¥æ |
| | | formData.value.maintenanceDate = getCurrentDate() |
| | | |
| | | let result = await addOrEditCoalInfo({ |
| | | ...formData.value, |
| | | }) |
| | |
| | | { required: true, message: "请æ£ç¡®è¾å
¥çº³ç¨äººè¯å«å·", trigger: "blur" }, |
| | | { min: 17, max: 20, message: "请è¾å
¥17-20ä½çº³ç¨äººè¯å«å·", trigger: "blur" }, |
| | | ], |
| | | address: [ |
| | | { |
| | | required: true, |
| | | message: "è¯·éæ©ç»è¥å°å", |
| | | trigger: "change", |
| | | }, |
| | | ], |
| | | bankAccount: [{ required: true, message: "请è¾å
¥é¶è¡è´¦æ·", trigger: "blur" }], |
| | | bank: [{ required: true, message: "请è¾å
¥å¼æ·è¡", trigger: "blur" }], |
| | | contacts: [{ required: true, message: "请è¾å
¥å¼æ·è¡", trigger: "blur" }], |
| | | contactsPhone: [ |
| | | { required: true, message: "请è¾å
¥è系人", trigger: "blur" }, |
| | | { min: 11, max: 11, message: "请è¾å
¥11ä½è系人çµè¯", trigger: "blur" }, |
| | | ], |
| | | }); |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 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'); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | </script> |
| | | |
| | | <style lang="sass" scoped> |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | :title="title" |
| | | width="600" |
| | | :close-on-click-modal="false" |
| | | :before-close="handleClose" |
| | | > |
| | | <el-form |
| | | ref="formRef" |
| | | style="max-width: 400px; margin: 0 auto" |
| | | :model="formData" |
| | | :rules="rules" |
| | | label-width="auto" |
| | | > |
| | | <el-form-item label="å¡è¡" prop="supplierName"> |
| | | <el-input |
| | | v-model="formData.supplierName" |
| | | placeholder="请è¾å
¥ä¾è´§ååç§°" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="纳ç¨äººè¯å«å·" prop="identifyNumber"> |
| | | <el-input |
| | | v-model="formData.identifyNumber" |
| | | placeholder="请è¾å
¥çº³ç¨äººè¯å«å·" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»è¥å°å" prop="address"> |
| | | <el-cascader |
| | | placeholder="è¯·éæ©ç»è¥å°å" |
| | | size="default" |
| | | :options="addressSelectOptions" |
| | | v-model="formData.address" |
| | | @change="handleChange" |
| | | > |
| | | </el-cascader> |
| | | </el-form-item> |
| | | <el-form-item label="详ç»å°å" prop="addressDetail"> |
| | | <el-input |
| | | v-model="formData.addressDetail" |
| | | placeholder="请è¾å
¥å®¢æ·è¯¦ç»å°å" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="é¶è¡è´¦æ·" prop="bankAccount"> |
| | | <el-input v-model="formData.bankAccount" placeholder="请è¾å
¥é¶è¡è´¦æ·" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="submitForm"> |
| | | ç¡®å® |
| | | </el-button> |
| | | <el-button v-if="addOrEdit === 'edit'" @click="resetForm">éç½®</el-button> |
| | | <el-button v-if="addOrEdit === 'add'" @click="cancelForm">åæ¶</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-dialog> |
| | | </div> |
| | | <div> |
| | | <el-dialog v-model="dialogVisible" :title="title" width="600" :close-on-click-modal="false" |
| | | :before-close="handleClose"> |
| | | <el-form ref="formRef" style="max-width: 400px; margin: 0 auto" :model="formData" :rules="rules" label-width="auto"> |
| | | <el-form-item label="客æ·åç§°" prop="customerName"> |
| | | <el-input v-model="formData.customerName" placeholder="请è¾å
¥å®¢æ·åç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="纳ç¨äººè¯å«å·" prop="taxpayerId"> |
| | | <el-input v-model="formData.taxpayerId" placeholder="请è¾å
¥çº³ç¨äººè¯å«å·" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»è¥å°å" prop="bids"> |
| | | <el-cascader placeholder="è¯·éæ©ç»è¥å°å" size="default" :options="addressSelectOptions" v-model="formData.bids" |
| | | :props="cascaderProps" @change="handleChange"> |
| | | </el-cascader> |
| | | </el-form-item> |
| | | <el-form-item label="ç»è¥è¯¦ç»å°å" prop="businessAddress"> |
| | | <el-input v-model="formData.businessAddress" placeholder="请è¾å
¥ç»è¥è¯¦ç»å°å" /> |
| | | </el-form-item> |
| | | <el-form-item label="弿·è¡" prop="bankName"> |
| | | <el-input v-model="formData.bankName" placeholder="请è¾å
¥å¼æ·è¡" /> |
| | | </el-form-item> |
| | | <el-form-item label="é¶è¡è´¦æ·" prop="bankAccount"> |
| | | <el-input v-model="formData.bankAccount" placeholder="请è¾å
¥é¶è¡è´¦æ·" /> |
| | | </el-form-item> |
| | | <el-form-item label="è系人" prop="contactPerson"> |
| | | <el-input v-model="formData.contactPerson" placeholder="请è¾å
¥è系人" /> |
| | | </el-form-item> |
| | | <el-form-item label="èç³»çµè¯" prop="contactPhone"> |
| | | <el-input v-model="formData.contactPhone" placeholder="请è¾å
¥èç³»çµè¯" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="è系人å°å" prop="cids"> |
| | | <el-cascader placeholder="è¯·éæ©è系人å°å" size="default" :options="addressSelectOptions" v-model="formData.cids" |
| | | :props="cascaderProps" @change="handleChange"> |
| | | </el-cascader> |
| | | </el-form-item> |
| | | <el-form-item label="è系人详ç»" prop="contactAddress"> |
| | | <el-input v-model="formData.contactAddress" placeholder="请è¾å
¥è系人详ç»å°å" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="submitForm"> |
| | | ç¡®å® |
| | | </el-button> |
| | | <el-button v-if="addOrEdit === 'edit'" @click="resetForm">éç½®</el-button> |
| | | <el-button v-if="addOrEdit === 'add'" @click="cancelForm">åæ¶</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, watch, onMounted } from "vue"; |
| | | import { getAreaOptions } from "@/api/system/area.js"; |
| | | import addressList from "@/api/jsonApi/areaList.json"; |
| | | import { addOrEditCustomer } from "@/api/basicInformation/customer"; |
| | | |
| | | const props = defineProps({ |
| | | beforeClose: { |
| | | type: Function, |
| | | default: () => {}, |
| | | default: () => { }, |
| | | }, |
| | | form: { |
| | | type: Object, |
| | |
| | | default: "", |
| | | }, |
| | | }); |
| | | |
| | | const handleChange = (value) => { |
| | | console.log(value); |
| | | }; |
| | |
| | | "update:customerDialogFormVisible", |
| | | ]); |
| | | onMounted(() => { |
| | | addressSelectOptions.value = mapAddress(addressList); |
| | | }); |
| | | fetchAreaOptions() |
| | | }) |
| | | |
| | | // ä¿®æ¹æ å½¢éæ©çæ å° |
| | | const cascaderProps = ref({ |
| | | value: 'id', // æå®valueåæ®µä¸ºid |
| | | label: 'label', // æå®labelåæ®µ |
| | | children: 'children' // æå®åèç¹å段 |
| | | }) |
| | | |
| | | // å°åéæ©æ°æ® |
| | | const addressSelectOptions = ref([]); |
| | | // å¤çå°åæ°æ®è½¬æ¢ |
| | | function mapAddress(list) { |
| | | return list.map((item) => ({ |
| | | value: item.no, |
| | | label: item.name, |
| | | children: item.children ? mapAddress(item.children) : undefined, |
| | | })); |
| | | const fetchAreaOptions = async () => { |
| | | addressSelectOptions.value = []; |
| | | |
| | | const res = await getAreaOptions(); |
| | | if (res.code === 200) { |
| | | addressSelectOptions.value = res.data; |
| | | } |
| | | } |
| | | // 表åå¼ç¨ |
| | | const formRef = ref(null); |
| | |
| | | }, |
| | | { deep: true } |
| | | ); |
| | | watch( |
| | | () => props.form, |
| | | (newVal) => { |
| | | formData.value = { ...newVal }; |
| | | }, |
| | | { deep: true } |
| | | ); |
| | | |
| | | // çå¬å
é¨å¼¹çªç¶æåå |
| | | watch( |
| | |
| | | // æäº¤è¡¨å |
| | | const submitForm = async () => { |
| | | if (!formRef.value) return; |
| | | await formRef.value.validate((valid, fields) => { |
| | | await formRef.value.validate(async (valid, fields) => { |
| | | if (valid) { |
| | | emit("submit", formData.value); |
| | | const obj = ref({}); |
| | | if (props.title.includes('æ°å¢')) { |
| | | let result = await addOrEditCustomer({ |
| | | ...formData.value, |
| | | }) |
| | | obj.value = { |
| | | title: "æ°å¢", |
| | | ...formData.value, |
| | | result |
| | | }; |
| | | } else { |
| | | delete formData.value.createTime |
| | | delete formData.value.updateTime |
| | | let result = await addOrEditCustomer({ |
| | | ...formData.value, |
| | | }) |
| | | console.log(result); |
| | | obj.value = { |
| | | title: "ç¼è¾", |
| | | ...formData.value, |
| | | result |
| | | }; |
| | | } |
| | | emit("submit", obj.value); |
| | | } |
| | | }); |
| | | }; |
| | |
| | | emit("update:customerDialogFormVisible", false); |
| | | }; |
| | | const rules = reactive({ |
| | | supplierName: [ |
| | | customerName: [ |
| | | { required: true, message: "请è¾å
¥ä¾è´§ååç§°", trigger: "blur" }, |
| | | ], |
| | | identifyNumber: [ |
| | | taxpayerId: [ |
| | | { required: true, message: "请æ£ç¡®è¾å
¥çº³ç¨äººè¯å«å·", trigger: "blur" }, |
| | | { min: 17, max: 20, message: "请è¾å
¥17-20ä½çº³ç¨äººè¯å«å·", trigger: "blur" }, |
| | | ], |
| | |
| | | }, |
| | | ], |
| | | bankAccount: [{ required: true, message: "请è¾å
¥é¶è¡è´¦æ·", trigger: "blur" }], |
| | | bank: [{ required: true, message: "请è¾å
¥å¼æ·è¡", trigger: "blur" }], |
| | | contacts: [{ required: true, message: "请è¾å
¥å¼æ·è¡", trigger: "blur" }], |
| | | contactsPhone: [ |
| | | bankName: [{ required: true, message: "请è¾å
¥å¼æ·è¡", trigger: "blur" }], |
| | | contactPerson: [{ required: true, message: "请è¾å
¥å¼æ·è¡", trigger: "blur" }], |
| | | cids: [{ required: true, message: "请è¾å
¥å¼æ·è¡", trigger: "blur" }], |
| | | bids: [{ required: true, message: "请è¾å
¥å¼æ·è¡", trigger: "blur" }], |
| | | contactPhone: [ |
| | | { required: true, message: "请è¾å
¥è系人", trigger: "blur" }, |
| | | { min: 11, max: 11, message: "请è¾å
¥11ä½è系人çµè¯", trigger: "blur" }, |
| | | ], |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog v-model="dialogVisible" :title="title" width="600" :close-on-click-modal="false" |
| | | :before-close="handleClose"> |
| | | <el-form ref="formRef" style="max-width: 400px; margin: 0 auto" :model="formData" :rules="rules" |
| | | label-width="auto"> |
| | | :before-close="handleClose"> |
| | | <el-form ref="formRef" style="max-width: 400px; margin: 0 auto" :model="formData" :rules="rules" label-width="auto"> |
| | | <el-form-item label="客æ·åç§°" prop="supplierName"> |
| | | <el-input v-model="formData.supplierName" placeholder="请è¾å
¥ä¾è´§ååç§°"/> |
| | | <el-input v-model="formData.supplierName" placeholder="请è¾å
¥ä¾è´§ååç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="纳ç¨äººè¯å«å·" prop="taxpayerId"> |
| | | <el-input v-model="formData.taxpayerId" placeholder="请è¾å
¥çº³ç¨äººè¯å«å·"/> |
| | | <el-input v-model="formData.taxpayerId" placeholder="请è¾å
¥çº³ç¨äººè¯å«å·" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»è¥å°å" prop="bids"> |
| | | <el-cascader placeholder="è¯·éæ©ç»è¥å°å" size="default" :options="addressSelectOptions" |
| | | v-model="formData.bids" |
| | | :props="cascaderProps" |
| | | @change="handleChange"> |
| | | <el-cascader placeholder="è¯·éæ©ç»è¥å°å" size="default" :options="addressSelectOptions" v-model="formData.bids" |
| | | :props="cascaderProps" @change="handleChange"> |
| | | </el-cascader> |
| | | </el-form-item> |
| | | <el-form-item label="详ç»å°å" prop="businessAddress"> |
| | | <el-input v-model="formData.businessAddress" placeholder="请è¾å
¥å®¢æ·è¯¦ç»å°å"/> |
| | | <el-input v-model="formData.businessAddress" placeholder="请è¾å
¥å®¢æ·è¯¦ç»å°å" /> |
| | | </el-form-item> |
| | | <el-form-item label="弿·è¡" prop="bankAccount"> |
| | | <el-input v-model="formData.bankAccount" placeholder="请è¾å
¥å¼æ·è¡"/> |
| | | <el-input v-model="formData.bankAccount" placeholder="请è¾å
¥å¼æ·è¡" /> |
| | | </el-form-item> |
| | | <el-form-item label="é¶è¡è´¦æ·" prop="bankName"> |
| | | <el-input v-model="formData.bankName" placeholder="请è¾å
¥é¶è¡è´¦æ·"/> |
| | | <el-input v-model="formData.bankName" placeholder="请è¾å
¥é¶è¡è´¦æ·" /> |
| | | </el-form-item> |
| | | <el-form-item label="è系人" prop="contactPerson"> |
| | | <el-input v-model="formData.contactPerson" placeholder="请è¾å
¥è系人"/> |
| | | <el-input v-model="formData.contactPerson" placeholder="请è¾å
¥è系人" /> |
| | | </el-form-item> |
| | | <el-form-item label="è系人çµè¯" prop="contactPhone"> |
| | | <el-input v-model="formData.contactPhone" placeholder="请è¾å
¥è系人çµè¯"/> |
| | | <el-input v-model="formData.contactPhone" placeholder="请è¾å
¥è系人çµè¯" /> |
| | | </el-form-item> |
| | | <el-form-item label="è系人å°å" prop="contactAddress"> |
| | | <el-input v-model="formData.contactAddress" placeholder="请è¾å
¥è系人å°å"/> |
| | | <el-form-item label="è系人å°å" prop="cids"> |
| | | <el-cascader placeholder="è¯·éæ©è系人å°å" size="default" :options="addressSelectOptions" v-model="formData.cids" |
| | | :props="cascaderProps" @change="handleChange"> |
| | | </el-cascader> |
| | | </el-form-item> |
| | | <el-form-item label="è系人详ç»å°å" prop="contactAddress"> |
| | | <el-input v-model="formData.contactAddress" placeholder="请è¾å
¥è系人å°å" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="submitForm"> ç¡®å®</el-button> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref, watch, defineProps, onMounted} from "vue"; |
| | | import {addOrEditSupply} from "@/api/basicInformation/supplier"; |
| | | import {getAreaOptions} from "@/api/system/area.js"; |
| | | import { ref, watch, defineProps, onMounted } from "vue"; |
| | | import { addOrEditSupply } from "@/api/basicInformation/supplier"; |
| | | import { getAreaOptions } from "@/api/system/area.js"; |
| | | |
| | | const props = defineProps({ |
| | | beforeClose: { |
| | |
| | | // 表åå¼ç¨ |
| | | const formRef = ref(null); |
| | | // è¡¨åæ°æ® |
| | | const formData = ref({...props.form}); |
| | | const formData = ref({ ...props.form }); |
| | | // å¼¹çªå¯è§æ§ |
| | | const dialogVisible = defineModel("supplierDialogFormVisible", { |
| | | required: true, |
| | |
| | | }); |
| | | // çå¬å¤é¨ä¼ å
¥çè¡¨åæ°æ®åå |
| | | watch( |
| | | () => props.form, |
| | | (newVal) => { |
| | | formData.value = {...newVal}; |
| | | }, |
| | | {deep: true} |
| | | () => props.form, |
| | | (newVal) => { |
| | | formData.value = { ...newVal }; |
| | | }, |
| | | { deep: true } |
| | | ); |
| | | |
| | | // çå¬å
é¨å¼¹çªç¶æåå |
| | | watch( |
| | | () => dialogVisible.value, |
| | | (newVal) => { |
| | | emit("update:supplierDialogFormVisible", newVal); |
| | | } |
| | | () => dialogVisible.value, |
| | | (newVal) => { |
| | | emit("update:supplierDialogFormVisible", newVal); |
| | | } |
| | | ); |
| | | // å¤çå°åéæ©åå |
| | | const handleChange = (value) => { |
| | |
| | | if (!formRef.value) return; |
| | | await formRef.value.validate(async (valid, fields) => { |
| | | if (valid) { |
| | | const obj = ref({}); |
| | | if (props.title.includes('æ°å¢')) { |
| | | let result = await addOrEditSupply({ |
| | | ...formData.value, |
| | | }) |
| | | let obj = { |
| | | obj.value = { |
| | | title: "æ°å¢", |
| | | ...formData.value, |
| | | result |
| | | }; |
| | |
| | | let result = await addOrEditSupply({ |
| | | ...formData.value, |
| | | }) |
| | | console.log(result) |
| | | obj.value = { |
| | | title: "ç¼è¾", |
| | | ...formData.value, |
| | | result |
| | | }; |
| | | } |
| | | emit("submit", obj); |
| | | emit("submit", obj.value); |
| | | } |
| | | }); |
| | | }; |
| | |
| | | }; |
| | | const rules = reactive({ |
| | | supplierName: [ |
| | | {required: true, message: "请è¾å
¥ä¾è´§ååç§°", trigger: "blur"}, |
| | | { required: true, message: "请è¾å
¥ä¾è´§ååç§°", trigger: "blur" }, |
| | | ], |
| | | taxpayerId: [ |
| | | {required: true, message: "请æ£ç¡®è¾å
¥çº³ç¨äººè¯å«å·", trigger: "blur"}, |
| | | {min: 17, max: 20, message: "请è¾å
¥17-20ä½çº³ç¨äººè¯å«å·", trigger: "blur"}, |
| | | { required: true, message: "请æ£ç¡®è¾å
¥çº³ç¨äººè¯å«å·", trigger: "blur" }, |
| | | { min: 17, max: 20, message: "请è¾å
¥17-20ä½çº³ç¨äººè¯å«å·", trigger: "blur" }, |
| | | ], |
| | | bids: [ |
| | | { |
| | | required: true, |
| | | message: "è¯·éæ©ç»è¥å°å", |
| | | trigger: "change", |
| | | }, |
| | | ], |
| | | bankName: [{required: true, message: "请è¾å
¥é¶è¡è´¦æ·", trigger: "blur"}], |
| | | bankAccount: [{required: true, message: "请è¾å
¥å¼æ·è¡", trigger: "blur"}], |
| | | contactPerson: [{required: true, message: "è系人", trigger: "blur"}], |
| | | // bids: [ |
| | | // { |
| | | // required: true, |
| | | // message: "è¯·éæ©ç»è¥å°å", |
| | | // trigger: "change", |
| | | // }, |
| | | // ], |
| | | bankName: [{ required: true, message: "请è¾å
¥é¶è¡è´¦æ·", trigger: "blur" }], |
| | | bankAccount: [{ required: true, message: "请è¾å
¥å¼æ·è¡", trigger: "blur" }], |
| | | contactPerson: [{ required: true, message: "è系人", trigger: "blur" }], |
| | | contactPhone: [ |
| | | {required: true, message: "请è¾å
¥è系人", trigger: "blur"}, |
| | | {min: 11, max: 11, message: "请è¾å
¥11ä½è系人çµè¯", trigger: "blur"}, |
| | | { required: true, message: "请è¾å
¥è系人", trigger: "blur" }, |
| | | { min: 11, max: 11, message: "请è¾å
¥11ä½è系人çµè¯", trigger: "blur" }, |
| | | ], |
| | | }); |
| | | </script> |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | v-model="dialogFormVisible" |
| | | :title="title" |
| | | width="600" |
| | | :close-on-click-modal="false" |
| | |
| | | default: "", |
| | | }, |
| | | }); |
| | | const emit = defineEmits(["update:visible", "success"]); |
| | | const dialogVisible = defineModel("dialogFormVisible", { |
| | | const emit = defineEmits(["update:dialogFormVisible", "success"]); |
| | | const dialogFormVisible = defineModel("dialogFormVisible", { |
| | | required: true, |
| | | type: Boolean, |
| | | }); |
| | |
| | | }; |
| | | // å
³éå¼¹çª |
| | | const handleClose = () => { |
| | | dialogVisible.value = false; |
| | | dialogFormVisible.value = false; |
| | | console.log(form.value); |
| | | }; |
| | | const handleReset = () => { |
| | |
| | | :show-selection="true" |
| | | :border="true" |
| | | :maxHeight="440" |
| | | /> |
| | | <pagination |
| | | /> <pagination |
| | | v-if="total>0" |
| | | :page-num="pageNum" |
| | | :page-size="pageSize" |
| | | :page="pageNum" |
| | | :limit="pageSize" |
| | | :total="total" |
| | | @pagination="handleQuery" |
| | | @pagination="handlePagination" |
| | | :layout="'total, prev, pager, next, jumper'" |
| | | /> |
| | | </el-card> |
| | | <ProductionDialog |
| | | v-if="total>0" |
| | | </el-card> <ProductionDialog |
| | | v-model:dialogFormVisible="dialogFormVisible" |
| | | :form="form" |
| | | :title="title" |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted } from "vue"; |
| | | import { ref, reactive, onMounted, getCurrentInstance } from "vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { Plus, Edit, Delete, Download } from "@element-plus/icons-vue"; |
| | | import DataTable from "@/components/Table/ETable.vue"; |
| | | import Pagination from "@/components/Pagination"; |
| | | import ProductionDialog from "./components/ProductionDialog.vue"; |
| | | import ProductionDialog from './components/ProductionDialog.vue'; |
| | | import { purchaseRegistration } from "@/api/procureMent"; |
| | | const { proxy } = getCurrentInstance() |
| | | |
| | | const dialogFormVisible = ref(false); |
| | | const form = ref({}); |
| | | const title = ref(""); |
| | |
| | | supplierName: "", |
| | | identifyNumber: "", |
| | | address: "", |
| | | |
| | | pageNum: 1, |
| | | pageSize: 10 |
| | | }); |
| | | // æ¯å¦ç¼è¾ |
| | | const addOrEdit = ref("add"); |
| | |
| | | const handleQuery = () => { |
| | | loading.value = true; |
| | | // è¿éæ·»å å®é
çæ¥è¯¢é»è¾ |
| | | setTimeout(() => { |
| | | loading.value = false; |
| | | }, 500); |
| | | getList(); |
| | | }; |
| | | |
| | | // å页å¤ç |
| | | const handlePagination = (val) => { |
| | | console.log("å页忰ï¼", val); |
| | | pageNum.value = val.page; |
| | | pageSize.value = val.limit; |
| | | queryParams.pageNum = val.page; |
| | | queryParams.pageSize = val.limit; |
| | | getList(); |
| | | }; |
| | | |
| | | // supplier ä¾åºåæ°æ® |
| | | const columns = ref([ |
| | | { prop: "supplierName", label: "ä¾åºååç§°", minWidth: 200 }, |
| | | { prop: "category", label: "ç
¤ç§", minWidth: 120 }, |
| | | { prop: "unit", label: "åä½", minWidth: 150 }, |
| | | { prop: "purchaseAmount", label: "éè´æ°é", minWidth: 120 }, |
| | | { prop: "priceBeforeTax", label: "åä»·(ç¨å)", minWidth: 150 }, |
| | | { prop: "totalBeforeTax", label: "æ»ä»·(ç¨å)", minWidth: 100 }, |
| | | { prop: "calorificValue", label: "çå¼", minWidth: 150 }, |
| | | { prop: "registrant", label: "ç»è®°äºº", minWidth: 100 }, |
| | | { prop: "coal", label: "ç
¤ç§ç±»å", minWidth: 120 }, |
| | | { prop: "purchaseQuantity", label: "éè´æ°é", minWidth: 100 }, |
| | | { prop: "priceIncludingTax", label: "åä»·ï¼å«ç¨ï¼", minWidth: 150 }, |
| | | { prop: "totalPriceIncludingTax", label: "æ»ä»·ï¼å«ç¨ï¼", minWidth: 100 }, |
| | | { prop: "taxRate", label: "ç¨ç", minWidth: 100 }, |
| | | { prop: "priceExcludingTax", label: "ä¸å«ç¨åä»·", minWidth: 100 }, |
| | | { prop: "registrantId", label: "ç»è®°äºº", minWidth: 100 }, |
| | | { prop: "registrationDate", label: "ç»è®°æ¥æ", minWidth: 100 }, |
| | | ]); |
| | | |
| | |
| | | }; |
| | | // æ°å¢ |
| | | const handleAdd = () => { |
| | | console.log("ç¹å»æ°å¢æé®"); |
| | | addOrEdit.value = "add"; |
| | | handleAddEdit(); |
| | | }; |
| | |
| | | // æå¼å¼¹çª |
| | | const openDialog = () => { |
| | | if (addOrEdit.value === "edit") { |
| | | // ç¡®ä¿å¤å¶ä¸ä»½æ°æ®ï¼é¿å
ç´æ¥å¼ç¨ |
| | | form.value = JSON.parse(JSON.stringify(form.value)); |
| | | dialogFormVisible.value = true; |
| | | return; |
| | | } |
| | | form.value = {}; |
| | | dialogFormVisible.value = true; |
| | | // æ°å»ºæ¶åå§å表å |
| | | form.value = { |
| | | supplierName: "", |
| | | category: "", |
| | | unit: "", |
| | | purchaseAmount: "", |
| | | priceBeforeTax: "", |
| | | totalBeforeTax: "", |
| | | calorificValue: "", |
| | | registrant: "", |
| | | registrationDate: new Date().toISOString().split('T')[0] |
| | | }; dialogFormVisible.value = true; |
| | | console.log("openDialog 设置 dialogFormVisible =", dialogFormVisible.value); |
| | | }; |
| | | |
| | | // æäº¤è¡¨å |
| | |
| | | total.value = tableData.value.length; |
| | | ElMessage.success("æä½æå"); |
| | | }; |
| | | const getList = () => { |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | setTimeout(() => { |
| | | tableData.value = [ |
| | | { |
| | | supplierName: "ä¸å½ç³æ²¹åå·¥è¡ä»½æéå
¬å¸", |
| | | category: "ç
¤", |
| | | unit: "å¨", |
| | | purchaseAmount: "1000", |
| | | priceBeforeTax: "100", |
| | | totalBeforeTax: "100000", |
| | | calorificValue: "5000", |
| | | registrant: "å¼ ä¸", |
| | | registrationDate: "2025-01-01", |
| | | }, |
| | | { |
| | | supplierName: "ä¸å½ä¸ç³å", |
| | | category: "ç²¾åç
¤", |
| | | unit: "åå
", |
| | | purchaseAmount: "1000", |
| | | priceBeforeTax: "100", |
| | | totalBeforeTax: "100000", |
| | | calorificValue: "5000", |
| | | registrant: "æå", |
| | | registrationDate: "2025-01-01", |
| | | } |
| | | ] |
| | | total.value = tableData.value.length; |
| | | try { |
| | | // ä¼ éå页忰 |
| | | let res = await purchaseRegistration({ |
| | | pageNum: pageNum.value, |
| | | pageSize: pageSize.value, |
| | | ...queryParams |
| | | }); |
| | | console.log("APIè¿åæ°æ®:", res); |
| | | if (res && res.data) { |
| | | tableData.value = res.data.records || []; |
| | | total.value = res.data.total || 0; |
| | | } |
| | | } catch (error) { |
| | | console.error("è·åæ°æ®å¤±è´¥:", error); |
| | | ElMessage.error("è·åæ°æ®å¤±è´¥"); |
| | | } finally { |
| | | loading.value = false; |
| | | }, 500); |
| | | } |
| | | }; |
| | | getList(); |
| | | </script> |