From f9d1ac78b245cb672342e96cf0e905b812352651 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期五, 21 三月 2025 11:23:24 +0800 Subject: [PATCH] 原材料下单-检验标准未回显 --- src/views/CNAS/resourceDemand/standardMaterialAccept/index.vue | 138 ++++++++++++--------------------------------- 1 files changed, 37 insertions(+), 101 deletions(-) diff --git a/src/views/CNAS/resourceDemand/standardMaterialAccept/index.vue b/src/views/CNAS/resourceDemand/standardMaterialAccept/index.vue index b6bb91f..7b2180f 100644 --- a/src/views/CNAS/resourceDemand/standardMaterialAccept/index.vue +++ b/src/views/CNAS/resourceDemand/standardMaterialAccept/index.vue @@ -4,11 +4,11 @@ <div> <el-form :model="form" ref="form" size="small" :inline="true"> <el-form-item label="鐗╄川鍚嶇О"> - <el-input v-model="form.search"></el-input> + <el-input v-model="form.name"></el-input> </el-form-item> <el-form-item> - <el-button @click="reset">閲� 缃�</el-button> - <el-button type="primary" @click="getTableData">鏌� 璇�</el-button> + <el-button type="primary" @click="getTableData" size="mini">鏌ヨ</el-button> + <el-button @click="reset" size="mini">閲嶇疆</el-button> </el-form-item> </el-form> </div> @@ -19,58 +19,33 @@ </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> - -<!-- <div class="tables">--> -<!-- <ZTTable--> -<!-- :column="columns"--> -<!-- :table-data="tableData"--> -<!-- >--> -<!-- <template slot="action" slot-scope="{ row }">--> -<!-- <el-button type="text" @click="edit(row)">缂栬緫</el-button>--> -<!-- </template>--> -<!-- </ZTTable>--> -<!-- <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="handleCurrent"--> -<!-- @size-change="handleSize"--> -<!-- >--> -<!-- </el-pagination>--> -<!-- </div>--> -<!-- </div>--> -<!-- <AddRecord ref="addRecordRef" @submit="submit"></AddRecord>--> </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: { - limsTable - + limsTable, + AddRecord }, data() { return { form: { - search: undefined + name: undefined }, + addRecordRef: false, columns: [ { label: "鍑哄満缂栧彿", @@ -137,81 +112,38 @@ this.getTableData() }, methods: { - async getTableData() { - const res = await getPageAcceptance(this.form); - if(res.code === 200){ + getTableData() { + getPageAcceptance({...this.form, ...this.page}).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.form.name = 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'}); - //灏咮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 = '鏍囧噯鐗╄川楠屾敹.xlsx'; - 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 = '鏍囧噯鐗╄川楠屾敹.xlsx'; - link.click(); - this.$message.success('瀵煎嚭鎴愬姛') - } - } }, - // 鍒嗛〉鍒囨崲 pagination(page) { this.page.size = page.limit @@ -222,6 +154,10 @@ </script> <style scoped> +.capacity-scope { + padding: 20px !important; +} + .search { height: 46px; display: flex; -- Gitblit v1.9.3