代码更新

This commit is contained in:
2022-08-16 19:55:37 +08:00
parent ace8399af0
commit de937332ad
35 changed files with 1322 additions and 1578 deletions

View File

@@ -63,4 +63,12 @@ export function copyAdd(data) {
})
}
export default { add, edit, del, getWorkprocedure, getItemByDevice, savaDeviceItem, getItemByDeviceId, copyAdd }
export function changeActive(data) {
return request({
url: 'api/device/changeActive',
method: 'put',
data
})
}
export default { add, edit, del, getWorkprocedure, getItemByDeviceId, copyAdd, changeActive }

View File

@@ -1,134 +0,0 @@
<template>
<el-dialog
title="选择设备扩展项"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
:show-close="false"
width="1000px"
@close="close"
@open="open"
>
<el-input
v-model="query.search"
clearable
placeholder="请输入项点编码或名称"
style="width: 185px;"
class="filter-item"
/>
<rrOperation :crud="crud" />
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;margin-top: 18px"
size="mini"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="selection" width="55" />
<el-table-column show-overflow-tooltip prop="item_code" label="项点编码"/>
<el-table-column show-overflow-tooltip prop="item_name" label="项点名称" />
<el-table-column show-overflow-tooltip prop="order_seq" label="顺序号" />
<el-table-column show-overflow-tooltip prop="default_value" label="默认值">
<template slot-scope="scope">
{{ is_or_no(scope.row.default_value, scope.row.data_type) }}
</template>
</el-table-column>
<el-table-column prop="data_type" label="默认值数据类型">
<template slot-scope="scope">
{{ dict.label.ITEM_VALUE_TYPE[scope.row.data_type] }}
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="remark" label="备注"/>
</el-table>
<!--分页组件-->
<pagination />
<span slot="footer" class="dialog-footer">
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
<el-button slot="left" type="primary" @click="submit">保存</el-button>
</span>
</el-dialog>
</template>
<script>
import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
export default {
name: 'AddDtl',
components: { rrOperation, pagination },
dicts: ['ITEM_VALUE_TYPE'],
cruds() {
return CRUD({ title: '项点', idField: 'item_id', url: 'api/deviceitem',
optShow: {
add: false,
edit: false,
del: false,
reset: true,
download: false
}})
},
mixins: [presenter(), header()],
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: String
}
},
data() {
return {
dialogVisible: false,
opendtlParam: '',
rows: []
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
openParam: {
handler(newValue, oldValue) {
this.opendtlParam = newValue
}
}
},
methods: {
is_or_no(val, type) {
if (type === '01' && val === '1') {
return '是'
} else if (type === '01' && val === '0') {
return '否'
} else {
return val
}
},
open() {
this.crud.toQuery()
},
close() {
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
},
submit() {
this.rows = this.$refs.table.selection
if (this.rows.length <= 0) {
this.$message('至少勾选一条项点信息')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
}
}
}
</script>

View File

@@ -1,257 +0,0 @@
<template>
<el-dialog
title="复制新增"
append-to-body
fullscreen
:visible.sync="dialogVisible"
@open="open"
@close="close"
>
<el-row :gutter="20">
<el-col :span="18" style="border: 1px solid white">
<span />
</el-col>
<el-col :span="6" style="margin-bottom: 20px">
<span style="float: right">
<el-button icon="el-icon-close" size="mini" type="info" @click="dialogVisible = false"> </el-button>
<el-button icon="el-icon-check" size="mini" type="primary" @click="saveCheck('form')">保存</el-button>
</span>
</el-col>
</el-row>
<el-card class="box-card" shadow="never">
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="mini" label-width="80px">
<el-form-item label="设备编码" prop="device_code">
<el-input v-model="form.device_code" placeholder="" style="width: 200px;" />
</el-form-item>
<el-form-item label="设备名称" prop="device_name">
<el-input v-model="form.device_name" style="width: 200px;" />
</el-form-item>
<el-form-item label="设备型号">
<el-input v-model="form.device_model" style="width: 370px;" />
</el-form-item>
<el-form-item label="所属工序">
<el-select v-model="form.workprocedure_id" filterable clearable class="filter-item" style="width: 200px">
<el-option
v-for="item in workList"
:key="item.workprocedure_id"
:label="item.workprocedure_name"
:value="item.workprocedure_id"
/>
</el-select>
</el-form-item>
<el-form-item label="外部编码">
<el-input v-model="form.extend_code" style="width: 200px;" />
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" :rows="2" type="textarea" style="width: 370px;" />
</el-form-item>
</el-form>
</el-card>
<div class="crud-opts2" style="margin-top: 30px">
<span class="role-span">扩展项明细</span>
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
type="warning"
icon="el-icon-plus"
size="mini"
@click="addrow"
>
新增扩展项
</el-button>
</span>
</div>
<!--表格渲染-->
<el-table
ref="table"
:data="tableData"
style="width: 100%;"
border
size="mini"
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="handleCurrentChange"
>
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="item_code" label="项点编码" align="center" />
<el-table-column prop="item_name" label="项点名称" align="center" />
<el-table-column prop="default_value" label="默认值" align="center">
<template slot-scope="scope">
{{ is_or_no(scope.row.default_value, scope.row.data_type) }}
</template>
</el-table-column>
<el-table-column prop="data_type" label="默认值数据类型">
<template slot-scope="scope">
{{ dict.label.ITEM_VALUE_TYPE[scope.row.data_type] }}
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" align="center" />
<el-table-column align="center" label="操作" width="160" fixed="right">
<template scope="scope">
<el-button type="danger" class="filter-item" size="mini" icon="el-icon-delete" @click.native.prevent="deleteRow(scope.$index, tableData)" />
</template>
</el-table-column>
</el-table>
<AddDtl :dialog-show.sync="dtlShow" @tableChanged="tableChanged" />
</el-dialog>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
import crudDevice from '@/api/wms/pdm/device'
import AddDtl from '@/views/wms/mps/device/AddDtl'
export default {
name: 'CopyDialog',
components: { AddDtl },
dicts: ['ITEM_VALUE_TYPE'],
mixins: [crud()],
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: Object
}
},
data() {
return {
dialogVisible: false,
nowindex: '',
nowrow: null,
dtlShow: false,
materShow: false,
workList: [],
form: {
device_id: '',
device_code: '',
device_name: '',
device_model: '',
workprocedure_id: '',
extend_code: '',
remark: '',
is_active: ''
},
tableData: [],
rules: {
device_code: [
{ required: true, message: '设备编码不能为空', trigger: 'blur' }
],
device_name: [
{ required: true, message: '设备名称不能为空', trigger: 'blur' }
]
}
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
}
},
methods: {
is_or_no(val, type) {
if (type === '01' && val === '1') {
return '是'
} else if (type === '01' && val === '0') {
return '否'
} else {
return val
}
},
handleCurrentChange(current) {
if (current !== null) {
this.nowrow = current
} else {
this.nowrow = null
}
},
async queryMater(index, row) {
this.materShow = true
this.nowindex = index
this.nowrow = row
},
getWorkprocedure() {
crudDevice.getWorkprocedure().then(res => {
this.workList = res
})
},
open() {
this.getWorkprocedure()
crudDevice.getItemByDevice({ device_id: this.form.device_id }).then(res => {
this.tableData = res
// 将明细变成不可编辑
for (let i = 0; i < this.tableData.length; i++) {
const row = this.tableData[i]
this.tableData.splice(i, 1, row)
}
})
},
close() {
this.$emit('AddChanged')
},
tableChanged(rows) {
var array = ([...this.tableData, ...rows])
this.tableData = this.unique(array)
},
unique(arr) {
// 根据唯一标识item_code来对数组进行过滤
// 定义常量 res,值为一个Map对象实例
const res = new Map()
// 返回arr数组过滤后的结果结果为一个数组 过滤条件是如果res中没有某个键就设置这个键的值为1
return arr.filter((arr) => !res.has(arr.item_code) && res.set(arr.item_code, 1))
},
setForm(row) {
this.dialogVisible = true
this.form = row
this.form.device_code = ''
this.form.device_name = ''
},
addrow() {
this.dtlShow = true
},
deleteRow(index, rows) {
rows.splice(index, 1)
this.nowindex = ''
this.nowrow = null
},
saveCheck(form) {
if (this.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
this.$refs[form].validate((valid) => {
if (valid) {
crudDevice.copyAdd({ 'row': this.form, 'rows': this.tableData }).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.dialogVisible = false
})
}
})
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
padding: 4px 4px;
}
.input-with-select {
background-color: #fff;
}
</style>

