| | |
| | | </div> |
| | | <div class="table"> |
| | | <lims-table :tableData="tableData" :column="columns" :height="'calc(100vh - 250px)'" @pagination="pagination" |
| | | :page="page" :tableLoading="tableLoading"></lims-table> |
| | | :page="page" :tableLoading="tableLoading"> |
| | | <template slot="action" slot-scope="{ row }"> |
| | | <el-button type="text" @click="edit(row)">编辑</el-button> |
| | | </template> |
| | | </lims-table> |
| | | </div> |
| | | <AddRecord ref="addRecordRef" @submit="submit"></AddRecord> |
| | | <AddRecord ref="addRecordRef" v-if="addRecordRef" @submit="submit"></AddRecord> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | // import axios from "axios"; |
| | | // import { getPageAcceptance, addAcceptance, updateAcceptance, getAcceptanceDetails, exportAcceptance } from "@/assets/api/api"; |
| | | // import ZTTable from '@/components/caorui/ZTTable/index.vue'; |
| | | // import AddRecord from './components/AddRecord.vue'; |
| | | |
| | | import limsTable from '@/components/Table/lims-table.vue' |
| | | import AddRecord from './component/AddRecord.vue'; |
| | | import { |
| | | getPageAcceptance, |
| | | updateAcceptanc, |
| | | addAcceptance |
| | | getPageAcceptance, getAcceptanceDetails, exportFeStandardSubstanceAcceptance, updateAcceptance, addAcceptance |
| | | } from '@/api/cnas/resourceDemand/standardMaterialAccept/standardMaterialAccept' |
| | | export default { |
| | | components: { |
| | |
| | | form: { |
| | | search: undefined |
| | | }, |
| | | addRecordRef: false, |
| | | columns: [ |
| | | { |
| | | label: "出场编号", |
| | |
| | | this.getTableData() |
| | | }, |
| | | methods: { |
| | | async getTableData() { |
| | | const res = await getPageAcceptance(this.form); |
| | | if (res.code === 200) { |
| | | getTableData() { |
| | | getPageAcceptance(this.form).then(res => { |
| | | this.tableData = res.data.records; |
| | | this.page.total = res.data.total; |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | openDialog() { |
| | | this.$refs.addRecordRef.openDialog() |
| | | }, |
| | | async submit(form) { |
| | | |
| | | const { code } = await form.acceptance.id ? updateAcceptanc(this.form) : addAcceptance((this.form)); |
| | | if (code == 200) { |
| | | this.$message.success(`${form.acceptance.id ? '编辑' : '添加'}成功`) |
| | | this.getTableData() |
| | | } |
| | | }, |
| | | async edit(row) { |
| | | const res = await this.getDetail(row.id) |
| | | this.$refs.addRecordRef.openDialog({ |
| | | acceptance: res.acceptance, |
| | | list: res.list |
| | | this.addRecordRef = true; |
| | | this.$nextTick(() => { |
| | | this.$refs.addRecordRef.openDialog() |
| | | }) |
| | | }, |
| | | async getDetail(id) { |
| | | const { code, data } = await axios({ |
| | | method: 'get', |
| | | url: getAcceptanceDetails, |
| | | params: { id } |
| | | submit() { |
| | | this.addRecordRef = false; |
| | | this.getTableData() |
| | | }, |
| | | edit(row) { |
| | | this.addRecordRef = true; |
| | | this.$nextTick(() => { |
| | | this.$refs.addRecordRef.openDialog(row.id) |
| | | }) |
| | | if (code == 200) { |
| | | return data; |
| | | } |
| | | }, |
| | | reset() { |
| | | this.form.search = undefined |
| | | this.getTableData() |
| | | }, |
| | | async exportExcel() { |
| | | const res = await axios({ |
| | | method: "get", |
| | | url: `${exportAcceptance}`, |
| | | responseType: "blob" |
| | | exportFeStandardSubstanceAcceptance().then(res => { |
| | | const blob = new Blob([res], { type: 'application/octet-stream' }); |
| | | this.$download.saveAs(blob, '标准物质验收.xlsx'); |
| | | }) |
| | | const blob = new Blob([res], { type: 'application/octet-stream' }); |
| | | this.$download.saveAs(blob, '标准物质验收.xlsx'); |
| | | }, |
| | | |
| | | // 分页切换 |
| | | pagination(page) { |
| | | this.page.size = page.limit |