init project
This commit is contained in:
353
mes/qd/src/views/wms/pf/productbom/AddDialog.vue
Normal file
353
mes/qd/src/views/wms/pf/productbom/AddDialog.vue
Normal file
@@ -0,0 +1,353 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
style="padding-top: 0px;"
|
||||
:title="crud.status.title"
|
||||
append-to-body
|
||||
fullscreen
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
|
||||
>
|
||||
<el-row v-show="crud.status.cu > 0" :gutter="20">
|
||||
<el-col :span="20" style="border: 1px solid white">
|
||||
<span />
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<span>
|
||||
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
|
||||
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="100px" label-suffix=":">
|
||||
<el-form-item label="选择产品" prop="receive_code">
|
||||
<el-input v-model="form.material_code" placeholder="请选择产品" disabled class="input-with-select">
|
||||
<el-button slot="append" icon="el-icon-plus" :disabled="crud.status.edit > 0" @click="queryMater" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="标准合计值" prop="total_value">
|
||||
<el-input v-model="form.total_value" :disabled="true" style="width: 210px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="明细数">
|
||||
<el-input v-model="form.tableData.length" :disabled="true" style="width: 210px;" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<label slot="label">备 注:</label>
|
||||
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div class="crud-opts2" style="margin-bottom: 5px;">
|
||||
<span class="crud-opts-right2">
|
||||
<!--左侧插槽-->
|
||||
<slot name="left" />
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
:disabled="crud.status.view > 0"
|
||||
@click="insertdtl"
|
||||
>
|
||||
添加一行
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="form.tableData"
|
||||
style="width: 100%;"
|
||||
size="mini"
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column prop="material_code" label="物料编码" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-show="!scope.row.edit" v-model="scope.row.material_code" disabled class="input-with-select">
|
||||
<el-button slot="append" icon="el-icon-search" @click="queryDtlMater(scope.$index, scope.row)" />
|
||||
</el-input>
|
||||
<span v-show="scope.row.edit">{{ scope.row.material_code }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="material_name" label="物料名称" align="center" />
|
||||
<el-table-column prop="standard_rate" label="标准值%" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.standard_rate"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="4"
|
||||
:max="100"
|
||||
:min="0"
|
||||
:disabled="scope.row.edit"
|
||||
/>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="calculate_rate" label="开单时计算含量%" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.calculate_rate"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="4"
|
||||
:max="100"
|
||||
:min="0"
|
||||
:disabled="scope.row.edit"
|
||||
/>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="seqno" label="顺序号" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="scope.row.seqno"
|
||||
size="mini"
|
||||
:controls="false"
|
||||
:precision="0"
|
||||
:min="0"
|
||||
:disabled="scope.row.edit"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="prior_level" label="库存优先等级" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.prior_level" :disabled="scope.row.edit" filterable class="edit-input" size="mini" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in dict.ST_IVT_LEVEL"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_need_manage" label="是否配粉" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.is_need_manage" :disabled="scope.row.edit" filterable class="edit-input" size="mini" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in dict.IS_OR_NOT"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="crud.status.cu > 0" v-permission="['admin','productbom:edit','productbom:del']" 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="delOne(scope.$index, form.tableData)" />
|
||||
<el-button v-show="!scope.row.edit" type="primary" class="filter-item" size="mini" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
||||
<el-button v-show="scope.row.edit" type="success" class="filter-item" size="mini" icon="el-icon-check" @click="handleEdit(scope.$index, scope.row)">完成</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<MaterDtl
|
||||
:dialog-show.sync="materShow"
|
||||
:is-single="true"
|
||||
:mater-opt-code="'21'"
|
||||
@tableChanged2="tableChanged"
|
||||
/>
|
||||
<MaterDtl
|
||||
:dialog-show.sync="dtlMaterShow"
|
||||
:is-single="true"
|
||||
:mater-opt-code="'04'"
|
||||
@tableChanged2="tableChanged2"
|
||||
/>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
const defaultForm = {
|
||||
material_code: '',
|
||||
total_value: 0,
|
||||
remark: '',
|
||||
tableData: []
|
||||
}
|
||||
|
||||
import crudProductbom from '@/api/wms/pf/productbom'
|
||||
import CRUD, { form, crud } from '@crud/crud'
|
||||
import MaterDtl from '@/views/wms/pub/MaterDialog'
|
||||
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
components: { MaterDtl },
|
||||
mixins: [crud(), form(defaultForm)],
|
||||
dicts: ['ST_IVT_LEVEL', 'IS_OR_NOT'],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
materShow: false,
|
||||
dtlMaterShow: false,
|
||||
nowrow: {},
|
||||
nowindex: '',
|
||||
rules: {
|
||||
material_code: [
|
||||
{ required: true, message: '产品不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
},
|
||||
materShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.materShow = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
[CRUD.HOOK.beforeSubmit]() {
|
||||
// 数据校验
|
||||
if (!this.form.material_code) {
|
||||
this.crud.notify('请选择产品', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (this.form.tableData.length === 0) {
|
||||
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (this.form.total_value < 100) {
|
||||
this.crud.notify('标准合计值不足100!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
},
|
||||
[CRUD.HOOK.afterToEdit]() {
|
||||
// 编辑之后获取明细
|
||||
crudProductbom.getDtl({ 'bom_id': this.form.bom_id }).then(res => {
|
||||
this.form.tableData = res
|
||||
// 计算合计值
|
||||
let all = 0
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
const row = this.form.tableData[i]
|
||||
row.edit = true
|
||||
this.form.tableData.splice(i, 1, row)
|
||||
if (row.is_need_manage === '1') {
|
||||
all = all + parseFloat(row.standard_rate)
|
||||
}
|
||||
}
|
||||
this.form.total_value = all
|
||||
})
|
||||
},
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done()
|
||||
})
|
||||
.catch(_ => {
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
// 判断是否可以关闭编辑状态
|
||||
if (!row.edit) {
|
||||
if (parseFloat(row.standard_rate) <= 0) {
|
||||
this.crud.notify('标准值必须大于0!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!row.seqno) {
|
||||
this.crud.notify('顺序号不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (!row.material_code) {
|
||||
this.crud.notify('物料不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (row.is_need_manage === '1') {
|
||||
if ((this.form.total_value + parseFloat(row.standard_rate)) > 100) {
|
||||
this.crud.notify('标准合计值不能超过100!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
row.edit = !row.edit
|
||||
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
|
||||
this.form.total_value = 0
|
||||
this.form.tableData.forEach((item) => {
|
||||
if (item.is_need_manage === '1' && item.edit) {
|
||||
this.form.total_value = this.form.total_value + parseFloat(item.standard_rate)
|
||||
}
|
||||
})
|
||||
},
|
||||
insertdtl() {
|
||||
this.form.tableData.push({ is_need_manage: '1', prior_level: '01', standard_rate: '0', edit: false })
|
||||
},
|
||||
delOne(index, rows) {
|
||||
this.form.total_value = parseFloat(this.form.total_value) - parseFloat(rows[index].standard_rate)
|
||||
if (this.form.total_value < 0) {
|
||||
this.form.total_value = 0
|
||||
}
|
||||
rows.splice(index, 1)
|
||||
},
|
||||
queryMater() {
|
||||
this.materShow = true
|
||||
},
|
||||
queryDtlMater(index, row) {
|
||||
this.dtlMaterShow = true
|
||||
this.nowindex = index
|
||||
this.nowrow = row
|
||||
},
|
||||
tableChanged(row) {
|
||||
this.form.material_code = row.material_code
|
||||
this.form.material_id = row.material_id
|
||||
},
|
||||
tableChanged2(row) {
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
if (this.form.tableData[i].material_id === row.material_id) {
|
||||
this.crud.notify('不允许添加相同物料!')
|
||||
return false
|
||||
}
|
||||
}
|
||||
this.nowrow.material_id = row.material_id
|
||||
this.nowrow.material_code = row.material_code
|
||||
this.nowrow.material_name = row.material_name
|
||||
this.nowrow.qty_unit_id = row.base_unit_id
|
||||
this.nowrow.qty_unit_name = row.unit_name
|
||||
this.nowrow.is_need_manage = '1'
|
||||
this.nowrow.prior_level = '01'
|
||||
this.nowrow.standard_rate = '0'
|
||||
this.nowrow.calculate_rate = '100'
|
||||
this.nowrow.edit = false
|
||||
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.crud-opts2 {
|
||||
padding: 4px 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.crud-opts2 .crud-opts-right2 {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding-top: 0px;
|
||||
}
|
||||
</style>
|
||||
121
mes/qd/src/views/wms/pf/productbom/ViewDialog.vue
Normal file
121
mes/qd/src/views/wms/pf/productbom/ViewDialog.vue
Normal file
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
style="padding-top: 0px;"
|
||||
title="bom详情"
|
||||
:visible.sync="dialogVisible"
|
||||
append-to-body
|
||||
fullscreen
|
||||
@open = "open"
|
||||
@close ="close"
|
||||
>
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" size="mini" label-width="100px" label-suffix=":">
|
||||
<el-form-item label="产品" prop="material_code">
|
||||
<el-input v-model="form.material_code" placeholder="产品" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="标准合计值" prop="total_value">
|
||||
<el-input v-model="form.total_value" :disabled="true" style="width: 210px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="明细数">
|
||||
<el-input v-model="form.detail_count" :disabled="true" style="width: 210px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<label slot="label">备 注:</label>
|
||||
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" disabled />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="tableData"
|
||||
style="width: 100%;"
|
||||
size="mini"
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column prop="seqno" label="顺序号" align="center"/>
|
||||
<el-table-column prop="material_code" label="物料编码" align="center"/>
|
||||
<el-table-column prop="material_name" label="物料名称" align="center" />
|
||||
<el-table-column prop="standard_rate" label="标准值%" align="center"/>
|
||||
<el-table-column prop="calculate_rate" label="开单时计算含量%" align="center"/>
|
||||
<el-table-column prop="prior_level" label="库存优先等级" align="center" :formatter="prior_levelFormat" />
|
||||
<el-table-column prop="is_need_manage" label="是否配粉" align="center":formatter="IS_OR_NOTFormat" />
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import crudProductbom from '@/api/wms/pf/productbom'
|
||||
import { crud } from '@crud/crud'
|
||||
|
||||
export default {
|
||||
name: 'ViewDialog',
|
||||
components: { },
|
||||
mixins: [crud()],
|
||||
dicts: ['ST_IVT_LEVEL', 'IS_OR_NOT'],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
rowmst: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
form:{},
|
||||
tableData:[]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
},
|
||||
rowmst: {
|
||||
handler(newValue) {
|
||||
this.form = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
prior_levelFormat(row) {
|
||||
return this.dict.label.ST_IVT_LEVEL[row.prior_level]
|
||||
},
|
||||
IS_OR_NOTFormat(row) {
|
||||
return this.dict.label.IS_OR_NOT[row.is_need_manage]
|
||||
},
|
||||
open() {
|
||||
crudProductbom.getDtl({ 'bom_id': this.form.bom_id }).then(res => {
|
||||
this.tableData = res
|
||||
// 计算合计值
|
||||
let all = 0
|
||||
for (let i = 0; i < this.tableData.length; i++) {
|
||||
const row = this.tableData[i]
|
||||
row.edit = true
|
||||
this.tableData.splice(i, 1, row)
|
||||
if (row.is_need_manage === '1') {
|
||||
all = all + parseFloat(row.standard_rate)
|
||||
}
|
||||
}
|
||||
this.form.total_value = all
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.form = {}
|
||||
this.tableData=[]
|
||||
this.$emit('AddChanged')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding-top: 0px;
|
||||
}
|
||||
</style>
|
||||
171
mes/qd/src/views/wms/pf/productbom/index.vue
Normal file
171
mes/qd/src/views/wms/pf/productbom/index.vue
Normal file
@@ -0,0 +1,171 @@
|
||||
<template>
|
||||
<div class="app-container" >
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
size="mini"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="模糊查询">
|
||||
<el-input
|
||||
v-model="query.material_code"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="请输入产品编码、名称、牌号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态">
|
||||
<el-select
|
||||
v-model="query.is_used"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="全部"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.is_used"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column v-permission="[]" label="操作" fixed="right" width="120px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
:disabled-edit="canUd(scope.row)"
|
||||
:disabled-dle="canUd(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="false" prop="bom_id" label="BOM单标识" />
|
||||
<el-table-column prop="bom_code" width="140px" label="BOM单编码">
|
||||
<template slot-scope="scope">
|
||||
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.bom_code }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="material_code" label="产品编码" width="150px" show-overflow-tooltip />
|
||||
<el-table-column prop="detail_count" label="明细数" />
|
||||
<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 prop="create_name" label="创建人" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="150px" />
|
||||
<el-table-column prop="update_optname" label="修改人" />
|
||||
<el-table-column prop="update_time" label="修改时间" width="150px" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<AddDialog />
|
||||
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudProductbom from '@/api/wms/pf/productbom'
|
||||
import CRUD, { presenter, header, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import AddDialog from '@/views/wms/pf/productbom/AddDialog'
|
||||
import ViewDialog from '@/views/wms/pf/productbom/ViewDialog'
|
||||
|
||||
export default {
|
||||
name: 'Productbom',
|
||||
dicts: ['is_used'],
|
||||
components: { AddDialog, ViewDialog, pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '配粉BOM维护',
|
||||
url: 'api/productbom',
|
||||
idField: 'bom_id',
|
||||
sort: 'bom_id,desc',
|
||||
crudMethod: { ...crudProductbom },
|
||||
optShow: {
|
||||
add: true,
|
||||
del: false,
|
||||
edit: false,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
},
|
||||
mstrow:{},
|
||||
viewShow:false,
|
||||
rules: {
|
||||
}}
|
||||
},
|
||||
methods: {
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
toView(index, row) {
|
||||
this.mstrow = row
|
||||
this.viewShow = true
|
||||
},
|
||||
canUd(row) {
|
||||
return row.is_used !== '0'
|
||||
},
|
||||
changeEnabled(data, val) {
|
||||
let msg = '此操作将停用bom单,是否继续!'
|
||||
if (val !== '1') {
|
||||
msg = '此操作将启用bom单,是否继续!'
|
||||
}
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
crudProductbom.changeActive(data).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => {
|
||||
data.is_used = !data.is_used
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
format_is_used(is_used) {
|
||||
return is_used === '1'
|
||||
},
|
||||
querytable() {
|
||||
this.crud.toQuery()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user