View File

@@ -1,234 +0,0 @@
<template>
<el-dialog
title="设备详情"
append-to-body
fullscreen
:visible.sync="dialogVisible"
@open="open"
@close="close"
>
<el-row :gutter="20">
<el-col :span="18" style="border: 1px solid white">
<span />
</el-col>
<el-col :span="6" style="margin-bottom: 20px">
<span style="float: right">
<el-button icon="el-icon-close" size="mini" type="info" @click="dialogVisible = false"> </el-button>
<el-button icon="el-icon-check" size="mini" type="primary" @click="saveCheck">保存</el-button>
</span>
</el-col>
</el-row>
<el-card class="box-card" shadow="never">
<el-form ref="form" disabled :inline="true" :model="form" :rules="rules" size="mini" label-width="80px">
<el-form-item label="设备编码">
<el-input v-model="form.device_code" placeholder="自动生产" style="width: 200px;" />
</el-form-item>
<el-form-item label="设备名称" prop="dtl_count">
<el-input v-model="form.device_name" style="width: 200px;" />
</el-form-item>
</el-form>
</el-card>
<div class="crud-opts2" style="margin-top: 30px;margin-bottom: 15px">
<span class="role-span">项点明细</span>
</div>
<!--表格渲染-->
<el-table
ref="table"
:data="tableData"
style="width: 100%;"
size="mini"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="handleCurrentChange"
>
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="item_code" label="项点编码" align="center" />
<el-table-column prop="item_name" label="项点名称" align="center" />
<el-table-column prop="item_value" label="项点值" align="center">
<template slot-scope="scope">
<span v-if="scope.row.is_show === '1' && scope.row.data_type !== '01'">{{ scope.row.item_value }}</span>
<span v-if="scope.row.is_show === '1' && scope.row.data_type === '01'">{{ is_or_no(scope.row.item_value) }}</span>
<el-input
v-else-if="scope.row.is_show === '0' && (scope.row.data_type === '' || scope.row.data_type === '03')"
v-model="scope.row.item_value"
/>
<el-input
type="number"
v-else-if="scope.row.is_show === '0' && scope.row.data_type === '02'"
v-model="scope.row.item_value"
/>
<el-select
v-else-if="scope.row.is_show === '0' && scope.row.data_type === '01'"
v-model="scope.row.item_value"
placeholder=""
>
<el-option
v-for="item in dict.IS_OR_NOT"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="data_type" label="默认值数据类型">
<template slot-scope="scope">
{{ dict.label.ITEM_VALUE_TYPE[scope.row.data_type] }}
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" align="center" />
<el-table-column align="center" label="操作" width="160" fixed="right">
<template scope="scope">
<el-button v-if="scope.row.is_show === '1'" type="primary" class="filter-item" size="mini" icon="el-icon-edit" @click="editData(scope.row,scope.$index)" />
<el-button v-else type="success" class="filter-item" size="mini" icon="el-icon-check" @click="saveData(scope.row,scope.column,scope.$index)" />
</template>
</el-table-column>
</el-table>
<AddDtl :dialog-show.sync="dtlShow" @tableChanged="tableChanged" />
</el-dialog>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
import crudDevice from '@/api/wms/pdm/device'
import AddDtl from '@/views/wms/mps/device/AddDtl'
export default {
name: 'DeviceInfoDialog',
components: { AddDtl },
mixins: [crud()],
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: Object
}
},
dicts: ['ITEM_VALUE_TYPE', 'IS_OR_NOT'],
data() {
return {
dialogVisible: false,
nowindex: '',
nowrow: null,
dtlShow: false,
materShow: false,
form: {
device_id: '',
device_code: '',
device_name: ''
},
tableData: [],
rules: {
}
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
}
},
methods: {
is_or_no(val) {
if (val === '1') {
return '是'
} else {
return '否'
}
},
editData(row, index) {
this.tableData[index].is_show = '0'
},
saveData(row, column, index) {
this.tableData[index].is_show = '1'
},
handleCurrentChange(current) {
if (current !== null) {
this.nowrow = current
} else {
this.nowrow = null
}
},
async queryMater(index, row) {
this.materShow = true
this.nowindex = index
this.nowrow = row
},
open() {
crudDevice.getItemByDevice({ device_id: this.form.device_id }).then(res => {
this.tableData = res
// 将明细变成不可编辑
for (let i = 0; i < this.tableData.length; i++) {
const row = this.tableData[i]
this.tableData.splice(i, 1, row)
}
})
},
close() {
this.$emit('AddChanged')
},
tableChanged(rows) {
const tablemap = new Map()
rows.forEach((item) => {
item.item_value = item.default_value
if (this.tableData.length !== 0) {
this.flagnow = false
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].item_code === item.item_code) {
this.flagnow = true
}
}
if (!this.flagnow) {
tablemap.set(item.item_code, item)
}
} else {
tablemap.set(item.item_code, item)
}
})
for (const value of tablemap.values()) {
this.tableData.push(value)
}
},
setForm(row) {
this.dialogVisible = true
this.form = row
},
saveCheck() {
if (this.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].is_show === '0') {
this.crud.notify('尚有未完成编辑的项点值,序号为' + (i + 1) + ',请检查!')
return false
}
}
crudDevice.savaDeviceItem({ 'row': this.form, 'rows': this.tableData }).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.dialogVisible = false
})
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
padding: 4px 4px;
}
.input-with-select {
background-color: #fff;
}
</style>

