init
This commit is contained in:
303
src/views/QualityManager/scrap/ScrapInfo-add.vue
Normal file
303
src/views/QualityManager/scrap/ScrapInfo-add.vue
Normal file
@@ -0,0 +1,303 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2021-07-20 11:03:09
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible"
|
||||
@close="onClose"
|
||||
>
|
||||
<el-row :gutter="15" style="padding: 0 20px;">
|
||||
<el-form
|
||||
ref="dataForm"
|
||||
:model="dataForm"
|
||||
:rules="rules"
|
||||
size="medium"
|
||||
label-width="150px"
|
||||
label-position="right"
|
||||
>
|
||||
|
||||
<el-form-item :label="$t('module.basicData.ScrapInfo.updateTime')" prop="registerTime">
|
||||
<el-date-picker
|
||||
v-model="dataForm.registerTime"
|
||||
format="yyyy-MM-dd"
|
||||
:style="{width: '100%'}"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.updateTime')])"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('module.basicData.ScrapInfo.RegisterPerson')" prop="registerPerson">
|
||||
<!-- <el-input v-model="dataForm.registerPerson" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.RegisterPerson')])" clearable :style="{width: '100%'}" /> -->
|
||||
<el-select
|
||||
v-model="dataForm.registerPerson"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.RegisterPerson')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in dict.worker"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('module.basicData.ScrapInfo.entryType')" prop="entryType">
|
||||
<!-- <el-input v-model="dataForm.registerPerson" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.RegisterPerson')])" clearable :style="{width: '100%'}" /> -->
|
||||
<el-select
|
||||
v-model="dataForm.entryType"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.entryType')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in entryType"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('module.basicData.ScrapInfo.workOrderId')" prop="workOrderId">
|
||||
<el-select
|
||||
v-model="dataForm.workOrderId"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.workOrderId')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in dict.orderList"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('module.basicData.ScrapInfo.source')" prop="source">
|
||||
<el-input v-model="dataForm.source" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.source')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('module.basicData.ScrapInfo.PlateId')" prop="substrateId">
|
||||
<el-input v-model="dataForm.substrateId" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.PlateId')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('module.basicData.ScrapInfo.name')" prop="equipmentId">
|
||||
<el-select v-model="dataForm.equipmentId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.name')])" clearable :style="{width: '100%'}" @change="getScrapGrade">
|
||||
<el-option
|
||||
v-for="(item, index) in device"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id "
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="tag" :label="$t('module.basicData.ScrapInfo.wasteGrade')" prop="ewasteGrade">
|
||||
<el-input v-model="wasteGrade" clear readonly :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.wasteGrade')])" :disabled="true" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('module.basicData.ScrapInfo.cause')" prop="scrapReasonId">
|
||||
<!-- <el-input v-model="dataForm.registerPerson" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.RegisterPerson')])" clearable :style="{width: '100%'}" /> -->
|
||||
<el-select
|
||||
v-model="dataForm.scrapReasonId"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.cause')])"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in dict.scrapReason"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('module.basicData.ScrapInfo.remark')" prop="remark">
|
||||
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.remark')])" clearable :style="{width: '100%'}" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import i18n from '@/lang'
|
||||
import { getScrapInfo, editScrapInfo, addScrapInfo, getScrap } from '@/api/quality-manage/scrap'
|
||||
import { scrapReasonList } from '@/api/dict'
|
||||
import { getDictWorker } from '@/api/dict'
|
||||
import { getEqList } from '@/api/equipment/maintain'
|
||||
import { workOrderList } from '@/api/orderManage/workOrder/workOrder'
|
||||
|
||||
const wasteGradeArr = [{
|
||||
value: '加工可用',
|
||||
label: i18n.t('module.basicData.ScrapInfo.completeWaste')
|
||||
},
|
||||
{
|
||||
value: '完全废品',
|
||||
label: i18n.t('module.basicData.ScrapInfo.CanBeUsedAfterProcessing')
|
||||
}]
|
||||
|
||||
const entryType = [{
|
||||
value: '2',
|
||||
label: i18n.t('module.basicData.ScrapInfo.manual')
|
||||
},
|
||||
{
|
||||
value: '1',
|
||||
label: i18n.t('module.basicData.ScrapInfo.automatic')
|
||||
}]
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
source: undefined,
|
||||
registerTime: undefined,
|
||||
registerPerson: undefined,
|
||||
scrapGrade: undefined,
|
||||
description: undefined,
|
||||
substrateId: undefined,
|
||||
remark: undefined
|
||||
},
|
||||
wasteGradeArr,
|
||||
entryType,
|
||||
rules: {
|
||||
name: [{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.WasteName')]),
|
||||
trigger: 'blur'
|
||||
}],
|
||||
code: [{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.WasteCode')]),
|
||||
trigger: 'blur'
|
||||
}],
|
||||
equipmentId: [{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.equipmentId')]),
|
||||
trigger: 'change'
|
||||
}],
|
||||
substrateId: [{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.PlateId')]),
|
||||
trigger: 'blur'
|
||||
}],
|
||||
registerPerson: [{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.registerPerson')]),
|
||||
trigger: 'change'
|
||||
}]
|
||||
},
|
||||
dict: {
|
||||
worker: [],
|
||||
scrapReason: [],
|
||||
orderList: []
|
||||
},
|
||||
device: [],
|
||||
wasteGrade: '',
|
||||
tag: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
getScrapGrade(val) {
|
||||
getScrap(val).then(res => {
|
||||
if (res.code === 0) {
|
||||
if (res.data) {
|
||||
this.tag = true
|
||||
this.wasteGrade = res.data.dataName
|
||||
} else {
|
||||
this.tag = false
|
||||
this.wasteGrade = ''
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
onClose() {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
},
|
||||
init(id) {
|
||||
this.dataForm.id = id || ''
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
if (this.dataForm.id) {
|
||||
getScrapInfo({ id: this.dataForm.id }).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.dataForm.id) {
|
||||
console.log(this.device)
|
||||
editScrapInfo(this.dataForm).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
addScrapInfo(this.dataForm).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
async getDict() {
|
||||
const result3 = await workOrderList({
|
||||
current: 1,
|
||||
size: 999
|
||||
})
|
||||
console.log(result3)
|
||||
this.dict.orderList = result3.data.records
|
||||
const result1 = await getEqList({
|
||||
current: 1,
|
||||
size: 999
|
||||
})
|
||||
if (result1.code === 0) {
|
||||
this.device = result1.data.records
|
||||
}
|
||||
const result = await getDictWorker()
|
||||
this.dict.worker = result
|
||||
const result2 = await scrapReasonList()
|
||||
this.dict.scrapReason = result2
|
||||
// this.dict.orderList = result3.data.records
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
60
src/views/QualityManager/scrap/ScrapInfoCause.vue
Normal file
60
src/views/QualityManager/scrap/ScrapInfoCause.vue
Normal file
@@ -0,0 +1,60 @@
|
||||
<!--
|
||||
* @Date: 2021-01-07 20:09:37
|
||||
* @LastEditors: guo
|
||||
* @LastEditTime: 2021-03-18 15:19:21
|
||||
* @FilePath: \basic-admin\src\views\QualityManager\scrap\ScrapInfoCause.vue
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<span>
|
||||
<el-button type="text" size="small" @click="emitClick">{{ $t('module.basicData.ScrapInfo.cause') }}</el-button>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getscrapReason } from '@/api/quality-manage/scrap'
|
||||
export default {
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formData: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async emitClick() {
|
||||
const h = this.$createElement
|
||||
await this.getReason()
|
||||
await this.$msgbox({
|
||||
title: this.$t('module.basicData.ScrapInfo.cause'),
|
||||
message: h('div', null, [
|
||||
h('span', null, `${this.$t('module.basicData.ScrapInfo.scrapType')}:${this.formData.scrapType}`),
|
||||
h('br'),
|
||||
h('div', null, `${this.$t('module.basicData.ScrapInfo.cause')}:${this.formData.scrap}`)
|
||||
]),
|
||||
showCancelButton: false,
|
||||
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText')
|
||||
})
|
||||
},
|
||||
async getReason() {
|
||||
if (this.injectData.scrapReasonId) {
|
||||
const result = await getscrapReason({
|
||||
id: this.injectData.scrapReasonId
|
||||
})
|
||||
if (result.code === 0) {
|
||||
this.formData = result.data
|
||||
}
|
||||
} else {
|
||||
this.formData = {
|
||||
scrapType: '暂无',
|
||||
scrap: '暂无'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
119
src/views/QualityManager/scrap/components/barChart.vue
Normal file
119
src/views/QualityManager/scrap/components/barChart.vue
Normal file
@@ -0,0 +1,119 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2021-03-03 16:39:34
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2021-07-23 10:26:44
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div :id="id" :style="barStyle" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from 'echarts'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
default: () => {
|
||||
return 'barChart'
|
||||
}
|
||||
},
|
||||
barStyle: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
title: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
series: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
color: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return ['#5470C6']
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chart: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
series: {
|
||||
handler() {
|
||||
this.init()
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
addEventListener('resize', () => {
|
||||
this.chart.resize()
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return
|
||||
}
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.chart = echarts.init(document.getElementById(this.id))
|
||||
|
||||
this.chart.setOption({
|
||||
color: this.color,
|
||||
title: this.title,
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
legend: this.legend,
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: this.xAxis,
|
||||
yAxis: this.yAxis,
|
||||
series: this.series
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
36
src/views/QualityManager/scrap/filters/index.js
Normal file
36
src/views/QualityManager/scrap/filters/index.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* @Date: 2020-12-29 16:49:28
|
||||
* @LastEditors: gtz
|
||||
* @LastEditTime: 2021-04-13 13:49:51
|
||||
* @FilePath: \basic-admin\src\filters\DataDict\index.js
|
||||
* @Description: 部分常量的数据字典定义
|
||||
*/
|
||||
|
||||
import { scrapReasonList } from '@/api/dict'
|
||||
import { getEqList } from '@/api/equipment/maintain'
|
||||
|
||||
const table = {
|
||||
device: {},
|
||||
scrap: {}
|
||||
}
|
||||
|
||||
getEqList({
|
||||
current: 1,
|
||||
size: 999
|
||||
}).then(res => {
|
||||
res.data.records.map(item => {
|
||||
table.device[item.id] = item.name
|
||||
})
|
||||
})
|
||||
|
||||
scrapReasonList().then(res => {
|
||||
res.map(item => {
|
||||
table.scrap[item.id] = item.name
|
||||
})
|
||||
})
|
||||
|
||||
export default function(dictTable) {
|
||||
return function(val) {
|
||||
return table?.[dictTable]?.[val]
|
||||
}
|
||||
}
|
||||
267
src/views/QualityManager/scrap/index.vue
Normal file
267
src/views/QualityManager/scrap/index.vue
Normal file
@@ -0,0 +1,267 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2021-07-26 13:39:35
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="formData"
|
||||
:inline="true"
|
||||
size="medium"
|
||||
label-width="130px"
|
||||
>
|
||||
<el-form-item v-if="false" :label="$t('module.basicData.ScrapInfo.PlateId')" prop="basalId">
|
||||
<el-input v-model="formData.basalId" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.PlateId')])" style="width:200px" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.ScrapInfo.TimePeriod')" prop="time">
|
||||
<el-date-picker
|
||||
v-model="formData.timeSlot"
|
||||
type="daterange"
|
||||
format="yyyy-MM-dd"
|
||||
:start-placeholder="$t('module.basicData.ScrapInfo.StartTime')"
|
||||
:end-placeholder="$t('module.basicData.ScrapInfo.EndTime')"
|
||||
:range-separator="$t('module.basicData.ScrapInfo.To')"
|
||||
clearable
|
||||
/>
|
||||
<!-- value-format="yyyy-MM-dd" -->
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.basicData.ScrapInfo.name')" prop="equipmentId">
|
||||
<el-select v-model="formData.equipmentId" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.name')])" clearable :style="{width: '100%'}" filterable>
|
||||
<el-option
|
||||
v-for="(item, index) in device"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getList()"> {{ 'btn.search' | i18nFilter }} </el-button>
|
||||
<el-button type="primary" @click="addNew()"> {{ 'btn.add' | i18nFilter }} </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="formData.current"
|
||||
:limit.sync="formData.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
<ScrapInfo-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getScrapList, delScrapInfo } from '@/api/quality-manage/scrap'
|
||||
import { scrapReasonList } from '@/api/dict'
|
||||
import ScrapInfoAdd from './ScrapInfo-add.vue'
|
||||
// import ScrapInfoCause from './ScrapInfoCause.vue'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import { timeFormatter } from '@/filters'
|
||||
import i18n from '@/lang'
|
||||
import { getEqList } from '@/api/equipment/maintain'
|
||||
// import DictFilter from '@/components/BaseTable/subcomponents/DataDictFilter'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
// {
|
||||
// prop: 'createTime',
|
||||
// label: i18n.t('module.basicData.factory.createTime'),
|
||||
// filter: timeFormatter
|
||||
// },
|
||||
{
|
||||
prop: 'source',
|
||||
label: i18n.t('module.basicData.ScrapInfo.source'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'scrapGradeDic',
|
||||
label: i18n.t('module.basicData.ScrapInfo.wasteGrade'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'equipmentName',
|
||||
label: i18n.t('module.basicData.ScrapInfo.name'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'substrateId',
|
||||
label: i18n.t('module.basicData.ScrapInfo.PlateId'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'registerPersonName',
|
||||
label: i18n.t('module.basicData.ScrapInfo.RegisterPerson'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'updateTime',
|
||||
label: i18n.t('module.basicData.ScrapInfo.updateTime'),
|
||||
filter: timeFormatter,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'scrapReason',
|
||||
label: i18n.t('module.basicData.ScrapInfo.cause'),
|
||||
align: 'center'
|
||||
}
|
||||
// {
|
||||
// prop: 'scrapReasonId',
|
||||
// label: i18n.t('module.basicData.ScrapInfo.cause'),
|
||||
// subcomponent: ScrapInfoCause,
|
||||
// align: 'center'
|
||||
// // filter: scrapReasonList
|
||||
// }
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'ScrapInfo',
|
||||
components: { Pagination, BaseTable, MethodBtn, ScrapInfoAdd },
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
formData: {
|
||||
timeSlot: null,
|
||||
basalId: '',
|
||||
current: 1,
|
||||
size: 10,
|
||||
id: ''
|
||||
},
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
},
|
||||
dict: {
|
||||
scrap: []
|
||||
},
|
||||
device: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDict()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(i18n.t('deleteMsgBox.content'), i18n.t('deleteMsgBox.hint'), {
|
||||
confirmButtonText: i18n.t('btn.confirm'),
|
||||
cancelButtonText: i18n.t('btn.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
delScrapInfo({ id: raw.data.id }).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
if (this.formData.timeSlot) {
|
||||
this.formData.startTime = this.formData.timeSlot[0]
|
||||
this.formData.endTime = this.formData.timeSlot[1]
|
||||
} else {
|
||||
this.formData.startTime = ''
|
||||
this.formData.endTime = ''
|
||||
}
|
||||
getScrapList(this.formData).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
console.log(this.list)
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
async getDict() {
|
||||
const result1 = await getEqList({
|
||||
current: 1,
|
||||
size: 999
|
||||
})
|
||||
if (result1.code === 0) {
|
||||
this.device = result1.data.records
|
||||
}
|
||||
const result = await scrapReasonList()
|
||||
this.dict.scrap = result
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
225
src/views/QualityManager/scrap/scrapCategoryStatistics.vue
Normal file
225
src/views/QualityManager/scrap/scrapCategoryStatistics.vue
Normal file
@@ -0,0 +1,225 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2021-07-20 10:54:53
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="formData"
|
||||
:inline="true"
|
||||
size="medium"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item v-if="false" :label="$t('module.quality.ScrapInfo.PlateId')" prop="basalId">
|
||||
<el-input v-model="formData.basalId" :placeholder="$i18nForm(['placeholder.input', $t('module.quality.ScrapInfo.PlateId')])" style="width:200px" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.quality.ScrapInfo.name')" prop="equipmentId">
|
||||
<el-select v-model="formData.equipmentId" :placeholder="$i18nForm(['placeholder.input', $t('module.quality.ScrapInfo.name')])" clearable :style="{width: '100%'}" filterable>
|
||||
<el-option
|
||||
v-for="(item, index) in dict.device"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getList()"> {{ 'btn.search' | i18nFilter }} </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
</el-col>
|
||||
<el-col :span="0">
|
||||
<echarts-bar
|
||||
v-if="false"
|
||||
ref="BarRef"
|
||||
:color="color"
|
||||
:bar-style="barStyle"
|
||||
:title="barTitle"
|
||||
:x-axis="xAxis"
|
||||
:y-axis="yAxis"
|
||||
:series="series"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="formData.current"
|
||||
:limit.sync="formData.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getList } from '@/api/quality-manage/scrapCategoryStatistics'
|
||||
import { scrapReasonList } from '@/api/dict'
|
||||
// import ScrapInfoCause from './ScrapInfoCause.vue'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import i18n from '@/lang'
|
||||
import dataDict from './filters'
|
||||
import { getEqList } from '@/api/equipment/maintain'
|
||||
import echartsBar from './components/barChart.vue'
|
||||
// import DictFilter from '@/components/BaseTable/subcomponents/DataDictFilter'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const tableBtn = []
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'equipmentId',
|
||||
label: i18n.t('module.quality.ScrapInfo.name'),
|
||||
align: 'center',
|
||||
filter: dataDict('device')
|
||||
},
|
||||
{
|
||||
prop: 'reasonId',
|
||||
label: i18n.t('module.quality.ScrapInfo.cause'),
|
||||
align: 'center',
|
||||
filter: dataDict('scrap')
|
||||
},
|
||||
{
|
||||
prop: 'count',
|
||||
label: i18n.t('module.quality.ScrapInfo.count'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
const barTitle = {
|
||||
text: i18n.t('module.quality.ScrapInfo.title'),
|
||||
subtext: i18n.t('module.quality.ScrapInfo.subTitle')
|
||||
}
|
||||
const color = [
|
||||
'#5470C6', '#91CC75'
|
||||
]
|
||||
const barStyle = {
|
||||
height: '400px',
|
||||
width: '100%',
|
||||
margin: '20px'
|
||||
}
|
||||
const series = [{
|
||||
name: i18n.t('module.quality.ScrapInfo.subTitle'),
|
||||
data: [],
|
||||
type: 'bar'
|
||||
}]
|
||||
|
||||
export default {
|
||||
name: 'ScrapInfo',
|
||||
components: { Pagination, BaseTable, MethodBtn, echartsBar },
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
formData: {
|
||||
equipmentId: '',
|
||||
current: 1,
|
||||
size: 10
|
||||
},
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
},
|
||||
dict: {
|
||||
scrap: [],
|
||||
device: []
|
||||
},
|
||||
color,
|
||||
barTitle,
|
||||
barStyle,
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: []
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {},
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
getList(this.formData).then(response => {
|
||||
this.series[0].data = []
|
||||
this.xAxis.data = []
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
response.data.records.map(item => {
|
||||
this.series[0].data.push(Number(item.count))
|
||||
this.xAxis.data.push(dataDict('device')(item.equipmentId) + '(' + dataDict('scrap')(item.reasonId) + ')')
|
||||
})
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
async getDict() {
|
||||
const result1 = await getEqList({
|
||||
current: 1,
|
||||
size: 999
|
||||
})
|
||||
if (result1.code === 0) {
|
||||
this.dict.device = result1.data.records
|
||||
}
|
||||
const result = await scrapReasonList()
|
||||
this.dict.scrap = result
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user