| | |
| | | <el-input v-model="form.partspec" placeholder="请输入" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="存货类型" style=" display: flex;"> |
| | | <el-select |
| | | v-model="form.stocktypecode" |
| | | <el-cascader |
| | | ref="cascader" |
| | | :options="stocktypeArr" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | > |
| | | <!-- @change="val=>stocktypecodeChange(val,'form')"--> |
| | | <el-option |
| | | v-for="item in stocktypeArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | :props="defaultProps" |
| | | @change="val=>cascaderChange(val,'form')" |
| | | /> |
| | | </el-select> |
| | | <!-- <el-select--> |
| | | <!-- v-model="form.stocktypecode"--> |
| | | <!-- filterable--> |
| | | <!-- :popper-append-to-body="false"--> |
| | | <!-- style="width: 200px"--> |
| | | <!-- placeholder="请选择"--> |
| | | <!-- >--> |
| | | <!-- <!– @change="val=>stocktypecodeChange(val,'form')"–>--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in stocktypeArr"--> |
| | | <!-- :key="item.code"--> |
| | | <!-- :label="item.name"--> |
| | | <!-- :value="item.code"--> |
| | | <!-- />--> |
| | | <!-- </el-select>--> |
| | | </el-form-item> |
| | | <el-form-item v-if="false" label="物料类型" style=" display: flex;"> |
| | | <el-select |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="存货类型" prop="stocktypecode"> |
| | | <el-select |
| | | v-model="dialogForm.stocktypecode" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | style="width: 200px" |
| | | placeholder="请选择" |
| | | > |
| | | <!-- @change="val=>stocktypecodeChange(val,'dialogForm')"--> |
| | | |
| | | <el-option |
| | | v-for="item in stocktypeArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | <el-cascader |
| | | ref="cascaderDialog" |
| | | :options="stocktypeArr" |
| | | filterable |
| | | :props="defaultPropsDialog" |
| | | @change="val=>cascaderChange(val,'dialogForm')" |
| | | /> |
| | | </el-select> |
| | | |
| | | <!-- <el-select--> |
| | | <!-- v-model="dialogForm.stocktypecode"--> |
| | | <!-- filterable--> |
| | | <!-- :popper-append-to-body="false"--> |
| | | <!-- style="width: 200px"--> |
| | | <!-- placeholder="请选择"--> |
| | | <!-- >--> |
| | | <!-- <!– @change="val=>stocktypecodeChange(val,'dialogForm')"–>--> |
| | | |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in stocktypeArr"--> |
| | | <!-- :key="item.code"--> |
| | | <!-- :label="item.name"--> |
| | | <!-- :value="item.code"--> |
| | | <!-- />--> |
| | | <!-- </el-select>--> |
| | | </el-form-item> |
| | | <el-form-item label="所属仓库" prop="warehousecode"> |
| | | <el-select |
| | |
| | | import elDragDialog from '@/directive/el-drag-dialog' |
| | | import waves from '@/directive/waves' |
| | | import TableColumnSettings from '@/components/TableColumnSettings' |
| | | import arrayToTree from 'array-to-tree' |
| | | |
| | | export default { |
| | | name: 'CHDA', |
| | |
| | | isBatchNo: false, // 是否批次管理 |
| | | isFifo: false, // 是否先进先出 |
| | | isInCheck: false, // 是否入库检验 |
| | | isOutCheck: false// 是否出厂检验 |
| | | isOutCheck: false, // 是否出厂检验 |
| | | |
| | | defaultProps: { |
| | | checkStrictly: true, |
| | | expandTrigger: 'hover', |
| | | value: 'code', |
| | | label: 'name' |
| | | }, |
| | | defaultPropsDialog: { |
| | | // checkStrictly: true, |
| | | expandTrigger: 'hover', |
| | | value: 'code', |
| | | label: 'name' |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | }, 10000) |
| | | } |
| | | }, |
| | | cascaderChange(val, type) { |
| | | if (type === 'form') { |
| | | this.form.stocktypecode = val[val.length - 1] |
| | | } |
| | | if (type === 'dialogForm') { |
| | | this.dialogForm.stocktypecode = val[val.length - 1] |
| | | } |
| | | }, |
| | | // parents:用于返回的数组,childNode:要查询的节点,treeData:json树形数据 |
| | | findParent(parents, childNode, treeData) { |
| | | for (let i = 0; i < treeData.length; i++) { |
| | | // 父节点查询条件 |
| | | if (treeData[i].code === childNode) { |
| | | // 如果找到结果,保存当前节点 |
| | | parents.push(treeData[i].code) |
| | | // 用当前节点再去原数据查找当前节点的父节点 |
| | | this.findParent(parents, treeData[i].iparent_id, this.stocktypeArr) |
| | | break |
| | | } else { |
| | | if (treeData[i].children instanceof Array) { |
| | | // 没找到,遍历该节点的子节点 |
| | | this.findParent(parents, childNode, treeData[i].children) |
| | | } |
| | | } |
| | | } |
| | | return parents |
| | | }, |
| | | |
| | | async getInventoryFileSelect() { |
| | | const res = await InventoryFileSelect(this.form) |
| | | this.tableData = res.data |
| | |
| | | }, |
| | | async getStockTypeSelect() { |
| | | const { data: res } = await StockTypeSelect() |
| | | this.stocktypeArr = res |
| | | this.stocktypeArr = arrayToTree(res, { |
| | | parentProperty: 'iparent_id', |
| | | customID: 'code', |
| | | childrenProperty: 'children' |
| | | }) |
| | | |
| | | console.log(this.stocktypeArr, 2) |
| | | }, |
| | | async getWareHouseSelect() { |
| | | const { data: res } = await WareHouseSelect() |
| | |
| | | this.form.stocktypecode = '' |
| | | this.form.materialtypecode = '' |
| | | this.form.storehousecode = '' |
| | | this.$refs.cascader.checkedValue = '' |
| | | this.getInventoryFileSelect() |
| | | }, |
| | | // 新增按钮 |
| | |
| | | }, |
| | | // 修改按钮 |
| | | async edit(operation, row) { |
| | | const cascaderCheckedValue = this.findParent([], row.stocktypecode, this.stocktypeArr) |
| | | |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | // await this.stocktypecodeChange(row.stocktypecode, 'dialogForm') |
| | | this.$nextTick(() => { |
| | | this.$refs.cascaderDialog.checkedValue = cascaderCheckedValue.reverse() |
| | | |
| | | this.dialogForm.id = row.id |
| | | this.dialogForm.materialcode = row.partcode |
| | | this.dialogForm.materialname = row.partname |
| | |
| | | this.isFifo = false |
| | | this.isInCheck = false |
| | | this.isOutCheck = false |
| | | this.$refs.cascaderDialog.checkedValue = '' |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | | // 对话框取消 |