View File

@@ -1,252 +0,0 @@
<template>
<el-dialog
title="设备扩展项"
append-to-body
fullscreen
:visible.sync="dialogVisible"
@open="open"
@close="close"
>
<el-row :gutter="20">
<el-col :span="18" style="border: 1px solid white">
<span />
</el-col>
<el-col :span="6" style="margin-bottom: 20px">
<span style="float: right">
<el-button icon="el-icon-close" size="mini" type="info" @click="dialogVisible = false"> </el-button>
<el-button icon="el-icon-check" size="mini" type="primary" @click="saveCheck">保存</el-button>
</span>
</el-col>
</el-row>
<el-card class="box-card" shadow="never">
<el-form ref="form" disabled :inline="true" :model="form" :rules="rules" size="mini" label-width="80px">
<el-form-item label="设备编码">
<el-input v-model="form.device_code" placeholder="自动生产" style="width: 200px;" />
</el-form-item>
<el-form-item label="设备名称" prop="dtl_count">
<el-input v-model="form.device_name" style="width: 200px;" />
</el-form-item>
</el-form>
</el-card>
<div class="crud-opts2" style="margin-top: 30px">
<span class="role-span">扩展项明细</span>
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
type="warning"
icon="el-icon-plus"
size="mini"
@click="addrow"
>
新增扩展项
</el-button>
</span>
</div>
<!--表格渲染-->
<el-table
ref="table"
:data="tableData"
style="width: 100%;"
size="mini"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="handleCurrentChange"
>
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="item_code" label="项点编码" align="center" />
<el-table-column prop="item_name" label="项点名称" align="center" />
<el-table-column prop="item_value" label="项点值" align="center">
<template slot-scope="scope">
<span v-if="scope.row.is_show === '1' && scope.row.data_type !== '01'">{{ scope.row.item_value }}</span>
<span v-if="scope.row.is_show === '1' && scope.row.data_type === '01'">{{ is_or_no(scope.row.item_value) }}</span>
<el-input
v-else-if="scope.row.is_show === '0' && (scope.row.data_type === '' || scope.row.data_type === '03')"
v-model="scope.row.item_value"
/>
<el-input
type="number"
v-else-if="scope.row.is_show === '0' && scope.row.data_type === '02'"
v-model="scope.row.item_value"
/>
<el-select
ref="select"
v-else-if="scope.row.is_show === '0' && scope.row.data_type === '01'"
v-model="scope.row.item_value"
placeholder=""
>
<el-option
v-for="item in dict.IS_OR_NOT"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="data_type" label="默认值数据类型">
<template slot-scope="scope">
{{ dict.label.ITEM_VALUE_TYPE[scope.row.data_type] }}
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" align="center" />
<el-table-column align="center" label="操作" width="160" fixed="right">
<template scope="scope">
<el-button v-if="scope.row.is_show === '1'" type="primary" class="filter-item" size="mini" icon="el-icon-edit" @click="editData(scope.row,scope.$index)" />
<el-button v-else type="success" class="filter-item" size="mini" icon="el-icon-check" @click="saveData(scope.row,scope.column,scope.$index)" />
<el-button type="danger" class="filter-item" size="mini" icon="el-icon-delete" @click.native.prevent="deleteRow(scope.$index, tableData)" />
</template>
</el-table-column>
</el-table>
<AddDtl :dialog-show.sync="dtlShow" @tableChanged="tableChanged" />
</el-dialog>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
import crudDevice from '@/api/wms/pdm/device'
import AddDtl from '@/views/wms/mps/device/AddDtl'
export default {
name: 'DeviceItemDialog',
components: { AddDtl },
mixins: [crud()],
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: Object
}
},
dicts: ['ITEM_VALUE_TYPE', 'IS_OR_NOT'],
data() {
return {
dialogVisible: false,
nowindex: '',
nowrow: null,
dtlShow: false,
materShow: false,
form: {
device_id: '',
device_code: '',
device_name: ''
},
tableData: [],
rules: {
}
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
}
},
methods: {
is_or_no(val) {
if (val === '1') {
return '是'
} else {
return '否'
}
},
editData(row, index) {
this.tableData[index].is_show = '0'
},
saveData(row, column, index) {
this.tableData[index].is_show = '1'
},
handleCurrentChange(current) {
if (current !== null) {
this.nowrow = current
} else {
this.nowrow = null
}
},
async queryMater(index, row) {
this.materShow = true
this.nowindex = index
this.nowrow = row
},
open() {
crudDevice.getItemByDevice({ device_id: this.form.device_id }).then(res => {
this.tableData = res
// 将明细变成不可编辑
for (let i = 0; i < this.tableData.length; i++) {
const row = this.tableData[i]
this.tableData.splice(i, 1, row)
}
})
},
close() {
this.$emit('AddChanged')
},
tableChanged(rows) {
rows.forEach((item) => {
this.$set(item, 'item_value', item.default_value)
})
var array = ([...this.tableData, ...rows])
this.tableData = this.unique(array)
},
unique(arr) {
// 根据唯一标识item_code来对数组进行过滤
// 定义常量 res,值为一个Map对象实例
const res = new Map()
// 返回arr数组过滤后的结果结果为一个数组 过滤条件是如果res中没有某个键就设置这个键的值为1
return arr.filter((arr) => !res.has(arr.item_code) && res.set(arr.item_code, 1))
},
setForm(row) {
this.dialogVisible = true
this.form = row
},
addrow() {
this.dtlShow = true
},
deleteRow(index, rows) {
rows.splice(index, 1)
this.nowindex = ''
this.nowrow = null
},
saveCheck() {
if (this.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].is_show === '0') {
this.crud.notify('尚有未完成编辑的项点值,序号为' + (i + 1) + ',请检查!')
return false
}
}
crudDevice.savaDeviceItem({ 'row': this.form, 'rows': this.tableData }).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.dialogVisible = false
})
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
padding: 4px 4px;
}
.input-with-select {
background-color: #fff;
}
</style>

