选煤厂生产管理平台前端代码
Jay
2024-12-10 58a8ee8eebcf13656445486333d2d3f3e02c938f
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<template>
  <div>
    <el-card shadow="never" class="aui-card--fill">
      <div class="mod-wash-curves">
        <el-form :inline="true" :model="dataForm">
          <el-form-item>
            <el-date-picker
              v-model="queryParams.startTime"
              type="date"
              clearable
              value-format="YYYY-MM-DD"
              format="YYYY-MM-DD"
              placeholder="开始时间"/>
          </el-form-item>
          <el-form-item>
            <el-date-picker
              v-model="queryParams.endTime"
              type="date"
              clearable
              value-format="YYYY-MM-DD"
              format="YYYY-MM-DD"
              placeholder="结束时间"/>
          </el-form-item>
          <el-form-item>
            <dict-select-tag style="width: 100%" v-model="queryParams.mz" :clearable="true" placeholder="煤种" dictCode="ymmz" />
          </el-form-item>
          <el-form-item>
            <dict-select-tag style="width: 100%" v-model="queryParams.fcfa" :clearable="true" placeholder="浮沉方案" dictCode="analysis-fcfa" />
          </el-form-item>
          <el-form-item>
            <el-button @click="handleQuery">
              <Icon icon="ep:search" class="mr-5px" />
              查询
            </el-button>
            <el-button type="primary" plain @click="openForm('create')">
              <Icon icon="ep:plus" class="mr-5px" />
              新增
            </el-button>
            <el-button type="warning" plain @click="handleImport">
              <Icon icon="ep:upload" /> 导出
            </el-button>
            <el-button @click="weighted()">加权平均</el-button>
          </el-form-item>
        </el-form>
        <el-table
          ref="table"
          v-loading="dataListLoading"
          :data="dataList"
          border
          height="400"
          highlight-current-row
          @current-change="currentChange"
          @selection-change="selectionChangeHandle"
          @sort-change="dataListSortChangeHandle"
          style="width: 100%;">
          <el-table-column type="selection" header-align="center" align="center"
                           width="50"/>
          <el-table-column prop="code" label="流水号" header-align="center" align="center"
                           width="120"/>
          <el-table-column prop="ny" label="年月" header-align="center" align="center"
                           width="100"/>
          <el-table-column prop="syrq" label="实验日期" header-align="center" width="120"
                           align="center"/>
          <el-table-column prop="mzName" label="煤种" header-align="center"
                           align="center"/>
          <el-table-column prop="drl" label="调入量" header-align="center"
                           align="center"/>
          <el-table-column prop="fcfaName" label="浮沉方案" header-align="center"
                           align="center"/>
          <el-table-column prop="bz" label="备注" header-align="center" align="left"
                           min-width="200"/>
          <el-table-column label="操作" fixed="right" header-align="center" align="center" width="150">
            <template #default="scope">
              <el-button v-hasPermi="['data:ind-item:update']" link type="primary" @click="openForm('update', scope.row.id)">
                修改
              </el-button>
              <el-button v-hasPermi="['data:ind-item:delete']" link type="danger" @click="handleDelete(scope.row.id)">
                删除
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <Pagination
          v-model:limit="queryParams.pageSize"
          v-model:page="queryParams.pageNo"
          :total="total"
          @pagination="getList"
        />
      </div>
    </el-card>
    <el-card shadow="never" class="aui-card--fill">
      <div class="mod-analysis-full-det">
        <WashCurvesDet ref="washCurvesDetRef" @drawWashCurves="drawWashCurves"/>
      </div>
    </el-card>
  </div>
  <WashCurvesForm ref="washCurvesFormRef" @success="getList" />
</template>
 
<script lang="ts" setup>
  import * as WashCurvesApi from '@/api/xmcpms/coal-quality/analysis/wash-curves/index'
  import WashCurvesDet from './WashCurvesDet.vue'
  import WashCurvesForm from './WashCurvesForm.vue'
  import { useRoute, useRouter } from 'vue-router';
 
  const router = useRouter() // 路由
  const message = useMessage() // 消息弹窗
  const { t } = useI18n() // 国际化
  defineOptions({ name: 'Analysis' })
  const dataListLoading = ref(true) // 列表的加载中
  const total = ref(0) // 列表的总页数
  const dataList = ref([]) // 字典表格数据
  const queryFormRef = ref() // 搜索的表单
  const exportLoading = ref(false) // 导出的加载中
 
  const handleQuery = () => {
    queryParams.pageNo = 1
    getList()
  }
 
  /** 重置按钮操作 */
  const resetQuery = () => {
    queryFormRef.value.resetFields()
    handleQuery()
  }
 
  const getList = async () => {
    dataListLoading.value = true
    try {
      const data = await WashCurvesApi.getWashCurvesPage(queryParams)
      dataList.value = data.list
      total.value = data.total
    } finally {
      dataListLoading.value = false
    }
  }
 
  const queryParams = reactive({
    pageNo: 1,
    pageSize: 10,
    startTime: '',
    endTime: '',
    mz: undefined,
    fcfa: undefined
  })
 
  /** 添加/修改操作 */
  const washCurvesFormRef = ref()
  const openForm = (type: string, id?: string) => {
    washCurvesFormRef.value.open(type, id)
  }
 
  const washCurvesDetRef = ref()
  const currentRow = ref()
 
  const currentChange = (row) =>  {
    currentRow.value = row
    washCurvesDetRef.value.open(row)
  }
 
  const route = useRoute();
 
  function drawWashCurves() {
    if (!currentRow.value.id) {
      message.error('请先选择可选性曲线台账!')
      return
    }
    // 动态路由
    router.push({
      // name: route.name + '__' + currentRow.value.id,
      path: '/xmcpms/coal-quality/analysis/WashCurvesDraw',
      query: {
        curvesId : currentRow.value.id,
        fcfa : currentRow.value.fcfa,
        code : currentRow.value.code,
        title : route.title + '-' + currentRow.value.code
      }
    })
  }
 
  let dataListSelections = reactive([])
  // 多选
  function selectionChangeHandle (val) {
    dataListSelections = val
  }
 
  /** 删除按钮操作 */
  const handleDelete = async (id: string) => {
    let ids = dataListSelections.map(item => {
      return item.id
    })
    ids.push(id)
    try {
      // 删除的二次确认
      await message.delConfirm()
      // 发起删除
      await WashCurvesApi.deleteWashCurves(ids)
      message.success(t('common.delSuccess'))
      // 刷新列表
      await getList()
    } catch {
    }
  }
  /** 初始化 **/
  onMounted(async () => {
    await getList()
  })
</script>