独墅湖高教创新区危化品智慧管控平台(新危化品)
zhouwx
2025-04-17 a8593f5ca77a934b31bbdd3b919d8e41796cb920
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<template>
  <div class="notice">
    <el-dialog
        v-model="dialogVisible"
        :title="title"
        width="50%"
        :before-close="handleClose"
        :close-on-press-escape="false"
        :close-on-click-modal="false"
    >
      <el-table v-loading="loading" :data="state.dataList" :border="true">
        <el-table-column label="序号" type="index" align="center" width="80" />
        <el-table-column label="时间" prop="createTime" align="center" width="120" />
        <el-table-column label="类型" prop="state" align="center">
          <template #default="scope">
            <span>{{scope.row.state ===0 ? '批量导入' : scope.row.state ===1 ? '取用' :scope.row.state ===2 ? '归还': scope.row.state ===3 ? '标签作废' : scope.row.state ===5 ? '相忌转入' : scope.row.state ===6 ? '相忌转出' : ''}}</span>
 
          </template>
        </el-table-column>
        <el-table-column label="数量" prop="num" align="center"  />
        <el-table-column label="操作人" prop="createName" align="center"  />
        <el-table-column label="变动后剩余" prop="remaining" align="center"  />
      </el-table>
      <pagination
          v-show="state.total > 0"
          :total="state.total"
          v-model:page="state.queryParams.pageNum"
          v-model:limit="state.queryParams.pageSize"
          @pagination="getRecord"
      />
 
    </el-dialog>
  </div>
</template>
<script setup>
import {reactive, ref, toRefs} from 'vue'
import {ElMessage} from "element-plus";
import {getRawWarehouseRecord} from "@/api/hazardousChemicals/rawRecord";
 
const dialogVisible = ref(false);
const title = ref("");
const busRef = ref();
const length = ref()
const emit = defineEmits(["getList"]);
const loading = ref(false)
const state = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    warehouseId: '',
    basicId: ''
  },
  total: 0,
  dataList: []
 
})
 
 
const openDialog = async (value) => {
  title.value = value.hazmatBasic.name + ' ' +  '(编号:' + value.hazmatBasic.productSn + ')' + ' '+  '的取用记录'
  state.form = JSON.parse(JSON.stringify(value));
  await getRecord()
  dialogVisible.value = true;
}
 
const getRecord = async () => {
  loading.value = true
  state.queryParams.basicId = state.form.basicId;
  state.queryParams.warehouseId = state.form.warehouseId;
  const res = await getRawWarehouseRecord(state.queryParams)
  if(res.code == 200){
    state.dataList = res.data.list
    state.total = res.data.total
  }else{
    ElMessage.warning(res.message)
  }
  loading.value = false
}
 
const handleClose = () => {
  reset();
  dialogVisible.value = false;
  emit("getList")
}
const reset = () => {
  state.form = {
    id: '',
    name: '',
    remark: '',
  }
}
defineExpose({
  openDialog
});
 
</script>
 
<style scoped lang="scss">
.notice{
  :deep(.el-form .el-form-item__label) {
    font-size: 15px;
  }
  .file {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
}
</style>