View File

@@ -13,52 +13,10 @@
style="width: 220px;"
class="filter-item"
/>
<label class="el-form-item-label">所属工序</label>
<el-select v-model="query.workprocedure_id" filterable clearable size="small" placeholder="所属工序" class="filter-item" style="width: 220px" @change="changeHeader(query.search, query.workprocedure_id)">
<el-option
v-for="item in workList"
:key="item.workprocedure_id"
:label="item.workprocedure_name"
:value="item.workprocedure_id"
/>
</el-select>
<rrOperation :crud="crud" />
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
:disabled="crud.selections.length !== 1"
@click="addItem(crud.selections[0])"
>
设备扩展项
</el-button>
<el-button
slot="right"
class="filter-item"
type="danger"
icon="el-icon-position"
size="mini"
:disabled="crud.selections.length !== 1"
@click="deviceInfo(crud.selections[0])"
>
设备详情
</el-button>
<el-button
slot="right"
class="filter-item"
type="warning"
icon="el-icon-document-copy"
:disabled="crud.selections.length !== 1"
size="mini"
@click="copyAdd(crud.selections[0])"
>
复制新增
</el-button>
</crudOperation>
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
@@ -75,22 +33,9 @@
<el-form-item label="设备产能">
<el-input type="number" oninput="value = value.replace(/[^\d]/g, '')" v-model="form.productivity" style="width: 370px;" />
</el-form-item>
<el-form-item label="所属工序">
<el-select v-model="form.workprocedure_id" filterable clearable class="filter-item" style="width: 370px">
<el-option
v-for="item in workList"
:key="item.workprocedure_id"
:label="item.workprocedure_name"
:value="item.workprocedure_id"
/>
</el-select>
</el-form-item>
<el-form-item label="外部编码">
<el-input v-model="form.extend_code" style="width: 370px;" />
</el-form-item>
<!-- <el-form-item label="设备档案标识">
未设置字典,请手动设置 Select
</el-form-item>-->
<el-form-item label="备注">
<el-input v-model="form.remark" :rows="3" type="textarea" style="width: 370px;" />
</el-form-item>
@@ -105,18 +50,19 @@
<el-table-column type="selection" width="55" />
<el-table-column prop="device_code" label="设备编码" />
<el-table-column prop="device_name" label="设备名称" min-width="200" show-overflow-tooltip />
<el-table-column prop="device_model" label="设备型号" min-width="200" show-overflow-tooltip />
<el-table-column prop="productivity" label="设备产能" />
<el-table-column prop="produceorder_code" label="工单编号" />
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.show"
:key="index"
:show-overflow-tooltip="true"
:prop="item.prop"
:label="item.label"
:min-width="item.width"
/>
</template>
<el-table-column label="是否启用" align="center" prop="is_used">
<template slot-scope="scope">
<el-switch
:value="format_is_used(scope.row.is_used)"
active-color="#409EFF"
inactive-color="#F56C6C"
@change="changeEnabled(scope.row, scope.row.is_used)"
/>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" />
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
@@ -129,9 +75,6 @@
<!--分页组件-->
<pagination />
</div>
<DeviceItemDialog ref="child" @AddChanged="querytable" />
<DeviceInfoDialog ref="child1" @AddChanged="querytable" />
<CopyDialog ref="copyChiled" @AddChanged="querytable" />
</div>
</template>
@@ -142,14 +85,11 @@ import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import DeviceItemDialog from '@/views/wms/mps/device/DeviceItemDialog'
import DeviceInfoDialog from '@/views/wms/mps/device/DeviceInfoDialog'
import CopyDialog from '@/views/wms/mps/device/CopyDialog'
const defaultForm = { device_id: null, device_code: null, device_name: null, device_model: null, workprocedure_id: null, extend_code: null, devicebill_id: null, remark: null, is_active: null, create_id: null, create_name: null, create_time: null, is_delete: null, productivity: null }
export default {
name: 'Device',
components: { pagination, crudOperation, rrOperation, udOperation, DeviceItemDialog, CopyDialog, DeviceInfoDialog },
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({ title: '生产设备', url: 'api/device', idField: 'device_id', sort: 'device_id,desc',
@@ -166,8 +106,6 @@ export default {
return {
permission: {
},
workList: [],
tableLabel: [],
rules: {
device_code: [
{ required: true, message: '设备编码不能为空', trigger: 'blur' }
@@ -178,42 +116,33 @@ export default {
}
}
},
created() {
this.getWorkprocedure()
},
methods: {
changeHeader(search, workprocedure_id) {
this.getHeader(search, workprocedure_id)
this.crud.toQuery()
},
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
this.getHeader(this.query.search, this.query.workprocedure_id)
return true
},
getWorkprocedure() {
crudDevice.getWorkprocedure().then(res => {
this.workList = res
changeEnabled(data, val) {
let msg = '此操作将停用设备,是否继续!'
if (val !== '1') {
msg = '此操作将启用设备,是否继续!'
}
this.$confirm(msg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
crudDevice.changeActive(data).then(res => {
this.crud.toQuery()
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(() => {
data.is_used = !data.is_used
})
}).catch(() => {
})
},
addItem(data) {
this.$refs.child.setForm(data)
format_is_used(is_used) {
return is_used === '1'
},
deviceInfo(data) {
this.$refs.child1.setForm(data)
},
copyAdd(data) {
const d = JSON.parse(JSON.stringify(data))
this.$refs.copyChiled.setForm(d)
},
querytable() {
this.crud.toQuery()
},
getHeader(search, workprocedure_id) {
crudDevice.getItemByDeviceId({ search: search, workprocedure_id: workprocedure_id }).then(res => {
this.tableLabel = res.newArray
})
}
}
}
</script>

View File

@@ -98,16 +98,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="产品系列">
<treeselect
v-model="query.product_series"
:options="classes3"
:auto-load-root-options="false"
:load-options="loadChildNodes"
style="width: 200px;"
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="销售单标识">
<el-input
v-model="query.sale_id"
@@ -132,7 +122,7 @@
:disabled="is_disabled(crud.selections.length,crud.selections[0])"
@click="submits(crud.selections[0])"
>
下发
开工
</el-button>
<el-button
slot="right"
@@ -165,28 +155,21 @@
/>
</el-select>
</el-form-item>
<el-form-item label="所属工序" prop="workprocedure_id">
<el-select
v-model="form.workprocedure_id"
clearable
size="mini"
class="filter-item"
style="width: 200px;"
>
<el-option
v-for="item in workprocedureList"
:key="item.workprocedure_id"
:label="item.workprocedure_name"
:value="item.workprocedure_id"
/>
</el-select>
</el-form-item>
<el-form-item label="生产日期" prop="produce_date">
<el-date-picker v-model="form.produce_date" type="date" value-format="yyyy-MM-dd" style="width: 200px;" />
</el-form-item>
<el-form-item v-if="false" label="物料标识" prop="material_id">
<el-input v-model="form.material_id" style="width: 200px;" />
</el-form-item>
<el-form-item label="生产设备">
<el-input
v-model="form.device_code"
style="width: 200px;"
clearable
@focus="deviceShow=true"
@clear="form.device_id='', form.device_code=''"
/>
</el-form-item>
<el-form-item label="物料编码" prop="material_code">
<el-input
v-model="form.material_code"
@@ -216,6 +199,15 @@
<el-form-item label="计划数量" prop="plan_qty">
<el-input v-model="form.plan_qty" style="width: 200px;" />
</el-form-item>
<el-form-item label="载具类型" prop="vehicle_type">
<el-select v-model="form.vehicle_type" style="width: 200px" filterable placeholder="请选择">
<el-option
v-for="item in dict.storagevehicle_type"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="计划开始时间" prop="planproducestart_date">
<el-date-picker
v-model="form.planproducestart_date"
@@ -306,22 +298,26 @@
{{ dict.label.PDM_BI_SHIFTTYPE[scope.row.shift_type_scode] }}
</template>
</el-table-column>
<el-table-column v-if="false" prop="workprocedure_id" label="工序标识" />
<el-table-column prop="produce_date" label="生产日期" width="100px" />
<el-table-column prop="plan_qty" label="计划数量" />
<el-table-column prop="real_qty" label="实际数量" />
<el-table-column prop="report_qty" label="报工数量" />
<el-table-column v-if="false" prop="material_id" label="物料标识" />
<el-table-column prop="device_name" label="设备" width="100" show-overflow-tooltip />
<el-table-column prop="material_code" label="物料编码" width="100" show-overflow-tooltip />
<el-table-column prop="material_name" label="物料名称" width="100" show-overflow-tooltip />
<el-table-column prop="material_spec" label="物料规格" width="100" show-overflow-tooltip />
<el-table-column prop="sale_id" label="销售单标识" width="100" show-overflow-tooltip />
<el-table-column prop="class_name" label="产品系列" width="100" show-overflow-tooltip />
<el-table-column prop="material_weight" label="物料单重" :formatter="rounding" />
<el-table-column prop="planproducestart_date" label="计划生产开始时间" width="150" />
<el-table-column prop="planproduceend_date" label="计划生产结束时间" width="150" />
<el-table-column prop="realproducestart_date" label="实际生产开始时间" width="150" />
<el-table-column prop="realproduceend_date" label="实际生产结束时间" width="150" />
<el-table-column prop="vehicle_type" label="载具类型">
<template slot-scope="scope">
{{ dict.label.storagevehicle_type[scope.row.vehicle_type] }}
</template>
</el-table-column>
<el-table-column prop="is_needmove" label="是否搬运">
<template slot-scope="scope">
{{ dict.label.IS_OR_NOT[scope.row.is_needmove] }}
@@ -348,12 +344,8 @@
<!--分页组件-->
<pagination />
</div>
<MaterDtl
:dialog-show.sync="materialShow"
:is-single="true"
:mater-opt-code="materType"
@setMaterValue="setMaterValue"
/>
<MaterDtl :dialog-show.sync="materialShow" :is-single="true" @setMaterValue="setMaterValue" />
<DeviceDialog :dialog-show.sync="deviceShow" :is-single="true" @tableChanged="tableChanged" />
<ViewDialog ref="child3"/>
</div>
</template>
@@ -365,13 +357,9 @@ import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import crudWorkProcedure from '@/api/wms/basedata/pdm/workProcedure'
import MaterDtl from '@/views/wms/pub/MaterDialog'
import Treeselect, {LOAD_CHILDREN_OPTIONS} from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
import ViewDialog from '@/views/wms/mps/produce/ViewDialog'
import crudClassstandard from '@/api/wms/basedata/master/classstandard'
import DeviceDialog from '@/views/wms/pub/DeviceDialog'
const defaultForm = {
produceorder_id: null,
@@ -386,6 +374,7 @@ const defaultForm = {
material_id: null,
material_code: null,
material_weight: null,
vehicle_type: null,
planproducestart_date: null,
planproduceend_date: null,
realproducestart_date: null,
@@ -404,15 +393,16 @@ const defaultForm = {
is_delete: null,
material_name: null,
device_id: null,
device_code: null,
is_canupdate_update: '1',
material_spec: null,
sale_id: null
}
export default {
name: 'Produceshiftorder',
components: { pagination, crudOperation, rrOperation, udOperation, MaterDtl, Treeselect, ViewDialog },
components: { pagination, crudOperation, rrOperation, udOperation, MaterDtl, ViewDialog, DeviceDialog },
mixins: [presenter(), header(), form(defaultForm), crud()],
dicts: ['PDM_BI_SHIFTTYPE', 'MPS_BD_ORDERSTATUS', 'is_used', 'PDM_BI_ORDERTYPE', 'IS_OR_NOT'],
dicts: ['PDM_BI_SHIFTTYPE', 'MPS_BD_ORDERSTATUS', 'is_used', 'PDM_BI_ORDERTYPE', 'IS_OR_NOT', 'storagevehicle_type'],
cruds() {
return CRUD({
title: '工单', url: 'api/produceshiftorder', idField: 'produceorder_id', sort: 'produceorder_id,desc',
@@ -434,6 +424,7 @@ export default {
classes3: [],
materType: '01',
materialShow: false,
deviceShow: false,
workprocedureList: [],
order_status: ['-1'],
permission: {},
@@ -447,9 +438,6 @@ export default {
shift_type_scode: [
{ required: true, message: '班次类型不能为空', trigger: 'blur' }
],
workprocedure_id: [
{ required: true, message: '工序标识不能为空', trigger: 'blur' }
],
produce_date: [
{ required: true, message: '生产日期不能为空', trigger: 'blur' }
],
@@ -484,59 +472,8 @@ export default {
}
},
created() {
this.getworkprocedure()
this.initClass3()
},
methods: {
queryClassId() {
const param = {
'class_idStr': this.class_idStr
}
crudClassstandard.queryClassById(param).then(res => {
this.classes = res.content.map(obj => {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
buildTree(classes) {
classes.forEach(data => {
if (data.children) {
this.buildTree(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null // 重点代码
}
})
},
// 获取子节点数据
loadChildNodes({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 100)
})
}
},
initClass3() {
const param = {
parent_class_code: '07'
}
crudClassstandard.getClassType(param).then(res => {
const data = res.content
this.buildTree(data)
this.classes3 = data
})
},
// 工单状态多选搜索
handTaskStatus(value) {
this.$forceUpdate()
@@ -579,11 +516,9 @@ export default {
this.form.material_name = row.material_name
this.form.material_spec = row.material_spec
},
getworkprocedure() {
// 查询工序
crudWorkProcedure.downSelect({}).then(res => {
this.workprocedureList = res
})
tableChanged(row) {
this.form.device_id = row.device_id
this.form.device_code = row.device_code
},
// 下发
submits(row) {

View File

@@ -0,0 +1,175 @@
<template>
<el-dialog
title="请选择设备"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="1000px"
@close="close"
@open="open"
>
<el-row style="margin-bottom: 10px;">
<el-col :span="22">
<el-form :inline="true" class="demo-form-inline">
<el-form-item :inline="true" label="模糊搜索:">
<el-input v-model="query.search" placeholder="请输入编码、名称" />
</el-form-item>
<rrOperation />
</el-form>
</el-col>
</el-row>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;"
size="mini"
border
:cell-style="{'text-align':'center'}"
:header-cell-style="{background:'#f5f7fa',color:'#606266','text-align':'center'}"
@select="handleSelectionChange"
@select-all="onSelectAll"
@current-change="clickChange"
>
<el-table-column v-if="!isSingle" type="selection" width="55" />
<el-table-column v-if="isSingle" label="选择" width="55">
<template slot-scope="scope">
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
</template>
</el-table-column>
<el-table-column prop="device_code" label="设备编码" show-overflow-tooltip />
<el-table-column prop="device_name" label="设备名称" show-overflow-tooltip />
<el-table-column prop="device_model" label="设备型号" show-overflow-tooltip/>
<el-table-column prop="device_model" label="设备型号" show-overflow-tooltip/>
<el-table-column prop="extend_code" label="外部编码" show-overflow-tooltip/>
</el-table>
<!--分页组件-->
<pagination />
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog>
</template>
<script>
import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import crudDevice from '@/api/wms/pdm/device'
export default {
name: 'EndPointDialog',
components: { rrOperation, pagination },
dicts: ['sch_area_type', 'sch_point_type'],
cruds() {
return CRUD({ title: '设备', url: 'api/device', crudMethod: { ...crudDevice }, optShow: {}})
},
mixins: [presenter(), header()],
props: {
dialogShow: {
type: Boolean,
default: false
},
isSingle: {
type: Boolean,
default: true
},
openParam: {
type: Object,
default: null
}
},
data() {
return {
formInline: {
search: ''
},
tableRadio: '',
tableData: [],
dialogVisible: false,
material: {}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
methods: {
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done()
})
.catch(_ => {
})
},
open() {
debugger
this.query.region_id = this.openParam
this.crud.toQuery()
},
close() {
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
},
submit() {
// 处理单选
if (this.isSingle && this.tableRadio) {
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.tableRadio)
return
}
this.rows = this.$refs.table.selection
if (this.rows.length <= 0) {
this.$message('请选择设备')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
},
handleSelectionChange(val, row) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
} else {
this.checkrow = row
}
},
onSelectAll() {
this.$refs.table.clearSelection()
},
clickChange(item) {
this.tableRadio = item
},
hand(value) {
this.crud.toQuery()
}
}
}
</script>
<style scoped>
.crud-opts2 {
padding: 4px 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
}
.el-table_body tr.current-row>td {
background-color: #e9e500;
}
</style>

View File

@@ -174,6 +174,15 @@
<el-form-item label="载具编码" prop="vehicle_code">
<el-input v-model="form.vehicle_code" clearable style="width: 370px;" />
</el-form-item>
<el-form-item label="是否专机" prop="is_host">
<el-radio-group v-model="form.is_host">
<el-radio
v-for="item in dict.IS_HOST"
:label="item.value"
>{{ item.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="点位类型" prop="point_type">
<el-radio-group v-model="form.point_type">
<el-radio
@@ -237,7 +246,17 @@
<el-table-column prop="task_code" label="锁定任务编码" width="100" />
<el-table-column prop="inv_code" label="锁定单据编码" width="130" />
<el-table-column prop="inv_type" label="锁定单据类型" width="110" :formatter="invtypeFormat" />
<el-table-column prop="vehicle_type" label="托盘类型">
<template slot-scope="scope">
{{ dict.label.storagevehicle_type[scope.row.vehicle_type] }}
</template>
</el-table-column>
<el-table-column prop="vehicle_qty" label="载具数量" />
<el-table-column prop="vehicle_type" label="是否专机">
<template slot-scope="scope">
{{ dict.label.IS_HOST[scope.row.is_host] }}
</template>
</el-table-column>
<el-table-column prop="update_optname" label="修改者" />
<el-table-column prop="update_time" label="修改时间" width="150" />
<el-table-column
@@ -270,10 +289,10 @@ import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
/*import checkoutbill from '@/api/wms/st/core/outbill/checkoutbill'*/
const defaultForm = { point_id: null, point_code: null, point_name: null, area_type: null, point_type: '00', point_status: '00', lock_type: '00', vehicle_code: null, source_id: null, remark: null, is_used: null, is_delete: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null }
const defaultForm = { point_id: null, is_host: null, point_code: null, point_name: null, area_type: null, point_type: '00', point_status: '00', lock_type: '00', vehicle_code: null, source_id: null, remark: null, is_used: null, is_delete: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null }
export default {
name: 'Point',
dicts: ['sch_point_type', 'sch_area_type', 'sch_point_status', 'is_used', 'd_lock_type', 'SCH_TASK_TYPE_DTL'],
dicts: ['sch_point_type', 'sch_area_type', 'sch_point_status', 'is_used', 'd_lock_type', 'SCH_TASK_TYPE_DTL', 'storagevehicle_type', 'IS_HOST'],
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
@@ -318,6 +337,9 @@ export default {
],
lock_type: [
{ required: true, message: '锁定类型不能为空', trigger: 'blur' }
],
is_host: [
{ required: true, message: '是否专机不能为空', trigger: 'blur' }
]
}