+
+ {changeFenlei(e)}" />
+ />
+
查询
@@ -52,7 +56,10 @@
// } from "@/api/system/baseForm.js"
import {
index
-} from '@/api/inventory.js'
+} from '@/api/inventory.js'
+ import {
+ index as getFenleilist
+ } from '@/api/fenlei.js'
export default {
data() {
return {
@@ -62,7 +69,9 @@ export default {
isShowWuzi: false,
wuziPageIndex: 1,
wuzibianmakeyword: '',
- wuzimingchengkeyword: '',
+ wuzimingchengkeyword: '',
+ wuzifenlei:'',
+ fenleiList:[],
wuziTotal: 0,
wzList: [],
selectItem: {},
@@ -127,7 +136,8 @@ export default {
},
watch: {
isShowWuzi(newVal) {
- if (newVal) {
+ if (newVal) {
+ this.getFenlei()
this.getWuzi()
}else{
this.wzList = []
@@ -136,7 +146,38 @@ export default {
}
}
},
- methods: {
+ methods: {
+ async getFenlei() {
+ const res = await getFenleilist({
+ tree: 1
+ })
+ this.fenleiList = this.removeEmptyChildren(res)
+ },
+ changeFenlei(e, row) {
+ console.log('e', e)
+ if (e) {
+ this.wuzifenlei = e[e.length - 1]
+ } else {
+ this.wuzifenlei = ''
+ }
+ },
+ // 移除children=[]
+ removeEmptyChildren(node) {
+ if (Array.isArray(node)) {
+ return node.map(child => {
+ if (child.children) {
+ // 递归处理子节点
+ child.children = this.removeEmptyChildren(child.children);
+ // 若处理后 children 为空,删除该属性
+ if (child.children.length === 0) {
+ delete child.children;
+ }
+ }
+ return child;
+ });
+ }
+ return [];
+ },
async getWuzi() {
this.showLoading = true
this.loadingtable = true
@@ -144,7 +185,8 @@ export default {
page_size: 40,
page: this.wuziPageIndex,
sort_type: 'DESC',
- sort_name: 'wuzibianma',
+ sort_name: 'wuzibianma',
+ fenlei:this.wuzifenlei,
// table_name: 'inventorys',
filter: [{
'key': 'zichanmingcheng',
diff --git a/src/views/inventorys/index.vue b/src/views/inventorys/index.vue
index 28cf28d..bf2b759 100644
--- a/src/views/inventorys/index.vue
+++ b/src/views/inventorys/index.vue
@@ -7,13 +7,18 @@
种类编码:
-
+
物资名称:
-
+
+
+
+ {changeFenlei(e)}" />
-
+
-
-
-
+ 查询
+ 打印
+ 导出
@@ -77,7 +82,10 @@
import {
index,
destroy
- } from '@/api/inventory.js'
+ } from '@/api/inventory.js'
+ import {
+ index as getFenleilist
+ } from '@/api/fenlei.js'
import {
getInfo
} from '@/api/user.js'
@@ -110,12 +118,14 @@
authName: '',
roleName: '',
isCkName: '',
- isPandian: '',
+ isPandian: '',
+ fenleiList:[],
select: {
pageSize: 40,
pageIndex: 1,
keyword: '',
- wzbm: '',
+ wzbm: '',
+ fenlei:'',
is_export: 0,
min: '',
max: '',
@@ -293,7 +303,8 @@
if (path[1]) {
this.isPandian = 'pandian'
}
- }
+ }
+ this.getFenlei()
this.getField()
this.getindex()
this.getUserName()
@@ -442,6 +453,37 @@
search() {
this.select.pageIndex = 1
this.getindex()
+ },
+ async getFenlei() {
+ const res = await getFenleilist({
+ tree: 1
+ })
+ this.fenleiList = this.removeEmptyChildren(res)
+ },
+ changeFenlei(e, row) {
+ console.log('e', e)
+ if (e) {
+ this.select.fenlei = e[e.length - 1]
+ } else {
+ this.select.fenlei = ''
+ }
+ },
+ // 移除children=[]
+ removeEmptyChildren(node) {
+ if (Array.isArray(node)) {
+ return node.map(child => {
+ if (child.children) {
+ // 递归处理子节点
+ child.children = this.removeEmptyChildren(child.children);
+ // 若处理后 children 为空,删除该属性
+ if (child.children.length === 0) {
+ delete child.children;
+ }
+ }
+ return child;
+ });
+ }
+ return [];
},
async getindex() {
this.loading = true
@@ -454,7 +496,8 @@
page: this.select.pageIndex,
table_name: 'inventorys',
sort_type: 'DESC',
- sort_name: 'wuzibianma',
+ sort_name: 'wuzibianma',
+ fenlei:this.select.fenlei,
// is_export:this.select.is_export,
filter: [{
'key': 'wuzibianma',
diff --git a/src/views/workOrder/index.vue b/src/views/workOrder/index.vue
index c344601..43b06f3 100644
--- a/src/views/workOrder/index.vue
+++ b/src/views/workOrder/index.vue
@@ -2,7 +2,7 @@