gaoluyang
2025-04-22 490e2309b3ea598b4ffe14ceb0e5a8d3bd222347
1.检测或校准物品的处置
已修改2个文件
437 ■■■■■ 文件已修改
src/api/cnas/process/sampleDisposal.js 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/process/disposal/sampleDisposal/index.vue 424 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/cnas/process/sampleDisposal.js
@@ -10,7 +10,7 @@
  });
}
// 新增
// 新增详情
export function addProcessDeal(data) {
  return request({
    url: "/processDeal/addProcessDeal",
@@ -27,13 +27,12 @@
    data: data,
  });
}
//查询详情  分页查询里面totaldealId  传参历史的id
export function pageProcessDeal(query) {
// 提交历史  传参id
export function addProcessTotaldeal(data) {
  return request({
    url: "/processDeal/pageProcessDeal",
    method: "get",
    params: query,
    url: "/processTotaldeal/addProcessTotaldeal",
    method: "post",
    data: data,
  });
}
src/views/CNAS/process/disposal/sampleDisposal/index.vue
@@ -1,14 +1,6 @@
<template>
  <div class="capacity-scope">
    <el-tabs type="border-card" v-model="activeName" style="height: 100%;" @tab-click="queryParams.totaldealId = ''">
      <el-tab-pane label="填写" name="填写" style="height: 100%;" :key="1">
        <el-button size="small" type="primary" @click="handleAdd0" style="margin-bottom: 10px">新增</el-button>
        <div class="table" style="height: calc(100% - 200px)" v-if="activeName == '填写'">
          <lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading"
                      key="tableData" :height="'calc(100vh - 290px)'" :page="page" @pagination="pagination"></lims-table>
        </div>
      </el-tab-pane>
      <el-tab-pane label="历史记录" name="历史记录" style="height: 100%;" :key="2">
    <div style="display: flex;justify-content: space-between;align-items: flex-start">
        <el-form :model="queryParams0" ref="queryParams0" size="small" :inline="true">
          <el-form-item label="年月" prop="month">
            <el-date-picker v-model="queryParams0.month" type="month" placeholder="选择月" format="yyyy-MM"
@@ -20,77 +12,93 @@
            <el-button size="mini" @click="refresh">重置</el-button>
          </el-form-item>
        </el-form>
      <el-button size="small" type="primary" @click="handleAdd0">新增</el-button>
    </div>
        <div class="table">
          <lims-table :tableData="tableData0" :column="column0" :tableLoading="tableLoading"
                      key="tableData0"
            :height="'calc(100vh - 300px)'" :page="page0" @pagination="pagination0"></lims-table>
                  key="tableData0" :height="'calc(100vh - 240px)'" :page="page0" @pagination="pagination0"></lims-table>
        </div>
      </el-tab-pane>
    </el-tabs>
    <el-dialog title="详情" :visible.sync="editDialogVisible" width="70%">
      <el-button size="small" type="primary" @click="handleAdd('add')" style="margin-bottom: 10px">新增</el-button>
      <lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading"
                  key="tableData" :height="'calc(100vh - 290px)'">
      </lims-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="editDialogVisible = false">取消</el-button>
      </span>
    </el-dialog>
    <!-- 新增样品 -->
    <el-dialog :title="title" :visible.sync="addDialogVisible" width="400px">
    <el-dialog title="新增" :visible.sync="addDialogVisible" width="400px" @close="closeAddDialogVisible">
      <el-form ref="addInfo" :model="addInfo" :rules="rules" label-width="120px">
      <el-row>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">样品名称:</div>
            <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                v-model="addInfo.sampleName"></el-input></div>
          </div>
          <el-col :span="24">
            <el-form-item label="样品名称" prop="sampleName">
              <el-input size="small" placeholder="请输入" clearable
                        v-model="addInfo.sampleName"></el-input>
            </el-form-item>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">样品编号:</div>
            <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                v-model="addInfo.sampleCode"></el-input></div>
          </div>
          <el-col :span="24">
            <el-form-item label="样品编号" prop="sampleCode">
              <el-input size="small" placeholder="请输入" clearable
                        v-model="addInfo.sampleCode"></el-input>
            </el-form-item>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">供样单位:</div>
            <div class="search_input">
          <el-col :span="24">
            <el-form-item label="供样单位" prop="sampleSupplier">
              <el-select v-model="addInfo.sampleSupplier" size="small">
                <el-option :label="item.company" :value="item.company" v-for="(item, index) in customPageList"
                  :key="item.id"></el-option>
              </el-select>
            </div>
          </div>
            </el-form-item>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">数量:</div>
            <div class="search_input"><el-input size="small" placeholder="请输入" clearable
          <el-col :span="24">
            <el-form-item label="数量" prop="num">
              <el-input size="small" placeholder="请输入" clearable
                v-model="addInfo.num"></el-input>
            </div>
          </div>
            </el-form-item>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">处理方式:</div>
            <div class="search_input"><el-input size="small" placeholder="请输入" clearable
                v-model="addInfo.dealMethod"></el-input></div>
          </div>
          <el-col :span="24">
            <el-form-item label="处理方式" prop="dealMethod">
              <el-input size="small" placeholder="请输入" clearable
                        v-model="addInfo.dealMethod"></el-input>
            </el-form-item>
        </el-col>
        <el-col :span="24" style="margin-bottom: 16px;">
          <div class="search_thing">
            <div class="search_label">时间:</div>
            <div class="search_input">
          <el-col :span="24">
            <el-form-item label="时间" prop="dealTime">
              <el-date-picker v-model="addInfo.dealTime" type="date" size="small" placeholder="选择日期" format="yyyy-MM-dd"
                value-format="yyyy-MM-dd" style="width: 100%;">
              </el-date-picker>
            </div>
          </div>
            </el-form-item>
        </el-col>
      </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addDialogVisible = false">取 消</el-button>
        <el-button @click="closeAddDialogVisible">取 消</el-button>
        <el-button type="primary" @click="submitAdd" :loading="addLoading">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 新增历史 -->
    <el-dialog title="新增" :visible.sync="addDialogVisibleDeal" width="400px" @close="closeDiaDeal">
      <el-form ref="addInfoDeal" :model="addInfoDeal" :rules="rulesDeal" label-width="80px">
        <el-row>
          <el-col :span="24">
            <el-form-item label="月份" prop="month">
              <el-date-picker v-model="addInfoDeal.month" type="month" size="small" placeholder="选择月份" format="yyyy-MM"
                              value-format="yyyy-MM" style="width: 100%;">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeDiaDeal">取 消</el-button>
        <el-button type="primary" @click="submitAddDeal" :loading="addLoading">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 详情/下载/审核/批准 -->
    <el-dialog :title="title0" :visible.sync="lookDialogVisible" width="800px" :class="{ downPdf: title0 == '下载' }"
    <el-dialog :title="title0" :visible.sync="lookDialogVisible" width="400px" :class="{ downPdf: title0 == '下载' }"
      :modal="title0 != '下载'" top="5vh">
      <filePreview v-if="lookDialogVisible" :fileUrl="javaApi + '/word/' + currentInfo.url" :currentFile="{}"
        style="max-height: 70vh;overflow-y: auto;" />
      <span>是否通过{{title0}}?</span>
      <span slot="footer" class="dialog-footer" v-if="title0 == '审核' || title0 == '批准'">
        <el-button @click="submitCheck('不通过')" :loading="noCheckLoading">不通过</el-button>
        <el-button type="primary" @click="submitCheck('通过')" :loading="checkLoading">通 过</el-button>
@@ -111,7 +119,7 @@
  checkProcessTotaldeal,
  ratifyProcessTotaldeal,
  delProcessDeal,
  pageProcessTotaldeal,
  pageProcessTotaldeal, getProcessDeal, addProcessTotaldeal,
} from "@/api/cnas/process/sampleDisposal";
export default {
  name: 'SampleDisposal',
@@ -121,25 +129,40 @@
  },
  data() {
    return {
      activeName: '填写',
      title: '新增',
      addDialogVisible: false,
      addLoading: false,
      outLoading: false,
      editDialogVisible: false,
      queryParams: {},
      submitState: '',
      lookDialogVisible: false,
      title0: '查看',
      noCheckLoading: false,
      checkLoading: false,
      // 历史列表
      addInfo: {},//新增样品
      addInfoDeal: {
        month: ''
      },//新增样品
      addDialogVisibleDeal: false,
      rules: {
        sampleName: [{ required: true, message: '请填写样品名称', trigger: 'blur' }],
        sampleCode: [{ required: true, message: '请填写样品编号', trigger: 'blur' }],
        sampleSupplier: [{ required: true, message: '请选择供样单位', trigger: 'change' }],
        num: [{ required: true, message: '请填写数量', trigger: 'blur' }],
        dealMethod: [{ required: true, message: '请填写处理方式', trigger: 'blur' }],
        dealTime: [{ required: true, message: '请选择时间', trigger: 'change' }],
      },
      rulesDeal: {
        month: [{ required: true, message: '请选择月份', trigger: 'change' }],
      },
      customPageList: [],
      currentInfo: {
        arr: []
      },//查看的详情
      outPower: false,
      addPower: false,
      queryParams: {},
      tableData: [],
      column: [
        { label: "样品名称", prop: "sampleName" },
@@ -150,15 +173,17 @@
        { label: "时间", prop: "dealTime" },
        {
          dataType: "action",
          fixed: "right",
          label: "操作",
          operation: [
            {
              name: "编辑",
              type: "text",
              clickFun: (row) => {
                this.handleAdd0(row);
                this.handleAdd('edit',row);
              },
              disabled: (row) => {
                return this.submitState === '已提交'
              }
            },
            {
              name: "删除",
@@ -166,27 +191,74 @@
              clickFun: (row) => {
                this.handleDelete(row);
              },
              disabled: (row) => {
                return this.submitState === '已提交'
              }
            },
          ],
        },
      ],
      page: {
        total: 0,
        size: 10,
        current: 0,
      },
      tableLoading: false,
      queryParams0: {},
      tableData0: [],
      column0: [
        { label: "月份", prop: "month" },
        { label: "总数量", prop: "totalNum" },
        { label: "提交人", prop: "submitUserName" },
        {
          dataType: 'tag',
          label: '提交状态',
          prop: 'submitState',
          formatData: (params) => {
            return params
          },
          formatType: (params) => {
            if (params === '待提交') {
              return 'danger';
            } else if (params === '已提交') {
              return 'success';
            } else {
              return null;
            }
          }
        },
        { label: "审核人", prop: "examineUserName" },
        {
          dataType: 'tag',
          label: '审核状态',
          prop: 'examineState',
          formatData: (params) => {
            return params
          },
          formatType: (params) => {
            if (params === '不通过') {
              return 'danger';
            } else if (params === '通过') {
              return 'success';
            } else {
              return null;
            }
          }
        },
        { label: "批准人", prop: "ratifyUserName" },
        {
          dataType: 'tag',
          label: '批准状态',
          prop: 'ratifyState',
          formatData: (params) => {
            return params
          },
          formatType: (params) => {
            if (params === '不通过') {
              return 'danger';
            } else if (params === '通过') {
              return 'success';
            } else {
              return null;
            }
          }
        },
        {
          dataType: "action",
          fixed: "right",
          label: "操作",
          operation: [
            {
@@ -241,14 +313,13 @@
      ],
      page0: {
        total: 0,
        size: 10,
        current: 0,
        size: 20,
        current: 1,
      },
      operationType: ''
    };
  },
  mounted() {
    this.getCustomPageList()
    this.getList()
    this.getList0()
  },
  methods: {
@@ -262,27 +333,6 @@
      }).catch(err => { });
    },
    handleDown() { },
    getList() {
      this.tableLoading = true;
      let param = { ...this.queryParams, ...this.page };
      delete param.total;
      pageProcessDeal({ ...param })
        .then((res) => {
          this.tableLoading = false;
          if (res.code === 200) {
            this.tableData = res.data.records;
            this.page.total = res.data.total;
          }
        })
        .catch((err) => {
          this.tableLoading = false;
        });
    },
    pagination({ page, limit }) {
      this.page.current = page;
      this.page.size = limit;
      this.getList();
    },
    refresh() {
      this.queryParams0 = {};
      this.page0.current = 1;
@@ -292,9 +342,10 @@
      this.page0.current = 1;
      this.getList0();
    },
    // 查询全部记录
    getList0() {
      this.tableLoading = true;
      let param = { ...this.queryParams0, ...this.page };
      let param = { ...this.queryParams0, ...this.page0 };
      delete param.total;
      pageProcessTotaldeal({ ...param })
        .then((res) => {
@@ -313,57 +364,40 @@
      this.page0.size = limit;
      this.getList0();
    },
    // 填写
    // handleAdd(row){
    //   this.componentData0.entity.totaldealId = row.id
    //   this.editDialogVisible = true
    // },
    // 打开新增界面
    handleAdd0(row) {
      if (row) {
        this.addInfo = this.HaveJson(row)
        this.title = '编辑'
      } else {
        this.title = '新增'
        this.addInfo = {}
      }
      this.addDialogVisible = true
    // 打开新增历史界面
    handleAdd0() {
      this.addDialogVisibleDeal = true
      this.addInfoDeal.month = ''
    },
    // 提交新增
    submitAdd() {
      if (this.addInfo.id) {
        // 编辑
        this.addLoading = true
        doProcessDeal({
          totaldealId: this.queryParams.totaldealId,
          ...this.addInfo
        }).then(res => {
          this.addLoading = false
    closeAddDialogVisible() {
      this.$refs['addInfo'].resetFields();
          this.addDialogVisible = false
          this.$message({
            type: 'success',
            message: '编辑成功!'
          });
          this.page.current = 0;
          this.getList();
        }).catch(err => { });
      } else {
    },
    // 提交新增-历史
    submitAddDeal () {
      this.$refs.addInfoDeal.validate(valid => {
        if (valid) {
        // 新增
        this.addLoading = true
        addProcessDeal({
          totaldealId: this.queryParams.totaldealId,
          ...this.addInfo
          addProcessTotaldeal({
            ...this.addInfoDeal
        }).then(res => {
          this.addLoading = false
          this.addDialogVisible = false
            this.addDialogVisibleDeal = false
          this.$message({
            type: 'success',
            message: '新增成功!'
          });
          this.page.current = 0;
          this.getList();
        }).catch(err => { });
            this.getList0()
          }).catch(err => {
            this.addLoading = false
          });
      }
      })
    },
    closeDiaDeal() {
      this.$refs['addInfoDeal'].resetFields();
      this.addDialogVisibleDeal = false
    },
    // 提交
    handleSubmit(row) {
@@ -385,36 +419,86 @@
    },
    // 查看
    handleLook(row) {
      this.activeName = '填写'
      this.queryParams.totaldealId = row.id
      this.queryParams.id = row.id
      this.submitState = row.submitState
      this.$nextTick(() => {
        this.page.current = 1;
        this.editDialogVisible = true
        this.getList();
      })
    },
    commonFun(row, callbanck) {
      this.currentInfo = row
      this.queryParams.totaldealId = row.id
      pageProcessDeal({
        current: -1,
        size: -1, ...this.queryParams
      }).then(res => {
        this.lookDialogVisible = true
        this.currentInfo.arr = res.data.records
        if (callbanck) {
          callbanck()
    getList() {
      this.tableLoading = true;
      let param = { ...this.queryParams };
      getProcessDeal({ ...param })
        .then((res) => {
          this.tableLoading = false;
          if (res.code === 200) {
            this.tableData = res.data;
        }
        })
        .catch((err) => {
          this.tableLoading = false;
        });
    },
    // 打开新增详情弹框
    handleAdd(type, row) {
      this.addDialogVisible = true
      this.getCustomPageList()
      this.operationType = type
      if (row) {
        this.addInfo = {...row}
      }
    },
    // 提交-详情
    submitAdd() {
      this.$refs.addInfo.validate(valid => {
        if (valid) {
          this.addLoading = true
          addProcessDeal({
            totaldealId: this.queryParams.id,
            ...this.addInfo
          }).then(res => {
            this.addLoading = false
            this.addDialogVisible = false
            this.$message({
              type: 'success',
              message: '新增成功!'
            });
            this.getList()
          }).catch(err => {
            this.addLoading = false
          });
        }
      })
    },
    // 提交修改详情
    handleEdit() {
      if (type === 'submit') {
        doProcessDeal({
          id: row.id,
          ...row
        }).then(res => {
          this.$message({
            type: 'success',
            message: '编辑成功!'
          });
          this.getList();
      }).catch(err => { });
      }
    },
    // 审核
    handleCheck(row) {
      this.title0 = '审核'
      this.commonFun(row)
      this.lookDialogVisible = true
      this.currentInfo = row
      this.queryParams.id = row.id
    },
    // 批准
    handleApproval(row) {
      this.title0 = '批准'
      this.commonFun(row)
      this.lookDialogVisible = true
      this.currentInfo = row
      this.queryParams.id = row.id
    },
    // 提交审核/批准
    submitCheck(state) {
@@ -467,55 +551,19 @@
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
      }).then(() => {
          delProcessDeal({ id: row.id }).then((res) => {
            this.$message.success("删除成功");
            this.page.current = 0;
            this.getList();
          });
        })
        .catch(() => { });
      }).catch(() => { });
    },
  },
}
</script>
<style scoped>
.search_thing {
  width: 350px;
  display: flex;
  align-items: center;
}
.search_label {
  width: 110px;
  font-size: 14px;
  text-align: right;
}
.search_input {
  width: calc(100% - 110px);
}
.downPdf {
  opacity: 0 !important;
}
.tables td {
  height: 40px;
  width: 100px;
  text-align: center;
  font-size: 14px;
  word-wrap: break-word;
  white-space: normal;
}
.user-info .el-button {
  margin: 0;
}
>>>.el-tabs__content {
  height: 100%;
>>>.el-dialog__body {
  padding-top: 10px;
}
</style>