You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
207 lines
5.7 KiB
207 lines
5.7 KiB
2 weeks ago
|
<template>
|
||
|
<el-dialog
|
||
|
title="新增"
|
||
|
append-to-body
|
||
|
:visible.sync="dialogVisible"
|
||
|
destroy-on-close
|
||
|
:show-close="false"
|
||
|
width="60%"
|
||
|
@close="close"
|
||
|
>
|
||
|
<div class="head-container">
|
||
|
<div v-if="crud.props.searchToggle">
|
||
|
<!-- 搜索 -->
|
||
|
<el-form
|
||
|
:inline="true"
|
||
|
class="demo-form-inline"
|
||
|
label-position="right"
|
||
|
label-width="80px"
|
||
|
label-suffix=":"
|
||
|
>
|
||
|
<el-form-item label="库区">
|
||
|
<label slot="label">库 区:</label>
|
||
|
<el-cascader
|
||
|
v-model="query.sect"
|
||
|
:options="sects"
|
||
|
placeholder="请选择库区"
|
||
|
clearable
|
||
|
@change="sectChange"
|
||
|
/>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="物料分类">
|
||
|
<treeselect
|
||
|
v-model="query.material_type_id"
|
||
|
:load-options="loadClass"
|
||
|
:options="classes"
|
||
|
style="width: 200px;"
|
||
|
placeholder="请选择"
|
||
|
/>
|
||
|
</el-form-item>
|
||
|
<rrOperation />
|
||
|
</el-form>
|
||
|
</div>
|
||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||
|
<crudOperation />
|
||
|
<!--表格渲染-->
|
||
|
<el-table
|
||
|
ref="multipleTable"
|
||
|
v-loading="crud.loading"
|
||
|
:data="crud.data"
|
||
|
style="width: 100%;"
|
||
|
@selection-change="crud.selectionChangeHandler"
|
||
|
>
|
||
|
<el-table-column type="selection" width="55" />
|
||
|
<el-table-column type="index" width="50" label="序号" />
|
||
|
<el-table-column show-overflow-tooltip prop="class_code" label="物料类别编码" />
|
||
|
<el-table-column show-overflow-tooltip prop="class_name" label="物料类别名称" />
|
||
|
<el-table-column show-overflow-tooltip prop="address" label="二级分类" />
|
||
|
</el-table>
|
||
|
<!--分页组件-->
|
||
|
<pagination />
|
||
|
</div>
|
||
|
|
||
|
<span slot="footer" class="dialog-footer">
|
||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||
|
<el-button type="primary" @click="doAdd">确 定</el-button>
|
||
|
</span>
|
||
|
</el-dialog>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||
|
import rrOperation from '@crud/RR.operation'
|
||
|
import crudOperation from '@crud/CRUD.operation'
|
||
|
import pagination from '@crud/Pagination'
|
||
|
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr'
|
||
|
import crudMaterialbase from '@/views/wms/basedata/material/material'
|
||
|
import crudClassstandard from '@/views/wms/basedata/class/classstandard'
|
||
|
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
|
||
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||
|
import crudStructrelamaterial from '@/views/wms/basedata/materialSet/structrelamaterial'
|
||
|
|
||
|
export default {
|
||
|
name: 'AddShowDialog',
|
||
|
components: { pagination, rrOperation, crudOperation, Treeselect },
|
||
|
mixins: [presenter(), header(), form(), crud()],
|
||
|
cruds() {
|
||
|
return CRUD({
|
||
|
url: 'api/Classstandard/getClassTable',
|
||
|
idField: 'class_id',
|
||
|
sort: 'class_id,desc',
|
||
|
crudMethod: { ... crudClassstandard },
|
||
|
optShow: {
|
||
|
add: false,
|
||
|
edit: false,
|
||
|
del: false,
|
||
|
download: false,
|
||
|
reset: true
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
props: {
|
||
|
dialogShow: {
|
||
|
type: Boolean,
|
||
|
default: false
|
||
|
},
|
||
|
openParam: {
|
||
|
type: Object
|
||
|
}
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
sects: [],
|
||
|
classes: [],
|
||
|
sect_id: '',
|
||
|
dialogVisible: false,
|
||
|
procStatusList: []
|
||
|
}
|
||
|
},
|
||
|
watch: {
|
||
|
dialogShow: {
|
||
|
handler(newValue, oldValue) {
|
||
|
this.dialogVisible = newValue
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
created() {
|
||
|
crudSectattr.getSect({ 'is_materialstore': '1' }).then(res => {
|
||
|
this.sects = res.content
|
||
|
})
|
||
|
const param = {
|
||
|
'materOpt_code': '00'
|
||
|
}
|
||
|
crudMaterialbase.getMaterOptType(param).then(res => {
|
||
|
this.class_idStr = res.class_idStr
|
||
|
this.crud.query.class_idStr = res.class_idStr
|
||
|
this.queryClassId()
|
||
|
})
|
||
|
},
|
||
|
methods: {
|
||
|
handleClose(done) {
|
||
|
this.$confirm('确认关闭?')
|
||
|
.then(_ => {
|
||
|
done()
|
||
|
})
|
||
|
.catch(_ => {
|
||
|
})
|
||
|
},
|
||
|
close() {
|
||
|
this.crud.resetQuery(false)
|
||
|
this.$emit('update:dialogShow', false)
|
||
|
},
|
||
|
sectChange(val) {
|
||
|
this.sect_id = val[1]
|
||
|
},
|
||
|
loadClass({ 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)
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
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
|
||
|
})
|
||
|
})
|
||
|
},
|
||
|
doAdd() {
|
||
|
const data = {}
|
||
|
const _selectData = this.$refs.multipleTable.selection
|
||
|
data.class_rows = _selectData
|
||
|
data.sect_id = this.sect_id
|
||
|
if (!this.query.sect) {
|
||
|
this.crud.notify('请选择库区', CRUD.NOTIFICATION_TYPE.INFO)
|
||
|
return false
|
||
|
}
|
||
|
crudStructrelamaterial.insertSet(data).then(() => {
|
||
|
this.crud.status.add = CRUD.STATUS.NORMAL
|
||
|
this.$emit('update:dialogShow', false)
|
||
|
this.crud.toQuery()
|
||
|
this.crud.notify('新增成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||
|
this.$parent.freshParentPage()
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style scoped>
|
||
|
|
||
|
</style>
|