<!--
|
* @Date: 2024-04-17 18:53:45
|
* @LastEditors: gaosp
|
* @LastEditTime: 2024-09-19 21:45:01
|
* @FilePath: /mdc/Users/mache/Documents/demo/cps-web/src/views/mdc/configComp/Status.vue
|
-->
|
<template>
|
<el-main>
|
<el-row>
|
<!-- dragSort -->
|
<scFormTable ref="table" size="small" v-model="data" stripe hideAdd hideDelete dragSort @rowDrop="rowDrop">
|
<el-table-column label="工位/机器状态" prop="name"></el-table-column>
|
<el-table-column label="编号" prop="code"></el-table-column>
|
<el-table-column label="颜色" prop="color"></el-table-column>
|
<el-table-column label="颜色" prop="color">
|
<template #default="scope">
|
<el-color-picker v-model="scope.row.color" @change="update(scope.row)" />
|
</template>
|
</el-table-column>
|
<el-table-column label="绩效时间" prop="rps">
|
<template #default="scope">
|
<el-select v-model="scope.row.rps" style="width: 100%;" @change="update(scope.row)">
|
<el-option v-for="(item, index) in options.rps" :key="index" :label="item.label"
|
:value="item.value"></el-option>
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column label="计划内外" prop="isPlan">
|
<template #default="scope">
|
<el-select v-model="scope.row.isPlan" style="width: 100%;" @change="update(scope.row)">
|
<el-option v-for="(item, index) in options.isPlan" :key="index" :label="item.label"
|
:value="item.value"></el-option>
|
</el-select>
|
</template>
|
</el-table-column>
|
</scFormTable>
|
</el-row>
|
<el-row style="margin-top: 20px;position: relative">
|
<!-- dragSort -->
|
<scFormTable ref=" table1" v-model="Tabledata" stripe @delRow="remove" :addTemplate="addTemplate"
|
@rowDrop="rowDrop" dragSort hideDelete>
|
<el-table-column label="人工反馈状态" prop="name">
|
<template #default="scope">
|
<el-input v-model="scope.row.name" @change="update(scope.row)"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column label="编号" prop="code">
|
<template #default="scope">
|
<el-input v-show="scope.row.isNew" v-model="scope.row.code"
|
@change="update(scope.row)"></el-input>
|
<span v-show="!scope.row.isNew">{{ scope.row.code }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="颜色" prop="color"></el-table-column>
|
<el-table-column label="颜色" prop="color">
|
<template #default="scope">
|
<el-color-picker v-model="scope.row.color" @change="update(scope.row)" />
|
</template>
|
</el-table-column>
|
<el-table-column label="计划内外" prop="state">
|
<template #default="scope">
|
<el-select v-model="scope.row.isPlan" style="width: 200px;" @change="update(scope.row)">
|
<el-option v-for="(item, index) in options.isPlan" :key="index" :label="item.label"
|
:value="item.value"></el-option>
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" prop="state">
|
<template #default="scope">
|
<el-popconfirm title="确定删除吗?" @confirm="rowDel(scope.row, scope.$index)">
|
<template #reference>
|
<el-button type="danger" icon="el-icon-delete" size="small" plain circle></el-button>
|
</template>
|
</el-popconfirm>
|
<el-button v-show="scope.row.isNew" @click="add(scope.row)">保存</el-button>
|
</template>
|
</el-table-column>
|
</scFormTable>
|
</el-row>
|
<el-row style="margin-top: 20px;">
|
<el-col :span="12">
|
<el-card>
|
<template #header>
|
<div class="card-header">
|
<span>效率计算公式说明</span>
|
</div>
|
</template>
|
<p>稼动率:计划内状态时长/采集状态总时长</p>
|
<p>根据采集的数据状态划分到相应的绩效时间,通过绩效时间的持续时长,并依照如下公式进行效率计算:</p>
|
|
<p>运行率:T1 /(T1+T2+T3+T4+T5+T6)</p>
|
<p>报警率:T4 /(T1+T2+T3+T4+T5+T6)</p>
|
</el-card>
|
</el-col>
|
<el-col :span="12">
|
<el-card>
|
<template #header>
|
<div class="card-header">
|
<span>绩效时间与对应色值说明</span>
|
</div>
|
</template>
|
<p><img style="width: 100%;" src="./configuration.23a90729.png" alt="" srcset=""></p>
|
</el-card>
|
</el-col>
|
</el-row>
|
|
|
</el-main>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
options: {
|
rps: [
|
{
|
label: 'T1',
|
value: 1
|
},
|
{
|
label: 'T2',
|
value: 2
|
},
|
{
|
label: 'T3',
|
value: 3
|
},
|
{
|
label: 'T4',
|
value: 4
|
},
|
{
|
label: 'T5',
|
value: 5
|
},
|
{
|
label: 'T6',
|
value: 6
|
}
|
],
|
isPlan: [
|
{
|
label: '计划内',
|
value: 0
|
},
|
{
|
label: '计划外',
|
value: 1
|
},
|
]
|
},
|
data: [],
|
Tabledata: [],
|
addTemplate: {
|
name: '人工状态',
|
code: '',
|
color: '#FFFFFF',
|
rps: 1,
|
isPlan: 0,
|
type: 4,
|
isNew: true
|
}
|
}
|
},
|
watch: {
|
data: {
|
handler() {
|
|
},
|
deep: true
|
}
|
},
|
created() {
|
this.getList()
|
},
|
methods: {
|
rowDel(row, index) {
|
// this.$emit('delRow', row)
|
this.remove(row)
|
this.data.splice(index, 1)
|
},
|
getList() {
|
this.$HTTP.get('/api/blade-cps/global_wcs/wcs-achievements').then(res => {
|
if (res.code === 200) {
|
this.data = res.data.filter(v => v.type === 1)
|
this.Tabledata = res.data.filter(v => v.type === 4)
|
}
|
})
|
},
|
save() {
|
this.$HTTP.post('/api/blade-cps/global_wcs/update-wcs-seq', this.data.map(v => v.code)).then(res => {
|
if (res.code == 200) {
|
this.$message.success(`操作成功`)
|
this.getList()
|
}
|
})
|
},
|
update(row) {
|
if (row.isNew) return
|
if (!row.code || !row.color || !row.name) {
|
return this.$message.warning('状态名称、编号、颜色必填'); (`操作成功`)
|
} console.log(row)
|
let data = {
|
code: row.code,
|
color: row.color,
|
isPlan: row.isPlan,
|
name: row.name,
|
rps: row.rps
|
}
|
this.$HTTP.post('/api/blade-cps/global_wcs/update-wcs-achievements', data).then(res => {
|
if (res.code == 200) {
|
this.$message.success(`操作成功`)
|
this.getList()
|
}
|
})
|
},
|
|
add(row) {
|
if (!row.code || !row.color || !row.name) {
|
return this.$message.warning('状态名称、编号、颜色必填'); (`操作成功`)
|
}
|
if (isNaN(row.code) || row.code < 1 || row.code > 99) {
|
return this.$message.warning('编号范围为1~99');
|
}
|
let data = {
|
code: row.code,
|
color: row.color,
|
isPlan: row.isPlan,
|
name: row.name,
|
rps: row.rps,
|
type: 4,
|
}
|
this.$HTTP.post('/api/blade-cps/global_wcs/add-wcs-achievements', data).then(res => {
|
if (res.code == 200) {
|
this.$message.success(`操作成功`)
|
this.getList()
|
}
|
})
|
},
|
remove(row) {
|
this.$HTTP.delete(`/api/blade-cps/global_wcs/delete-wcs-achievements/${row.code}`).then(res => {
|
if (res.code == 200) {
|
this.$message.success(`操作成功`)
|
this.getList()
|
}
|
})
|
},
|
rowDrop(arr) {
|
this.$HTTP.post(`/api/blade-cps/global_wcs/update-wcs-seq`, arr.map(v => v.code)).then(res => {
|
if (res.success) {
|
this.$message.success(res.msg)
|
} else {
|
this.$message.success(res.msg)
|
}
|
})
|
console.log(arr)
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped></style>
|