gaoluyang
2025-03-05 9b0a40a9b2918dd0e92161edaff4a3f61b510141
src/views/CNAS/externalService/serviceAndSupplyPro/component/ConsumableList.vue
@@ -15,18 +15,10 @@
        </div>
      </template>
      <template v-slot:table>
        <limsTable
          :column="columns"
          :currentChange="rowClick"
          :height="'25vh'"
          :highlightCurrentRow="true"
          :isSelection="false"
          :rowStyle="tableRowStyle"
          :table-data="tableData"
          rowKey="id"
          style="margin-top: 18px; padding: 0 15px;"
        >
          <template v-slot:consumablesTypeSlot="{row}">
        <limsTable :column="columns" :currentChange="rowClick" :height="'25vh'" :highlightCurrentRow="true"
          :isSelection="false" :rowStyle="tableRowStyle" :table-data="tableData" rowKey="id"
          style="margin-top: 18px; padding: 0 15px;">
          <template v-slot:consumablesTypeSlot="{ row }">
            {{ findType(row.consumablesType) }}
          </template>
          <template v-slot:operation="scope">
@@ -36,14 +28,8 @@
        </limsTable>
        <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 :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>
      </template>
@@ -52,7 +38,7 @@
    <div>
      <ConsumableProject ref="consumableProject"></ConsumableProject>
    </div>
    <Edit ref="editRef" :contentsId="contentsId" @submit="fetchData"/>
    <Edit ref="editRef" :contentsId="contentsId" @submit="fetchData" />
  </div>
</template>
@@ -70,7 +56,7 @@
export default {
  dicts: ["consumables_type"],
  components: {
    TableCard, limsTable,Edit, ConsumableProject
    TableCard, limsTable, Edit, ConsumableProject
  },
  props: {
    contentsId: {
@@ -161,7 +147,7 @@
  },
  methods: {
    async fetchData() {
      procurementSuppliesList({ contentId: this.contentsId}).then(res => {
      procurementSuppliesList({ contentId: this.contentsId }).then(res => {
        if (res.code === 200) {
          this.tableData = res.data.records
          if (this.tableData.length > 0) {
@@ -174,7 +160,7 @@
      this.$nextTick()
      let res
      const e = this.options.find(item => item.value == val)
      if(e) {
      if (e) {
        res = e.label
      } else {
        res = '-'
@@ -185,10 +171,9 @@
      this.$refs.editRef.openDialog(row);
    },
    async exportExcel() {
      exportProcurementSuppliesList({parentId:this.contentsId}).then(res => {
        const blob = new Blob([res], {type: 'application/octet-stream'});
      exportProcurementSuppliesList({ parentId: this.contentsId }).then(res => {
        const blob = new Blob([res], { type: 'application/octet-stream' });
        this.$download.saveAs(blob, '耗材列表.xlsx')
        this.$message.success('导出成功')
      })
    },
    handleCurrent() {
@@ -196,7 +181,7 @@
    handleSize() {
    },
    handleDelete(row) {
      deleteProcurementSuppliesList({ id:row.id }).then(res => {
      deleteProcurementSuppliesList({ id: row.id }).then(res => {
        if (res.code === 200) {
          this.$message.success('删除成功')
          this.fetchData()
@@ -206,8 +191,8 @@
    rowClick(row) {
      this.$refs.consumableProject.fetchListId(row)
    },
    tableRowStyle({row}) {
      if(row.currentAmount <= row.lowerLimit) {
    tableRowStyle({ row }) {
      if (row.currentAmount <= row.lowerLimit) {
        return { background: '#ffcaca' }
      } else {
        return {}