修改
This commit is contained in:
@@ -117,6 +117,18 @@
|
||||
:min-width="item.width"
|
||||
/>
|
||||
</template>
|
||||
<el-table-column label="是否启用" align="center" prop="is_active">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.is_active"
|
||||
active-color="#409EFF"
|
||||
inactive-color="#F56C6C"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
@change="changeEnabled(scope.row, scope.row.is_active)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
@@ -145,12 +157,14 @@ import pagination from '@crud/Pagination'
|
||||
import DeviceItemDialog from '@/views/wms/pdm/device/DeviceItemDialog'
|
||||
import DeviceInfoDialog from '@/views/wms/pdm/device/DeviceInfoDialog'
|
||||
import CopyDialog from '@/views/wms/pdm/device/CopyDialog'
|
||||
import crudSectattr from "@/api/wms/basedata/st/sectattr";
|
||||
|
||||
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 },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
dicts: ['is_used'],
|
||||
cruds() {
|
||||
return CRUD({ title: '生产设备', url: 'api/device', idField: 'device_id', sort: 'device_id,desc',
|
||||
optShow: {
|
||||
@@ -191,6 +205,38 @@ export default {
|
||||
this.getHeader(this.query.search, this.query.workprocedure_id)
|
||||
return true
|
||||
},
|
||||
// 改变状态
|
||||
format_is_used(is_used) {
|
||||
return is_used === '1'
|
||||
},
|
||||
changeEnabled(data, val) {
|
||||
debugger
|
||||
this.$confirm('此操作将 "' + this.dict.label.is_used[val] + '" ' + data.device_code + ', 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
crudDevice.edit(data).then(res => {
|
||||
this.crud.notify(this.dict.label.is_used[val] + '成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => {
|
||||
if (data.is_active === '0') {
|
||||
data.is_active = '1'
|
||||
return
|
||||
}
|
||||
if (data.is_active === '1') {
|
||||
data.is_active = '0'
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
if (data.is_active === '0') {
|
||||
data.is_active = '1'
|
||||
return
|
||||
}
|
||||
if (data.is_active === '1') {
|
||||
data.is_active = '0'
|
||||
}
|
||||
})
|
||||
},
|
||||
getWorkprocedure() {
|
||||
crudDevice.getWorkprocedure().then(res => {
|
||||
this.workList = res
|
||||
|
||||
Reference in New Issue
Block a user