| | |
| | | > |
| | | <div class="bodyTopButtonGroup" style="justify-content: space-between"> |
| | | <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button> |
| | | <el-button |
| | | v-waves |
| | | type="success" |
| | | icon="el-icon-download" |
| | | @click="$router.push('./../systemSetting/dataImport?fileCode=7')" |
| | | >导入 |
| | | </el-button> |
| | | <!-- <el-button--> |
| | | <!-- v-waves--> |
| | | <!-- type="success"--> |
| | | <!-- icon="el-icon-download"--> |
| | | <!-- @click="$router.push('./../systemSetting/dataImport?fileCode=7')"--> |
| | | <!-- >导入--> |
| | | <!-- </el-button>--> |
| | | </div> |
| | | |
| | | <div class="bodyTopFormGroup"> |
| | |
| | | style="display: flex;" |
| | | > |
| | | <div class="elForm"> |
| | | <el-form-item label="仓库编码" style=" display: flex;"> |
| | | <el-form-item label="货位编码" style=" display: flex;"> |
| | | <el-input v-model="form.locacode" placeholder="请输入" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="仓库名称" style=" display: flex;"> |
| | | <el-form-item label="货位名称" style=" display: flex;"> |
| | | <el-input v-model="form.locaname" placeholder="请输入" style="width: 200px" /> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="存货规格" style=" display: flex;">--> |
| | |
| | | /> |
| | | <el-table-column |
| | | prop="code" |
| | | label="仓库编码" |
| | | label="货位编码" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="name" |
| | | label="仓库名称" |
| | | label="货位名称" |
| | | show-overflow-tooltip |
| | | sortable="custom" |
| | | /> |
| | |
| | | |
| | | <el-form ref="dialogForm" class="" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> |
| | | <!-- <el-divider content-position="left">基本信息</el-divider>--> |
| | | <el-form-item label="仓库编码" prop="locacode"> |
| | | <el-form-item label="货位编码" prop="locacode"> |
| | | <el-input v-model="dialogForm.locacode" :disabled="operation!=='add'" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="仓库名称" prop="locaname"> |
| | | <el-form-item label="货位名称" prop="locaname"> |
| | | <el-input v-model="dialogForm.locaname" style="width: 200px" /> |
| | | </el-form-item> |
| | | |
| | |
| | | placeholder="请选择" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | :disabled="!isEdit&&operation==='edit'" |
| | | @change="stckcodeChange" |
| | | > |
| | | <el-option |
| | |
| | | TCunstomerClassTreeDelete, |
| | | TCunstomerData, TCunstomerDelete, TSecLocaAddUpdate, TSecLocaData, TSecLocaDelete, TSecLocaTree |
| | | } from '@/api/basicSettings' |
| | | import { WareHouseSelectLocation } from '@/api/GeneralBasicData' |
| | | |
| | | const _ = require('lodash') |
| | | |
| | | export default { |
| | | name: 'RoleList', |
| | |
| | | locacode: '', |
| | | locaname: '', |
| | | partspec: '', |
| | | flag: '', |
| | | page: 1, |
| | | rows: 20, |
| | | prop: 'lm_date', // 排序字段 |
| | |
| | | parentlocacode: '', // 上级货位编码 |
| | | status: '0', // 使用状态: 正常(0)停用(1) |
| | | description: '', |
| | | depth: '', // 层级 |
| | | |
| | | OperType: '' // 操作类型 |
| | | }, |
| | | dialogFormRules: { |
| | |
| | | ] |
| | | }, |
| | | stckcodeArr: [], |
| | | parentlocacodeArr: [] |
| | | parentlocacodeArr: [], |
| | | |
| | | isEdit: true |
| | | |
| | | } |
| | | }, |
| | |
| | | }, |
| | | methods: { |
| | | async getTSecLocaTree() { |
| | | const res = await TSecLocaTree() |
| | | this.treeLeftArr = res.data |
| | | this.treeLeftArr.forEach(e => { |
| | | const { data: res } = await TSecLocaTree() |
| | | res.forEach(e => { |
| | | e.name = e.code + ' ' + e.name |
| | | }) |
| | | this.stckcodeArr = res.data.filter(i => i.idparent === '-1') |
| | | this.treeLeft = [ |
| | | { |
| | | code: '-1', |
| | | name: '全部' |
| | | } |
| | | ]// 左侧树 |
| | | this.treeLeft = arrayToTree(this.treeLeft.concat(res.data), { |
| | | // 获取仓库 |
| | | const ck = res.filter(i => i.depth === 0)// 层级为0的 是仓库 |
| | | const kw = res.filter(i => i.depth !== 0)// 反之 为仓位 |
| | | this.stckcodeArr = ck |
| | | const tree = arrayToTree(kw, { |
| | | parentProperty: 'idparent', |
| | | customID: 'code', |
| | | childrenProperty: 'children' |
| | | }) |
| | | const group = _.groupBy(tree, i => i.warhouse) |
| | | const newArr = [] |
| | | ck.forEach(j => { |
| | | if (Object.keys(group).includes(j.code)) { |
| | | newArr.push({ |
| | | code: j.code, |
| | | name: j.name, |
| | | depth: 0, |
| | | idparent: '-1', |
| | | children: group[j.code] |
| | | }) |
| | | } else { |
| | | newArr.push({ |
| | | code: j.code, |
| | | name: j.name, |
| | | depth: 0, |
| | | idparent: '-1', |
| | | children: [] |
| | | }) |
| | | } |
| | | }) |
| | | this.treeLeft = [ |
| | | { |
| | | code: '-1', |
| | | name: '全部', |
| | | idparent: '', |
| | | children: newArr |
| | | } |
| | | ]// 左侧树 |
| | | this.$nextTick(() => { |
| | | this.$refs.treeLeftRef.setCurrentKey('-1') |
| | | this.getTSecLocaData(this.$refs.treeLeftRef.getCurrentNode()) |
| | | }) |
| | | |
| | | console.log(JSON.parse(JSON.stringify(this.treeLeft))) |
| | | }, |
| | | |
| | | async getTSecLocaData(node) { |
| | | let result = '' |
| | | if (node.code === '-1') { |
| | |
| | | // result.shift() |
| | | // } |
| | | this.form.stckcode = result.join(',') |
| | | |
| | | if (this.$refs.treeLeftRef.getCurrentNode().idparent === '') { |
| | | this.form.flag = -1 |
| | | } else { |
| | | this.form.flag = this.$refs.treeLeftRef.getCurrentNode().depth |
| | | } |
| | | |
| | | const res = await TSecLocaData(this.form) |
| | | |
| | | this.tableData = res.data |
| | |
| | | this.dialogVisible = true |
| | | this.dialogForm.OperType = 'Update' |
| | | |
| | | this.$nextTick(() => { |
| | | this.dialogForm.data_sources = row.data_sources |
| | | this.dialogForm.locacode = row.code |
| | | this.dialogForm.locaname = row.name |
| | | this.dialogForm.stckcode = row.stckcode |
| | | const temp = this.$refs.treeLeftRef.getCurrentNode() |
| | | |
| | | this.parentlocacodeArr = this.treeLeftArr.filter(i => i.idparent === this.dialogForm.stckcode) |
| | | if (temp.idparent === '-1' || temp.idparent === '') { |
| | | this.isEdit = temp.depth !== 1 |
| | | } else { |
| | | this.isEdit = false |
| | | } |
| | | |
| | | this.dialogForm.parentlocacode = row.parentname ? row.parentcode : null |
| | | this.dialogForm.status = row.status |
| | | this.dialogForm.description = row.description |
| | | }) |
| | | // this.$nextTick(() => { |
| | | this.dialogForm.data_sources = row.data_sources |
| | | this.dialogForm.locacode = row.code |
| | | this.dialogForm.locaname = row.name |
| | | this.dialogForm.stckcode = row.stckcode |
| | | |
| | | const { data: res } = await WareHouseSelectLocation({ warhousecode: row.stckcode }) |
| | | |
| | | this.parentlocacodeArr = res |
| | | // this.parentlocacodeArr = this.treeLeftArr.filter(i => i.idparent === this.dialogForm.stckcode) |
| | | |
| | | this.dialogForm.parentlocacode = row.parentname ? row.parentcode : null |
| | | this.dialogForm.status = row.status |
| | | this.dialogForm.description = row.description |
| | | // }) |
| | | }, |
| | | del(row) { |
| | | this.$confirm('是否确认删除?', '提示', { |
| | |
| | | this.dialogForm.parentlocacode = '' |
| | | this.dialogForm.description = '' |
| | | this.dialogForm.status = '0' |
| | | |
| | | if (this.$refs.treeLeftRef.getCurrentNode().idparent === '') { |
| | | this.form.flag = '' |
| | | } else { |
| | | this.form.flag = this.$refs.treeLeftRef.getCurrentNode().depth |
| | | } |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | | // 对话框取消 |
| | |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | // console.log(JSON.parse(JSON.stringify(this.dialogForm)), 2) |
| | | |
| | | if (this.dialogForm.locacode === this.dialogForm.parentlocacode) { |
| | | return this.$message.error('上级货位不能是货位本身!') |
| | | } |
| | | |
| | | if (this.dialogForm.parentlocacode === '') { |
| | | this.dialogForm.depth = 1 |
| | | } else { |
| | | this.dialogForm.depth = parseFloat(this.parentlocacodeArr.find(i => i.code === this.dialogForm.parentlocacode).depth) + 1 |
| | | } |
| | | |
| | | this.$store.state.app.buttonIsDisabled = true |
| | | TSecLocaAddUpdate(this.dialogForm).then(res => { |
| | | if (res.code === '200') { |
| | |
| | | this.dialogVisible = false |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.getTSecLocaTree() |
| | | this.getTSecLocaData(this.$refs.treeLeftRef.getCurrentNode()) |
| | | } else { |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.$notify.error(this.operation === 'add' ? '添加失败!' : '修改失败!') |
| | |
| | | }) |
| | | }, |
| | | |
| | | stckcodeChange(val) { |
| | | this.dialogForm.parentlocacode = '' |
| | | const res = this.recursiveLookupArray([], val)// 递归查找数组 |
| | | async stckcodeChange(val) { |
| | | const { data: res } = await WareHouseSelectLocation({ warhousecode: val }) |
| | | this.parentlocacodeArr = res |
| | | |
| | | this.dialogForm.parentlocacode = '' |
| | | // const res = this.recursiveLookupArray([], val)// 递归查找数组 |
| | | // this.parentlocacodeArr = res |
| | | }, |
| | | recursiveLookupArray(newArr, val) { |
| | | const temp = this.treeLeftArr.filter(i => i.idparent === val) |