¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | /** |
| | | * 书æ¶ç®¡çç¸å
³APIæ¥å£ |
| | | * å
å«ä»åºç®¡çãè´§æ¶ç®¡çãå¾ä¹¦ç®¡ççåè½çæ¥å£ |
| | | */ |
| | | |
| | | /** |
| | | * è·åä»åºå表 |
| | | * @description è·åææä»åºçåºæ¬ä¿¡æ¯å表 |
| | | * @returns {Promise} è¿åä»åºåè¡¨æ°æ® |
| | | */ |
| | | export function getWarehouseList() { |
| | | return request({ |
| | | url: "/warehouse/tree", |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ä»åº |
| | | * @description å建æ°çä»åºè®°å½ |
| | | * @param {Object} data ä»åºä¿¡æ¯å¯¹è±¡ï¼å
å«ä»åºåç§°çåæ®µ |
| | | * @returns {Promise} è¿åæ°å¢ç»æ |
| | | */ |
| | | export function addWarehouse(data) { |
| | | return request({ |
| | | url: "/warehouse/add", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°ä»åºä¿¡æ¯ |
| | | * @description ä¿®æ¹ç°æä»åºçåºæ¬ä¿¡æ¯ |
| | | * @param {Object} data ä»åºä¿¡æ¯å¯¹è±¡ï¼å¿
é¡»å
å«ä»åºID |
| | | * @returns {Promise} è¿åæ´æ°ç»æ |
| | | */ |
| | | export function updateWarehouse(data) { |
| | | return request({ |
| | | url: "/warehouse/update", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä»åº |
| | | * @description æ ¹æ®ä»åºIDå 餿å®çä»åºè®°å½ |
| | | * @param {string|number} id ä»åºID |
| | | * @returns {Promise} è¿åå é¤ç»æ |
| | | */ |
| | | export function deleteWarehouse(data) { |
| | | return request({ |
| | | url: `/warehouse/delete/`, |
| | | method: "delete", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * è·åè´§æ¶å表 |
| | | * @description æ ¹æ®ä»åºIDè·å该ä»åºä¸çææè´§æ¶ä¿¡æ¯ |
| | | * @param {string|number} warehouseId ä»åºID |
| | | * @returns {Promise} è¿åè´§æ¶åè¡¨æ°æ® |
| | | */ |
| | | export function getShelfList(warehouseId) { |
| | | return request({ |
| | | url: `/shelf/list/${warehouseId}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è´§æ¶ |
| | | * @description 卿å®ä»åºä¸å建æ°çè´§æ¶è®°å½ |
| | | * @param {Object} data è´§æ¶ä¿¡æ¯å¯¹è±¡ï¼å
å«è´§æ¶åç§°ã屿°ãåæ°çåæ®µ |
| | | * @returns {Promise} è¿åæ°å¢ç»æ |
| | | */ |
| | | export function addShelf(data) { |
| | | return request({ |
| | | url: "/warehouse/goodsShelves/add", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°è´§æ¶ä¿¡æ¯ |
| | | * @description ä¿®æ¹ç°æè´§æ¶çåºæ¬ä¿¡æ¯ |
| | | * @param {Object} data è´§æ¶ä¿¡æ¯å¯¹è±¡ï¼å¿
é¡»å
å«è´§æ¶ID |
| | | * @returns {Promise} è¿åæ´æ°ç»æ |
| | | */ |
| | | export function updateShelf(data) { |
| | | return request({ |
| | | url: "/warehouse/goodsShelves/update", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * å é¤è´§æ¶ |
| | | * @description æ ¹æ®è´§æ¶IDå 餿å®çè´§æ¶è®°å½ |
| | | * @param {string|number} id è´§æ¶ID |
| | | * @returns {Promise} è¿åå é¤ç»æ |
| | | */ |
| | | export function deleteShelf(id) { |
| | | return request({ |
| | | url: `/warehouse/goodsShelves/delete/${id}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * è·åä»åºç»æ |
| | | * @description è·åæå®ä»åºç宿´ç»æä¿¡æ¯ï¼å
æ¬è´§æ¶ã屿°ãåæ°ç |
| | | * @param {string|number} warehouseId ä»åºID |
| | | * @returns {Promise} è¿åä»åºç宿´ç»ææ°æ® |
| | | */ |
| | | export function getWarehouseStructure(data) { |
| | | return request({ |
| | | url: `/warehouse/goodsShelvesRowcol/list`, |
| | | method: "get", |
| | | params: data, |
| | | }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | // ææ¡£åé
管çç¸å
³æ¥å£ |
| | | |
| | | // è·åææ¡£å表ï¼ç¨äºåé
书ç±éæ©ï¼ |
| | | export function getDocumentList() { |
| | | return request({ |
| | | url: "/documentation/list", |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // åé
å页æ¥è¯¢ |
| | | export function getBorrowList(params) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/listPage", |
| | | method: "get", |
| | | params: params, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢åé
|
| | | export function addBorrow(data) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/add", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // æ´æ°åé
|
| | | export function updateBorrow(data) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/update", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤åé
|
| | | export function deleteBorrow(ids) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/delete", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | // è·ååç±»æ |
| | | export function getCategoryTree() { |
| | | return request({ |
| | | url: "/warehouse/documentClassification/getList", |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢åç±» |
| | | export function addCategory(data) { |
| | | return request({ |
| | | url: "/warehouse/documentClassification/add", |
| | | method: "post", |
| | | data: { |
| | | category: data.category, |
| | | parentId: data.parentId, |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹åç±» |
| | | export function updateCategory(data) { |
| | | return request({ |
| | | url: "/warehouse/documentClassification/update", |
| | | method: "put", |
| | | data: { |
| | | id: data.id, |
| | | category: data.category, |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | // å é¤åç±» |
| | | export function deleteCategory(ids) { |
| | | return request({ |
| | | url: "/warehouse/documentClassification/delete", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | // è·åææ¡£å表ï¼åé¡µï¼ |
| | | export function getDocumentList(query) { |
| | | return request({ |
| | | url: "/documentation/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢ææ¡£ |
| | | export function addDocument(data) { |
| | | return request({ |
| | | url: "/documentation/add", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹ææ¡£ |
| | | export function updateDocument(data) { |
| | | return request({ |
| | | url: "/documentation/update", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤ææ¡£ |
| | | export function deleteDocument(ids) { |
| | | return request({ |
| | | url: "/documentation/delete", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | // è·åææ¡£è¯¦æ
|
| | | export function getDocumentDetail(id) { |
| | | return request({ |
| | | url: "/document/" + id, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // æç´¢ææ¡£ |
| | | export function searchDocument(query) { |
| | | return request({ |
| | | url: "/document/search", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // è·åä»åºç»æ |
| | | export function getWarehouseStructure() { |
| | | return request({ |
| | | url: "/document/warehouse/structure", |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | // é件管çç¸å
³æ¥å£ |
| | | // æ·»å éä»¶ |
| | | export function addDocumentationFile(data) { |
| | | return request({ |
| | | url: "/documentation/documentationFile/add", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // è·åéä»¶å表 |
| | | export function getDocumentationFileList(params) { |
| | | return request({ |
| | | url: "/documentation/documentationFile/listPage", |
| | | method: "get", |
| | | params: params, |
| | | }); |
| | | } |
| | | |
| | | // å é¤éä»¶ |
| | | export function deleteDocumentationFile(ids) { |
| | | return request({ |
| | | url: "/documentation/documentationFile/del", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | // ææ¡£åé
管çç¸å
³æ¥å£ |
| | | export function getBorrowList(params) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/listPage", |
| | | method: "get", |
| | | params: params, |
| | | }); |
| | | } |
| | | |
| | | export function addBorrow(data) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/add", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function updateBorrow(data) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/update", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function deleteBorrow(ids) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/delete", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢å½è¿è®°å½ |
| | | export function getReturnListPage(query) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/listPageReturn", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // å½è¿æä½ |
| | | export function returnDocument(data) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/revent", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤å½è¿è®°å½ |
| | | export function deleteReturn(ids) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/reventDelete", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | // æ´æ°åé
è®°å½ |
| | | export function updateBorrow(data) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/update", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // å½è¿æ´æ° |
| | | export function reventUpdate(data) { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/reventUpdate", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // è·åææ¡£å表 |
| | | export function getDocumentList() { |
| | | return request({ |
| | | url: "/documentationBorrowManagement/list", |
| | | method: "get", |
| | | }); |
| | | } |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function listPage(params) { |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: '/lavorIssue/listPage', |
| | | method: 'get', |
| | | params |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | export function statisticsList(params) { |
| | | return request({ |
| | | url: '/lavorIssue/statisticsList', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | // æ·»å |
| | | export function add(data) { |
| | | return request({ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="dynamic-table-container"> |
| | | <el-table |
| | | ref="tableRef" |
| | | v-loading="loading" |
| | | :data="tableData" |
| | | :border="border" |
| | | :height="height" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" |
| | | style="width: 100%" |
| | | @selection-change="handleSelectionChange" |
| | | @row-click="handleRowClick" |
| | | > |
| | | <!-- éæ©å --> |
| | | <el-table-column |
| | | v-if="showSelection" |
| | | align="center" |
| | | type="selection" |
| | | width="55" |
| | | /> |
| | | |
| | | <!-- åºå·å --> |
| | | <el-table-column |
| | | v-if="showIndex" |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | |
| | | <!-- åºå®åï¼é¨é¨ --> |
| | | <el-table-column |
| | | label="é¨é¨" |
| | | prop="department" |
| | | width="120" |
| | | show-overflow-tooltip |
| | | align="center" |
| | | /> |
| | | |
| | | <!-- åºå®åï¼å§å --> |
| | | <el-table-column |
| | | label="å§å" |
| | | prop="name" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | align="center" |
| | | /> |
| | | |
| | | <!-- åºå®åï¼å·¥å· --> |
| | | <el-table-column |
| | | label="å·¥å·" |
| | | prop="employeeId" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | align="center" |
| | | /> |
| | | |
| | | <!-- 卿åï¼æ ¹æ®åå
¸æ¸²æ --> |
| | | <el-table-column |
| | | v-for="(dictItem, index) in dynamicColumns" |
| | | :key="dictItem.value" |
| | | :label="dictItem.label" |
| | | :prop="dictItem.value" |
| | | :width="dictItem.width || 120" |
| | | show-overflow-tooltip |
| | | align="center" |
| | | > |
| | | <template #default="scope"> |
| | | <!-- æ ¹æ®åå
¸ç±»å渲æä¸åçæ¾ç¤ºæ¹å¼ --> |
| | | <template v-if="dictItem.renderType === 'tag'"> |
| | | <el-tag |
| | | :type="getTagType(scope.row[dictItem.value])" |
| | | size="small" |
| | | > |
| | | {{ getDictValueLabel(dictItem.dictType, scope.row[dictItem.value]) }} |
| | | </el-tag> |
| | | </template> |
| | | <template v-else-if="dictItem.renderType === 'select'"> |
| | | <el-select |
| | | v-model="scope.row[dictItem.value]" |
| | | placeholder="è¯·éæ©" |
| | | size="small" |
| | | @change="handleSelectChange(scope.row, dictItem.value, $event)" |
| | | > |
| | | <el-option |
| | | v-for="option in dictItem.options" |
| | | :key="option.value" |
| | | :label="option.label" |
| | | :value="option.value" |
| | | /> |
| | | </el-select> |
| | | </template> |
| | | <template v-else-if="dictItem.renderType === 'input'"> |
| | | <el-input |
| | | v-model="scope.row[dictItem.value]" |
| | | size="small" |
| | | placeholder="请è¾å
¥" |
| | | @blur="handleInputChange(scope.row, dictItem.value, $event)" |
| | | /> |
| | | </template> |
| | | <template v-else> |
| | | <span>{{ getDictValueLabel(dictItem.dictType, scope.row[dictItem.value]) }}</span> |
| | | </template> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <!-- æä½å --> |
| | | <el-table-column |
| | | v-if="showActions" |
| | | label="æä½" |
| | | width="150" |
| | | align="center" |
| | | fixed="right" |
| | | > |
| | | <template #default="scope"> |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | size="small" |
| | | @click="handleEdit(scope.row, scope.$index)" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | link |
| | | size="small" |
| | | @click="handleDelete(scope.row, scope.$index)" |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- å页ç»ä»¶ --> |
| | | <div v-if="showPagination" class="pagination-container"> |
| | | <el-pagination |
| | | v-model:current-page="pagination.current" |
| | | v-model:page-size="pagination.size" |
| | | :page-sizes="[10, 20, 50, 100]" |
| | | :total="pagination.total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed, onMounted, watch } from 'vue' |
| | | import { useDict } from '@/utils/dict' |
| | | |
| | | // å®ä¹ç»ä»¶å±æ§ |
| | | const props = defineProps({ |
| | | // è¡¨æ ¼æ°æ® |
| | | data: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | // åå
¸ç±»åæ°ç»ï¼ç¨äºå¨æçæå |
| | | dictTypes: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | // æ¯å¦æ¾ç¤ºéæ©å |
| | | showSelection: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | // æ¯å¦æ¾ç¤ºåºå·å |
| | | showIndex: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | // æ¯å¦æ¾ç¤ºæä½å |
| | | showActions: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | // æ¯å¦æ¾ç¤ºå页 |
| | | showPagination: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | // è¡¨æ ¼é«åº¦ |
| | | height: { |
| | | type: [String, Number], |
| | | default: 'auto' |
| | | }, |
| | | // æ¯å¦æ¾ç¤ºè¾¹æ¡ |
| | | border: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | // å è½½ç¶æ |
| | | loading: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | // å页é
ç½® |
| | | pagination: { |
| | | type: Object, |
| | | default: () => ({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0 |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | // å®ä¹äºä»¶ |
| | | const emit = defineEmits([ |
| | | 'selection-change', |
| | | 'row-click', |
| | | 'edit', |
| | | 'delete', |
| | | 'select-change', |
| | | 'input-change', |
| | | 'size-change', |
| | | 'current-change' |
| | | ]) |
| | | |
| | | // ååºå¼æ°æ® |
| | | const tableRef = ref(null) |
| | | const tableData = ref([]) |
| | | |
| | | // è·ååå
¸æ°æ® |
| | | const dictData = ref({}) |
| | | |
| | | // 卿åé
ç½® |
| | | const dynamicColumns = computed(() => { |
| | | const columns = [] |
| | | |
| | | props.dictTypes.forEach(dictType => { |
| | | const dictItems = dictData.value[dictType] || [] |
| | | // 为æ¯ä¸ªåå
¸ç±»åå建ä¸ä¸ªåï¼è䏿¯ä¸ºæ¯ä¸ªåå
¸é¡¹å建å |
| | | if (dictItems.length > 0) { |
| | | columns.push({ |
| | | label: getDictLabel(dictType), // è·ååå
¸ç±»åçæ¾ç¤ºåç§° |
| | | value: dictType, // 使ç¨åå
¸ç±»åä½ä¸ºå段å |
| | | width: 120, |
| | | renderType: 'tag', // é»è®¤ä½¿ç¨æ ç¾æ¾ç¤º |
| | | options: dictItems, // æä¾é项 |
| | | dictType: dictType |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | return columns |
| | | }) |
| | | |
| | | // è·ååå
¸ç±»åçæ¾ç¤ºåç§° |
| | | const getDictLabel = (dictType) => { |
| | | const labelMap = { |
| | | 'sys_normal_disable': 'ç¶æ', |
| | | 'sys_user_level': '级å«', |
| | | 'sys_user_position': 'èä½', |
| | | 'sys_yes_no': 'æ¯å¦', |
| | | 'sys_user_sex': 'æ§å«', |
| | | 'sys_lavor_issue': 'å³å¡é®é¢' // æ·»å å³å¡é®é¢åå
¸ |
| | | } |
| | | return labelMap[dictType] || dictType |
| | | } |
| | | |
| | | // è·ååå
¸æ°æ® |
| | | const loadDictData = async () => { |
| | | try { |
| | | const dictPromises = props.dictTypes.map(async (dictType) => { |
| | | const { getDicts } = await import('@/api/system/dict/data') |
| | | const response = await getDicts(dictType) |
| | | return { |
| | | type: dictType, |
| | | data: response.data.map(item => ({ |
| | | label: item.dictLabel, |
| | | value: item.dictValue, |
| | | elTagType: item.listClass, |
| | | elTagClass: item.cssClass |
| | | })) |
| | | } |
| | | }) |
| | | |
| | | const results = await Promise.all(dictPromises) |
| | | results.forEach(result => { |
| | | dictData.value[result.type] = result.data |
| | | }) |
| | | } catch (error) { |
| | | console.error('å è½½åå
¸æ°æ®å¤±è´¥:', error) |
| | | // 妿åå
¸å 载失败ï¼ä½¿ç¨é»è®¤æ°æ® |
| | | props.dictTypes.forEach(dictType => { |
| | | if (!dictData.value[dictType]) { |
| | | dictData.value[dictType] = [] |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | // è·åæ ç¾ç±»å |
| | | const getTagType = (value) => { |
| | | // æ ¹æ®å¼è¿åä¸åçæ ç¾ç±»å |
| | | if (value === '1' || value === 'true' || value === 'æ¯') return 'success' |
| | | if (value === '0' || value === 'false' || value === 'å¦') return 'danger' |
| | | if (value === '2' || value === 'warning') return 'warning' |
| | | return 'info' |
| | | } |
| | | |
| | | // è·ååå
¸å¼çæ ç¾ |
| | | const getDictValueLabel = (dictType, value) => { |
| | | if (!value) return '-' |
| | | const dictItems = dictData.value[dictType] || [] |
| | | const item = dictItems.find(item => item.value === value) |
| | | return item ? item.label : value |
| | | } |
| | | |
| | | // äºä»¶å¤ç彿° |
| | | const handleSelectionChange = (selection) => { |
| | | emit('selection-change', selection) |
| | | } |
| | | |
| | | const handleRowClick = (row, column, event) => { |
| | | emit('row-click', row, column, event) |
| | | } |
| | | |
| | | const handleEdit = (row, index) => { |
| | | emit('edit', row, index) |
| | | } |
| | | |
| | | const handleDelete = (row, index) => { |
| | | emit('delete', row, index) |
| | | } |
| | | |
| | | const handleSelectChange = (row, prop, value) => { |
| | | emit('select-change', row, prop, value) |
| | | } |
| | | |
| | | const handleInputChange = (row, prop, event) => { |
| | | emit('input-change', row, prop, event.target.value) |
| | | } |
| | | |
| | | const handleSizeChange = (size) => { |
| | | emit('size-change', size) |
| | | } |
| | | |
| | | const handleCurrentChange = (current) => { |
| | | emit('current-change', current) |
| | | } |
| | | |
| | | // ç嬿°æ®åå |
| | | watch(() => props.data, (newData) => { |
| | | tableData.value = newData |
| | | }, { immediate: true }) |
| | | |
| | | // çå¬åå
¸ç±»ååå |
| | | watch(() => props.dictTypes, () => { |
| | | loadDictData() |
| | | }, { immediate: true }) |
| | | |
| | | // ç»ä»¶æè½½æ¶å è½½åå
¸æ°æ® |
| | | onMounted(() => { |
| | | loadDictData() |
| | | }) |
| | | |
| | | // æ´é²æ¹æ³ç»ç¶ç»ä»¶ |
| | | defineExpose({ |
| | | tableRef, |
| | | getSelection: () => tableRef.value?.getSelectionRows() || [], |
| | | clearSelection: () => tableRef.value?.clearSelection(), |
| | | toggleRowSelection: (row, selected) => tableRef.value?.toggleRowSelection(row, selected), |
| | | setCurrentRow: (row) => tableRef.value?.setCurrentRow(row) |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .dynamic-table-container { |
| | | width: 100%; |
| | | } |
| | | |
| | | .pagination-container { |
| | | margin-top: 20px; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | :deep(.el-table .el-table__header-wrapper th) { |
| | | background-color: #F0F1F5 !important; |
| | | color: #333333; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | :deep(.el-table .el-table__body-wrapper td) { |
| | | padding: 8px 0; |
| | | } |
| | | |
| | | :deep(.el-select) { |
| | | width: 100%; |
| | | } |
| | | |
| | | :deep(.el-input) { |
| | | width: 100%; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search-form"> |
| | | <el-form :inline="true" :model="searchForm"> |
| | | <el-form-item label="é¨é¨"> |
| | | <el-input |
| | | v-model="searchForm.department" |
| | | placeholder="请è¾å
¥é¨é¨åç§°" |
| | | clearable |
| | | style="width: 200px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="å§å"> |
| | | <el-input |
| | | v-model="searchForm.name" |
| | | placeholder="请è¾å
¥å§å" |
| | | clearable |
| | | style="width: 200px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleSearch">æç´¢</el-button> |
| | | <el-button @click="handleReset">éç½®</el-button> |
| | | <el-button type="success" @click="handleAdd">æ°å¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <div class="table-container"> |
| | | <DynamicTable |
| | | ref="dynamicTableRef" |
| | | :data="tableData" |
| | | :dict-types="dictTypes" |
| | | :loading="loading" |
| | | :show-selection="true" |
| | | :show-actions="true" |
| | | :show-pagination="true" |
| | | :pagination="pagination" |
| | | height="calc(100vh - 280px)" |
| | | @selection-change="handleSelectionChange" |
| | | @edit="handleEdit" |
| | | @delete="handleDelete" |
| | | @select-change="handleSelectChange" |
| | | @input-change="handleInputChange" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¯¹è¯æ¡ --> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | :title="dialogTitle" |
| | | width="600px" |
| | | append-to-body |
| | | > |
| | | <el-form |
| | | ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="100px" |
| | | > |
| | | <el-form-item label="é¨é¨" prop="department"> |
| | | <el-input v-model="form.department" placeholder="请è¾å
¥é¨é¨" /> |
| | | </el-form-item> |
| | | <el-form-item label="å§å" prop="name"> |
| | | <el-input v-model="form.name" placeholder="请è¾å
¥å§å" /> |
| | | </el-form-item> |
| | | <el-form-item label="å·¥å·" prop="employeeId"> |
| | | <el-input v-model="form.employeeId" placeholder="请è¾å
¥å·¥å·" /> |
| | | </el-form-item> |
| | | |
| | | <!-- å¨æè¡¨åé¡¹ï¼æ ¹æ®åå
¸çæ --> |
| | | <el-form-item |
| | | v-for="dictItem in dynamicFormItems" |
| | | :key="dictItem.value" |
| | | :label="dictItem.label" |
| | | :prop="dictItem.value" |
| | | > |
| | | <el-select |
| | | v-model="form[dictItem.value]" |
| | | placeholder="è¯·éæ©" |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="option in dictItem.options" |
| | | :key="option.value" |
| | | :label="option.label" |
| | | :value="option.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="dialogVisible = false">åæ¶</el-button> |
| | | <el-button type="primary" @click="handleSubmit">ç¡®å®</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed, onMounted } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import DynamicTable from '@/components/DynamicTable/index.vue' |
| | | |
| | | // ååºå¼æ°æ® |
| | | const loading = ref(false) |
| | | const dialogVisible = ref(false) |
| | | const dialogTitle = ref('') |
| | | const editIndex = ref(-1) |
| | | const selectedRows = ref([]) |
| | | |
| | | // æç´¢è¡¨å |
| | | const searchForm = reactive({ |
| | | department: '', |
| | | name: '' |
| | | }) |
| | | |
| | | // è¡¨æ ¼æ°æ® |
| | | const tableData = ref([ |
| | | { |
| | | id: 1, |
| | | department: 'ææ¯é¨', |
| | | name: 'å¼ ä¸', |
| | | employeeId: 'EMP001', |
| | | status: '1', |
| | | level: '2', |
| | | position: '1' |
| | | }, |
| | | { |
| | | id: 2, |
| | | department: '人äºé¨', |
| | | name: 'æå', |
| | | employeeId: 'EMP002', |
| | | status: '0', |
| | | level: '1', |
| | | position: '2' |
| | | }, |
| | | { |
| | | id: 3, |
| | | department: 'è´¢å¡é¨', |
| | | name: 'çäº', |
| | | employeeId: 'EMP003', |
| | | status: '1', |
| | | level: '3', |
| | | position: '1' |
| | | } |
| | | ]) |
| | | |
| | | // åå
¸ç±»åé
ç½® |
| | | const dictTypes = ref([ |
| | | 'sys_normal_disable', // ç¶æåå
¸ |
| | | 'sys_user_level', // 级å«åå
¸ |
| | | 'sys_user_position' // èä½åå
¸ |
| | | ]) |
| | | |
| | | // å页é
ç½® |
| | | const pagination = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0 |
| | | }) |
| | | |
| | | // è¡¨åæ°æ® |
| | | const form = reactive({ |
| | | department: '', |
| | | name: '', |
| | | employeeId: '', |
| | | status: '', |
| | | level: '', |
| | | position: '' |
| | | }) |
| | | |
| | | // 表åéªè¯è§å |
| | | const rules = { |
| | | department: [ |
| | | { required: true, message: '请è¾å
¥é¨é¨', trigger: 'blur' } |
| | | ], |
| | | name: [ |
| | | { required: true, message: '请è¾å
¥å§å', trigger: 'blur' } |
| | | ], |
| | | employeeId: [ |
| | | { required: true, message: '请è¾å
¥å·¥å·', trigger: 'blur' } |
| | | ] |
| | | } |
| | | |
| | | // å¨æè¡¨å项 |
| | | const dynamicFormItems = computed(() => { |
| | | // è¿éå¯ä»¥æ ¹æ®åå
¸æ°æ®å¨æçæè¡¨å项 |
| | | return [ |
| | | { |
| | | label: 'ç¶æ', |
| | | value: 'status', |
| | | options: [ |
| | | { label: 'å¯ç¨', value: '1' }, |
| | | { label: 'ç¦ç¨', value: '0' } |
| | | ] |
| | | }, |
| | | { |
| | | label: '级å«', |
| | | value: 'level', |
| | | options: [ |
| | | { label: 'å级', value: '1' }, |
| | | { label: 'ä¸çº§', value: '2' }, |
| | | { label: 'é«çº§', value: '3' } |
| | | ] |
| | | }, |
| | | { |
| | | label: 'èä½', |
| | | value: 'position', |
| | | options: [ |
| | | { label: 'åå·¥', value: '1' }, |
| | | { label: '主管', value: '2' }, |
| | | { label: 'ç»ç', value: '3' } |
| | | ] |
| | | } |
| | | ] |
| | | }) |
| | | |
| | | // ç»ä»¶å¼ç¨ |
| | | const dynamicTableRef = ref(null) |
| | | const formRef = ref(null) |
| | | |
| | | // äºä»¶å¤ç彿° |
| | | const handleSearch = () => { |
| | | // å®ç°æç´¢é»è¾ |
| | | console.log('æç´¢æ¡ä»¶:', searchForm) |
| | | ElMessage.success('æç´¢åè½å¾
å®ç°') |
| | | } |
| | | |
| | | const handleReset = () => { |
| | | searchForm.department = '' |
| | | searchForm.name = '' |
| | | } |
| | | |
| | | const handleAdd = () => { |
| | | dialogTitle.value = 'æ°å¢åå·¥' |
| | | editIndex.value = -1 |
| | | resetForm() |
| | | dialogVisible.value = true |
| | | } |
| | | |
| | | const handleEdit = (row, index) => { |
| | | dialogTitle.value = 'ç¼è¾åå·¥' |
| | | editIndex.value = index |
| | | Object.assign(form, row) |
| | | dialogVisible.value = true |
| | | } |
| | | |
| | | const handleDelete = async (row, index) => { |
| | | try { |
| | | await ElMessageBox.confirm('ç¡®å®è¦å é¤è¿æ¡è®°å½åï¼', 'æç¤º', { |
| | | type: 'warning' |
| | | }) |
| | | |
| | | tableData.value.splice(index, 1) |
| | | ElMessage.success('å 餿å') |
| | | } catch (error) { |
| | | // ç¨æ·åæ¶å é¤ |
| | | } |
| | | } |
| | | |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection |
| | | } |
| | | |
| | | const handleSelectChange = (row, prop, value) => { |
| | | console.log('éæ©åå:', row, prop, value) |
| | | // å¯ä»¥å¨è¿éå¤çæ°æ®æ´æ°é»è¾ |
| | | } |
| | | |
| | | const handleInputChange = (row, prop, value) => { |
| | | console.log('è¾å
¥åå:', row, prop, value) |
| | | // å¯ä»¥å¨è¿éå¤çæ°æ®æ´æ°é»è¾ |
| | | } |
| | | |
| | | const handleSizeChange = (size) => { |
| | | pagination.size = size |
| | | // éæ°å è½½æ°æ® |
| | | } |
| | | |
| | | const handleCurrentChange = (current) => { |
| | | pagination.current = current |
| | | // éæ°å è½½æ°æ® |
| | | } |
| | | |
| | | const handleSubmit = async () => { |
| | | try { |
| | | await formRef.value.validate() |
| | | |
| | | if (editIndex.value === -1) { |
| | | // æ°å¢ |
| | | const newRow = { |
| | | id: Date.now(), |
| | | ...form |
| | | } |
| | | tableData.value.push(newRow) |
| | | ElMessage.success('æ°å¢æå') |
| | | } else { |
| | | // ç¼è¾ |
| | | Object.assign(tableData.value[editIndex.value], form) |
| | | ElMessage.success('ç¼è¾æå') |
| | | } |
| | | |
| | | dialogVisible.value = false |
| | | } catch (error) { |
| | | console.error('表åéªè¯å¤±è´¥:', error) |
| | | } |
| | | } |
| | | |
| | | const resetForm = () => { |
| | | Object.assign(form, { |
| | | department: '', |
| | | name: '', |
| | | employeeId: '', |
| | | status: '', |
| | | level: '', |
| | | position: '' |
| | | }) |
| | | formRef.value?.resetFields() |
| | | } |
| | | |
| | | // ç»ä»¶æè½½æ¶åå§åæ°æ® |
| | | onMounted(() => { |
| | | pagination.total = tableData.value.length |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .app-container { |
| | | padding: 20px; |
| | | } |
| | | |
| | | .search-form { |
| | | margin-bottom: 20px; |
| | | padding: 20px; |
| | | background-color: #f5f5f5; |
| | | border-radius: 4px; |
| | | } |
| | | |
| | | .table-container { |
| | | background-color: #fff; |
| | | border-radius: 4px; |
| | | padding: 20px; |
| | | } |
| | | |
| | | .dialog-footer { |
| | | text-align: right; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!-- ç®åçæç´¢åºå --> |
| | | <el-card class="search-card"> |
| | | <el-form :inline="true"> |
| | | <el-form-item label="é¨é¨"> |
| | | <el-input v-model="searchForm.department" placeholder="请è¾å
¥é¨é¨" clearable /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleSearch">æç´¢</el-button> |
| | | <el-button @click="handleReset">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | |
| | | <!-- å¨æè¡¨æ ¼ --> |
| | | <el-card class="table-card"> |
| | | <template #header> |
| | | <div class="card-header"> |
| | | <span>å工信æ¯è¡¨</span> |
| | | <el-button type="primary" size="small" @click="handleAdd">æ°å¢åå·¥</el-button> |
| | | </div> |
| | | </template> |
| | | |
| | | <DynamicTable |
| | | :data="tableData" |
| | | :dict-types="dictTypes" |
| | | :loading="loading" |
| | | :show-selection="true" |
| | | :show-actions="true" |
| | | height="400px" |
| | | @selection-change="handleSelectionChange" |
| | | @edit="handleEdit" |
| | | @delete="handleDelete" |
| | | /> |
| | | </el-card> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import DynamicTable from '@/components/DynamicTable/index.vue' |
| | | |
| | | // æç´¢è¡¨å |
| | | const searchForm = reactive({ |
| | | department: '' |
| | | }) |
| | | |
| | | // è¡¨æ ¼æ°æ® |
| | | const tableData = ref([ |
| | | { |
| | | id: 1, |
| | | department: 'ææ¯é¨', |
| | | name: 'å¼ ä¸', |
| | | employeeId: 'EMP001', |
| | | sys_normal_disable: '1', // ç¶æ |
| | | sys_user_level: '2', // çº§å« |
| | | sys_user_position: '1' // èä½ |
| | | }, |
| | | { |
| | | id: 2, |
| | | department: '人äºé¨', |
| | | name: 'æå', |
| | | employeeId: 'EMP002', |
| | | sys_normal_disable: '0', // ç¶æ |
| | | sys_user_level: '1', // çº§å« |
| | | sys_user_position: '2' // èä½ |
| | | } |
| | | ]) |
| | | |
| | | // åå
¸ç±»å |
| | | const dictTypes = ref([ |
| | | 'sys_normal_disable', // ç¶æï¼å¯ç¨/ç¦ç¨ |
| | | 'sys_user_level', // 级å«ï¼å级/ä¸çº§/é«çº§ |
| | | 'sys_user_position' // èä½ï¼åå·¥/主管/ç»ç |
| | | ]) |
| | | |
| | | // å è½½ç¶æ |
| | | const loading = ref(false) |
| | | |
| | | // äºä»¶å¤ç |
| | | const handleSearch = () => { |
| | | loading.value = true |
| | | // 模ææç´¢ |
| | | setTimeout(() => { |
| | | loading.value = false |
| | | ElMessage.success('æç´¢å®æ') |
| | | }, 1000) |
| | | } |
| | | |
| | | const handleReset = () => { |
| | | searchForm.department = '' |
| | | } |
| | | |
| | | const handleAdd = () => { |
| | | ElMessage.info('æ°å¢åè½å¾
å®ç°') |
| | | } |
| | | |
| | | const handleSelectionChange = (selection) => { |
| | | console.log('éä¸çè¡:', selection) |
| | | } |
| | | |
| | | const handleEdit = (row, index) => { |
| | | ElMessage.info(`ç¼è¾ç¬¬${index + 1}è¡æ°æ®`) |
| | | } |
| | | |
| | | const handleDelete = (row, index) => { |
| | | ElMessage.warning(`å é¤ç¬¬${index + 1}è¡æ°æ®`) |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .app-container { |
| | | padding: 20px; |
| | | } |
| | | |
| | | .search-card { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .table-card { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .card-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | |
| | | :deep(.el-form-item) { |
| | | margin-bottom: 0; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="detail-container"> |
| | | <div class="header"> |
| | | <el-button @click="handleBack" type="primary" size="small">è¿å</el-button> |
| | | <h2>å¾ä¹¦è¯¦æ
</h2> |
| | | </div> |
| | | |
| | | <div class="content" v-loading="loading"> |
| | | <el-card v-if="current"> |
| | | <template #header> |
| | | <div class="card-header"> |
| | | <span>åºæ¬ä¿¡æ¯</span> |
| | | </div> |
| | | </template> |
| | | |
| | | <el-descriptions :column="2" border> |
| | | <el-descriptions-item label="å¾ä¹¦ç¼å·">{{ current.docNumber }}</el-descriptions-item> |
| | | <el-descriptions-item label="å¾ä¹¦åç§°">{{ current.docName }}</el-descriptions-item> |
| | | <el-descriptions-item label="å
¥åºæ¶é´">{{ current.createTime }}</el-descriptions-item> |
| | | <!-- <el-descriptions-item label="å½åä½ç½®">{{ current.currentLocation }}</el-descriptions-item> --> |
| | | <el-descriptions-item label="ç¶æ">{{ current.docStatus }}</el-descriptions-item> |
| | | </el-descriptions> |
| | | |
| | | <!-- <div class="additional-info" v-if="current.description"> |
| | | <h4>å¾ä¹¦ç®ä»</h4> |
| | | <p>{{ current.description }}</p> |
| | | </div> --> |
| | | </el-card> |
| | | |
| | | <el-empty v-else description="ææ æ°æ®" /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue' |
| | | |
| | | // å®ä¹props |
| | | const props = defineProps({ |
| | | current: { |
| | | type: Object, |
| | | required: true |
| | | } |
| | | }) |
| | | |
| | | // å®ä¹emits |
| | | const emit = defineEmits(['hanldeBack']) |
| | | |
| | | // ååºå¼æ°æ® |
| | | const loading = ref(false) |
| | | // const bookInfo = ref(null) |
| | | |
| | | // æ¹æ³ |
| | | const handleBack = () => { |
| | | emit('hanldeBack') |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .detail-container { |
| | | padding: 20px; |
| | | height: 100%; |
| | | background-color: #f5f5f5; |
| | | } |
| | | |
| | | .header { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 20px; |
| | | background-color: #fff; |
| | | padding: 15px 20px; |
| | | border-radius: 4px; |
| | | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .header h2 { |
| | | margin: 0 0 0 20px; |
| | | color: #333; |
| | | } |
| | | |
| | | .content { |
| | | background-color: #fff; |
| | | border-radius: 4px; |
| | | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .card-header { |
| | | font-weight: bold; |
| | | color: #333; |
| | | } |
| | | |
| | | .additional-info { |
| | | margin-top: 20px; |
| | | padding-top: 20px; |
| | | border-top: 1px solid #ebeef5; |
| | | } |
| | | |
| | | .additional-info h4 { |
| | | margin: 0 0 10px 0; |
| | | color: #333; |
| | | font-size: 16px; |
| | | } |
| | | |
| | | .additional-info p { |
| | | margin: 0; |
| | | color: #666; |
| | | line-height: 1.6; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="sample"> |
| | | <div class="main-content" v-if="!isDetail"> |
| | | <div class="search"> |
| | | <div class="search_thing"> |
| | | <div class="search_label">ä»åºåç§°ï¼</div> |
| | | <div class="search_input"> |
| | | <el-select v-model="entity.warehouseId" placeholder="éæ©ä»åº" size="small" @change="warehouseChange"> |
| | | <el-option v-for="item in warehouse" :key="item.id" :label="item.label" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_label">è´§æ¶ï¼</div> |
| | | <div class="search_input"> |
| | | <el-select v-model="entity.shelfId" placeholder="éæ©è´§æ¶" size="small" @change="handleShelf"> |
| | | <el-option v-for="item in shelf" :key="item.id" :label="item.label" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="search_thing"> |
| | | <el-button size="small" @click="handleShelf(entity.shelfId,'')">éç½®</el-button> |
| | | <el-button size="small" type="primary" @click="handleShelf(entity.shelfId)">æ¥è¯¢</el-button> |
| | | </div> --> |
| | | <div class="btns"> |
| | | <el-button size="small" style="color:#3A7BFA" @click="keepVisible=true">ç»´æ¤</el-button> |
| | | <el-button size="small" style="color:#3A7BFA" @click="warehouseVisible=true,isEdit=false">æ·»å ä»åº</el-button> |
| | | <el-button size="small" style="color:#3A7BFA" @click="shelvesVisible=true,isEdit=false" |
| | | :disabled="entity.warehouseId==null">æ·»å è´§æ¶</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table" v-loading="tableLoading"> |
| | | <table class="tables" style="table-layout:fixed;" v-if="tableList.length>0"> |
| | | <tbody> |
| | | <tr v-for="(item,index) in tableList" :key="index"> |
| | | <td v-for="(m,i) in item" :key="i" class="content"> |
| | | <h4 v-if="m.row!=undefined">{{ m.row }} - {{ m.col }}</h4> |
| | | <ul> |
| | | <el-tooltip |
| | | effect="dark" |
| | | placement="top" |
| | | v-for="(n,j) in m.documentationDtoList" |
| | | :key="j"> |
| | | <template #content><span>{{ n.docName }}</span> |
| | | <span> [{{ n.docNumber }}]</span></template> |
| | | <li class="green" |
| | | @click="handelDetail(n)"> |
| | | <i></i> |
| | | <span>{{ n.docName }}</span> |
| | | <span> [{{ n.docNumber }}] <span :style="{ color: getStatusColor(n.docStatus) }">ï¼{{ n.docStatus }}ï¼</span></span> |
| | | </li> |
| | | </el-tooltip> |
| | | </ul> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td v-for="(item,index) in rowList" :key="index" style="background: ghostwhite;height: 20px;">{{ item }} |
| | | </td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | <span v-else style="color: rgb(144, 147, 153);display: inline-block;position: absolute;top: 60%;left: 50%;transform: translate(-50%,-50%);">ææ æ°æ®</span> |
| | | </div> |
| | | </div> |
| | | <Detail v-else @hanldeBack="isDetail=false" :current="current" /> |
| | | |
| | | <!-- åºä½ç»´æ¤å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="keepVisible" title="åºä½ç»´æ¤" width="350px" :append-to-body="true"> |
| | | <el-tree :data="warehouse" ref="tree" node-key="id" |
| | | highlight-current v-if="keepVisible" |
| | | empty-text="ææ æ°æ®"> |
| | | <template #default="{ node, data }"> |
| | | <div class="custom-tree-node" style="width: 100%;"> |
| | | <el-row style="width: 100%;display: flex;align-items: center;"> |
| | | <el-col :span="14"> |
| | | <span> |
| | | <el-icon v-if="node.level < 2" class="folder-icon"> |
| | | <FolderOpened /> |
| | | </el-icon> |
| | | <el-icon v-else class="file-icon"> |
| | | <Document /> |
| | | </el-icon> |
| | | {{ data.label }} |
| | | </span> |
| | | </el-col> |
| | | <el-col :span="10" v-if="node.level<3"> |
| | | <el-button type="link" size="small" :icon="Edit" @click.stop="handleEdit(data,node.level)"> |
| | | </el-button> |
| | | <el-button type="danger" size="small" :icon="Delete" @click.stop="handleDelete(data,node.level)"> |
| | | </el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </template> |
| | | </el-tree> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="keepVisible = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="keepVisible = false" >ç¡® å®</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- ä»åºæ°å¢/ä¿®æ¹å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="warehouseVisible" :title="isEdit?'ä»åºä¿®æ¹':'ä»åºæ°å¢'" width="350px"> |
| | | <el-row> |
| | | <el-col class="search_thing" :span="24"> |
| | | <div class="search_label"><span class="required-span">* </span>ä»åºåç§°ï¼</div> |
| | | <div class="search_input"> |
| | | <el-input v-model="name" size="small" @keyup.enter="confirmWarehouse"></el-input> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="warehouseVisible = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="confirmWarehouse" :loading="upLoadWarehouse">ç¡® å®</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- è´§æ¶æ°å¢/ä¿®æ¹å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="shelvesVisible" :title="isEdit?'è´§æ¶ä¿®æ¹':'è´§æ¶æ°å¢'" width="350px"> |
| | | <el-row> |
| | | <el-col class="search_thing" :span="24"> |
| | | <div class="search_label"><span class="required-span">* </span>è´§æ¶åç§°ï¼</div> |
| | | <div class="search_input"> |
| | | <el-input v-model="shelves.name" size="small"></el-input> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col class="search_thing" :span="24"> |
| | | <div class="search_label"><span class="required-span">* </span>è´§æ¶å±æ°ï¼</div> |
| | | <div class="search_input"> |
| | | <el-input v-model="shelves.row" size="small"></el-input> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col class="search_thing" :span="24"> |
| | | <div class="search_label"><span class="required-span">* </span>è´§æ¶åæ°ï¼</div> |
| | | <div class="search_input"> |
| | | <el-input v-model="shelves.col" size="small"></el-input> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="shelvesVisible = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="confirmShelves" :loading="upLoadShelves">ç¡® å®</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted, watch } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { Edit, Delete, FolderOpened, Document } from '@element-plus/icons-vue' |
| | | import { getWarehouseList, addWarehouse, updateWarehouse, deleteWarehouse, getWarehouseStructure, addShelf, updateShelf, deleteShelf } from '@/api/fileManagement/bookshelf' |
| | | import Detail from './detail.vue' |
| | | |
| | | // ååºå¼æ°æ® |
| | | const entity = reactive({ |
| | | warehouseId: null, |
| | | shelfId: null |
| | | }) |
| | | |
| | | const warehouse = ref([]) |
| | | const shelf = ref([]) |
| | | const keepVisible = ref(false) |
| | | const warehouseVisible = ref(false) |
| | | const shelvesVisible = ref(false) |
| | | const upLoadWarehouse = ref(false) |
| | | const upLoadShelves = ref(false) |
| | | const tableList = ref([]) |
| | | const rowList = ref([]) |
| | | const value = ref('') |
| | | const name = ref('') |
| | | const shelves = reactive({}) |
| | | const isEdit = ref(false) |
| | | const isDetail = ref(false) |
| | | const currentEdit = ref(null) |
| | | const tableLoading = ref(false) |
| | | const current = ref({}) |
| | | |
| | | // 模æ¿å¼ç¨ |
| | | const organization = ref(null) |
| | | |
| | | // çå¬å¨ |
| | | watch(isEdit, (newVal) => { |
| | | if (!newVal) { |
| | | Object.keys(shelves).forEach(key => delete shelves[key]) |
| | | } |
| | | }) |
| | | |
| | | // æ¹æ³ |
| | | |
| | | const selectList = async () => { |
| | | // è¿ééè¦æ¿æ¢ä¸ºå®é
çAPIè°ç¨ |
| | | const res = await getWarehouseList() |
| | | warehouse.value = res.data |
| | | |
| | | if (warehouse.value.length == 0) { |
| | | entity.warehouseId = '' |
| | | entity.shelfId = '' |
| | | tableList.value = [] |
| | | } |
| | | |
| | | |
| | | |
| | | if (!entity.warehouseId && warehouse.value.length > 0) { |
| | | entity.warehouseId = warehouse.value[0].id |
| | | warehouseChange(entity.warehouseId) |
| | | if (shelf.value.length > 0) { |
| | | entity.shelfId = shelf.value[0].id |
| | | handleShelf(entity.shelfId) |
| | | } else { |
| | | tableList.value = [] |
| | | } |
| | | } else if (warehouse.value.length > 0) { |
| | | warehouseChange(entity.warehouseId) |
| | | if (shelf.value.length > 0) { |
| | | entity.shelfId = shelf.value[0].id |
| | | handleShelf(entity.shelfId) |
| | | } else { |
| | | tableList.value = [] |
| | | } |
| | | } |
| | | } |
| | | |
| | | const confirmWarehouse = () => { |
| | | if (!name.value) { |
| | | ElMessage.error('请填åä»åºåç§°') |
| | | return |
| | | } |
| | | upLoadWarehouse.value = true |
| | | |
| | | if (currentEdit.value && currentEdit.value.id) { |
| | | // ä¿®æ¹ä»åº |
| | | // è¿ééè¦æ¿æ¢ä¸ºå®é
çAPIè°ç¨ |
| | | updateWarehouse({ |
| | | id: currentEdit.value.id, |
| | | warehouseName: name.value |
| | | }).then(res => { |
| | | upLoadWarehouse.value = false |
| | | warehouseVisible.value = false |
| | | currentEdit.value = null |
| | | ElMessage.success('ä¿®æ¹æå') |
| | | selectList() |
| | | name.value = '' |
| | | warehouseChange(entity.warehouseId) |
| | | }) |
| | | |
| | | } else { |
| | | // æ°å¢ä»åº |
| | | // è¿ééè¦æ¿æ¢ä¸ºå®é
çAPIè°ç¨ |
| | | addWarehouse({ |
| | | warehouseName: name.value |
| | | }).then(res => { |
| | | upLoadWarehouse.value = false |
| | | warehouseVisible.value = false |
| | | ElMessage.success('æ·»å æå') |
| | | selectList() |
| | | name.value = '' |
| | | warehouseChange(entity.warehouseId) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | const confirmShelves = () => { |
| | | if (!shelves.name) { |
| | | ElMessage.error('请填åè´§æ¶åç§°') |
| | | return |
| | | } |
| | | if (!shelves.row) { |
| | | ElMessage.error('请填åè´§æ¶å±æ°') |
| | | return |
| | | } |
| | | if (!shelves.col) { |
| | | ElMessage.error('请填åè´§æ¶åæ°') |
| | | return |
| | | } |
| | | upLoadShelves.value = true |
| | | |
| | | if (currentEdit.value && currentEdit.value.id) { |
| | | // ä¿®æ¹ |
| | | updateShelf({ |
| | | id: currentEdit.value.id, |
| | | name: shelves.name, |
| | | row: Number(shelves.row), |
| | | col: Number(shelves.col), |
| | | warehouseId: entity.warehouseId |
| | | }).then(res => { |
| | | upLoadShelves.value = false |
| | | shelvesVisible.value = false |
| | | ElMessage.success('ä¿®æ¹æå') |
| | | selectList() |
| | | currentEdit.value = {} |
| | | }).catch(err => { |
| | | upLoadShelves.value = false |
| | | shelvesVisible.value = false |
| | | ElMessage.error('ä¿®æ¹å¤±è´¥') |
| | | }) |
| | | |
| | | } else { |
| | | // æ°å¢ |
| | | // è¿ééè¦æ¿æ¢ä¸ºå®é
çAPIè°ç¨ |
| | | addShelf({ |
| | | name: shelves.name, |
| | | row: Number(shelves.row), |
| | | col: Number(shelves.col), |
| | | warehouseId: entity.warehouseId |
| | | }).then(res => { |
| | | upLoadShelves.value = false |
| | | shelvesVisible.value = false |
| | | ElMessage.success('æ·»å æå') |
| | | selectList() |
| | | Object.keys(shelves).forEach(key => delete shelves[key]) |
| | | }).catch(err => { |
| | | upLoadShelves.value = false |
| | | shelvesVisible.value = false |
| | | ElMessage.error('æ·»å 失败') |
| | | }) |
| | | } |
| | | warehouseChange(entity.warehouseId) |
| | | } |
| | | |
| | | |
| | | |
| | | const handleDelete = (row, level) => { |
| | | ElMessageBox.confirm('æ¯å¦å é¤å½åæ°æ®?', "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(() => { |
| | | if (level == 1) { |
| | | // å é¤ä»åº |
| | | deleteWarehouse([row.id]).then(res => { |
| | | ElMessage.success('å 餿å') |
| | | selectList() |
| | | }) |
| | | } else { |
| | | // å é¤è´§æ¶ |
| | | deleteShelf({ |
| | | id: row.id |
| | | }).then(res => { |
| | | ElMessage.success('å 餿å') |
| | | selectList() |
| | | }) |
| | | } |
| | | warehouseChange(entity.warehouseId) |
| | | }).catch(() => {}) |
| | | } |
| | | |
| | | const handleEdit = (data, level) => { |
| | | isEdit.value = true |
| | | if (level == 1) { |
| | | warehouseVisible.value = true |
| | | currentEdit.value = data |
| | | name.value = data.label |
| | | } else { |
| | | shelvesVisible.value = true |
| | | currentEdit.value = data |
| | | Object.assign(shelves, { |
| | | name: data.label, |
| | | row: data.row, |
| | | col: data.col, |
| | | warehouseId: data.warehouseId |
| | | }) |
| | | } |
| | | } |
| | | |
| | | const handelDetail = (row) => { |
| | | current.value = row |
| | | isDetail.value = true |
| | | } |
| | | |
| | | // æ ¹æ®ææ¡£ç¶æè¿å对åºçé¢è² |
| | | const getStatusColor = (status) => { |
| | | if (status === 'æ£å¸¸') { |
| | | return '#34BD66' // ç»¿è² |
| | | } else if (status === 'ååº') { |
| | | return '#F56C6C' // çº¢è² |
| | | } |
| | | return '#606266' // é»è®¤é¢è² |
| | | } |
| | | |
| | | const warehouseChange = (val) => { |
| | | tableList.value = [] |
| | | let map = warehouse.value.find(a => { |
| | | return a && a.id === val ? a : null |
| | | }) |
| | | if (map && map.children) { |
| | | shelf.value = map.children |
| | | entity.shelfId = '' |
| | | } else { |
| | | shelf.value = [] |
| | | } |
| | | currentEdit.value = null |
| | | } |
| | | |
| | | const handleShelf = async(e) => { |
| | | if (e) { |
| | | tableLoading.value = true |
| | | let data = [] |
| | | const res = await getWarehouseStructure({warehouseGoodsShelvesId:e}) |
| | | if(res.code == 200){ |
| | | data = res.data.map(m=>{ |
| | | m.books = m.documentationDtoList|[] |
| | | return m |
| | | }) |
| | | }else{ |
| | | ElMessage.error(res.message) |
| | | } |
| | | setTimeout(() => { |
| | | tableLoading.value = false |
| | | let set = new Set() |
| | | tableList.value = [] |
| | | let arr = [] |
| | | |
| | | if (data && data.length > 0) { |
| | | data.forEach(m => { |
| | | if (m && m.row && m.col) { |
| | | set.add(m.col) |
| | | if (arr.length > 0) { |
| | | if (arr.find(n => n.row == m.row)) { |
| | | arr.push(m) |
| | | } else { |
| | | tableList.value.push(arr) |
| | | arr = [] |
| | | arr.push(m) |
| | | } |
| | | } else { |
| | | arr.push(m) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | if (arr.length > 0) { |
| | | tableList.value.push(arr) |
| | | } |
| | | } |
| | | |
| | | rowList.value = [] |
| | | for (let i = 0; i < set.size; i++) { |
| | | rowList.value.push(`${i + 1} å`) |
| | | } |
| | | console.log(6666, tableList.value,rowList.value,data) |
| | | }, 1000) |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // çå½å¨æ |
| | | onMounted(() => { |
| | | selectList() |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .main-content { |
| | | width: 100%; |
| | | height: 100%; |
| | | padding: 20px; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .title { |
| | | height: 20px; |
| | | line-height: 20px; |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .search { |
| | | background-color: #fff; |
| | | height: 80px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | padding: 0 20px; |
| | | border-radius: 8px; |
| | | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .search_thing { |
| | | display: flex; |
| | | align-items: center; |
| | | height: 50px; |
| | | margin-right: 20px; |
| | | } |
| | | |
| | | .search_label { |
| | | width: 90px; |
| | | font-size: 14px; |
| | | text-align: right; |
| | | color: #606266; |
| | | font-weight: 500; |
| | | margin-right: 10px; |
| | | } |
| | | |
| | | .search_input { |
| | | width: 200px; |
| | | } |
| | | |
| | | .table { |
| | | background-color: #fff; |
| | | width: 100%; |
| | | height: calc(100% - 100px); |
| | | padding: 20px; |
| | | overflow-y: auto; |
| | | border-radius: 8px; |
| | | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .el-form-item { |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | .btns { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 10px; |
| | | } |
| | | |
| | | .tables { |
| | | width: 100%; |
| | | height: 100%; |
| | | border-collapse: collapse; |
| | | border: 1px solid #e4e7ed; |
| | | } |
| | | |
| | | .tables th { |
| | | font-size: 14px; |
| | | border: 1px solid #e4e7ed; |
| | | background-color: #fafafa; |
| | | padding: 8px; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .tables td { |
| | | font-size: 12px; |
| | | text-align: center; |
| | | vertical-align: top; |
| | | border: 1px solid #e4e7ed; |
| | | padding: 8px; |
| | | box-sizing: border-box; |
| | | height: 120px; |
| | | background-color: #fff; |
| | | } |
| | | |
| | | .tables ul { |
| | | list-style-type: none; |
| | | } |
| | | |
| | | .tables ul li { |
| | | border-radius: 3px; |
| | | padding: 4px 10px; |
| | | box-sizing: border-box; |
| | | margin-bottom: 5px; |
| | | font-size: 12px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: start; |
| | | color: #333333; |
| | | cursor: pointer; |
| | | overflow: hidden; |
| | | white-space: nowrap; |
| | | text-overflow: ellipsis; |
| | | } |
| | | |
| | | .tables h4 { |
| | | color: #999999; |
| | | font-size: 14px; |
| | | font-weight: 400; |
| | | padding: 6px 0; |
| | | } |
| | | |
| | | .tables i { |
| | | display: inline-block; |
| | | width: 6px; |
| | | height: 6px; |
| | | border-radius: 50%; |
| | | margin-right: 6px; |
| | | } |
| | | |
| | | li:hover { |
| | | background: rgba(58, 123, 250, 0.18); |
| | | } |
| | | |
| | | li:hover i { |
| | | background: #3A7BFA; |
| | | } |
| | | |
| | | li:hover .num { |
| | | color: #3A7BFA; |
| | | } |
| | | |
| | | .green { |
| | | background: #E0F6EA; |
| | | } |
| | | |
| | | .green i { |
| | | background: #34BD66; |
| | | } |
| | | |
| | | .green .num { |
| | | color: #34BD66; |
| | | } |
| | | |
| | | .el-dialog { |
| | | position: relative; |
| | | } |
| | | |
| | | .shaoma { |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 14px; |
| | | color: #3A7BFA; |
| | | position: absolute; |
| | | top: 23px; |
| | | right: 54px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .folder-icon { |
| | | color: #409eff; |
| | | font-size: 16px; |
| | | margin-right: 6px; |
| | | } |
| | | |
| | | .file-icon { |
| | | color: #67c23a; |
| | | font-size: 16px; |
| | | margin-right: 6px; |
| | | } |
| | | |
| | | .node_i { |
| | | color: orange; |
| | | font-size: 18px; |
| | | } |
| | | |
| | | .custom-tree-node .el-button { |
| | | opacity: 0; |
| | | } |
| | | |
| | | .custom-tree-node:hover .el-button { |
| | | opacity: 1; |
| | | } |
| | | |
| | | :deep(.el-loading-mask) { |
| | | z-index: 10; |
| | | } |
| | | |
| | | .required-span { |
| | | color: #f56c6c; |
| | | } |
| | | |
| | | .table-row { |
| | | border-bottom: 1px solid #e4e7ed; |
| | | } |
| | | |
| | | .table-row:last-child { |
| | | border-bottom: none; |
| | | } |
| | | |
| | | .column-header { |
| | | background-color: #fafafa !important; |
| | | font-weight: 500; |
| | | color: #606266; |
| | | } |
| | | |
| | | .content { |
| | | transition: background-color 0.2s ease; |
| | | } |
| | | |
| | | .content:hover { |
| | | background-color: #f5f7fa; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container borrow-view"> |
| | | <!-- æ¥è¯¢åºå --> |
| | | <div class="search-container"> |
| | | <el-form :model="searchForm" :inline="true" class="search-form"> |
| | | <el-form-item label="åé
ç¶æï¼"> |
| | | <el-select v-model="searchForm.borrowStatus" placeholder="è¯·éæ©åé
ç¶æ" clearable style="width: 150px"> |
| | | <el-option label="åé
" value="åé
" /> |
| | | <el-option label="å½è¿" value="å½è¿" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åé
人ï¼"> |
| | | <el-input |
| | | v-model="searchForm.borrower" |
| | | placeholder="请è¾å
¥åé
人" |
| | | clearable |
| | | style="width: 200px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="åé
æ¥æèå´ï¼"> |
| | | <el-date-picker |
| | | v-model="searchForm.dateRange" |
| | | type="daterange" |
| | | range-separator="è³" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 300px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleSearch"> |
| | | <el-icon><Search /></el-icon> |
| | | æ¥è¯¢ |
| | | </el-button> |
| | | <el-button @click="handleReset"> |
| | | <el-icon><Refresh /></el-icon> |
| | | éç½® |
| | | </el-button> |
| | | </el-form-item> |
| | | <el-form-item style="margin-left: auto;"> |
| | | <el-button type="primary" @click="openBorrowDia('add')"> |
| | | <el-icon><Plus /></el-icon> |
| | | æ°å¢åé
|
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | @click="handleBatchDelete" |
| | | :disabled="selectedRows.length === 0" |
| | | > |
| | | <el-icon><Delete /></el-icon> |
| | | æ¹éå é¤ ({{ selectedRows.length }}) |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <!-- è¡¨æ ¼åºå --> |
| | | <div class="table-container"> |
| | | <PIMTable |
| | | :table-data="borrowList" |
| | | :column="tableColumns" |
| | | :is-selection="true" |
| | | :border="true" |
| | | :table-loading="tableLoading" |
| | | :page="{ |
| | | current: pagination.currentPage, |
| | | size: pagination.pageSize, |
| | | total: pagination.total, |
| | | layout: 'total, sizes, prev, pager, next, jumper' |
| | | }" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="handlePagination" |
| | | /> |
| | | </div> |
| | | |
| | | <!-- åé
æ°å¢/ç¼è¾å¯¹è¯æ¡ --> |
| | | <el-dialog |
| | | v-model="borrowDia" |
| | | :title="borrowOperationType === 'add' ? 'æ°å¢åé
' : 'ç¼è¾åé
'" |
| | | width="800px" |
| | | @close="closeBorrowDia" |
| | | @keydown.enter.prevent |
| | | > |
| | | <el-form |
| | | :model="borrowForm" |
| | | label-width="140px" |
| | | :rules="borrowRules" |
| | | ref="borrowFormRef" |
| | | > |
| | | <el-row :gutter="20"> |
| | | |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åé
人ï¼" prop="borrower"> |
| | | <el-input v-model="borrowForm.borrower" placeholder="请è¾å
¥åé
人" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åé
书ç±ï¼" prop="documentationId"> |
| | | <el-select v-model="borrowForm.documentationId" placeholder="è¯·éæ©åé
书ç±" style="width: 100%"> |
| | | <el-option |
| | | v-for="item in documentList" |
| | | :key="item.id" |
| | | :label="item.docName || item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åé
æ¥æï¼" prop="borrowDate"> |
| | | <el-date-picker |
| | | v-model="borrowForm.borrowDate" |
| | | type="date" |
| | | placeholder="éæ©åé
æ¥æ" |
| | | style="width: 100%" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åºå½è¿æ¥æï¼" prop="dueReturnDate"> |
| | | <el-date-picker |
| | | v-model="borrowForm.dueReturnDate" |
| | | type="date" |
| | | placeholder="éæ©åºå½è¿æ¥æ" |
| | | style="width: 100%" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åé
ç®çï¼" prop="borrowPurpose"> |
| | | <el-input v-model="borrowForm.borrowPurpose" placeholder="请è¾å
¥åé
ç®ç" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="夿³¨ï¼" prop="remark"> |
| | | <el-input |
| | | v-model="borrowForm.remark" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥å¤æ³¨ä¿¡æ¯" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitBorrowForm">确认</el-button> |
| | | <el-button @click="closeBorrowDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted, getCurrentInstance } from "vue"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | import { Search, Refresh, Plus, Delete } from '@element-plus/icons-vue'; |
| | | import PIMTable from '@/components/PIMTable/PIMTable.vue'; |
| | | import { getBorrowList, addBorrow, updateBorrow, deleteBorrow, getDocumentList } from '@/api/fileManagement/borrow'; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // ååºå¼æ°æ® |
| | | const borrowDia = ref(false); |
| | | const borrowOperationType = ref(""); |
| | | const tableLoading = ref(false); |
| | | const borrowList = ref([]); |
| | | const selectedRows = ref([]); |
| | | const documentList = ref([]); // ææ¡£å表ï¼ç¨äºåé
书ç±éæ© |
| | | |
| | | // å页ç¸å
³ |
| | | const pagination = reactive({ |
| | | currentPage: 1, |
| | | pageSize: 10, |
| | | total: 0, |
| | | }); |
| | | |
| | | // æ¥è¯¢è¡¨å |
| | | const searchForm = reactive({ |
| | | documentationId: "", |
| | | borrowStatus: "", |
| | | borrower: "", |
| | | returnerId: "", |
| | | dateRange: [] |
| | | }); |
| | | |
| | | // åé
表å |
| | | const borrowForm = reactive({ |
| | | id: "", |
| | | documentationId: "", |
| | | borrower: "", |
| | | returnerId: "", |
| | | borrowPurpose: "", |
| | | borrowDate: "", |
| | | dueReturnDate: "", |
| | | returnDate: "", |
| | | borrowStatus: "", |
| | | remark: "" |
| | | }); |
| | | |
| | | // 表åéªè¯è§å |
| | | const borrowRules = reactive({ |
| | | documentationId: [{ required: true, message: "è¯·éæ©åé
书ç±", trigger: "change" }], |
| | | borrower: [{ required: true, message: "请è¾å
¥åé
人", trigger: "blur" }], |
| | | borrowPurpose: [{ required: true, message: "请è¾å
¥åé
ç®ç", trigger: "blur" }], |
| | | borrowDate: [{ required: true, message: "è¯·éæ©åé
æ¥æ", trigger: "change" }], |
| | | dueReturnDate: [{ required: true, message: "è¯·éæ©åºå½è¿æ¥æ", trigger: "change" }], |
| | | borrowStatus: [{ required: true, message: "è¯·éæ©åé
ç¶æ", trigger: "change" }] |
| | | }); |
| | | |
| | | // è¡¨æ ¼åé
ç½® |
| | | const tableColumns = ref([ |
| | | { |
| | | label: 'ææ¡£åç§°', |
| | | prop: 'documentationId', |
| | | width: '200', |
| | | formatData: (params) => { |
| | | if (!params) return '-'; |
| | | const doc = documentList.value.find(item => item.id === params); |
| | | return doc ? (doc.docName || doc.name) : params; |
| | | } |
| | | }, |
| | | { label: 'åé
人', prop: 'borrower' }, |
| | | { label: 'åé
ç®ç', prop: 'borrowPurpose' }, |
| | | { label: 'åé
æ¥æ', prop: 'borrowDate' }, |
| | | { label: 'åºå½è¿æ¥æ', prop: 'dueReturnDate' }, |
| | | { |
| | | label: 'åé
ç¶æ', |
| | | prop: 'borrowStatus', |
| | | width: '100', |
| | | dataType: 'tag', |
| | | formatData: (params) => { |
| | | if (params === null || params === undefined || params === '') return '-'; |
| | | return params; |
| | | }, |
| | | formatType: (params) => { |
| | | if (params === 'å½è¿') return 'success'; |
| | | if (params === 'åé
') return 'warning'; |
| | | return 'info'; |
| | | } |
| | | }, |
| | | { label: '夿³¨', prop: 'remark', width: '150' }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: 'right', |
| | | width: '150', |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openBorrowDia('edit', row) |
| | | }, |
| | | }, |
| | | { |
| | | name: "å é¤", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | handleDelete(row) |
| | | }, |
| | | }, |
| | | ], |
| | | } |
| | | ]); |
| | | |
| | | // åå§åæ°æ® |
| | | const initData = async () => { |
| | | await Promise.all([ |
| | | loadDocumentList(), |
| | | loadBorrowList() |
| | | ]); |
| | | }; |
| | | |
| | | // å è½½ææ¡£å表 |
| | | const loadDocumentList = async () => { |
| | | try { |
| | | const res = await getDocumentList(); |
| | | if (res.code === 200) { |
| | | documentList.value = res.data || []; |
| | | } else { |
| | | ElMessage.error(res.msg || "è·åææ¡£å表失败"); |
| | | documentList.value = []; |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("è·åææ¡£å表失败ï¼è¯·éè¯"); |
| | | documentList.value = []; |
| | | } |
| | | }; |
| | | |
| | | // å è½½åé
å表 |
| | | const loadBorrowList = async () => { |
| | | try { |
| | | tableLoading.value = true; |
| | | |
| | | // æå»ºæ¥è¯¢åæ° |
| | | const query = { |
| | | page: pagination.currentPage, |
| | | size: pagination.pageSize, |
| | | documentationId: searchForm.documentationId || undefined, |
| | | borrowStatus: searchForm.borrowStatus || undefined, |
| | | borrower: searchForm.borrower || undefined, |
| | | returnerId: searchForm.returnerId || undefined, |
| | | entryDateStart: searchForm.dateRange && searchForm.dateRange.length > 0 ? searchForm.dateRange[0] : undefined, |
| | | entryDateEnd: searchForm.dateRange && searchForm.dateRange.length > 1 ? searchForm.dateRange[1] : undefined |
| | | }; |
| | | |
| | | // ç§»é¤undefinedçåæ° |
| | | Object.keys(query).forEach(key => { |
| | | if (query[key] === undefined) { |
| | | delete query[key]; |
| | | } |
| | | }); |
| | | |
| | | const res = await getBorrowList(query); |
| | | if (res.code === 200) { |
| | | borrowList.value = res.data.records || []; |
| | | pagination.total = res.data.total || 0; |
| | | } else { |
| | | ElMessage.error(res.msg || "è·ååé
å表失败"); |
| | | borrowList.value = []; |
| | | pagination.total = 0; |
| | | } |
| | | |
| | | // éç½®éæ©ç¶æ |
| | | selectedRows.value = []; |
| | | } catch (error) { |
| | | ElMessage.error("è·ååé
å表失败ï¼è¯·éè¯"); |
| | | borrowList.value = []; |
| | | pagination.total = 0; |
| | | } finally { |
| | | tableLoading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // æ¥è¯¢ |
| | | const handleSearch = () => { |
| | | pagination.currentPage = 1; |
| | | loadBorrowList(); |
| | | }; |
| | | |
| | | // éç½®æ¥è¯¢ |
| | | const handleReset = () => { |
| | | searchForm.documentationId = ""; |
| | | searchForm.borrowStatus = ""; |
| | | searchForm.borrower = ""; |
| | | searchForm.returnerId = ""; |
| | | searchForm.dateRange = []; |
| | | pagination.currentPage = 1; |
| | | loadBorrowList(); |
| | | ElMessage.success("æ¥è¯¢æ¡ä»¶å·²éç½®"); |
| | | }; |
| | | |
| | | // æå¼åé
å¼¹æ¡ |
| | | const openBorrowDia = (type, data) => { |
| | | borrowOperationType.value = type; |
| | | borrowDia.value = true; |
| | | |
| | | if (type === "edit") { |
| | | // ç¼è¾æ¨¡å¼ï¼å è½½ç°ææ°æ® |
| | | Object.assign(borrowForm, data); |
| | | } else { |
| | | // æ°å¢æ¨¡å¼ï¼æ¸
空表å |
| | | Object.keys(borrowForm).forEach(key => { |
| | | borrowForm[key] = ""; |
| | | }); |
| | | // 设置é»è®¤ç¶æ |
| | | borrowForm.borrowStatus = "åé
"; |
| | | // 设置å½åæ¥æä¸ºåé
æ¥æ |
| | | borrowForm.borrowDate = new Date().toISOString().split('T')[0]; |
| | | } |
| | | }; |
| | | |
| | | // å
³éåé
å¼¹æ¡ |
| | | const closeBorrowDia = () => { |
| | | proxy.$refs.borrowFormRef.resetFields(); |
| | | borrowDia.value = false; |
| | | }; |
| | | |
| | | // æäº¤åé
表å |
| | | const submitBorrowForm = () => { |
| | | proxy.$refs.borrowFormRef.validate(async (valid) => { |
| | | if (valid) { |
| | | try { |
| | | if (borrowOperationType.value === "edit") { |
| | | // ç¼è¾æ¨¡å¼ï¼æ´æ°ç°ææ°æ® |
| | | const res = await updateBorrow({ |
| | | borrower:borrowForm.borrower, |
| | | id: borrowForm.id, |
| | | borrowPurpose: borrowForm.borrowPurpose, |
| | | borrowDate: borrowForm.borrowDate, |
| | | dueReturnDate: borrowForm.dueReturnDate, |
| | | returnDate: borrowForm.returnDate, |
| | | remark: borrowForm.remark |
| | | }); |
| | | |
| | | if (res.code === 200) { |
| | | ElMessage.success("ç¼è¾æå"); |
| | | await loadBorrowList(); |
| | | closeBorrowDia(); |
| | | } else { |
| | | ElMessage.error(res.msg || "ç¼è¾å¤±è´¥"); |
| | | } |
| | | } else { |
| | | // æ°å¢æ¨¡å¼ï¼æ·»å æ°æ°æ® |
| | | const res = await addBorrow({ |
| | | documentationId: borrowForm.documentationId, |
| | | borrower: borrowForm.borrower, |
| | | returnerId: borrowForm.returnerId, |
| | | borrowPurpose: borrowForm.borrowPurpose, |
| | | borrowDate: borrowForm.borrowDate, |
| | | dueReturnDate: borrowForm.dueReturnDate, |
| | | returnDate: borrowForm.returnDate, |
| | | borrowStatus: borrowForm.borrowStatus, |
| | | remark: borrowForm.remark |
| | | }); |
| | | |
| | | if (res.code === 200) { |
| | | ElMessage.success("æ°å¢æå"); |
| | | await loadBorrowList(); |
| | | closeBorrowDia(); |
| | | } else { |
| | | ElMessage.error(res.msg || "æ°å¢å¤±è´¥"); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("æä½å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // å é¤åé
è®°å½ |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm( |
| | | `ç¡®å®è¦å é¤è¿æ¡åé
è®°å½åï¼`, |
| | | "å é¤æç¤º", |
| | | { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | } |
| | | ).then(async () => { |
| | | try { |
| | | const res = await deleteBorrow([row.id]); |
| | | if (res.code === 200) { |
| | | ElMessage.success("å 餿å"); |
| | | await loadBorrowList(); |
| | | } else { |
| | | ElMessage.error(res.msg || "å é¤å¤±è´¥"); |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("å é¤å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | }).catch(() => { |
| | | ElMessage.info("已忶å é¤"); |
| | | }); |
| | | }; |
| | | |
| | | // æ¹éå é¤ |
| | | const handleBatchDelete = () => { |
| | | if (selectedRows.value.length === 0) { |
| | | ElMessage.warning("è¯·éæ©è¦å é¤çè®°å½"); |
| | | return; |
| | | } |
| | | |
| | | ElMessageBox.confirm( |
| | | `ç¡®å®è¦å é¤éä¸ç ${selectedRows.value.length} æ¡åé
è®°å½åï¼`, |
| | | "æ¹éå é¤æç¤º", |
| | | { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | } |
| | | ).then(async () => { |
| | | try { |
| | | const selectedIds = selectedRows.value.map(row => row.id); |
| | | const res = await deleteBorrow(selectedIds); |
| | | if (res.code === 200) { |
| | | ElMessage.success("æ¹éå 餿å"); |
| | | await loadBorrowList(); |
| | | } else { |
| | | ElMessage.error(res.msg || "æ¹éå é¤å¤±è´¥"); |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("æ¹éå é¤å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | }).catch(() => { |
| | | ElMessage.info("已忶å é¤"); |
| | | }); |
| | | }; |
| | | |
| | | // éæ©ååäºä»¶ |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | // å¤çå页åå |
| | | const handlePagination = (current, size) => { |
| | | pagination.currentPage = current; |
| | | pagination.pageSize = size; |
| | | loadBorrowList(); |
| | | }; |
| | | |
| | | // çå½å¨æ |
| | | onMounted(() => { |
| | | initData(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .borrow-view { |
| | | padding: 20px; |
| | | } |
| | | |
| | | .search-container { |
| | | background: #ffffff; |
| | | padding: 20px; |
| | | border-radius: 8px; |
| | | margin-bottom: 20px; |
| | | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .search-form { |
| | | margin: 0; |
| | | } |
| | | |
| | | .table-container { |
| | | background: #ffffff; |
| | | border-radius: 8px; |
| | | overflow: hidden; |
| | | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .empty-data { |
| | | text-align: center; |
| | | color: #909399; |
| | | padding: 40px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .dialog-footer { |
| | | text-align: right; |
| | | } |
| | | |
| | | :deep(.el-form-item__label) { |
| | | font-weight: 500; |
| | | color: #303133; |
| | | } |
| | | |
| | | :deep(.el-input__wrapper) { |
| | | box-shadow: 0 0 0 1px #dcdfe6 inset; |
| | | } |
| | | |
| | | :deep(.el-input__wrapper:hover) { |
| | | box-shadow: 0 0 0 1px #c0c4cc inset; |
| | | } |
| | | |
| | | :deep(.el-input__wrapper.is-focus) { |
| | | box-shadow: 0 0 0 1px #409eff inset; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog v-model="dialogVisible" title="é件管ç" width="60%" :before-close="handleClose"> |
| | | <div class="attachment-manager"> |
| | | <!-- ä¸ä¼ åºå --> |
| | | <div class="upload-section"> |
| | | <el-upload |
| | | ref="uploadRef" |
| | | :action="uploadUrl" |
| | | :headers="uploadHeaders" |
| | | :before-upload="handleBeforeUpload" |
| | | :on-success="handleUploadSuccess" |
| | | :on-error="handleUploadError" |
| | | :on-remove="handleRemove" |
| | | :file-list="fileList" |
| | | multiple |
| | | :limit="10" |
| | | :show-file-list="false" |
| | | :data="{documentId: currentDocumentId}" |
| | | accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.txt,.xml,.jpg,.jpeg,.png,.gif,.bmp,.rar,.zip,.7z" |
| | | > |
| | | <el-button type="primary" :icon="Plus">ä¸ä¼ éä»¶</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 |
| | | <br>å个æä»¶å¤§å°ä¸è¶
è¿50MB |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | | </div> |
| | | |
| | | <!-- éä»¶å表 --> |
| | | <div class="attachment-list"> |
| | | <el-table :data="fileList" border height="400px" v-loading="loading"> |
| | | <el-table-column label="åºå·" type="index" width="60" align="center" /> |
| | | <el-table-column label="éä»¶åç§°" prop="name" min-width="200" show-overflow-tooltip /> |
| | | <el-table-column label="æä»¶å¤§å°" prop="size" width="100" align="center"> |
| | | <template #default="scope"> |
| | | {{ formatFileSize(scope.row.size) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ä¸ä¼ æ¶é´" prop="uploadTime" width="160" align="center"> |
| | | <template #default="scope"> |
| | | {{ formatDate(scope.row.uploadTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç¶æ" prop="status" width="80" align="center"> |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.status === 'success' ? 'success' : 'danger'" size="small"> |
| | | {{ scope.row.status === 'success' ? 'æå' : '失败' }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" label="æä½" width="200" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="previewFile(scope.row)"> |
| | | é¢è§ |
| | | </el-button> |
| | | <el-button link type="primary" size="small" @click="downloadFile(scope.row)"> |
| | | ä¸è½½ |
| | | </el-button> |
| | | <el-button link type="danger" size="small" @click="removeFile(scope.row)"> |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- æä»¶é¢è§ç»ä»¶ --> |
| | | <filePreview ref="filePreviewRef" /> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { Plus } from '@element-plus/icons-vue' |
| | | import { getToken } from "@/utils/auth" |
| | | import { addDocumentationFile, getDocumentationFileList, deleteDocumentationFile } from '@/api/fileManagement/document' |
| | | import filePreview from '@/components/filePreview/index.vue' |
| | | |
| | | const props = defineProps({ |
| | | // documentId éè¿ open äºä»¶ä¼ å
¥ï¼ä¸éè¦ä½ä¸º props |
| | | }) |
| | | |
| | | const emit = defineEmits(['update:attachments']) |
| | | |
| | | const dialogVisible = ref(false) |
| | | const loading = ref(false) |
| | | const fileList = ref([]) |
| | | const uploadRef = ref() |
| | | const filePreviewRef = ref() |
| | | const currentDocumentId = ref('') // å
é¨ç®¡çå½åææ¡£ID |
| | | |
| | | // ä¸ä¼ é
ç½® |
| | | const uploadUrl = import.meta.env.VITE_APP_BASE_API + "/file/upload" |
| | | const uploadHeaders = computed(() => ({ |
| | | Authorization: "Bearer " + getToken() |
| | | })) |
| | | |
| | | // æå¼å¼¹æ¡ |
| | | const open = (attachments = [], documentId = '') => { |
| | | dialogVisible.value = true |
| | | currentDocumentId.value = documentId // 设置å½åææ¡£ID |
| | | // å¦ææææ¡£IDï¼åå è½½éä»¶å表 |
| | | if (documentId) { |
| | | loadAttachmentList(documentId) |
| | | } else { |
| | | fileList.value = attachments || [] |
| | | // total.value = fileList.value.length // Removed total.value |
| | | } |
| | | // currentPage.value = 1 // Removed currentPage.value |
| | | } |
| | | |
| | | // å è½½éä»¶å表 |
| | | const loadAttachmentList = async (documentId) => { |
| | | try { |
| | | loading.value = true |
| | | const params = { |
| | | page: 1, // Always load from page 1 |
| | | size: 1000, // Load all for now |
| | | documentationId: documentId |
| | | } |
| | | |
| | | const res = await getDocumentationFileList(params) |
| | | if (res.code === 200) { |
| | | const records = res.data |
| | | |
| | | // è½¬æ¢æ°æ®æ ¼å¼ |
| | | fileList.value = records.map(item => ({ |
| | | id: item.id, |
| | | name: item.name, |
| | | size: item.fileSize, |
| | | url: item.url, |
| | | uploadTime: item.createTime || item.uploadTime, |
| | | status: 'success', |
| | | uid: item.id |
| | | })) |
| | | |
| | | // total.value = totalCount // Removed total.value |
| | | } else { |
| | | ElMessage.error(res.msg || 'è·åéä»¶å表失败') |
| | | fileList.value = [] |
| | | // total.value = 0 // Removed total.value |
| | | } |
| | | } catch (error) { |
| | | console.error('è·åéä»¶å表失败:', error) |
| | | ElMessage.error('è·åéä»¶å表失败') |
| | | fileList.value = [] |
| | | // total.value = 0 // Removed total.value |
| | | } finally { |
| | | loading.value = false |
| | | } |
| | | } |
| | | |
| | | // å
³éå¼¹æ¡ |
| | | const handleClose = () => { |
| | | dialogVisible.value = false |
| | | emit('update:attachments', fileList.value) |
| | | } |
| | | |
| | | // æä»¶ä¸ä¼ åæ ¡éª |
| | | const handleBeforeUpload = (file) => { |
| | | // æ£æ¥æä»¶å¤§å°ï¼50MBï¼ |
| | | const isLt50M = file.size / 1024 / 1024 < 50 |
| | | if (!isLt50M) { |
| | | ElMessage.error('æä»¶å¤§å°ä¸è½è¶
è¿50MB!') |
| | | return false |
| | | } |
| | | |
| | | // æ£æ¥æä»¶ç±»å |
| | | const allowedTypes = [ |
| | | 'application/msword', |
| | | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', |
| | | 'application/vnd.ms-excel', |
| | | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', |
| | | 'application/vnd.ms-powerpoint', |
| | | 'application/vnd.openxmlformats-officedocument.presentationml.presentation', |
| | | 'application/pdf', |
| | | 'text/plain', |
| | | 'text/xml', |
| | | 'image/jpeg', |
| | | 'image/png', |
| | | 'image/gif', |
| | | 'image/bmp', |
| | | 'application/x-rar-compressed', |
| | | 'application/zip', |
| | | 'application/x-7z-compressed' |
| | | ] |
| | | |
| | | if (!allowedTypes.includes(file.type)) { |
| | | ElMessage.error('䏿¯æçæä»¶ç±»å!') |
| | | return false |
| | | } |
| | | |
| | | return true |
| | | } |
| | | |
| | | // æä»¶ä¸ä¼ æå |
| | | const handleUploadSuccess = (response, file, fileList) => { |
| | | console.log('æä»¶ä¸ä¼ æåååº:', response); |
| | | console.log('æä»¶ä¿¡æ¯:', file); |
| | | |
| | | if (response.code === 200) { |
| | | // æå»ºéä»¶æ°æ® - ç¡®ä¿æ£ç¡®è·åURL |
| | | const attachmentData = { |
| | | name: file.name, |
| | | url: response.data.url || response.data.path || response.data.tempPath || file.url, |
| | | fileSize: file.size, |
| | | documentationId: currentDocumentId.value |
| | | }; |
| | | |
| | | console.log('æå»ºçéä»¶æ°æ®:', attachmentData); |
| | | |
| | | // è°ç¨ä¿åéä»¶æ¥å£ |
| | | saveAttachment(attachmentData, file, fileList); |
| | | } else { |
| | | ElMessage.error(response.msg || 'æä»¶ä¸ä¼ 失败') |
| | | } |
| | | } |
| | | |
| | | // ä¿åéä»¶ä¿¡æ¯ |
| | | const saveAttachment = async (attachmentData, file, fileList) => { |
| | | try { |
| | | console.log('å¼å§ä¿åéä»¶ï¼æ°æ®:', attachmentData); |
| | | |
| | | // ç¡®ä¿URLåæ®µåå¨ä¸ææ |
| | | if (!attachmentData.url) { |
| | | console.error('éä»¶URLä¸ºç©ºï¼æ æ³ä¿å'); |
| | | ElMessage.error('æä»¶URLè·åå¤±è´¥ï¼æ æ³ä¿åéä»¶'); |
| | | return; |
| | | } |
| | | |
| | | const res = await addDocumentationFile(attachmentData); |
| | | console.log('ä¿åéä»¶æ¥å£ååº:', res); |
| | | |
| | | if (res.code === 200) { |
| | | const newFile = { |
| | | id: res.data.id || Date.now(), |
| | | name: attachmentData.name, |
| | | size: attachmentData.fileSize, |
| | | url: attachmentData.url, |
| | | uploadTime: new Date().toISOString(), |
| | | status: 'success', |
| | | uid: file.uid |
| | | } |
| | | |
| | | console.log('åå»ºçæ°æä»¶å¯¹è±¡:', newFile); |
| | | fileList.push(newFile) |
| | | ElMessage.success('æä»¶ä¸ä¼ å¹¶ä¿åæå') |
| | | |
| | | // ä¿åæååå·æ°éä»¶å表 |
| | | if (currentDocumentId.value) { |
| | | await loadAttachmentList(currentDocumentId.value); |
| | | } |
| | | } else { |
| | | ElMessage.error(res.msg || 'ä¿åéä»¶ä¿¡æ¯å¤±è´¥') |
| | | // ä¿å失败æ¶ç§»é¤æä»¶ |
| | | const index = fileList.findIndex(item => item.uid === file.uid) |
| | | if (index > -1) { |
| | | fileList.splice(index, 1) |
| | | } |
| | | } |
| | | } catch (error) { |
| | | console.error('ä¿åé件失败:', error) |
| | | ElMessage.error('ä¿åéä»¶ä¿¡æ¯å¤±è´¥') |
| | | // ä¿å失败æ¶ç§»é¤æä»¶ |
| | | const index = fileList.findIndex(item => item.uid === file.uid) |
| | | if (index > -1) { |
| | | fileList.splice(index, 1) |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æä»¶ä¸ä¼ 失败 |
| | | const handleUploadError = (error, file, fileList) => { |
| | | console.error('æä»¶ä¸ä¼ 失败:', error); |
| | | console.error('失败çæä»¶:', file); |
| | | console.error('å½åæä»¶å表:', fileList); |
| | | |
| | | ElMessage.error('æä»¶ä¸ä¼ 失败ï¼è¯·æ£æ¥ç½ç»è¿æ¥ææä»¶æ ¼å¼') |
| | | } |
| | | |
| | | // ç§»é¤æä»¶ |
| | | const handleRemove = (file, fileList) => { |
| | | const index = fileList.findIndex(item => item.uid === file.uid) |
| | | if (index > -1) { |
| | | fileList.splice(index, 1) |
| | | // total.value = fileList.length // Removed total.value |
| | | } |
| | | } |
| | | |
| | | // å 餿件 |
| | | const removeFile = (file) => { |
| | | ElMessageBox.confirm(`ç¡®å®è¦å 餿件 "${file.name}" åï¼`, 'å é¤ç¡®è®¤', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(async () => { |
| | | try { |
| | | // è°ç¨å 餿¥å£ |
| | | const res = await deleteDocumentationFile([file.id]); |
| | | if (res.code === 200) { |
| | | // 仿¬å°å表ä¸ç§»é¤ |
| | | const index = fileList.value.findIndex(item => item.id === file.id); |
| | | if (index > -1) { |
| | | fileList.value.splice(index, 1); |
| | | } |
| | | ElMessage.success('å 餿å'); |
| | | |
| | | // å¦ææææ¡£IDï¼å·æ°éä»¶å表 |
| | | if (currentDocumentId.value) { |
| | | await loadAttachmentList(currentDocumentId.value); |
| | | } |
| | | } else { |
| | | ElMessage.error(res.msg || 'å é¤å¤±è´¥'); |
| | | } |
| | | } catch (error) { |
| | | console.error('å é¤é件失败:', error); |
| | | ElMessage.error('å é¤é件失败'); |
| | | } |
| | | }).catch(() => { |
| | | // åæ¶å é¤ |
| | | }) |
| | | } |
| | | |
| | | // é¢è§æä»¶ |
| | | const previewFile = (file) => { |
| | | if (file.url) { |
| | | filePreviewRef.value.open(file.url) |
| | | } else { |
| | | ElMessage.warning('æä»¶å°åæ æï¼æ æ³é¢è§') |
| | | } |
| | | } |
| | | |
| | | // ä¸è½½æä»¶ |
| | | const downloadFile = (file) => { |
| | | if (file.url) { |
| | | // å建ä¸è½½é¾æ¥ |
| | | const link = document.createElement('a') |
| | | link.href = file.url |
| | | link.download = file.name |
| | | document.body.appendChild(link) |
| | | link.click() |
| | | document.body.removeChild(link) |
| | | ElMessage.success('å¼å§ä¸è½½æä»¶') |
| | | } else { |
| | | ElMessage.warning('æä»¶å°åæ æï¼æ æ³ä¸è½½') |
| | | } |
| | | } |
| | | |
| | | // æ ¼å¼åæä»¶å¤§å° |
| | | const formatFileSize = (bytes) => { |
| | | if (bytes === 0) return '0 B' |
| | | const k = 1024 |
| | | const sizes = ['B', 'KB', 'MB', 'GB'] |
| | | const i = Math.floor(Math.log(bytes) / Math.log(k)) |
| | | return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i] |
| | | } |
| | | |
| | | // æ ¼å¼åæ¥æ |
| | | const formatDate = (dateString) => { |
| | | if (!dateString) return '' |
| | | const date = new Date(dateString) |
| | | return date.toLocaleString('zh-CN', { |
| | | year: 'numeric', |
| | | month: '2-digit', |
| | | day: '2-digit', |
| | | hour: '2-digit', |
| | | minute: '2-digit' |
| | | }) |
| | | } |
| | | |
| | | // æµè¯æä»¶ä¸ä¼ |
| | | const testUpload = () => { |
| | | console.log('å½åææ¡£ID:', currentDocumentId.value); |
| | | console.log('ä¸ä¼ URL:', uploadUrl); |
| | | console.log('ä¸ä¼ Headers:', uploadHeaders.value); |
| | | } |
| | | |
| | | // æ´é²æ¹æ³ |
| | | defineExpose({ |
| | | open, |
| | | loadAttachmentList, |
| | | testUpload |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .attachment-manager { |
| | | padding: 20px; |
| | | } |
| | | |
| | | .upload-section { |
| | | margin-bottom: 20px; |
| | | padding: 20px; |
| | | background-color: #f8f9fa; |
| | | border-radius: 8px; |
| | | border: 2px dashed #d9d9d9; |
| | | } |
| | | |
| | | .upload-section:hover { |
| | | border-color: #409eff; |
| | | } |
| | | |
| | | .attachment-list { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .el-upload__tip { |
| | | margin-top: 10px; |
| | | color: #666; |
| | | font-size: 12px; |
| | | line-height: 1.5; |
| | | } |
| | | |
| | | :deep(.el-upload) { |
| | | width: 100%; |
| | | } |
| | | |
| | | :deep(.el-upload-dragger) { |
| | | width: 100%; |
| | | height: 120px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container document-view"> |
| | | <div class="left"> |
| | | <div> |
| | | <el-input |
| | | v-model="search" |
| | | style="width: 210px" |
| | | placeholder="è¾å
¥å
³é®åè¿è¡æç´¢" |
| | | @change="searchFilter" |
| | | @clear="searchFilter" |
| | | clearable |
| | | prefix-icon="Search" |
| | | /> |
| | | <el-button |
| | | type="primary" |
| | | @click="openCategoryDia('addOne')" |
| | | style="margin-left: 10px" |
| | | >æ°å¢åç±»</el-button |
| | | > |
| | | </div> |
| | | <div ref="containerRef"> |
| | | <el-tree |
| | | ref="tree" |
| | | v-loading="treeLoad" |
| | | :data="categoryList" |
| | | @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: 'category' }" |
| | | highlight-current |
| | | node-key="id" |
| | | style=" |
| | | height: calc(100vh - 190px); |
| | | overflow-y: scroll; |
| | | scrollbar-width: none; |
| | | margin-top: 10px; |
| | | " |
| | | > |
| | | <template #default="{ node, data }"> |
| | | <div class="custom-tree-node"> |
| | | <span class="tree-node-content"> |
| | | <el-icon class="orange-icon"> |
| | | <component :is="data.children && data.children.length > 0 |
| | | ? node.expanded ? 'FolderOpened' : 'Folder' : 'Tickets'" /> |
| | | </el-icon> |
| | | {{ data.category }} |
| | | </span> |
| | | <div> |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | @click="openCategoryDia('edit', data)" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | @click="openCategoryDia('addSub', data)" |
| | | v-if="node.level < 2" |
| | | > |
| | | æ·»å ååç±» |
| | | </el-button> |
| | | <el-button |
| | | v-if="!node.childNodes.length" |
| | | style="margin-left: 4px" |
| | | type="danger" |
| | | link |
| | | @click="removeCategory(node, data)" |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </el-tree> |
| | | </div> |
| | | </div> |
| | | <div class="right"> |
| | | <div style="margin-bottom: 10px" v-if="isShowButton"> |
| | | <el-button type="primary" @click="openDocumentDia('add')"> |
| | | æ°å¢ææ¡£ |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | @click="handleDelete" |
| | | style="margin-left: 10px" |
| | | plain |
| | | :disabled="selectedRows.length === 0" |
| | | > |
| | | å é¤ ({{ selectedRows.length }}) |
| | | </el-button> |
| | | </div> |
| | | <div class="table-container"> |
| | | |
| | | <!-- PIMTable ç»ä»¶ --> |
| | | <PIMTable |
| | | :table-data="documentList" |
| | | :column="tableColumns" |
| | | :is-selection="true" |
| | | :border="true" |
| | | :table-loading="tableLoading" |
| | | :page="{ |
| | | current: pagination.currentPage, |
| | | size: pagination.pageSize, |
| | | total: pagination.total, |
| | | layout: 'total, sizes, prev, pager, next, jumper' |
| | | }" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="handlePagination" |
| | | /> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- åç±»æ°å¢/ä¿®æ¹å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="categoryDia" title="åç±»" width="400px" @keydown.enter.prevent> |
| | | <el-form |
| | | :model="categoryForm" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="categoryRules" |
| | | ref="categoryFormRef" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24" v-if="categoryOperationType === 'addSub'"> |
| | | <el-form-item label="ç¶åç±»ï¼" prop="parentName"> |
| | | <el-input |
| | | v-model="categoryForm.parentName" |
| | | placeholder="ç¶åç±»åç§°" |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åç±»åç§°ï¼" prop="category"> |
| | | <el-input |
| | | v-model="categoryForm.category" |
| | | placeholder="请è¾å
¥åç±»åç§°" |
| | | clearable |
| | | @keydown.enter.prevent |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitCategoryForm">确认</el-button> |
| | | <el-button @click="closeCategoryDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- ææ¡£æ°å¢/ä¿®æ¹å¯¹è¯æ¡ --> |
| | | <el-dialog |
| | | v-model="documentDia" |
| | | :title="documentOperationType === 'add' ? 'æ°å¢ææ¡£' : 'ç¼è¾ææ¡£'" |
| | | width="600px" |
| | | @close="closeDocumentDia" |
| | | @keydown.enter.prevent |
| | | > |
| | | <el-form |
| | | :model="documentForm" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="documentRules" |
| | | ref="documentFormRef" |
| | | > |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ¡£åç§°ï¼" prop="docName"> |
| | | <el-input v-model="documentForm.docName" placeholder="请è¾å
¥" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="年度ï¼" prop="year"> |
| | | <el-date-picker |
| | | v-model="documentForm.year" |
| | | type="year" |
| | | value-format="YYYY" |
| | | format="YYYY" |
| | | placeholder="éæ©å¹´åº¦" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ¡£ç¼å·ï¼" prop="docNumber"> |
| | | <el-input v-model="documentForm.docNumber" placeholder="请è¾å
¥" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="责任人ï¼" prop="responsiblePerson"> |
| | | <el-input v-model="documentForm.responsiblePerson" placeholder="请è¾å
¥" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ¡£åç±»ï¼" prop="documentClassificationId"> |
| | | <el-select v-model="documentForm.documentClassificationId" placeholder="è¯·éæ©ææ¡£åç±»" style="width: 100%"> |
| | | <el-option |
| | | v-for="item in categoryList" |
| | | :key="item.id" |
| | | :label="item.category" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ¡£æ¾ç½®ä½ç½®ï¼" prop="warehouseGoodsShelvesRowcolId"> |
| | | <el-tree-select |
| | | v-model="documentForm.warehouseGoodsShelvesRowcolId" |
| | | :data="locationTree" |
| | | placeholder="è¯·éæ©æä»¶æ¾ç½®ä½ç½®" |
| | | clearable |
| | | check-strictly |
| | | :render-after-expand="false" |
| | | :props="{ children: 'children', label: 'label', value: 'value' }" |
| | | style="width: 100%" |
| | | @change="handleLocationChange" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ¡£æ¥æï¼" prop="docData"> |
| | | <el-date-picker |
| | | v-model="documentForm.docData" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | placeholder="éæ©æ¥æ" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¿ç®¡æéï¼" prop="retentionPeriod"> |
| | | <el-select v-model="documentForm.retentionPeriod" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in retention_period" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¿å¯çº§å«ï¼" prop="securityLevel"> |
| | | <el-select v-model="documentForm.securityLevel" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in confidentiality_level" |
| | | :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="copyCount"> |
| | | <el-input v-model="documentForm.copyCount" placeholder="请è¾å
¥" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="页æ°ï¼" prop="pageCount"> |
| | | <el-input v-model="documentForm.pageCount" placeholder="请è¾å
¥" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ¡£ç±»å«ï¼" prop="docCategory"> |
| | | <el-select v-model="documentForm.docCategory" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in document_type" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ¡£ç§ç±»ï¼" prop="docType"> |
| | | <el-select v-model="documentForm.docType" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in document_categories" |
| | | :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="urgencyLevel"> |
| | | <el-select v-model="documentForm.urgencyLevel" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in document_urgency" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ¡£ç¶æï¼" prop="docStatus"> |
| | | <el-select v-model="documentForm.docStatus" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="item in document_status" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="夿³¨ï¼" prop="remark"> |
| | | <el-input |
| | | v-model="documentForm.remark" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥å¤æ³¨ä¿¡æ¯" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitDocumentForm">确认</el-button> |
| | | <el-button @click="closeDocumentDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <AttachmentManager ref="attachmentManagerRef" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted, getCurrentInstance, toRefs, watch } from "vue"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | import { ArrowRight, Folder, FolderOpened, Tickets, Document } from '@element-plus/icons-vue'; |
| | | import PIMTable from '@/components/PIMTable/PIMTable.vue'; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { getCategoryTree, addCategory, updateCategory, deleteCategory, getDocumentList, addDocument, updateDocument, deleteDocument, getDocumentDetail, searchDocument, getWarehouseStructure } from '@/api/fileManagement/document' |
| | | import { getWarehouseList } from '@/api/fileManagement/bookshelf' |
| | | import AttachmentManager from './attachmentManager.vue' |
| | | import { useDict } from '@/utils/dict' |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const tree = ref(null); |
| | | const containerRef = ref(null); |
| | | |
| | | // 使ç¨åå
¸æ°æ® |
| | | const { confidentiality_level, document_urgency, document_status, document_type, document_categories, retention_period } = useDict('confidentiality_level', 'document_urgency', 'document_status', 'document_type', 'document_categories', 'retention_period') |
| | | |
| | | // çå¬åå
¸æ°æ®åå |
| | | watch([confidentiality_level, document_urgency, document_status, document_type, document_categories, retention_period], () => { |
| | | // åå
¸æ°æ®å·²æ´æ° |
| | | }, { immediate: true, deep: true }); |
| | | |
| | | const categoryDia = ref(false); |
| | | const documentDia = ref(false); |
| | | const categoryOperationType = ref(""); |
| | | const documentOperationType = ref(""); |
| | | const search = ref(""); |
| | | const currentId = ref(""); |
| | | const currentParentId = ref(""); |
| | | const treeLoad = ref(false); |
| | | const categoryList = ref([]); |
| | | const expandedKeys = ref([]); |
| | | const documentList = ref([]); |
| | | const isShowButton = ref(false); |
| | | const selectedRows = ref([]); |
| | | const selectAll = ref(false); |
| | | const isIndeterminate = ref(false); |
| | | const tableLoading = ref(false); |
| | | const attachmentManagerRef = ref(null); |
| | | |
| | | // æä»¶ä¸ä¼ é
ç½® |
| | | const upload = reactive({ |
| | | url: import.meta.env.VITE_APP_BASE_API + "/file/upload", |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | }); |
| | | |
| | | // ä½ç½®æ æ°æ® |
| | | const locationTree = ref([]); |
| | | |
| | | // è¡¨æ ¼åé
ç½® |
| | | const tableColumns = ref([ |
| | | { label: 'ææ¡£åç§°', prop: 'docName', width: '200' }, |
| | | { label: 'ææ¡£ç¼å·', prop: 'docNumber', width: '120' }, |
| | | { label: '年度', prop: 'year', width: '80' }, |
| | | { label: '责任人', prop: 'responsiblePerson', width: '100' }, |
| | | { |
| | | label: 'ææ¡£æ¾ç½®ä½ç½®', |
| | | prop: 'warehouseGoodsShelvesRowcolId', |
| | | width: '150', |
| | | formatData: (params) => { |
| | | if (params === null || params === undefined || params === '') return '-'; |
| | | return getLocationName(params); |
| | | } |
| | | }, |
| | | { label: 'ææ¡£æ¥æ', prop: 'docData', width: '120' }, |
| | | { |
| | | label: 'ä¿ç®¡æé', |
| | | prop: 'retentionPeriod', |
| | | width: '100', |
| | | dataType: 'tag', |
| | | formatData: (params) => { |
| | | if (params === null || params === undefined || params === '') return '-'; |
| | | if (!retention_period.value || retention_period.value.length === 0) { |
| | | return params; |
| | | } |
| | | const item = retention_period.value.find(item => item.value == params); |
| | | return item ? item.label : params; |
| | | }, |
| | | formatType: (params) => { |
| | | if (params === null || params === undefined || params === '') return 'info'; |
| | | if (!retention_period.value || retention_period.value.length === 0) { |
| | | return 'info'; |
| | | } |
| | | const item = retention_period.value.find(item => item.value == params); |
| | | const validTypes = ['success', 'warning', 'danger', 'info']; |
| | | return item && validTypes.includes(item.elTagType) ? item.elTagType : 'info'; |
| | | } |
| | | }, |
| | | { |
| | | label: 'ä¿å¯çº§å«', |
| | | prop: 'securityLevel', |
| | | width: '80', |
| | | dataType: 'tag', |
| | | formatData: (params) => { |
| | | if (params === null || params === undefined || params === '') return '-'; |
| | | if (!confidentiality_level.value || confidentiality_level.value.length === 0) { |
| | | return params; |
| | | } |
| | | const item = confidentiality_level.value.find(item => item.value == params); |
| | | return item ? item.label : params; |
| | | }, |
| | | formatType: (params) => { |
| | | if (params === null || params === undefined || params === '') return 'info'; |
| | | if (!confidentiality_level.value || confidentiality_level.value.length === 0) { |
| | | return 'info'; |
| | | } |
| | | const item = confidentiality_level.value.find(item => item.value == params); |
| | | const validTypes = ['success', 'warning', 'danger', 'info']; |
| | | return item && validTypes.includes(item.elTagType) ? item.elTagType : 'info'; |
| | | } |
| | | }, |
| | | { label: 'åæ°', prop: 'copyCount', width: '80' }, |
| | | { label: '页æ°', prop: 'pageCount', width: '80' }, |
| | | { |
| | | label: 'ææ¡£ç±»å«', |
| | | prop: 'docCategory', |
| | | width: '100', |
| | | dataType: 'tag', |
| | | formatData: (params) => { |
| | | if (params === null || params === undefined || params === '') return '-'; |
| | | if (!document_type.value || document_type.value.length === 0) { |
| | | return params; |
| | | } |
| | | const item = document_type.value.find(item => item.value == params); |
| | | return item ? item.label : params; |
| | | }, |
| | | formatType: (params) => { |
| | | if (params === null || params === undefined || params === '') return 'info'; |
| | | if (!document_type.value || document_type.value.length === 0) { |
| | | return 'info'; |
| | | } |
| | | const item = document_type.value.find(item => item.value == params); |
| | | const validTypes = ['success', 'warning', 'danger', 'info']; |
| | | return item && validTypes.includes(item.elTagType) ? item.elTagType : 'info'; |
| | | } |
| | | }, |
| | | { |
| | | label: 'ææ¡£ç§ç±»', |
| | | prop: 'docType', |
| | | width: '100', |
| | | dataType: 'tag', |
| | | formatData: (params) => { |
| | | if (params === null || params === undefined || params === '') return '-'; |
| | | if (!document_categories.value || document_categories.value.length === 0) { |
| | | return params; |
| | | } |
| | | const item = document_categories.value.find(item => item.value == params); |
| | | return item ? item.label : params; |
| | | }, |
| | | formatType: (params) => { |
| | | if (params === null || params === undefined || params === '') return 'info'; |
| | | if (!document_categories.value || document_categories.value.length === 0) { |
| | | return 'info'; |
| | | } |
| | | const item = document_categories.value.find(item => item.value == params); |
| | | const validTypes = ['success', 'warning', 'danger', 'info']; |
| | | return item && validTypes.includes(item.elTagType) ? item.elTagType : 'info'; |
| | | } |
| | | }, |
| | | { |
| | | label: 'ç´§æ¥ç¨åº¦', |
| | | prop: 'urgencyLevel', |
| | | width: '100', |
| | | dataType: 'tag', |
| | | formatData: (params) => { |
| | | if (params === null || params === undefined || params === '') return '-'; |
| | | if (!document_urgency.value || document_urgency.value.length === 0) { |
| | | return params; |
| | | } |
| | | const item = document_urgency.value.find(item => item.value == params); |
| | | return item ? item.label : params; |
| | | }, |
| | | formatType: (params) => { |
| | | if (params === null || params === undefined || params === '') return 'info'; |
| | | if (!document_urgency.value || document_urgency.value.length === 0) { |
| | | return 'info'; |
| | | } |
| | | const item = document_urgency.value.find(item => item.value == params); |
| | | const validTypes = ['success', 'warning', 'danger', 'info']; |
| | | return item && validTypes.includes(item.elTagType) ? item.elTagType : 'info'; |
| | | } |
| | | }, |
| | | { |
| | | label: 'ææ¡£ç¶æ', |
| | | prop: 'docStatus', |
| | | width: '100', |
| | | dataType: 'tag', |
| | | formatData: (params) => { |
| | | if (params === null || params === undefined || params === '') return '-'; |
| | | if (!document_status.value || document_status.value.length === 0) { |
| | | return params; |
| | | } |
| | | const item = document_status.value.find(item => item.value == params); |
| | | return item ? item.label : params; |
| | | }, |
| | | formatType: (params) => { |
| | | if (params === null || params === undefined || params === '') return 'info'; |
| | | if (!document_status.value || document_status.value.length === 0) { |
| | | return 'info'; |
| | | } |
| | | const item = document_status.value.find(item => item.value == params); |
| | | const validTypes = ['success', 'warning', 'danger', 'info']; |
| | | return item && validTypes.includes(item.elTagType) ? item.elTagType : 'info'; |
| | | } |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: 'right', |
| | | width: '150', |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openDocumentDia('edit', row) |
| | | }, |
| | | }, |
| | | { |
| | | name: "éä»¶", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openAttachment(row) |
| | | }, |
| | | }, |
| | | ], |
| | | } |
| | | ]); |
| | | |
| | | // å类表å |
| | | const categoryForm = reactive({ |
| | | category: "", |
| | | parentId: "", |
| | | parentName: "", |
| | | }); |
| | | |
| | | const categoryRules = reactive({ |
| | | category: [{ required: true, message: "请è¾å
¥åç±»åç§°", trigger: "blur" }], |
| | | }); |
| | | |
| | | // ææ¡£è¡¨å |
| | | const documentForm = reactive({ |
| | | id: "", |
| | | documentClassificationId: "", |
| | | docName: "", |
| | | docNumber: "", |
| | | year: "", |
| | | responsiblePerson: "", |
| | | warehouseGoodsShelvesRowcolId: "", |
| | | docData: "", |
| | | retentionPeriod: "", |
| | | securityLevel: "", |
| | | copyCount: "", |
| | | pageCount: "", |
| | | docCategory: "", |
| | | docType: "", |
| | | urgencyLevel: "", |
| | | docStatus: "", |
| | | remark: "", |
| | | attachments: [], // æ°å¢éä»¶æ°ç» |
| | | }); |
| | | |
| | | const documentRules = reactive({ |
| | | docName: [{ required: true, message: "请è¾å
¥ææ¡£åç§°", trigger: "blur" }], |
| | | docNumber: [{ required: true, message: "请è¾å
¥ææ¡£ç¼å·", trigger: "blur" }], |
| | | year: [{ required: true, message: "è¯·éæ©å¹´åº¦", trigger: "change" }], |
| | | documentClassificationId: [{ required: true, message: "è¯·éæ©ææ¡£åç±»", trigger: "change" }], |
| | | warehouseGoodsShelvesRowcolId: [{ required: true, message: "è¯·éæ©ææ¡£æ¾ç½®ä½ç½®", trigger: "change" }], |
| | | }); |
| | | |
| | | // å页ç¸å
³ |
| | | const pagination = reactive({ |
| | | currentPage: 1, |
| | | pageSize: 10, |
| | | total: 0, |
| | | }); |
| | | |
| | | // åå§ååç±»æ æ°æ® |
| | | const initCategoryTree = async() => { |
| | | try { |
| | | treeLoad.value = true; |
| | | const res = await getCategoryTree(); |
| | | if (res.code === 200) { |
| | | categoryList.value = res.data || []; |
| | | |
| | | // 设置å±å¼çèç¹ |
| | | expandedKeys.value = []; |
| | | categoryList.value.forEach((item) => { |
| | | if (item.id) { |
| | | expandedKeys.value.push(item.id); |
| | | } |
| | | }); |
| | | } else { |
| | | ElMessage.error(res.msg || "è·ååç±»æ 失败"); |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("è·ååç±»æ 失败ï¼è¯·éè¯"); |
| | | } finally { |
| | | treeLoad.value = false; |
| | | } |
| | | }; |
| | | |
| | | // åå§åä»åºä½ç½®æ°æ® |
| | | const initLocationTree = async() => { |
| | | try { |
| | | const res = await getWarehouseList(); |
| | | if (res.code === 200) { |
| | | // è½¬æ¢æ°æ®æ ¼å¼ï¼éé
el-tree-selectç»ä»¶ |
| | | locationTree.value = transformWarehouseData(res.data || []); |
| | | } else { |
| | | ElMessage.error(res.msg || "è·åä»åºä½ç½®å¤±è´¥"); |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("è·åä»åºä½ç½®å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | }; |
| | | |
| | | // 转æ¢ä»åºæ°æ®æ ¼å¼ |
| | | const transformWarehouseData = (data) => { |
| | | return data.map(item => ({ |
| | | id: item.id, |
| | | label: item.name || item.warehouseName || item.label, |
| | | value: item.id, |
| | | children: item.children ? transformWarehouseData(item.children) : [] |
| | | })); |
| | | }; |
| | | |
| | | // æ ¹æ®IDè·åä½ç½®åç§° |
| | | const getLocationName = (locationId) => { |
| | | if (!locationId || !locationTree.value || locationTree.value.length === 0) { |
| | | return locationId || '-'; |
| | | } |
| | | |
| | | const findLocation = (tree, id) => { |
| | | for (let item of tree) { |
| | | if (item.value === locationId || item.id === locationId) { |
| | | return item.label; |
| | | } |
| | | if (item.children && item.children.length > 0) { |
| | | const result = findLocation(item.children, id); |
| | | if (result) return result; |
| | | } |
| | | } |
| | | return null; |
| | | }; |
| | | |
| | | const locationName = findLocation(locationTree.value, locationId); |
| | | return locationName || locationId; |
| | | }; |
| | | |
| | | // è¿æ»¤åç±»æ |
| | | const searchFilter = () => { |
| | | if (proxy.$refs.tree) { |
| | | proxy.$refs.tree.filter(search.value); |
| | | } |
| | | }; |
| | | |
| | | // æå¼åç±»å¼¹æ¡ |
| | | const openCategoryDia = (type, data) => { |
| | | categoryOperationType.value = type; |
| | | categoryDia.value = true; |
| | | categoryForm.category = ""; |
| | | categoryForm.parentId =""; |
| | | categoryForm.parentName = ""; |
| | | |
| | | if (type === "edit") { |
| | | categoryForm.category = data.category; |
| | | // ä¿åå½åç¼è¾çåç±»ID |
| | | currentId.value = data.id; |
| | | } else if (type === "addSub") { |
| | | categoryForm.parentId = data.id; |
| | | categoryForm.parentName = data.category; |
| | | } |
| | | }; |
| | | |
| | | // æå¼ææ¡£å¼¹æ¡ |
| | | const openDocumentDia = (type, data) => { |
| | | documentOperationType.value = type; |
| | | documentDia.value = true; |
| | | |
| | | if (type === "edit") { |
| | | // ç¼è¾æ¨¡å¼ï¼å è½½ç°ææ°æ® |
| | | Object.assign(documentForm, data); |
| | | documentForm.retentionPeriod = String(documentForm.retentionPeriod) |
| | | documentForm.securityLevel = String(documentForm.securityLevel) |
| | | documentForm.docCategory = String(documentForm.docCategory) |
| | | documentForm.docType = String(documentForm.docType) |
| | | documentForm.urgencyLevel = String(documentForm.urgencyLevel) |
| | | documentForm.docStatus = String(documentForm.docStatus) |
| | | |
| | | // å è½½éä»¶ä¿¡æ¯ |
| | | if (data.attachments) { |
| | | documentForm.attachments = [...data.attachments]; |
| | | } else { |
| | | documentForm.attachments = []; |
| | | } |
| | | } else { |
| | | // æ°å¢æ¨¡å¼ï¼æ¸
空表å |
| | | Object.keys(documentForm).forEach(key => { |
| | | documentForm[key] = ""; |
| | | }); |
| | | documentForm.attachments = []; // æ°å¢æ¨¡å¼ä¸ä¹æ¸
空éä»¶ |
| | | // 设置é»è®¤å¼ - 使ç¨åå
¸æ°æ®ç第ä¸ä¸ªé项ä½ä¸ºé»è®¤å¼ |
| | | if (document_status.value && document_status.value.length > 0) { |
| | | documentForm.docStatus = document_status.value[0].value; |
| | | } |
| | | if (document_urgency.value && document_urgency.value.length > 0) { |
| | | documentForm.urgencyLevel = document_urgency.value[0].value; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | // æäº¤å类表å |
| | | const submitCategoryForm = () => { |
| | | proxy.$refs.categoryFormRef.validate(async (valid) => { |
| | | if (valid) { |
| | | try { |
| | | if (categoryOperationType.value === "addSub") { |
| | | // æ·»å ååç±» |
| | | const res = await addCategory({ |
| | | category: categoryForm.category, |
| | | parentId: categoryForm.parentId |
| | | }); |
| | | if (res.code === 200) { |
| | | ElMessage.success("æ·»å ååç±»æå"); |
| | | // éæ°å è½½åç±»æ |
| | | await initCategoryTree(); |
| | | } else { |
| | | ElMessage.error(res.msg || "æ·»å åå类失败"); |
| | | } |
| | | } else if (categoryOperationType.value === "edit") { |
| | | // ç¼è¾åç±» |
| | | const res = await updateCategory({ |
| | | id: currentId.value, |
| | | category: categoryForm.category |
| | | }); |
| | | if (res.code === 200) { |
| | | ElMessage.success("ç¼è¾åç±»æå"); |
| | | // éæ°å è½½åç±»æ |
| | | await initCategoryTree(); |
| | | } else { |
| | | ElMessage.error(res.msg || "ç¼è¾å类失败"); |
| | | } |
| | | } else { |
| | | // æ°å¢é¡¶çº§åç±» |
| | | const res = await addCategory({ |
| | | category: categoryForm.category, |
| | | parentId: null |
| | | }); |
| | | if (res.code === 200) { |
| | | ElMessage.success("æ°å¢åç±»æå"); |
| | | // éæ°å è½½åç±»æ |
| | | await initCategoryTree(); |
| | | } else { |
| | | ElMessage.error(res.msg || "æ°å¢å类失败"); |
| | | } |
| | | } |
| | | |
| | | closeCategoryDia(); |
| | | } catch (error) { |
| | | ElMessage.error("æä½å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // å
³éåç±»å¼¹æ¡ |
| | | const closeCategoryDia = () => { |
| | | proxy.$refs.categoryFormRef.resetFields(); |
| | | categoryForm.parentId = ""; |
| | | categoryForm.parentName = ""; |
| | | categoryDia.value = false; |
| | | }; |
| | | |
| | | // å é¤åç±» |
| | | const removeCategory = (node, data) => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(async () => { |
| | | try { |
| | | const res = await deleteCategory([data.id]); |
| | | if (res.code === 200) { |
| | | ElMessage.success("å 餿å"); |
| | | // éæ°å è½½åç±»æ |
| | | await initCategoryTree(); |
| | | } else { |
| | | ElMessage.error(res.msg || "å é¤å¤±è´¥"); |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("å é¤å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // éæ©åç±» |
| | | const handleNodeClick = (val, node, el) => { |
| | | // 夿æ¯å¦ä¸ºå¶åèç¹ |
| | | isShowButton.value = true; |
| | | // åªæå¶åèç¹ææ§è¡ä»¥ä¸é»è¾ |
| | | currentId.value = val.id; |
| | | currentParentId.value = val.parentId; |
| | | |
| | | // æ¸
ç©ºéæ©ç¶æ |
| | | selectedRows.value = []; |
| | | selectAll.value = false; |
| | | isIndeterminate.value = false; |
| | | |
| | | // éç½®å页 |
| | | pagination.currentPage = 1; |
| | | pagination.total = 0; |
| | | |
| | | // å è½½ææ¡£å表 |
| | | if (isShowButton.value) { |
| | | loadDocumentList(); |
| | | } else { |
| | | // 妿䏿¯å¶åèç¹ï¼æ¸
ç©ºææ¡£å表 |
| | | documentList.value = []; |
| | | } |
| | | }; |
| | | |
| | | // æäº¤ææ¡£è¡¨å |
| | | const submitDocumentForm = () => { |
| | | proxy.$refs.documentFormRef.validate(async (valid) => { |
| | | if (valid) { |
| | | try { |
| | | // æå»ºæäº¤æ°æ® |
| | | const submitData = { |
| | | ...documentForm, |
| | | // 设置å½åéä¸çåç±»ID |
| | | documentClassificationId: currentId.value || documentForm.documentClassificationId, |
| | | // æ·»å éä»¶ä¿¡æ¯ |
| | | // attachments: documentForm.attachments |
| | | }; |
| | | |
| | | if (documentOperationType.value === "edit") { |
| | | // ç¼è¾æ¨¡å¼ï¼æ´æ°ç°ææ°æ® |
| | | const res = await updateDocument(submitData); |
| | | if (res.code === 200) { |
| | | ElMessage.success("ç¼è¾æå"); |
| | | // éæ°å è½½ææ¡£å表 |
| | | await loadDocumentList(); |
| | | // å·æ°éä»¶å表 |
| | | if (attachmentManagerRef.value && documentForm.id) { |
| | | attachmentManagerRef.value.loadAttachmentList(documentForm.id); |
| | | } |
| | | } else { |
| | | ElMessage.error(res.msg || "ç¼è¾å¤±è´¥"); |
| | | } |
| | | } else { |
| | | // æ°å¢æ¨¡å¼ï¼æ·»å æ°æ°æ® |
| | | const res = await addDocument(submitData); |
| | | if (res.code === 200) { |
| | | ElMessage.success("æ°å¢æå"); |
| | | // éæ°å è½½ææ¡£å表 |
| | | await loadDocumentList(); |
| | | // å·æ°éä»¶å表 |
| | | if (attachmentManagerRef.value && res.data && res.data.id) { |
| | | attachmentManagerRef.value.loadAttachmentList(res.data.id); |
| | | } |
| | | } else { |
| | | ElMessage.error(res.msg || "æ°å¢å¤±è´¥"); |
| | | } |
| | | } |
| | | closeDocumentDia(); |
| | | } catch (error) { |
| | | ElMessage.error("æä½å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // å
³éææ¡£å¼¹æ¡ |
| | | const closeDocumentDia = () => { |
| | | proxy.$refs.documentFormRef.resetFields(); |
| | | documentDia.value = false; |
| | | // æ¸
ç©ºè¡¨åæ°æ® |
| | | Object.keys(documentForm).forEach(key => { |
| | | documentForm[key] = ""; |
| | | }); |
| | | documentForm.attachments = []; // å
³éå¼¹æ¡æ¶ä¹æ¸
空éä»¶ |
| | | }; |
| | | |
| | | // å¤çä½ç½®éæ©åå |
| | | const handleLocationChange = (value) => { |
| | | if (value) { |
| | | // æ£æ¥éæ©çæ¯å¦ä¸ºå¶åèç¹ |
| | | const isLeafNode = checkIfLeafNode(locationTree.value, value); |
| | | if (!isLeafNode) { |
| | | ElMessage.warning("è¯·éæ©æåºå±çä½ç½®ï¼å¦ï¼æå±ï¼"); |
| | | documentForm.warehouseGoodsShelvesRowcolId = ""; |
| | | return; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | // æ£æ¥æ¯å¦ä¸ºå¶åèç¹ |
| | | const checkIfLeafNode = (tree, value) => { |
| | | for (let item of tree) { |
| | | if (item.value === value || item.id === value) { |
| | | // å¦ææ²¡æåèç¹ï¼å为å¶åèç¹ |
| | | return !item.children || item.children.length === 0; |
| | | } |
| | | if (item.children && item.children.length > 0) { |
| | | const result = checkIfLeafNode(item.children, value); |
| | | if (result !== null) { |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | }; |
| | | |
| | | // å é¤ææ¡£ |
| | | const handleDelete = () => { |
| | | if (selectedRows.value.length > 0) { |
| | | ElMessageBox.confirm(`ç¡®å®è¦å é¤éä¸ç ${selectedRows.value.length} æ¡è®°å½åï¼`, "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(async () => { |
| | | try { |
| | | const selectedIds = selectedRows.value.map(row => row.id); |
| | | const res = await deleteDocument(selectedIds); |
| | | if (res.code === 200) { |
| | | ElMessage.success("å 餿å"); |
| | | // éæ°å è½½ææ¡£å表 |
| | | await loadDocumentList(); |
| | | } else { |
| | | ElMessage.error(res.msg || "å é¤å¤±è´¥"); |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("å é¤å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage("已忶"); |
| | | }); |
| | | } else { |
| | | ElMessage.warning("è¯·éæ©è¦å é¤çæ°æ®"); |
| | | } |
| | | }; |
| | | |
| | | // PIMTable éæ©ååäºä»¶ |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | |
| | | // æ´æ°å
¨éç¶æ |
| | | const selectedCount = selection.length; |
| | | const totalCount = documentList.value.length; |
| | | |
| | | if (selectedCount === 0) { |
| | | selectAll.value = false; |
| | | isIndeterminate.value = false; |
| | | } else if (selectedCount === totalCount) { |
| | | selectAll.value = true; |
| | | isIndeterminate.value = false; |
| | | } else { |
| | | selectAll.value = false; |
| | | isIndeterminate.value = true; |
| | | } |
| | | }; |
| | | |
| | | // å è½½ææ¡£å表 |
| | | const loadDocumentList = async () => { |
| | | try { |
| | | tableLoading.value = true; |
| | | |
| | | // æå»ºæ¥è¯¢åæ° |
| | | const query = { |
| | | page: pagination.currentPage, |
| | | size: pagination.pageSize, |
| | | documentClassificationId:currentId.value |
| | | }; |
| | | |
| | | const res = await getDocumentList(query); |
| | | if (res.code === 200) { |
| | | documentList.value = res.data.records || []; |
| | | pagination.total = res.data.total || 0; |
| | | } else { |
| | | ElMessage.error(res.msg || "è·åææ¡£å表失败"); |
| | | documentList.value = []; |
| | | pagination.total = 0; |
| | | } |
| | | |
| | | // éç½®éæ©ç¶æ |
| | | selectedRows.value = []; |
| | | selectAll.value = false; |
| | | isIndeterminate.value = false; |
| | | } catch (error) { |
| | | ElMessage.error("è·åææ¡£å表失败ï¼è¯·éè¯"); |
| | | documentList.value = []; |
| | | pagination.total = 0; |
| | | } finally { |
| | | tableLoading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // å¤çå页åå |
| | | const handlePagination = (current, size) => { |
| | | pagination.currentPage = current; |
| | | pagination.pageSize = size; |
| | | loadDocumentList(); |
| | | }; |
| | | |
| | | // è°ç¨treeè¿æ»¤æ¹æ³ |
| | | const filterNode = (value, data, node) => { |
| | | if (!value) { |
| | | return true; |
| | | } |
| | | let val = value.toLowerCase(); |
| | | return chooseNode(val, data, node); |
| | | }; |
| | | |
| | | // è¿æ»¤ç¶èç¹ / åèç¹ |
| | | const chooseNode = (value, data, node) => { |
| | | if (data.category && data.category.toLowerCase().indexOf(value) !== -1) { |
| | | return true; |
| | | } |
| | | const level = node.level; |
| | | if (level === 1) { |
| | | return false; |
| | | } |
| | | let parentData = node.parent; |
| | | let index = 0; |
| | | while (index < level - 1) { |
| | | if (parentData.data.category && parentData.data.category.toLowerCase().indexOf(value) !== -1) { |
| | | return true; |
| | | } |
| | | parentData = parentData.parent; |
| | | index++; |
| | | } |
| | | return false; |
| | | }; |
| | | |
| | | // æå¼éä»¶ |
| | | const openAttachment = (row) => { |
| | | attachmentManagerRef.value.open([], row.id); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | initCategoryTree(); |
| | | initLocationTree(); |
| | | |
| | | // ä¸å¨åå§åæ¶å è½½ææ¡£å表ï¼çå¾
ç¨æ·éæ©åç±»ååå è½½ |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .document-view { |
| | | display: flex; |
| | | height: 100%; |
| | | } |
| | | |
| | | .left { |
| | | width: 380px; |
| | | padding: 16px; |
| | | background: #ffffff; |
| | | border-right: 1px solid #e4e7ed; |
| | | } |
| | | |
| | | .right { |
| | | width: calc(100% - 380px); |
| | | padding: 16px; |
| | | background: #ffffff; |
| | | } |
| | | |
| | | .custom-tree-node { |
| | | flex: 1; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | font-size: 14px; |
| | | padding-right: 8px; |
| | | } |
| | | |
| | | .tree-node-content { |
| | | display: flex; |
| | | align-items: center; |
| | | height: 100%; |
| | | } |
| | | |
| | | .orange-icon { |
| | | color: orange; |
| | | font-size: 18px; |
| | | margin-right: 8px; |
| | | } |
| | | |
| | | .table-container { |
| | | background: #ffffff; |
| | | border-radius: 8px; |
| | | overflow: hidden; |
| | | position: relative; |
| | | } |
| | | |
| | | .add-row { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 8px; |
| | | background-color: #f5f7fa; |
| | | cursor: pointer; |
| | | transition: background-color 0.2s ease; |
| | | padding: 12px 16px; |
| | | margin-bottom: 16px; |
| | | border-radius: 6px; |
| | | border: 1px dashed #d9d9d9; |
| | | } |
| | | |
| | | .add-row:hover { |
| | | background-color: #e4e7ed; |
| | | border-color: #c0c4cc; |
| | | } |
| | | |
| | | .add-icon { |
| | | color: #909399; |
| | | font-size: 16px; |
| | | } |
| | | |
| | | .add-row span { |
| | | color: #606266; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .empty-data { |
| | | text-align: center; |
| | | color: #909399; |
| | | padding: 40px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .dialog-footer { |
| | | text-align: right; |
| | | } |
| | | |
| | | .operation-column { |
| | | position: absolute; |
| | | right: 0; |
| | | top: 0; |
| | | width: 120px; |
| | | background: #ffffff; |
| | | border-left: 1px solid #e4e7ed; |
| | | z-index: 1; |
| | | box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .operation-header { |
| | | height: 40px; |
| | | line-height: 40px; |
| | | text-align: center; |
| | | background: #fafafa; |
| | | border-bottom: 1px solid #e4e7ed; |
| | | font-weight: 500; |
| | | color: #606266; |
| | | } |
| | | |
| | | .operation-cell { |
| | | height: 40px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | border-bottom: 1px solid #e4e7ed; |
| | | } |
| | | |
| | | .operation-cell:last-child { |
| | | border-bottom: none; |
| | | } |
| | | |
| | | .attachment-section { |
| | | width: 100%; |
| | | } |
| | | |
| | | .attachment-list { |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .attachment-item { |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 8px 12px; |
| | | background-color: #f5f7fa; |
| | | border-radius: 4px; |
| | | margin-bottom: 8px; |
| | | } |
| | | |
| | | .file-icon { |
| | | margin-right: 8px; |
| | | color: #409eff; |
| | | } |
| | | |
| | | .file-name { |
| | | flex: 1; |
| | | color: #606266; |
| | | font-size: 14px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container return-view"> |
| | | <!-- æ¥è¯¢åºå --> |
| | | <div class="search-container"> |
| | | <el-form :model="searchForm" :inline="true" class="search-form"> |
| | | <!-- <el-form-item label="åé
ç¶æï¼"> |
| | | <el-select v-model="searchForm.borrowStatus" placeholder="è¯·éæ©åé
ç¶æ" clearable style="width: 150px"> |
| | | <el-option label="åé
" value="åé
" /> |
| | | <el-option label="å½è¿" value="å½è¿" /> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | <el-form-item label="åé
人ï¼"> |
| | | <el-input |
| | | v-model="searchForm.borrower" |
| | | placeholder="请è¾å
¥åé
人" |
| | | clearable |
| | | style="width: 200px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="å½è¿äººï¼"> |
| | | <el-input |
| | | v-model="searchForm.returner" |
| | | placeholder="请è¾å
¥å½è¿äºº" |
| | | clearable |
| | | style="width: 200px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="å½è¿æ¥æèå´ï¼"> |
| | | <el-date-picker |
| | | v-model="searchForm.dateRange" |
| | | type="daterange" |
| | | range-separator="è³" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 300px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleSearch"> |
| | | <el-icon><Search /></el-icon> |
| | | æ¥è¯¢ |
| | | </el-button> |
| | | <el-button @click="handleReset"> |
| | | <el-icon><Refresh /></el-icon> |
| | | éç½® |
| | | </el-button> |
| | | </el-form-item> |
| | | <el-form-item style="margin-left: auto;"> |
| | | <el-button type="primary" @click="openReturnDia('add')"> |
| | | <el-icon><Plus /></el-icon> |
| | | æ°å¢å½è¿ |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | @click="handleBatchDelete" |
| | | :disabled="selectedRows.length === 0" |
| | | > |
| | | <el-icon><Delete /></el-icon> |
| | | æ¹éå é¤ ({{ selectedRows.length }}) |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <!-- è¡¨æ ¼åºå --> |
| | | <div class="table-container"> |
| | | <PIMTable |
| | | :table-data="returnList" |
| | | :column="tableColumns" |
| | | :is-selection="true" |
| | | :border="true" |
| | | :table-loading="tableLoading" |
| | | :page="{ |
| | | current: pagination.currentPage, |
| | | size: pagination.pageSize, |
| | | total: pagination.total, |
| | | layout: 'total, sizes, prev, pager, next, jumper' |
| | | }" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="handlePagination" |
| | | /> |
| | | </div> |
| | | |
| | | <!-- å½è¿æ°å¢/ç¼è¾å¯¹è¯æ¡ --> |
| | | <el-dialog |
| | | v-model="returnDia" |
| | | :title="returnOperationType === 'add' ? 'æ°å¢å½è¿' : 'ç¼è¾å½è¿'" |
| | | width="800px" |
| | | @close="closeReturnDia" |
| | | @keydown.enter.prevent |
| | | > |
| | | <el-form |
| | | :model="returnForm" |
| | | label-width="140px" |
| | | :rules="returnRules" |
| | | ref="returnFormRef" |
| | | > |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ææ¡£ï¼" prop="borrowId"> |
| | | <el-select v-model="returnForm.borrowId" placeholder="è¯·éæ©ææ¡£" style="width: 100%" @change="handleDocumentChange"> |
| | | <el-option |
| | | v-for="item in documentList" |
| | | :key="item.id" |
| | | :label="item.docName || item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åé
人ï¼" prop="borrower"> |
| | | <el-input v-model="returnForm.borrower" placeholder="åé
äººå°æ ¹æ®ææ¡£éæ©èªå¨å¸¦åº" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½è¿äººï¼" prop="returner"> |
| | | <el-input v-model="returnForm.returner" placeholder="请è¾å
¥å½è¿äºº" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½è¿æ¥æï¼" prop="returnDate"> |
| | | <el-date-picker |
| | | v-model="returnForm.returnDate" |
| | | type="date" |
| | | placeholder="éæ©å½è¿æ¥æ" |
| | | style="width: 100%" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åºå½è¿æ¥æï¼" prop="dueReturnDate"> |
| | | <el-date-picker |
| | | v-model="returnForm.dueReturnDate" |
| | | type="date" |
| | | placeholder="åºå½è¿æ¥æå°æ ¹æ®ææ¡£éæ©èªå¨å¸¦åº" |
| | | style="width: 100%" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="夿³¨è¯´æï¼" prop="remark"> |
| | | <el-input |
| | | v-model="returnForm.remark" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥å¤æ³¨è¯´æ" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitReturnForm">确认</el-button> |
| | | <el-button @click="closeReturnDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted, getCurrentInstance } from "vue"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | import { Search, Refresh, Plus, Delete } from '@element-plus/icons-vue'; |
| | | import PIMTable from '@/components/PIMTable/PIMTable.vue'; |
| | | import { getReturnListPage, returnDocument, deleteReturn, getDocumentList, updateBorrow, reventUpdate } from '@/api/fileManagement/return'; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // ååºå¼æ°æ® |
| | | const returnDia = ref(false); |
| | | const returnOperationType = ref(""); |
| | | const tableLoading = ref(false); |
| | | const returnList = ref([]); |
| | | const selectedRows = ref([]); |
| | | const documentList = ref([]); // ææ¡£å表 |
| | | |
| | | // å页ç¸å
³ |
| | | const pagination = reactive({ |
| | | currentPage: 1, |
| | | pageSize: 10, |
| | | total: 0, |
| | | }); |
| | | |
| | | // æ¥è¯¢è¡¨å |
| | | const searchForm = reactive({ |
| | | borrowStatus: "", |
| | | borrower: "", |
| | | returner: "", |
| | | dateRange: [] |
| | | }); |
| | | |
| | | // å½è¿è¡¨å |
| | | const returnForm = reactive({ |
| | | id: "", |
| | | borrowId: "", |
| | | borrower: "", |
| | | returner: "", |
| | | borrowStatus: "", |
| | | returnDate: "", |
| | | dueReturnDate: "", |
| | | remark: "" |
| | | }); |
| | | |
| | | // 表åéªè¯è§å |
| | | const returnRules = reactive({ |
| | | borrowId: [{ required: true, message: "è¯·éæ©ææ¡£", trigger: "change" }], |
| | | returner: [{ required: true, message: "请è¾å
¥å½è¿äºº", trigger: "blur" }], |
| | | returnDate: [{ required: true, message: "è¯·éæ©å½è¿æ¥æ", trigger: "change" }] |
| | | }); |
| | | |
| | | // è¡¨æ ¼åé
ç½® |
| | | const tableColumns = ref([ |
| | | { |
| | | label: 'ææ¡£åç§°', |
| | | prop: 'docName', |
| | | width: '200', |
| | | }, |
| | | { label: 'åé
人', prop: 'borrower' }, |
| | | { label: 'å½è¿äºº', prop: 'returner' }, |
| | | { |
| | | label: 'åé
ç¶æ', |
| | | prop: 'borrowStatus', |
| | | dataType: 'tag', |
| | | formatData: (params) => { |
| | | if (params === null || params === undefined || params === '') return '-'; |
| | | return params; |
| | | }, |
| | | formatType: (params) => { |
| | | if (params === 'å½è¿') return 'success'; |
| | | if (params === 'åé
') return 'warning'; |
| | | return 'info'; |
| | | } |
| | | }, |
| | | { label: 'å½è¿æ¥æ', prop: 'returnDate' }, |
| | | { label: 'åºå½è¿æ¥æ', prop: 'dueReturnDate' }, |
| | | { label: '夿³¨', prop: 'remark', width: '150' }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: 'right', |
| | | width: '150', |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openReturnDia('edit', row) |
| | | }, |
| | | }, |
| | | { |
| | | name: "å é¤", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | handleDelete(row) |
| | | }, |
| | | }, |
| | | ], |
| | | } |
| | | ]); |
| | | |
| | | // åå§åæ°æ® |
| | | const initData = async () => { |
| | | await Promise.all([ |
| | | loadDocumentList(), |
| | | loadReturnList() |
| | | ]); |
| | | }; |
| | | |
| | | // å è½½ææ¡£å表 |
| | | const loadDocumentList = async () => { |
| | | try { |
| | | const res = await getDocumentList(); |
| | | if (res.code === 200) { |
| | | documentList.value = res.data || []; |
| | | } else { |
| | | ElMessage.error(res.msg || "è·åææ¡£å表失败"); |
| | | documentList.value = []; |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("è·åææ¡£å表失败ï¼è¯·éè¯"); |
| | | documentList.value = []; |
| | | } |
| | | }; |
| | | |
| | | // å è½½å½è¿å表 |
| | | const loadReturnList = async () => { |
| | | try { |
| | | tableLoading.value = true; |
| | | |
| | | // æå»ºæ¥è¯¢åæ° |
| | | const query = { |
| | | page: pagination.currentPage, |
| | | size: pagination.pageSize, |
| | | borrowStatus: searchForm.borrowStatus || undefined, |
| | | borrower: searchForm.borrower || undefined, |
| | | returner: searchForm.returner || undefined, |
| | | entryDateStart: searchForm.dateRange && searchForm.dateRange.length > 0 ? searchForm.dateRange[0] : undefined, |
| | | entryDateEnd: searchForm.dateRange && searchForm.dateRange.length > 1 ? searchForm.dateRange[1] : undefined |
| | | }; |
| | | |
| | | // ç§»é¤undefinedçåæ° |
| | | Object.keys(query).forEach(key => { |
| | | if (query[key] === undefined) { |
| | | delete query[key]; |
| | | } |
| | | }); |
| | | |
| | | const res = await getReturnListPage(query); |
| | | if (res.code === 200) { |
| | | returnList.value = res.data.records || []; |
| | | pagination.total = res.data.total || 0; |
| | | } else { |
| | | ElMessage.error(res.msg || "è·åå½è¿å表失败"); |
| | | returnList.value = []; |
| | | pagination.total = 0; |
| | | } |
| | | |
| | | // éç½®éæ©ç¶æ |
| | | selectedRows.value = []; |
| | | } catch (error) { |
| | | ElMessage.error("è·åå½è¿å表失败ï¼è¯·éè¯"); |
| | | returnList.value = []; |
| | | pagination.total = 0; |
| | | } finally { |
| | | tableLoading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // æ¥è¯¢ |
| | | const handleSearch = () => { |
| | | pagination.currentPage = 1; |
| | | loadReturnList(); |
| | | }; |
| | | |
| | | // éç½®æ¥è¯¢ |
| | | const handleReset = () => { |
| | | searchForm.borrowStatus = ""; |
| | | searchForm.borrower = ""; |
| | | searchForm.returner = ""; |
| | | searchForm.dateRange = []; |
| | | pagination.currentPage = 1; |
| | | loadReturnList(); |
| | | ElMessage.success("æ¥è¯¢æ¡ä»¶å·²éç½®"); |
| | | }; |
| | | |
| | | // æå¼å½è¿å¼¹æ¡ |
| | | const openReturnDia = (type, data) => { |
| | | returnOperationType.value = type; |
| | | returnDia.value = true; |
| | | |
| | | if (type === "edit") { |
| | | // ç¼è¾æ¨¡å¼ï¼å è½½ç°ææ°æ® |
| | | Object.assign(returnForm, data); |
| | | // ç¼è¾æ¨¡å¼ä¸ï¼ææ¡£éæ©åèªå¨å¡«å
åé
人ååºå½è¿æ¥æ |
| | | if (returnForm.borrowId) { |
| | | handleDocumentChange(returnForm.borrowId); |
| | | } |
| | | } else { |
| | | // æ°å¢æ¨¡å¼ï¼æ¸
空表å |
| | | Object.keys(returnForm).forEach(key => { |
| | | returnForm[key] = ""; |
| | | }); |
| | | // 设置é»è®¤ç¶æ |
| | | returnForm.borrowStatus = "å½è¿"; |
| | | // 设置å½åæ¥æä¸ºå½è¿æ¥æ |
| | | returnForm.returnDate = new Date().toISOString().split('T')[0]; |
| | | } |
| | | }; |
| | | |
| | | // å
³éå½è¿å¼¹æ¡ |
| | | const closeReturnDia = () => { |
| | | proxy.$refs.returnFormRef.resetFields(); |
| | | returnDia.value = false; |
| | | }; |
| | | |
| | | // æäº¤å½è¿è¡¨å |
| | | const submitReturnForm = () => { |
| | | proxy.$refs.returnFormRef.validate(async (valid) => { |
| | | if (valid) { |
| | | try { |
| | | if (returnOperationType.value === "edit") { |
| | | // ç¼è¾æ¨¡å¼ï¼è°ç¨å½è¿æ´æ°æ¥å£ |
| | | const res = await reventUpdate({ |
| | | id: returnForm.id, |
| | | documentationId: returnForm.documentationId, |
| | | borrower: returnForm.borrower, |
| | | returner: returnForm.returner, |
| | | borrowStatus: returnForm.borrowStatus, |
| | | returnDate: returnForm.returnDate, |
| | | dueReturnDate: returnForm.dueReturnDate, |
| | | remark: returnForm.remark |
| | | }); |
| | | |
| | | if (res.code === 200) { |
| | | ElMessage.success("ç¼è¾æå"); |
| | | await loadReturnList(); |
| | | closeReturnDia(); |
| | | } else { |
| | | ElMessage.error(res.msg || "ç¼è¾å¤±è´¥"); |
| | | } |
| | | } else { |
| | | // æ°å¢æ¨¡å¼ï¼è°ç¨å½è¿æ¥å£ |
| | | const res = await returnDocument({ |
| | | borrowId: returnForm.borrowId, |
| | | borrower: returnForm.borrower, |
| | | returner: returnForm.returner, |
| | | borrowStatus: returnForm.borrowStatus, |
| | | returnDate: returnForm.returnDate, |
| | | dueReturnDate: returnForm.dueReturnDate, |
| | | remark: returnForm.remark |
| | | }); |
| | | |
| | | if (res.code === 200) { |
| | | ElMessage.success("æ°å¢æå"); |
| | | await loadReturnList(); |
| | | closeReturnDia(); |
| | | } else { |
| | | ElMessage.error(res.msg || "æ°å¢å¤±è´¥"); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("æä½å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // å é¤å½è¿è®°å½ |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm( |
| | | `ç¡®å®è¦å é¤è¿æ¡å½è¿è®°å½åï¼`, |
| | | "å é¤æç¤º", |
| | | { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | } |
| | | ).then(async () => { |
| | | try { |
| | | const res = await deleteReturn([row.id]); |
| | | if (res.code === 200) { |
| | | ElMessage.success("å 餿å"); |
| | | await loadReturnList(); |
| | | } else { |
| | | ElMessage.error(res.msg || "å é¤å¤±è´¥"); |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("å é¤å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | }).catch(() => { |
| | | ElMessage.info("已忶å é¤"); |
| | | }); |
| | | }; |
| | | |
| | | // æ¹éå é¤ |
| | | const handleBatchDelete = () => { |
| | | if (selectedRows.value.length === 0) { |
| | | ElMessage.warning("è¯·éæ©è¦å é¤çè®°å½"); |
| | | return; |
| | | } |
| | | |
| | | ElMessageBox.confirm( |
| | | `ç¡®å®è¦å é¤éä¸ç ${selectedRows.value.length} æ¡å½è¿è®°å½åï¼`, |
| | | "æ¹éå é¤æç¤º", |
| | | { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | } |
| | | ).then(async () => { |
| | | try { |
| | | const selectedIds = selectedRows.value.map(row => row.id); |
| | | const res = await deleteReturn(selectedIds); |
| | | if (res.code === 200) { |
| | | ElMessage.success("æ¹éå 餿å"); |
| | | await loadReturnList(); |
| | | } else { |
| | | ElMessage.error(res.msg || "æ¹éå é¤å¤±è´¥"); |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error("æ¹éå é¤å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | }).catch(() => { |
| | | ElMessage.info("已忶å é¤"); |
| | | }); |
| | | }; |
| | | |
| | | // éæ©ååäºä»¶ |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | // å¤çå页åå |
| | | const handlePagination = (current, size) => { |
| | | pagination.currentPage = current; |
| | | pagination.pageSize = size; |
| | | loadReturnList(); |
| | | }; |
| | | |
| | | // å¤çææ¡£éæ©åå |
| | | const handleDocumentChange = (documentId) => { |
| | | if (documentId) { |
| | | // æ ¹æ®éæ©çææ¡£IDï¼ä»ææ¡£åè¡¨ä¸æ¥æ¾å¯¹åºçææ¡£ä¿¡æ¯ |
| | | const selectedDoc = documentList.value.find(doc => doc.id === documentId); |
| | | if (selectedDoc) { |
| | | // èªå¨å¡«å
åé
人ååºå½è¿æ¥æ |
| | | returnForm.borrower = selectedDoc.borrower || selectedDoc.borrowerName || ''; |
| | | returnForm.dueReturnDate = selectedDoc.dueReturnDate || selectedDoc.expectedReturnDate || ''; |
| | | } |
| | | } else { |
| | | // æ¸
空ç¸å
³å段 |
| | | returnForm.borrower = ''; |
| | | returnForm.dueReturnDate = ''; |
| | | } |
| | | }; |
| | | |
| | | // çå½å¨æ |
| | | onMounted(() => { |
| | | initData(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .return-view { |
| | | padding: 20px; |
| | | } |
| | | |
| | | .search-container { |
| | | background: #ffffff; |
| | | padding: 20px; |
| | | border-radius: 8px; |
| | | margin-bottom: 20px; |
| | | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .search-form { |
| | | margin: 0; |
| | | } |
| | | |
| | | .table-container { |
| | | background: #ffffff; |
| | | border-radius: 8px; |
| | | overflow: hidden; |
| | | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .empty-data { |
| | | text-align: center; |
| | | color: #909399; |
| | | padding: 40px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .dialog-footer { |
| | | text-align: right; |
| | | } |
| | | |
| | | :deep(.el-form-item__label) { |
| | | font-weight: 500; |
| | | color: #303133; |
| | | } |
| | | |
| | | :deep(.el-input__wrapper) { |
| | | box-shadow: 0 0 0 1px #dcdfe6 inset; |
| | | } |
| | | |
| | | :deep(.el-input__wrapper:hover) { |
| | | box-shadow: 0 0 0 1px #c0c4cc inset; |
| | | } |
| | | |
| | | :deep(.el-input__wrapper.is-focus) { |
| | | box-shadow: 0 0 0 1px #409eff inset; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">åæ¾å£åº¦ï¼</span> |
| | | <el-select |
| | | style="width: 200px;" |
| | | @change="handleQuery" |
| | | v-model="searchForm.season" |
| | | placeholder="è¯·éæ©" |
| | | :clearable="false" |
| | | > |
| | | <el-option :label="item.label" :value="item.value" v-for="(item,index) in jidu" :key="item.value" /> |
| | | </el-select> |
| | | <span class="search_title ml10">åå·¥åç§°ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.staffName" |
| | | 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="add" icon="Plus"> æ°å¢ </el-button> |
| | | <el-button @click="handleOut" icon="download">导åº</el-button> |
| | | <el-button |
| | | type="danger" |
| | | icon="Delete" |
| | | :disabled="multipleList.length <= 0" |
| | | @click="deleteRow(multipleList.map((item) => item.id))" |
| | | > |
| | | æ¹éå é¤ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <el-table |
| | | ref="tableRef" |
| | | v-loading="tableLoading" |
| | | :data="tableData" |
| | | border |
| | | height="calc(100vh - 21em)" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" |
| | | style="width: 100%" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <!-- éæ©å --> |
| | | <el-table-column |
| | | align="center" |
| | | type="selection" |
| | | width="55" |
| | | fixed="left" |
| | | /> |
| | | |
| | | <!-- åºå·å --> |
| | | <el-table-column |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | fixed="left" |
| | | /> |
| | | |
| | | <!-- åºå®åï¼å§å --> |
| | | <el-table-column |
| | | label="å§å" |
| | | prop="staffName" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | align="center" |
| | | fixed="left" |
| | | /> |
| | | |
| | | <!-- åºå®åï¼å·¥å· --> |
| | | <el-table-column |
| | | label="å·¥å·" |
| | | prop="staffNo" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | align="center" |
| | | fixed="left" |
| | | /> |
| | | |
| | | <!-- 卿åï¼æ ¹æ®åå
¸æ¸²æ --> |
| | | <el-table-column |
| | | v-for="(dictItem, index) in sys_lavor_issue" |
| | | :key="dictItem.value" |
| | | :label="dictItem.label" |
| | | :prop="dictItem.value" |
| | | show-overflow-tooltip |
| | | > |
| | | </el-table-column> |
| | | |
| | | <!-- æä½å --> |
| | | <el-table-column |
| | | label="æä½" |
| | | width="150" |
| | | align="center" |
| | | fixed="right" |
| | | > |
| | | <template #default="scope"> |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | size="small" |
| | | @click="edit(scope.row)" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | link |
| | | size="small" |
| | | :disabled="!!scope.row.adoptedDate" |
| | | @click="adopted(scope.row)" |
| | | > |
| | | é¢ç¨ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination :total="total" layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" :limit="page.size" @pagination="paginationChange" /> |
| | | </div> |
| | | <Modal ref="modalRef" @success="handleQuery"></Modal> |
| | | <files-dia ref="filesDia"></files-dia> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, onMounted, reactive, toRefs, nextTick, getCurrentInstance } from 'vue' |
| | | import dayjs from "dayjs"; |
| | | import Modal from "./Modal.vue"; |
| | | import FilesDia from "./filesDia.vue"; |
| | | import Pagination from "@/components/Pagination/index.vue"; |
| | | import {lavorIssueListPage, deleteLedger, update} from "@/api/lavorissce/ledger.js"; |
| | | import {ElMessageBox, ElMessage} from "element-plus"; |
| | | const { proxy } = getCurrentInstance(); |
| | | import { getCurrentMonth } from "@/utils/util" |
| | | |
| | | const page = ref({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | // ååºå¼æ°æ® |
| | | const tableRef = ref(null) |
| | | const tableData = ref([]) |
| | | const tableLoading = ref(false) |
| | | const { sys_lavor_issue } = proxy.useDict("sys_lavor_issue") |
| | | const data = reactive({ |
| | | searchForm: { |
| | | season: "", |
| | | staffName: "", |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | |
| | | const modalRef = ref(); |
| | | const filesDia = ref(); |
| | | const multipleList = ref([]); |
| | | const jidu = ref([ |
| | | { |
| | | value: '1', |
| | | label: '第ä¸å£åº¦' |
| | | }, |
| | | { |
| | | value: '2', |
| | | label: '第äºå£åº¦' |
| | | }, |
| | | { |
| | | value: '3', |
| | | label: '第ä¸å£åº¦' |
| | | }, |
| | | { |
| | | value: '4', |
| | | label: '第åå£åº¦' |
| | | } |
| | | ]) |
| | | |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.value.current = 1; |
| | | getList(); |
| | | }; |
| | | // è·ååå
¸æ°æ® |
| | | const getList = async () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm.value, ...page.value }; |
| | | lavorIssueListPage(params).then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | total.value = res.data.total; |
| | | }).catch(err => { |
| | | tableLoading.value = false; |
| | | }) |
| | | } |
| | | const add = () => { |
| | | modalRef.value.openModal(); |
| | | }; |
| | | const edit = (row) => { |
| | | modalRef.value.loadForm(row); |
| | | }; |
| | | const deleteRow = (id) => { |
| | | ElMessageBox.confirm("æ¤æä½å°æ°¸ä¹
å é¤è¯¥æ°æ®, æ¯å¦ç»§ç»?", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(async () => { |
| | | const { code } = await deleteLedger(id); |
| | | if (code == 200) { |
| | | ElMessage({ |
| | | type: "success", |
| | | message: "å 餿å", |
| | | }); |
| | | await getList(); |
| | | } |
| | | }); |
| | | }; |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download(`/lavorIssue/exportCopy`, {season: searchForm.value.season}, "å³ä¿å°è´¦.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.info("已忶"); |
| | | }); |
| | | }; |
| | | const adopted = (row) => { |
| | | ElMessageBox.confirm("æ¯å¦ç¡®è®¤é¢ç¨?", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(async () => { |
| | | const params = { |
| | | id: row.id, |
| | | adoptedDate: dayjs().format("YYYY-MM-DD") |
| | | } |
| | | const { code } = await update(params); |
| | | if (code == 200) { |
| | | ElMessage({ |
| | | type: "success", |
| | | message: "é¢ç¨æå", |
| | | }); |
| | | await getList(); |
| | | } |
| | | }) |
| | | } |
| | | // æå¼éä»¶å¼¹æ¡ |
| | | const openFilesFormDia = (row) => { |
| | | nextTick(() => { |
| | | filesDia.value?.openDialog( row,'æ¶å
¥') |
| | | }) |
| | | }; |
| | | // äºä»¶å¤ç彿° |
| | | const handleSelectionChange = (selection) => { |
| | | multipleList.value = selection; |
| | | } |
| | | |
| | | const paginationChange = (pagination) => { |
| | | page.value.current = pagination.page; |
| | | page.value.size = pagination.limit; |
| | | getList(); |
| | | } |
| | | |
| | | // ç»ä»¶æè½½æ¶å è½½åå
¸æ°æ® |
| | | onMounted(() => { |
| | | handleQuery() |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .dynamic-table-container { |
| | | width: 100%; |
| | | } |
| | | |
| | | .pagination-container { |
| | | margin-top: 20px; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | :deep(.el-table .el-table__header-wrapper th) { |
| | | background-color: #F0F1F5 !important; |
| | | color: #333333; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | :deep(.el-table .el-table__body-wrapper td) { |
| | | padding: 8px 0; |
| | | } |
| | | |
| | | :deep(.el-select) { |
| | | width: 100%; |
| | | } |
| | | |
| | | :deep(.el-input) { |
| | | width: 100%; |
| | | } |
| | | </style> |
| | |
| | | <div></div> |
| | | <div> |
| | | <el-button type="primary" @click="add" icon="Plus"> æ°å¢ </el-button> |
| | | <el-button @click="handleOut" icon="download">导åº</el-button> |
| | | <!-- <el-button @click="handleOut" icon="download">导åº</el-button>--> |
| | | <el-button |
| | | type="danger" |
| | | icon="Delete" |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="filters" :inline="true"> |
| | | <el-form-item label="åæ¾å£åº¦:" prop="season"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">åæ¾å£åº¦ï¼</span> |
| | | <el-select |
| | | :disabled="filters.issueDate ? true : false" |
| | | style="width: 200px;" |
| | | @change="getList" |
| | | v-model="filters.season" |
| | | @change="handleQuery" |
| | | v-model="searchForm.season" |
| | | placeholder="è¯·éæ©" |
| | | @clear="clearSeason" |
| | | clearable |
| | | :disabled="searchForm.issueDate ? true : false" |
| | | |
| | | > |
| | | <el-option :label="item.label" :value="item.value" v-for="(item,index) in jidu" :key="value" /> |
| | | <el-option :label="item.label" :value="item.value" v-for="(item,index) in jidu" :key="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åæ¾æä»½:" prop="issueDate"> |
| | | <span class="search_title ml10">åæ¾æä»½ï¼</span> |
| | | <el-date-picker |
| | | :disabled="filters.season ? true : false" |
| | | v-model="filters.issueDate" |
| | | @change="getList" |
| | | style="width: 200px;" |
| | | :disabled="searchForm.season ? true : false" |
| | | v-model="searchForm.issueDate" |
| | | @change="handleQuery" |
| | | @clear="clearIssueDaten" |
| | | type="month" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM" |
| | | placeholder="è¯·éæ©æä»½" |
| | | clearable |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getList">æç´¢</el-button> |
| | | <el-button @click="resetParams">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | | <el-button type="primary" @click="resetHandleQuery" style="margin-left: 10px" |
| | | >éç½®</el-button |
| | | > |
| | | </div> |
| | | <div> |
| | | <el-button @click="handleOut" icon="download">导åº</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <div class="actions"> |
| | | <div class="head" @click="getList(1)">å·²é¢åå³ä¿æ°é:{{statisticsObj.ylqNum}}</div> |
| | | <div class="head" @click="getList(2)">æªé¢åå³ä¿æ°é: {{ statisticsObj.wlqNum }}</div> |
| | | <div class="head" @click="getList(3)">è¶
æ¶å·²é¢åå³ä¿æ°é: {{statisticsObj.csylqNum}}</div> |
| | | <div class="head" @click="getList(4)">è¶
æ¶æªé¢åå³ä¿æ°é: {{statisticsObj.cswlqNum}}</div> |
| | | <div class="head" @click="handleQuery(1)">å·²é¢åå³ä¿æ°é:{{statisticsObj.ylqNum}}</div> |
| | | <div class="head" @click="handleQuery(2)">æªé¢åå³ä¿æ°é: {{ statisticsObj.wlqNum }}</div> |
| | | <div class="head" @click="handleQuery(3)">è¶
æ¶å·²é¢åå³ä¿æ°é: {{statisticsObj.csylqNum}}</div> |
| | | <div class="head" @click="handleQuery(4)">è¶
æ¶æªé¢åå³ä¿æ°é: {{statisticsObj.cswlqNum}}</div> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | isSelection |
| | | :column="columns" |
| | | :tableData="dataList" |
| | | :page="{ |
| | | current: pagination.currentPage, |
| | | size: pagination.pageSize, |
| | | total: pagination.total, |
| | | }" |
| | | <el-table |
| | | ref="tableRef" |
| | | v-loading="tableLoading" |
| | | :data="tableData" |
| | | border |
| | | height="calc(100vh - 21em)" |
| | | :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" |
| | | style="width: 100%" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="changePage" |
| | | > |
| | | </PIMTable> |
| | | <!-- éæ©å --> |
| | | <el-table-column |
| | | align="center" |
| | | type="selection" |
| | | width="55" |
| | | fixed="left" |
| | | /> |
| | | |
| | | <!-- åºå·å --> |
| | | <el-table-column |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | fixed="left" |
| | | /> |
| | | |
| | | <!-- åºå®åï¼å§å --> |
| | | <el-table-column |
| | | label="å§å" |
| | | prop="staffName" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | align="center" |
| | | fixed="left" |
| | | /> |
| | | |
| | | <!-- åºå®åï¼å·¥å· --> |
| | | <el-table-column |
| | | label="å·¥å·" |
| | | prop="staffNo" |
| | | width="100" |
| | | show-overflow-tooltip |
| | | align="center" |
| | | fixed="left" |
| | | /> |
| | | |
| | | <!-- 卿åï¼æ ¹æ®åå
¸æ¸²æ --> |
| | | <el-table-column |
| | | v-for="(dictItem, index) in sys_lavor_issue" |
| | | :key="dictItem.value" |
| | | :label="dictItem.label" |
| | | :prop="dictItem.value" |
| | | show-overflow-tooltip |
| | | > |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { usePaginationApi } from "@/hooks/usePaginationApi"; |
| | | import { listPage,statistics } from "@/api/lavorissce/ledger"; |
| | | import { onMounted, getCurrentInstance } from "vue"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | import { ref, onMounted, reactive, toRefs, nextTick, getCurrentInstance } from 'vue' |
| | | import dayjs from "dayjs"; |
| | | |
| | | // è¡¨æ ¼å¤éæ¡éä¸é¡¹ |
| | | const multipleList = ref([]); |
| | | import {statisticsList, statistics} from "@/api/lavorissce/ledger.js"; |
| | | import {ElMessageBox, ElMessage} from "element-plus"; |
| | | const { proxy } = getCurrentInstance(); |
| | | import { getCurrentMonth } from "@/utils/util" |
| | | |
| | | const page = ref({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | // ååºå¼æ°æ® |
| | | const tableRef = ref(null) |
| | | const tableData = ref([]) |
| | | const tableLoading = ref(false) |
| | | const { sys_lavor_issue } = proxy.useDict("sys_lavor_issue") |
| | | const data = reactive({ |
| | | searchForm: { |
| | | season: getCurrentMonth(), |
| | | issueDate: "", |
| | | status: 0 |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | |
| | | const modalRef = ref(); |
| | | const filesDia = ref() |
| | | const filesDia = ref(); |
| | | const multipleList = ref([]); |
| | | const jidu = ref([ |
| | | { |
| | | value: '1', |
| | |
| | | label: '第åå£åº¦' |
| | | } |
| | | ]) |
| | | const clearSeason = () => { |
| | | console.log("req") |
| | | searchForm.value.season = "" |
| | | searchForm.value.issueDate = dayjs().format("YYYY-MM-DD"); |
| | | } |
| | | |
| | | const { |
| | | filters, |
| | | columns, |
| | | dataList, |
| | | pagination, |
| | | getTableData, |
| | | resetFilters, |
| | | onCurrentChange, |
| | | } = usePaginationApi( |
| | | listPage, |
| | | { |
| | | season: '', |
| | | issueDate: '', |
| | | status: 0 |
| | | }, |
| | | [ |
| | | { |
| | | label: "å³ä¿åå·", |
| | | align: "center", |
| | | prop: "orderNo", |
| | | }, |
| | | { |
| | | label: "åå·¥åç§°", |
| | | align: "center", |
| | | prop: "staffName", |
| | | }, |
| | | { |
| | | label: "åå·¥ç¼å·", |
| | | align: "center", |
| | | prop: "staffNo" |
| | | }, |
| | | |
| | | { |
| | | label: "å³ä¿ç±»å", |
| | | align: "center", |
| | | prop: "dictTypeName", |
| | | |
| | | }, |
| | | { |
| | | label: "å³ä¿é²å
·", |
| | | align: "center", |
| | | prop: "dictName", |
| | | |
| | | }, |
| | | { |
| | | label: "åæ¾æ°é", |
| | | align: "center", |
| | | prop: "num", |
| | | |
| | | }, |
| | | { |
| | | label: "è¿åæ¥æ", |
| | | align: "center", |
| | | prop: "factoryDate", |
| | | |
| | | }, |
| | | { |
| | | label: "åæ¾æ¥æ", |
| | | align: "center", |
| | | prop: "issueDate", |
| | | |
| | | }, |
| | | { |
| | | label: "é¢ç¨æ¥æ", |
| | | align: "center", |
| | | prop: "adoptedDate", |
| | | |
| | | } |
| | | ] |
| | | ); |
| | | const clearIssueDaten = () => { |
| | | searchForm.value.issueDate = "" |
| | | searchForm.value.season = getCurrentMonth() |
| | | } |
| | | const statisticsObj = ref({ |
| | | ylqNum: 0, // å·²é¢åæ°é |
| | | wlqNum: 0, // æªé¢åæ°é |
| | | csylqNum: 0, // è¶
æ¶å·²é¢åæ°é |
| | | cswlqNum: 0 // è¶
æ¶æªé¢åæ°é |
| | | }) |
| | | |
| | | const resetParams = () => { |
| | | resetFilters(); |
| | | getStatistics(); |
| | | }; |
| | | |
| | | // å¤éååä»ä¹ |
| | | const handleSelectionChange = (selectionList) => { |
| | | multipleList.value = selectionList; |
| | | }; |
| | | const getList = (status) => { |
| | | switch (status){ |
| | | case 1: |
| | | filters.status = 1 |
| | | break; |
| | | case 2: |
| | | filters.status = 2 |
| | | break; |
| | | case 3: |
| | | filters.status = 3 |
| | | break; |
| | | case 4: |
| | | filters.status = 4 |
| | | break; |
| | | default: |
| | | filters.status = 0 |
| | | } |
| | | console.log(filters) |
| | | getTableData(); |
| | | getStatistics(); |
| | | const resetHandleQuery = () => { |
| | | searchForm.value.issueDate = ""; |
| | | searchForm.value.season = getCurrentMonth(); |
| | | handleQuery(0) |
| | | }; |
| | | |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getTableData(); |
| | | const handleQuery = (status) => { |
| | | switch (status){ |
| | | case 1: |
| | | searchForm.value.status = 1 |
| | | break; |
| | | case 2: |
| | | searchForm.value.status = 2 |
| | | break; |
| | | case 3: |
| | | searchForm.value.status = 3 |
| | | break; |
| | | case 4: |
| | | searchForm.value.status = 4 |
| | | break; |
| | | default: |
| | | searchForm.value.status = 0 |
| | | } |
| | | getList(); |
| | | getStatistics(); |
| | | }; |
| | | const changePage = ({ page, limit }) => { |
| | | pagination.currentPage = page; |
| | | pagination.pageSize = limit; |
| | | onCurrentChange(page); |
| | | }; |
| | | |
| | | const getStatistics = () => { |
| | | statistics(filters).then(res => { |
| | | statistics(searchForm.value).then(res => { |
| | | statisticsObj.value.cswlqNum = res.data.cswlqNum |
| | | statisticsObj.value.csylqNum = res.data.csylqNum |
| | | statisticsObj.value.ylqNum = res.data.ylqNum |
| | | statisticsObj.value.wlqNum = res.data.wlqNum |
| | | }) |
| | | } |
| | | // è·ååå
¸æ°æ® |
| | | const getList = async () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm.value}; |
| | | statisticsList(params).then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data; |
| | | }).catch(err => { |
| | | tableLoading.value = false; |
| | | }) |
| | | } |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download(`/lavorIssue/exportCopy`, {season: searchForm.value.season,issueDate: searchForm.value.issueDate}, "å³ä¿å°è´¦.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.info("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // äºä»¶å¤ç彿° |
| | | const handleSelectionChange = (selection) => { |
| | | multipleList.value = selection; |
| | | } |
| | | |
| | | // ç»ä»¶æè½½æ¶å è½½åå
¸æ°æ® |
| | | onMounted(() => { |
| | | getList() |
| | | }); |
| | | handleQuery() |
| | | }) |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .table_list { |
| | | margin-top: unset; |
| | | <style scoped> |
| | | .dynamic-table-container { |
| | | width: 100%; |
| | | } |
| | | |
| | | .pagination-container { |
| | | margin-top: 20px; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | :deep(.el-table .el-table__header-wrapper th) { |
| | | background-color: #F0F1F5 !important; |
| | | color: #333333; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | :deep(.el-table .el-table__body-wrapper td) { |
| | | padding: 8px 0; |
| | | } |
| | | |
| | | :deep(.el-select) { |
| | | width: 100%; |
| | | } |
| | | |
| | | :deep(.el-input) { |
| | | width: 100%; |
| | | } |
| | | .actions { |
| | | display: flex; |
| | | justify-content: space-around; |
| | | align-items: center; |
| | | //margin-top: 20px; |
| | | margin-bottom: 30px; |
| | | } |
| | | .head{ |
| | |
| | | font-weight: 600; |
| | | } |
| | | </style> |
| | | |
| | |
| | | const { VITE_APP_ENV } = env;
|
| | | const baseUrl =
|
| | | VITE_APP_ENV == "development"
|
| | | ? "http://114.132.189.42:8092" // å¼åç¯å¢å端æ¥å£
|
| | | : "http://114.132.189.42:8092"; // ç产ç¯å¢å端æ¥å£
|
| | | ? "http://192.168.1.138:7788" // å¼åç¯å¢å端æ¥å£
|
| | | : "http://114.132.189.42:7003"; // ç产ç¯å¢å端æ¥å£
|
| | |
|
| | | return {
|
| | | // é¨ç½²ç产ç¯å¢åå¼åç¯å¢ä¸çURLã
|
| | |
| | | },
|
| | | // vite ç¸å
³é
ç½®
|
| | | server: {
|
| | | port: 80,
|
| | | port: 8001,
|
| | | host: true,
|
| | | open: true,
|
| | | proxy: {
|