|
@@ -41,6 +41,7 @@
|
|
|
import Assembly from "@/components/Assembly/material.vue";
|
|
|
@Component
|
|
|
export default class AgencyGoods extends Vue {
|
|
|
+ parentId : any = 0
|
|
|
parentIds : any = ''
|
|
|
timeNum = 0;
|
|
|
timer : any = null
|
|
@@ -272,7 +273,8 @@
|
|
|
onChangeTree(e : any) {
|
|
|
let data : any = {};
|
|
|
e.isContain ? data.ids = e.id : data.parentId = e.id;
|
|
|
- this.parentIds = e.id;
|
|
|
+ this.parentIds = (this as any).$lodash.cloneDeep(e.id);
|
|
|
+ this.parentId = e.id[0];
|
|
|
data.pageSize = 20;
|
|
|
data.pageNo = 1;
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
@@ -295,6 +297,9 @@
|
|
|
let query = (this as any).$refs.addFormId.getValue();
|
|
|
query.status = this.radio;
|
|
|
if (this.popTitle === '新增') {
|
|
|
+ if(!query.parentId){
|
|
|
+ query.parentId=0
|
|
|
+ }
|
|
|
api.saveList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success(this.popTitle + '成功!');
|
|
@@ -361,15 +366,27 @@
|
|
|
// 打开新增
|
|
|
onAdd() {
|
|
|
this.popTitle = '新增'
|
|
|
- this.radio = 0
|
|
|
this.dialogFormVisible = true;
|
|
|
+ this.radio = 0
|
|
|
this.getTreeList();
|
|
|
setTimeout(() => {
|
|
|
- (this as any).$refs.addFormId.setValue();
|
|
|
- (this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
|
|
|
- this.$nextTick(()=>{
|
|
|
- (this as any).$refs.addFormId.clearValidate();
|
|
|
- })
|
|
|
+ if(this.parentId!=0){
|
|
|
+ var data = {
|
|
|
+ parentName: '',
|
|
|
+ parentId: 0
|
|
|
+ }
|
|
|
+ api.single({ id: this.parentId }, 'maindataMaterialOrganizationCategory').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ data.parentName = res.data.name;
|
|
|
+ data.parentId = res.data.id;
|
|
|
+ this.dialogFormVisible = true;
|
|
|
+ setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
|
|
|
+ }
|
|
|
+ }).catch(() => {});
|
|
|
+ }else{
|
|
|
+ (this as any).$refs.addFormId.setValue();
|
|
|
+ (this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
|
|
|
+ }
|
|
|
}, 0)
|
|
|
}
|
|
|
// 打开编辑
|