From ecb306c5612f474a5911af20a567f3f4d4db33d1 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期三, 24 九月 2025 15:02:23 +0800
Subject: [PATCH] 原材料订单拆分功能v1
---
src/views/CNAS/personnel/personnelInfo/tabs/communicate.vue | 334 +++++++++++++++++++-----------------------------------
1 files changed, 119 insertions(+), 215 deletions(-)
diff --git a/src/views/CNAS/personnel/personnelInfo/tabs/communicate.vue b/src/views/CNAS/personnel/personnelInfo/tabs/communicate.vue
index 4ae47d9..186ee8e 100644
--- a/src/views/CNAS/personnel/personnelInfo/tabs/communicate.vue
+++ b/src/views/CNAS/personnel/personnelInfo/tabs/communicate.vue
@@ -1,48 +1,28 @@
<template>
- <div class="flex_column">
-<!-- <TableCard :showForm="isDepartment" title="娌熼�氳褰�">-->
-<!-- <template v-slot:form >-->
-<!-- <div v-if="isDepartment" class="w100 items_center justify_between">-->
-<!-- <div></div>-->
-<!-- <div>-->
-<!-- <!– <el-button type="primary" size="small">瀵煎嚭</el-button> –>-->
-<!-- <el-button size="small" type="primary" @click="openDialog">鏂板</el-button>-->
-<!-- </div>-->
-<!-- </div>-->
-<!-- </template>-->
-<!-- <template v-slot:table>-->
-<!-- <ZTTable-->
-<!-- :column="columnData"-->
-<!-- :height="'calc(100vh - 21em)'"-->
-<!-- :table-data="tableData"-->
-<!-- :table-loading="loading"-->
-<!-- style="margin-top: 18px; padding: 0 15px;"-->
-<!-- ></ZTTable>-->
-<!-- <el-divider></el-divider>-->
-<!-- <div class="pagination">-->
-<!-- <div></div>-->
-<!-- <el-pagination-->
-<!-- :page-size="pagination.pageSize"-->
-<!-- :page-sizes="[10, 20, 30, 40]"-->
-<!-- :total="pagination.total"-->
-<!-- layout="total, sizes, prev, pager, next, jumper"-->
-<!-- @current-change=""-->
-<!-- @size-change=""-->
-<!-- >-->
-<!-- </el-pagination>-->
-<!-- </div>-->
-<!-- </template>-->
-<!-- </TableCard>-->
- <Add ref="communicateModal" @submit="getTableData"></Add>
+ <div class="flex_column">
+ <div v-if="isDepartment" style="display: flex;justify-content: space-between;margin-bottom: 10px">
+ <el-button size="small" type="primary" @click="getTableData">鍒锋柊</el-button>
+ <el-button size="small" type="primary" icon="el-icon-plus" @click="openDialog">鏂板</el-button>
</div>
+ <lims-table :tableData="tableData" :column="columnData"
+ @pagination="page" :height="'calc(100vh - 18em)'"
+ :page="pagination" :tableLoading="loading"></lims-table>
+ <Add ref="communicateModal" @submit="getTableData"></Add>
+ </div>
</template>
<script>
-// import Add from "./Add.vue"
+import CommunicateAdd from "../components/communicateAdd.vue"
+import limsTable from "@/components/Table/lims-table.vue";
+import {
+ deletePersonCommunicationAbility, exportPersonCommunicationAbility,
+ personPersonCommunicationAbilityPage
+} from "@/api/cnas/personal/personPersonCommunicationAbilityPage";
export default {
- components: {
- // Add
- },
+ components: {
+ limsTable,
+ Add: CommunicateAdd
+ },
props: {
departId: {
type: Number,
@@ -55,158 +35,109 @@
default: false
}
},
- data() {
- return {
- // departId: 0,
- columnData: [
- {
- label: '搴忓彿',
- prop: 'id'
- }, {
- label: '娌熼�氫汉',
- prop: 'userName'
- }, {
- label: '娌熼�氭椂闂�',
- prop: 'communicationTime'
- }, {
- label: '娌熼�氬湴鐐�',
- prop: 'communicationPlace'
- }, {
- label: '娌熼�氬唴瀹�',
- prop: 'communicationContent'
- }, {
- label: '鎿嶄綔',
- dataType: 'action',
- operation: [
- {
- name: '缂栬緫',
- type: 'text',
- clickFun: (row) => {
- this.openDialog(row, true)
- }
- }, {
- name: '瀵煎嚭',
- type: 'text',
- clickFun: (row) => {
- this.handleDown(row)
- }
- }, {
- name: '鍒犻櫎',
- type: 'text',
- color: '#f56c6c',
- clickFun: (row) => {
- this.delPerson(row.id)
- }
- }
- ]
- },
- ],
- tableData: [],
- pagination: {
- current: 1,
- pageSize: 20,
- total: 0
- },
- loading: false
- }
- },
- mounted() {
- // this.getTableData()
- },
- methods: {
- openDialog(row, type=false) {
- this.$refs.communicateModal.openDialog(row, type)
- },
- async getTableData() {
- this.loading = true
- const params = this.isDepartment ? {
- departLimsId: this.departId,
- current: this.pagination.current,
- size: this.pagination.pageSize
- } : {
- userId: this.departId,
- current: this.pagination.current,
- size: this.pagination.pageSize
- }
- const { code, data } = await this.$axios({
- method: 'get',
- url: personPersonCommunicationAbilityPage,
- params: params
- })
- if(code == 200) {
- this.pagination.total = data.total
- this.tableData = data.records
- this.loading = false
- }
- },
- /**
- * @desc 鑾峰彇璁惧id
- */
- getDepart(id) {
- // this.departId = id
- this.getTableData()
- },
- /**
- * @desc 鍒犻櫎娌熼�氳褰�
- */
- delPerson(id) {
- this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- }).then(async () => {
- let formData = new FormData()
- formData.append('id', id)
- const { code } = await this.$axios({
- method: 'delete',
- url: deletePersonCommunicationAbility,
- data: formData
- })
- if(code == 200) {
- this.$message({
- type: 'success',
- message: '鍒犻櫎鎴愬姛!'
- });
- this.getTableData()
- }
- })
- },
- async handleDown(row){
- this.$axios.post(this.$api.personCommunicationAbility.exportPersonCommunicationAbility,{id:row.id},{responseType: "blob"}).then(res => {
- if(res.code == 201){
- this.$message.error(res.message)
- return
- }
- const blob = new Blob([res],{ type: 'application/octet-stream' });
- //灏咮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 = row.userName+'-娌熼�氳褰�'+'.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 = row.userName+'-娌熼�氳褰�'+'.docx';
- link.click();
- this.$message.success('瀵煎嚭鎴愬姛')
+ data() {
+ return {
+ columnData: [
+ {
+ label: '娌熼�氫汉',
+ prop: 'userName'
+ }, {
+ label: '娌熼�氭椂闂�',
+ prop: 'communicationTime'
+ }, {
+ label: '娌熼�氬湴鐐�',
+ prop: 'communicationPlace'
+ }, {
+ label: '娌熼�氬唴瀹�',
+ prop: 'communicationContent'
+ }, {
+ label: '鎿嶄綔',
+ dataType: 'action',
+ operation: [
+ {
+ name: '缂栬緫',
+ type: 'text',
+ clickFun: (row) => {
+ this.openDialog(row, true)
+ }
+ }, {
+ name: '瀵煎嚭',
+ type: 'text',
+ clickFun: (row) => {
+ this.handleDown(row)
+ }
+ }, {
+ name: '鍒犻櫎',
+ type: 'text',
+ color: '#f56c6c',
+ clickFun: (row) => {
+ this.delPerson(row.id)
}
}
- })
- }
+ ]
+ },
+ ],
+ tableData: [],
+ pagination: {
+ current: 1,
+ size: 20,
+ total: 0
+ },
+ loading: false
+ }
+ },
+ mounted() {
+ this.getTableData()
+ },
+ methods: {
+ openDialog(row, type=false) {
+ this.$refs.communicateModal.openDialog(row, type)
},
+ getTableData() {
+ this.loading = true
+ const params = this.isDepartment ? {
+ departLimsId: this.departId,
+ current: this.pagination.current,
+ size: this.pagination.size
+ } : {
+ userId: this.departId,
+ current: this.pagination.current,
+ size: this.pagination.size
+ }
+ personPersonCommunicationAbilityPage(params).then(res => {
+ this.loading = false
+ this.tableData = res.data.records
+ this.pagination.total = res.data.total
+ }).catch(err => {
+ this.loading = false
+ })
+ },
+ page (page) {
+ this.pagination.size = page.limit
+ this.getTableData()
+ },
+ /**
+ * @desc 鍒犻櫎娌熼�氳褰�
+ */
+ delPerson(id) {
+ this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(async () => {
+ deletePersonCommunicationAbility({id: id}).then(res => {
+ this.$message.success('鍒犻櫎鎴愬姛!');
+ this.getTableData()
+ })
+ })
+ },
+ async handleDown(row){
+ exportPersonCommunicationAbility({id:row.id}).then(res => {
+ const blob = new Blob([res],{ type: 'application/octet-stream' });
+ this.$download.saveAs(blob, row.userName+'-娌熼�氳褰�'+'.docx');
+ })
+ }
+ },
watch: {
departId: {
handler(newId, oldId) {
@@ -219,31 +150,4 @@
}
</script>
<style scoped>
-.flex_column {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
-}
-.w100 {
- width: 100%;
-}
-.pagination {
- display: flex;
- justify-content: space-between
-}
-.items_center {
- display: flex;
- align-items: center;
-}
-.justify_between {
- justify-content: space-between
-}
-.date_box {
- margin: 0 5px;
-}
-
-.search {
- width: 150px;
- padding: 0 16px;
-}
</style>
--
Gitblit v1.9.3