From f2d864f310854aafbdae6683430c72aad19464a7 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期四, 26 十二月 2024 14:33:08 +0800 Subject: [PATCH] 完成标准物质清单迁移 --- src/components/view/a6-standard-material-list.vue | 418 +++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 305 insertions(+), 113 deletions(-) diff --git a/src/components/view/a6-standard-material-list.vue b/src/components/view/a6-standard-material-list.vue index 188fa49..6314d96 100644 --- a/src/components/view/a6-standard-material-list.vue +++ b/src/components/view/a6-standard-material-list.vue @@ -1,139 +1,331 @@ -<style scoped> - .title { - height: 60px; - line-height: 60px; - } - - .search { - background-color: #fff; - height: 80px; - display: flex; - align-items: center; - } - .search_thing { - display: flex; - align-items: center; - height: 50px; - } - .search_label { - width: 120px; - font-size: 14px; - text-align: right; - } - - .search_input { - width: calc(100% - 120px); - } - .table { - margin-top: 10px; - background-color: #fff; - width: calc(100% - 40px); - height: calc(100% - 60px - 80px - 10px - 40px); - padding: 20px; - } - -</style> <template> - <div class="below-standard-main"> - <div style="width: 100%;height: 100%;"> - <div> - <el-row class="title"> - <el-col :span="12" style="padding-left: 20px;text-align: left;">鏍囧噯鐗╄川娓呭崟</el-col> - <el-col :span="12" style="text-align: right;"> - <el-button size="medium" type="primary" @click="$refs['ValueTable'].openAddDia('鏂板鎺ュ彛')" v-if="addPower">鏂� 澧�</el-button> - <el-button size="medium" @click="$refs['ValueTable'].openDownDia()">瀵� 鍑�</el-button> - </el-col> - </el-row> + <div> + <div> + <div class="view-title"> + <span>鏍囧噯鐗╄川娓呭崟</span> + <span> + <el-button size="medium" @click="exportFun">瀵� 鍑�</el-button> + <el-button size="medium" type="primary" @click="openFormDia('add')">鏂� 澧�</el-button> + </span> </div> - <div class="search"> - <div class="search_thing"> - <div class="search_label">鍚嶇О锛�</div> - <div class="search_input"> - <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="componentData.entity.model" - @keyup.enter.native="refreshTable()"></el-input></div> - </div> - <div class="search_thing"> - <div class="search_label">鐢熶骇鍘傚锛�</div> - <div class="search_input"> - <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="componentData.entity.sample" - @keyup.enter.native="refreshTable()"></el-input> - </div> - </div> - <div class="search_thing" style="padding-left: 30px;"> - <el-button size="small" @click="refresh()">閲� 缃�</el-button> - <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> - </div> + <div class="search-background"> + <span class="search-group"> + <span style="width: 180px">鏍囧噯鐗╄川鍚嶇О锛�</span> + <el-input v-model="searchForm.name" clearable size="small"></el-input> + </span> + <span class="search-group"> + <span style="width: 120px">鐢熶骇鍘傚锛�</span> + <el-input v-model="searchForm.factoryManufacturer" clearable size="small"></el-input> + </span> + <span class="search-group"> + <el-button size="medium" @click="resetSearchForm">閲� 缃�</el-button> + <el-button size="medium" type="primary" @click="searchList">鏌� 璇�</el-button> + </span> </div> <div class="table"> - <ValueTable ref="ValueTable" :url="$api.unPass.pageInsUnPass" :componentData="componentData" - :key="upIndex" /> + <div> + <TableCard :showForm="false" :showTitle="false"> + <template v-slot:table> + <ZTTable + :column="tableColumn" + :height="'calc(100vh - 23em)'" + :table-data="tableData" + :table-loading="tableLoading" + style="padding: 0 15px;margin-bottom: 16px"> + </ZTTable> + </template> + </TableCard> + <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> + </div> </div> </div> + <form-dia v-if="formDia" ref="formDia" @closeYearDia="closeYearDia"></form-dia> + <borrow-dia v-if="borrowDia" ref="borrowDia" @closeYearDia="closeBorrowDia"></borrow-dia> + <return-dia v-if="returnDia" ref="returnDia" @closeYearDia="closeReturnDia"></return-dia> </div> </template> <script> import ValueTable from '../tool/value-table.vue' + import ZTTable from '../caorui/ZTTable/index.vue'; + import TableCard from '../caorui/TableCard/index.vue'; + import FormDia from '../do/a6-standard-material-list/formDia.vue'; + import BorrowDia from '../do/a6-standard-material-list/borrowDia.vue'; + import ReturnDia from '../do/a6-standard-material-list/returnDia.vue'; export default { components: { + ReturnDia, + BorrowDia, + FormDia, + TableCard, + ZTTable, ValueTable, }, data() { return { - componentData: { - entity: { - sample: null, - model: null, - orderBy: { - field: 'id', - order: 'asc' - } - }, - isIndex: true, - showSelect: false, - select: false, - do: [ - { - id: 'update', - font: '缂栬緫', - type: 'text', - method: 'doDiy', - field:['createUserName','updateUserName'] - },{ - id: 'delete', - font: '鍒犻櫎', - type: 'text', - method: 'doDiy' - } - ], - tagField: [], - selectField: [], - requiredAdd: ['model','sample',], - requiredUp: [], - needSort: ['sample'], + searchForm: { + name: '', + factoryManufacturer: '', + }, + tableColumn: [ + { + label: '鏍囧噯鐗╄川鍚嶇О', + prop: 'name', + minWidth: '120' }, - entityCopy: {}, - upIndex: 0, - stateList: [], - addPower:true, - } + { + label: '瑙勬牸鍨嬪彿', + prop: 'model', + minWidth: '100' + }, + { + label: '鐢熶骇鍘傚', + prop: 'factoryManufacturer', + minWidth: '100' + }, + { + label: '鍑哄巶缂栧彿', + prop: 'factoryNum', + minWidth: '100' + }, + { + label: '绠$悊缂栧彿', + prop: 'manageNum', + minWidth: '100' + }, + { + label: '涓嶇‘瀹氬害', + prop: 'uncertainty', + minWidth: '100' + }, + { + label: '鏁伴噺', + prop: 'quantity', + minWidth: '100' + }, + { + label: '璐疆鏃ユ湡', + prop: 'acquisitionDate', + minWidth: '150' + }, + { + label: '鏈夋晥鏈�', + prop: 'effectiveDate', + minWidth: '150' + }, + { + label: '妗f缂栧彿', + prop: 'fileNum', + minWidth: '100' + }, + { + label: '瀛樻斁浣嶇疆', + prop: 'position', + minWidth: '100' + }, + { + label: '澶囨敞', + prop: 'remark', + minWidth: '100' + }, + // { + // label: '鍒涘缓浜�', + // prop: 'createUser', + // minWidth: '100' + // }, + { + label: '鍒涘缓鏃堕棿', + prop: 'createTime', + minWidth: '150' + }, + { + dataType: 'action', + fixed: 'right', + minWidth: '180', + label: '鎿嶄綔', + operation: [ + { + name: '缂栬緫', + type: 'text', + clickFun: (row) => { + this.openFormDia('edit', row); + }, + }, + { + name: '鍊熺敤', + type: 'text', + clickFun: (row) => { + this.borrow(row); + }, + }, + { + name: '褰掕繕', + type: 'text', + clickFun: (row) => { + this.return(row); + } + }, + { + name: '鍒犻櫎', + type: 'text', + color: '#f56c6c', + clickFun: (row) => { + this.delPlan(row) + }, + } + ] + } + ], + tableData: [], + tableLoading: false, + page: { + size: 20, + current: 1, + }, + total: 0, + formDia: false, + borrowDia: false, + returnDia: false, + } }, mounted() { - this.entityCopy = this.HaveJson(this.componentData.entity) - this.getPower() + this.searchList() }, methods :{ - refreshTable() { - this.$refs['ValueTable'].selectList() - }, - refresh() { - this.componentData.entity = this.HaveJson(this.entityCopy) - this.upIndex++ - }, - // 鏉冮檺鍒嗛厤 - getPower(radio) { - let power = JSON.parse(sessionStorage.getItem('power')) + exportFun() { + this.outLoading = true + this.$axios.get(this.$api.feStandardSubstance.exportOfStandardSubstanceList + '?factoryManufacturer=' + this.searchForm.factoryManufacturer + + '&name=' + this.searchForm.name, {responseType: "blob"}).then(res => { + this.outLoading = false + this.$message.success('瀵煎嚭鎴愬姛') + const blob = new Blob([res], {type: 'application/octet-stream'}); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '鏍囧噯鐗╄川娓呭崟.xlsx'; + link.click(); + }).finally(() => { + this.outLoading = false + }) + }, + // 鏌ヨ鍒楄〃 + searchList () { + this.tableLoading = true + this.$axios.get(this.$api.feStandardSubstance.getPageStandardSubstance + '?factoryManufacturer=' + this.searchForm.factoryManufacturer + + '&name=' + this.searchForm.name + + '&pages=' + this.page.current + '&size=' + this.page.size).then(res => { + this.tableLoading = false + if (res.code === 201) return + this.tableData = res.data.records + this.total = res.data.total + }).catch(err => { + this.tableLoading = false + }) + }, + // 鍒犻櫎 + delPlan (row) { + this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.tableLoading = true + this.$axios.get(this.$api.feStandardSubstance.removeStandardSubstance + '?id=' + row.id).then(res => { + this.tableLoading = false + if (res.code === 201) return + this.$message.success('鍒犻櫎鎴愬姛') + this.searchList() + }).catch(err => { + this.tableLoading = false + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + // 鏂板锛岀紪杈戯紝鎵瑰噯寮规 + openFormDia (type, row) { + this.formDia = true + this.$nextTick(() => { + this.$refs.formDia.openDia(type, row) + }) + }, + closeYearDia () { + this.formDia = false + this.searchList() + }, + // 鍊熺敤 + borrow (row) { + this.borrowDia = true + this.$nextTick(() => { + this.$refs.borrowDia.openDia(row) + }) + }, + closeBorrowDia () { + this.borrowDia = false + this.searchList() + }, + // 褰掕繕 + return (row) { + this.returnDia = true + this.$nextTick(() => { + this.$refs.returnDia.openDia(row) + }) + }, + closeReturnDia () { + this.returnDia = false + this.searchList() + }, + // 閲嶇疆鏌ヨ鏉′欢 + resetSearchForm () { + this.searchForm.name = ''; + this.searchForm.factoryManufacturer = ''; + this.searchList() + }, + // 鍒嗛〉 + handleSizeChange(val) { + this.page.size = val; + this.searchList(); + }, + handleCurrentChange(val) { + this.page.current = val; + this.searchList(); }, } } </script> +<style scoped> +.view-title { + display: flex; + justify-content: space-between; + align-items: center; + height: 60px; + padding-left: 20px; +} + +.search-background { + width: 100%; + height: 80px; + line-height: 80px; + background-color: #ffffff; + display: flex; +} + +.search-group { + display: flex; + align-items: center; + margin: 0 20px; +} + +.table { + margin-top: 20px; + background-color: #ffffff; + padding-top: 20px; +} +</style> -- Gitblit v1.9.3