From e5454b769d44a34af423bf87ac8a740bf8c20341 Mon Sep 17 00:00:00 2001 From: Crunchy <3114200645@qq.com> Date: 星期二, 29 四月 2025 13:25:29 +0800 Subject: [PATCH] Merge branch 'dev' into dev_tides --- src/views/CNAS/resourceDemand/facilitiesEnvironment/component/Personnel-management.vue | 166 +++++++++++++++++++----------------------------------- 1 files changed, 59 insertions(+), 107 deletions(-) diff --git a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/Personnel-management.vue b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/Personnel-management.vue index b15fbc2..bfa51b8 100644 --- a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/Personnel-management.vue +++ b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/Personnel-management.vue @@ -1,52 +1,47 @@ <template> <div> - <div class="search-background"> - <span class="search-group"> - <span style="width: 160px">鏃ユ湡锛�</span> - <el-date-picker v-model="searchForm.registerDate" - clearable - format="yyyy-MM-dd" - placeholder="閫夋嫨鏃ユ湡" - size="small" - style="width: 100%" - type="date" - value-format="yyyy-MM-dd"> + <div class="search"> + <div> + <el-form :model="searchForm" ref="searchForm" size="small" :inline="true"> + <el-form-item label="鏃ユ湡" prop="registerDate"> + <el-date-picker v-model="searchForm.registerDate" clearable format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" + @change="searchList" size="small" style="width: 100%" type="date" value-format="yyyy-MM-dd"> </el-date-picker> - <el-button size="medium" style="margin-left: 10px" @click="resetSearchForm">閲� 缃�</el-button> - <el-button size="medium" type="primary" @click="searchList">鏌� 璇�</el-button> - </span> - <span class="search-group"> - <el-button size="medium" @click="handleDown">瀵� 鍑�</el-button> - <el-button size="medium" type="primary" @click="openFormDia('add')">鏂� 澧�</el-button> - </span> + </el-form-item> + <el-form-item> + <el-button type="primary" size="mini" @click="searchList">鏌ヨ</el-button> + <el-button size="mini" @click="resetSearchForm">閲嶇疆</el-button> + </el-form-item> + </el-form> + </div> + <div> + <el-button size="small" @click="handleDown">瀵� 鍑�</el-button> + <el-button size="small" type="primary" @click="openFormDia('add')">鏂� 澧�</el-button> + </div> </div> <div class="table"> - <ZTTable - :column="tableColumn" - :height="'calc(100vh - 20em)'" - :table-data="tableData" - :table-loading="tableLoading" - style="padding: 0 10px;margin-bottom: 16px"> - </ZTTable> - <el-pagination :current-page="1" :page-size="page.size" :page-sizes="[10, 20, 30, 50, 100]" - :total="total" layout="->,total, sizes, prev, pager, next, jumper" - @size-change="handleSizeChange" - @current-change="handleCurrentChange"> - </el-pagination> + <lims-table :tableData="tableData" :column="tableColumn" :height="'calc(100vh - 250px)'" @pagination="pagination" + :page="page" :tableLoading="tableLoading"></lims-table> </div> - <personnel-management-dia v-if="threeWastesDia" ref="threeWastesDia" @closeThreeWastesDia="closeThreeWastesDia"></personnel-management-dia> + <personnel-management-dia v-if="threeWastesDia" ref="threeWastesDia" + @closeThreeWastesDia="closeThreeWastesDia"></personnel-management-dia> </div> </template> <script> -// import ZTTable from '../../caorui/ZTTable/index.vue'; -// import PersonnelManagementDia from './Personnel-management-dia.vue'; import PersonnelManagementDia from '../component/Personnel-management-dia.vue'; +import limsTable from '@/components/Table/lims-table.vue' + +import { + pageForeignRegister, + delForeignRegister, + exportForeignRegister +} from '@/api/cnas/resourceDemand/foreignRegister/foreignRegister' export default { name: 'Personnel-management', // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� - components: { PersonnelManagementDia}, + components: { limsTable, PersonnelManagementDia }, data() { // 杩欓噷瀛樻斁鏁版嵁 return { @@ -121,8 +116,9 @@ tableData: [], tableLoading: false, page: { - size: 20, - current: 1, + total: 0, + size: 10, + current: 1 }, total: 0, threeWastesDia: false @@ -134,38 +130,37 @@ // 鏂规硶闆嗗悎 methods: { // 鏌ヨ鍒楄〃 - searchList () { - const entity = this.searchForm - const page = this.page + searchList() { this.tableLoading = true - this.$axios.post(this.$api.foreignRegister.pageForeignRegister, {entity, page}, { - headers: { - "Content-Type": "application/json" - }, - noQs: true + pageForeignRegister({ + ...this.page, + ...this.searchForm }).then(res => { this.tableLoading = false - if (res.code === 201) return - this.tableData = res.data.records - this.total = res.data.total + if (res.code === 200) { + this.tableData = res.data.records + this.page.total = res.data.total + } + }).catch(err => { console.log('err---', err); this.tableLoading = false }) }, // 鍒犻櫎 - delPlan (row) { + delPlan(row) { this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { confirmButtonText: '纭畾', cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => { this.tableLoading = true - this.$axios.get(this.$api.foreignRegister.delForeignRegister + '?registerId=' + row.registerId).then(res => { + delForeignRegister({ registerId: row.registerId }).then(res => { this.tableLoading = false - if (res.code === 201) return - this.$message.success('鍒犻櫎鎴愬姛') - this.searchList() + if (res.code === 200) { + this.$message.success('鍒犻櫎鎴愬姛') + this.searchList() + } }).catch(err => { this.tableLoading = false console.log('err---', err); @@ -178,67 +173,31 @@ }); }, // 鏂板锛岀紪杈戯紝鎵瑰噯寮规 - openFormDia (type, row) { + openFormDia(type, row) { this.threeWastesDia = true this.$nextTick(() => { this.$refs.threeWastesDia.openDia(type, row) }) }, // 瀵煎嚭 - handleDown (row) { - const entity = this.searchForm - this.$axios.post(this.$api.foreignRegister.exportForeignRegister,{entity},{ - responseType: "blob", - headers: { - "Content-Type": "application/json" - }, - noQs: true}).then(res => { - this.outLoading = false - const blob = new Blob([res],{ type: 'application/msword' }); - //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 - let reader = new FileReader(); - reader.readAsText(blob, 'utf-8'); - reader.onload = () => { - try { - let result = JSON.parse(reader.result); - if (result.message) { - this.$message.error(result.message); - } else { - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.download = '澶栨潵浜哄憳鐧昏' + '.docx'; - link.click(); - this.$message.success('瀵煎嚭鎴愬姛') - } - } catch (err) { - console.log(err); - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.download = '澶栨潵浜哄憳鐧昏' + '.docx'; - link.click(); - this.$message.success('瀵煎嚭鎴愬姛') - } - } + handleDown() { + exportForeignRegister(this.searchForm).then(res => { + const blob = new Blob([res], { type: 'application/msword' }); + this.$download.saveAs(blob, '澶栨潵浜哄憳鐧昏.docx') }) }, - closeThreeWastesDia () { + closeThreeWastesDia() { this.threeWastesDia = false this.searchList() }, // 閲嶇疆鏌ヨ鏉′欢 - resetSearchForm () { + resetSearchForm() { this.searchForm.registerDate = ''; this.searchList() }, - // 鍒嗛〉 - handleSizeChange(val) { - this.page.size = val; - this.searchList(); - }, - handleCurrentChange(val) { - this.page.current = val; + // 鍒嗛〉鍒囨崲 + pagination(page) { + this.page.size = page.limit this.searchList(); }, } @@ -246,16 +205,9 @@ </script> <style scoped> -.search-background { - width: 100%; - height: 60px; - line-height: 60px; +.search { + height: 46px; display: flex; justify-content: space-between; -} -.search-group { - display: flex; - align-items: center; - margin: 0 20px; } </style> -- Gitblit v1.9.3