|
@@ -24,6 +24,7 @@
|
|
|
@append="append"
|
|
|
@remove="remove"
|
|
|
:searchHeight="searchHeight"
|
|
|
+ @handleAddBM="handleAddBM(false)"
|
|
|
>
|
|
|
<template #crt_time="{ row }">
|
|
|
<span>{{ func.replaceDateNoHMS(row.crt_time) }}</span>
|
|
@@ -38,41 +39,29 @@
|
|
|
</template>
|
|
|
<template #form>
|
|
|
<Form :label-width="80" style="display: flex; flex-wrap: wrap">
|
|
|
- <FormItem label="物料">
|
|
|
- <Input size="small" class="form_item" />
|
|
|
+ <FormItem label="物料名称">
|
|
|
+ <Input
|
|
|
+ size="small"
|
|
|
+ class="form_item"
|
|
|
+ v-model="searchData.title"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
</FormItem>
|
|
|
- <FormItem label="物料">
|
|
|
- <Input size="small" class="form_item" />
|
|
|
+ <FormItem label="创建日期">
|
|
|
+ <DatePicker
|
|
|
+ type="daterange"
|
|
|
+ size="small"
|
|
|
+ transfer
|
|
|
+ class="date_item"
|
|
|
+ placeholder="年/月/日"
|
|
|
+ v-model="searchData.crt_time"
|
|
|
+ @on-change="handleSelectTime"
|
|
|
+ />
|
|
|
</FormItem>
|
|
|
- <FormItem label="物料">
|
|
|
- <Input size="small" class="form_item" />
|
|
|
- </FormItem>
|
|
|
- <FormItem label="班组">
|
|
|
- <Select size="small" transfer class="form_item">
|
|
|
- <Option :label="1" :value="1" />
|
|
|
- </Select>
|
|
|
- </FormItem>
|
|
|
- <FormItem label="班组">
|
|
|
- <Select size="small" transfer class="form_item">
|
|
|
- <Option :label="1" :value="1" />
|
|
|
- </Select>
|
|
|
- </FormItem>
|
|
|
- <FormItem label="班组">
|
|
|
- <Select size="small" transfer class="form_item">
|
|
|
- <Option :label="1" :value="1" />
|
|
|
- </Select>
|
|
|
- </FormItem>
|
|
|
- <FormItem label="日期">
|
|
|
- <DatePicker type="date" size="small" transfer class="date_item" />
|
|
|
- <DatePicker type="date" size="small" transfer class="date_item" />
|
|
|
- </FormItem>
|
|
|
- <FormItem label="日期">
|
|
|
- <DatePicker type="date" size="small" transfer class="date_item" />
|
|
|
- <DatePicker type="date" size="small" transfer class="date_item" />
|
|
|
- </FormItem>
|
|
|
- <FormItem label="日期">
|
|
|
- <DatePicker type="date" size="small" transfer class="date_item" />
|
|
|
- <DatePicker type="date" size="small" transfer class="date_item" />
|
|
|
+ <FormItem :label-width="20">
|
|
|
+ <Button type="primary" ghost @click="handleSearch" size="small"
|
|
|
+ >查询</Button
|
|
|
+ >
|
|
|
</FormItem>
|
|
|
</Form>
|
|
|
</template>
|
|
@@ -90,14 +79,64 @@
|
|
|
<Button @click="handleSureBasic" type="primary">确认</Button>
|
|
|
</div>
|
|
|
</Modal>
|
|
|
+ <Modal
|
|
|
+ title="新增物料分类"
|
|
|
+ :closable="false"
|
|
|
+ :mask-closable="false"
|
|
|
+ v-model="is_addBM"
|
|
|
+ width="30"
|
|
|
+ >
|
|
|
+ <div style="max-height: 400px; overflow: auto">
|
|
|
+ <Form
|
|
|
+ :label-width="100"
|
|
|
+ v-for="(item, index) in modalData"
|
|
|
+ :key="index"
|
|
|
+ style="display: flex"
|
|
|
+ >
|
|
|
+ <FormItem label="物料分类名称" style="width: 70%">
|
|
|
+ <Input
|
|
|
+ clearable
|
|
|
+ placeholder="请输入"
|
|
|
+ v-model="item.title"
|
|
|
+ style="width: 100%"
|
|
|
+ />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem :label-width="10" style="width: 20%">
|
|
|
+ <div class="icon">
|
|
|
+ <Icon
|
|
|
+ :size="20"
|
|
|
+ type="ios-add-circle-outline"
|
|
|
+ style="padding-right: 10px; cursor: pointer"
|
|
|
+ @click="handleModalAdd(index)"
|
|
|
+ />
|
|
|
+ <Icon
|
|
|
+ :size="20"
|
|
|
+ type="ios-remove-circle-outline"
|
|
|
+ style="cursor: pointer"
|
|
|
+ @click="handleModalRemove(index)"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
+ <div slot="footer">
|
|
|
+ <Button style="margin-right: 10px" @click="is_addBM = false"
|
|
|
+ >取消</Button
|
|
|
+ >
|
|
|
+ <Button type="primary" @click="handleSureBM">确认</Button>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ is_addBM: false,
|
|
|
show_basic: false,
|
|
|
materialList: [],
|
|
|
+ proxyData: {},
|
|
|
+ searchData: {},
|
|
|
// menuList: [{ name: 'hw', state: false, sideState: false, detailState: false, children: [{ name: 'a', state: false, sideState: false, detailState: false }, { name: 'b', state: false, detailState: false, sideState: false }, { name: 'b', state: false, detailState: false, sideState: false }, { name: 'b', state: false, detailState: false, sideState: false }] },
|
|
|
// { name: '啊比', state: false, detailState: false, sideState: false, children: [{ name: 'a', state: false, detailState: false, sideState: false }, { name: 'b', state: false, detailState: false, sideState: false }, { name: 'c', state: false, detailState: false, sideState: false }, { name: 'd', state: false, detailState: false, sideState: false, children: [{ name: 'zuilicneg', state: false, detailState: false, sideState: false, children: [{ name: '99999999', state: false, detailState: false, sideState: false, children: [{ name: '88888', state: false, sideState: false, detailState: false }] }] }] }] },
|
|
|
// {
|
|
@@ -117,6 +156,8 @@ export default {
|
|
|
pageSize: 10,
|
|
|
searchHeight: '0px',
|
|
|
showText: false,
|
|
|
+ modalData: [],
|
|
|
+ selectID: ''
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -129,6 +170,49 @@ export default {
|
|
|
this.initData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleSelectTime() {
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ handleSearch() {
|
|
|
+ this.proxyData = JSON.parse(JSON.stringify(this.searchData));
|
|
|
+ this.pageIndex = 1;
|
|
|
+ this.proxyData.crt_time = [this.proxyData.crt_time[0] ? Date.parse(this.proxyData.crt_time[0]).toString().slice(0, 10) : '', this.proxyData.crt_time[1] ? Date.parse(this.proxyData.crt_time[1]).toString().slice(0, 10) : '']
|
|
|
+
|
|
|
+ this.initData(this.proxyData);
|
|
|
+ },
|
|
|
+ handleModalAdd(index) {
|
|
|
+ this.modalData.splice(index + 1, 0, { title: "" })
|
|
|
+ },
|
|
|
+ handleModalRemove(index) {
|
|
|
+ if (this.modalData.length == 1) {
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ this.modalData.splice(index, 1)
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ handleSureBM() {
|
|
|
+ let data = JSON.parse(JSON.stringify(this.modalData));
|
|
|
+ data.forEach(v => {
|
|
|
+ v.parent_id = this.selectID;
|
|
|
+ })
|
|
|
+ this.axios.post('/api/basicMaterialAdd', { data }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$Message.success(res.msg);
|
|
|
+ this.getMaterial();
|
|
|
+ this.is_addBM = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleAddBM(e) {
|
|
|
+ if (e) {
|
|
|
+ this.selectID = e;
|
|
|
+ } else {
|
|
|
+ this.selectID = 0;
|
|
|
+ }
|
|
|
+ this.is_addBM = true;
|
|
|
+ this.modalData = [{ title: '' }];
|
|
|
+ },
|
|
|
handleShow() {
|
|
|
if (this.searchHeight === 'auto') {
|
|
|
this.searchHeight = '0px';
|
|
@@ -140,23 +224,23 @@ export default {
|
|
|
},
|
|
|
getMaterial() {
|
|
|
this.axios.post('/api/basicMaterialList').then(res => {
|
|
|
- this.materialList = this.handleSetState(res.data.data);
|
|
|
- this.tapList = this.handleGetChildren(this.materialList);
|
|
|
+ this.materialList = this.handleSetState(res.data);
|
|
|
+ this.tapList = this.getArr(this.materialList);
|
|
|
})
|
|
|
},
|
|
|
- handleGetChildren(arr) {
|
|
|
+ getArr(arr) {
|
|
|
let data = [];
|
|
|
arr.forEach(v => {
|
|
|
- if (!v.children || v.children.length == 0) {
|
|
|
+ if (v.children.length == 0) {
|
|
|
data.push(v);
|
|
|
} else {
|
|
|
- data = [...this.handleGetChildren(v.children)];
|
|
|
+ data = [...data, ...this.getArr(v.children)];
|
|
|
}
|
|
|
})
|
|
|
- return data;
|
|
|
+ return data
|
|
|
},
|
|
|
append(data) {
|
|
|
-
|
|
|
+ this.handleAddBM(data.id);
|
|
|
},
|
|
|
remove(data) {
|
|
|
this.axios.post('/api/basicMaterialDel', { id: data.data.id }).then(res => {
|
|
@@ -170,14 +254,14 @@ export default {
|
|
|
// if (!this.clickID) {
|
|
|
// return this.$Message.warning('请先选择要新增的物料分类!');
|
|
|
// }
|
|
|
- this.$router.push({ path: '/cms/BasicSettings/MaterialManage/edit', query: { type: 2, title: '编辑物料', id: row.id } })
|
|
|
+ this.$router.push({ path: '/cms/BasicSettings/MaterialManage/detail', query: { type: 2, title: '编辑物料', id: row.id } })
|
|
|
},
|
|
|
handleSureBasic() {
|
|
|
if (!this.tapList.find(v => (v.is_choose))) {
|
|
|
return this.$Message.warning('请选择一个物料分类!')
|
|
|
}
|
|
|
this.show_basic = false;
|
|
|
- this.$router.push({ path: '/cms/BasicSettings/MaterialManage/add', query: { type: 1, basicMaterial_id: this.tapList.find(v => (v.is_choose)).id, title: '新增物料' } })
|
|
|
+ this.$router.push({ path: '/cms/BasicSettings/MaterialManage/detail', query: { type: 1, basicMaterial_id: this.tapList.find(v => (v.is_choose)).id, title: '新增物料' } })
|
|
|
|
|
|
},
|
|
|
handleAdd() {
|
|
@@ -197,7 +281,9 @@ export default {
|
|
|
if (this.pageIndex != 1 && this.tableData.length == 1) {
|
|
|
this.pageIndex--;
|
|
|
}
|
|
|
- this.clickID ? this.initData({ id: this.clickID }) : this.initData();
|
|
|
+ this.proxyData.b_m_id = this.clickID ? this.clickID : '';
|
|
|
+
|
|
|
+ this.initData(this.proxyData);
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -209,13 +295,14 @@ export default {
|
|
|
},
|
|
|
handleMenuClick(e) {
|
|
|
this.clickID = e.data.id;
|
|
|
- this.initData({ id: e.id })
|
|
|
+ this.proxyData.b_m_id = e.data.id;
|
|
|
+ this.initData(this.proxyData);
|
|
|
},
|
|
|
handleSetState(arr) {
|
|
|
arr.forEach(ele => {
|
|
|
ele.label = ele.title;
|
|
|
- if (ele.children && ele.children.length != 0) {
|
|
|
- this.handleSetState(ele.children)
|
|
|
+ if (ele.children.length !== 0) {
|
|
|
+ this.handleSetState(ele.children);
|
|
|
}
|
|
|
});
|
|
|
return arr;
|
|
@@ -270,9 +357,16 @@ export default {
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.form_item {
|
|
|
- width: 100px;
|
|
|
+ width: 150px;
|
|
|
}
|
|
|
.date_item {
|
|
|
- width: 140px;
|
|
|
+ width: 200px;
|
|
|
+}
|
|
|
+.icon {
|
|
|
+ display: flex;
|
|
|
+ width: 100%;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ height: 44px;
|
|
|
}
|
|
|
</style>
|