import_cma 优化
This commit is contained in:
parent
430a41a7e0
commit
b3232df682
|
@ -435,6 +435,7 @@ export default {
|
|||
this.getList();
|
||||
this.getList2();
|
||||
this.getGroup();
|
||||
this.getGroup2();
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1;
|
||||
|
@ -443,6 +444,7 @@ export default {
|
|||
this.listQuery2.search = this.listQuery.search;
|
||||
this.getList2();
|
||||
this.getGroup();
|
||||
this.getGroup2();
|
||||
},
|
||||
handleAdd() {
|
||||
this.cma = Object.assign({}, defaultCMA);
|
||||
|
@ -485,6 +487,13 @@ export default {
|
|||
this.listQuery.page = 1;
|
||||
this.getList();
|
||||
},
|
||||
filterChange2(obj) {
|
||||
for (let key in obj) {
|
||||
this.listQuery2[key] = obj[key][0];
|
||||
}
|
||||
this.listQuery2.page = 1;
|
||||
this.getList2();
|
||||
},
|
||||
async confirm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
highlight-current-row
|
||||
max-height="700"
|
||||
ref="filterTable"
|
||||
@selection-change="handleSelectionChange">
|
||||
@selection-change="handleSelectionChange"
|
||||
@filter-change="filterChange"
|
||||
>
|
||||
<el-table-column
|
||||
|
@ -324,7 +324,6 @@ export default {
|
|||
data.group_by = key;
|
||||
getCMAGroup(data).then((response) => {
|
||||
this.groupBy[key] = response.data;
|
||||
console.log(this.groupBy);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -372,7 +371,6 @@ export default {
|
|||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -399,7 +397,6 @@ export default {
|
|||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -407,6 +404,7 @@ export default {
|
|||
this.multipleSelection = val;
|
||||
},
|
||||
filterChange(obj) {
|
||||
console.log(obj)
|
||||
for (let key in obj) {
|
||||
this.listQuery[key] = obj[key][0];
|
||||
}
|
||||
|
|
|
@ -432,84 +432,49 @@ def import_cma2(filename, path):
|
|||
CMA.objects.filter(sszx=sszx, type='sub').delete()
|
||||
i = 3
|
||||
max_row = sheet.max_row
|
||||
defaultv = {}
|
||||
while i<max_row+1:
|
||||
data = {}
|
||||
if sheet['a'+str(i)].value:
|
||||
data['dlxh'] = sheet['a'+str(i)].value
|
||||
elif sheet['a3'].value:
|
||||
m = i - 1
|
||||
while True:
|
||||
if sheet['a'+str(m)].value:
|
||||
data['dlxh'] = sheet['a'+str(m)].value
|
||||
break
|
||||
m = m - 1
|
||||
defaultv['dlxh'] = data['dlxh']
|
||||
else:
|
||||
data['dlxh'] = defaultv['dlxh']
|
||||
if sheet['b'+str(i)].value:
|
||||
data['dlmc'] = sheet['b'+str(i)].value
|
||||
elif sheet['b3'].value:
|
||||
m = i - 1
|
||||
while True:
|
||||
if sheet['b'+str(m)].value:
|
||||
data['dlmc'] = sheet['b'+str(m)].value
|
||||
break
|
||||
m = m - 1
|
||||
defaultv['dlmc'] = data['dlmc']
|
||||
else:
|
||||
data['dlmc'] = defaultv['dlmc']
|
||||
if sheet['c'+str(i)].value:
|
||||
data['lbxh'] = sheet['c'+str(i)].value
|
||||
defaultv['lbxh'] = data['lbxh']
|
||||
else:
|
||||
m = i - 1
|
||||
while True:
|
||||
if sheet['c'+str(m)].value:
|
||||
data['lbxh'] = sheet['c'+str(m)].value
|
||||
break
|
||||
m = m - 1
|
||||
data['lbxh'] = defaultv['lbxh']
|
||||
if sheet['d'+str(i)].value:
|
||||
data['lbmc'] = sheet['d'+str(i)].value
|
||||
defaultv['lbmc'] = data['lbmc']
|
||||
else:
|
||||
m = i - 1
|
||||
while True:
|
||||
if sheet['d'+str(m)].value:
|
||||
data['lbmc'] = sheet['d'+str(m)].value
|
||||
break
|
||||
m = m - 1
|
||||
data['lbmc'] = defaultv['lbmc']
|
||||
if sheet['e'+str(i)].value:
|
||||
data['xmxh'] = sheet['e'+str(i)].value
|
||||
elif sheet['e3'].value: # 该表存在项目序号
|
||||
m = i - 1
|
||||
while True:
|
||||
if sheet['e'+str(m)].value:
|
||||
data['xmxh'] = sheet['e'+str(m)].value
|
||||
break
|
||||
m = m - 1
|
||||
else: #该表没有项目序号,自己定
|
||||
pass
|
||||
defaultv['xmxh'] = data['xmxh']
|
||||
else:
|
||||
data['xmxh'] = defaultv['xmxh']
|
||||
if sheet['f'+str(i)].value:
|
||||
data['xmmc'] = sheet['f'+str(i)].value
|
||||
elif sszx=='枣庄公司':
|
||||
pass
|
||||
defaultv['xmmc'] = data['xmmc']
|
||||
else:
|
||||
m = i - 1
|
||||
while True:
|
||||
if sheet['f'+str(m)].value:
|
||||
data['xmmc'] = sheet['f'+str(m)].value
|
||||
break
|
||||
m = m - 1
|
||||
data['xmmc'] = defaultv['xmmc']
|
||||
if sheet['g'+str(i)].value:
|
||||
data['bzmc'] = sheet['g'+str(i)].value
|
||||
defaultv['bzmc'] = data['bzmc']
|
||||
else:
|
||||
m = i - 1
|
||||
while True:
|
||||
if sheet['g'+str(m)].value:
|
||||
data['bzmc'] = sheet['g'+str(m)].value
|
||||
break
|
||||
m = m - 1
|
||||
data['bzmc'] = defaultv['bzmc']
|
||||
if sheet['h'+str(i)].value:
|
||||
data['bzbh'] = sheet['h'+str(i)].value
|
||||
elif sheet['h3'].value:
|
||||
m = i - 1
|
||||
while True:
|
||||
if sheet['h'+str(m)].value:
|
||||
data['bzbh'] = sheet['h'+str(m)].value
|
||||
break
|
||||
m = m - 1
|
||||
defaultv['bzbh'] = data['bzbh']
|
||||
else:
|
||||
data['bzbh'] = defaultv['bzbh']
|
||||
data['xzfw'] = sheet['i'+str(i)].value if (sheet['i'+str(i)].value and sheet['i'+str(i)].value !='无') else None
|
||||
data['bz'] = sheet['j'+str(i)].value if (sheet['j'+str(i)].value and sheet['j'+str(i)].value !='无') else None
|
||||
data['glzz'] = sheet['k'+str(i)].value if (sheet['k'+str(i)].value and sheet['k'+str(i)].value !='无') else None
|
||||
|
@ -527,6 +492,7 @@ def import_inspection(filename, path):
|
|||
Inspection.objects.filter(sszx=sszx).delete()
|
||||
i = 3
|
||||
max_row = sheet.max_row
|
||||
defaultv = {}
|
||||
while i<max_row+1:
|
||||
data = {}
|
||||
if sheet['a'+str(i)].value:
|
||||
|
|
Loading…
Reference in New Issue