Commit cc4c8296 authored by 高宇's avatar 高宇

1.优化代码

parent 24d86333
......@@ -4,7 +4,7 @@
<el-button type="primary" class="tarButon" @click="upload">上传</el-button>
</div>
<!-- 第一个模板 -->
<div v-if="showTable">
<div v-if="sheetForm">
<div class="tableArea" v-if="index === 0 || index=== 4">
<div class="measureTable">
<!-- 测量 -->
......@@ -434,7 +434,7 @@
:close-on-click-modal="false" append-to-body>
<el-form ref="sheetRef" :model="sheetForm" :rules="rules" label-width="80" label-position="right">
<el-form-item>
<el-select v-model="sheetForm.sheetIndex" placeholder="请选择sheet页">
<el-select v-model="sheetForm.sheetIndex" clearable placeholder="请选择sheet页">
<el-option
v-for="(item,index) in sheetList"
:key="index"
......@@ -461,7 +461,7 @@ export default {
props: {
defaultIndex: {
type: Number,
default: 0
default: null
},
defaultObject: {
type: Object,
......@@ -471,15 +471,9 @@ export default {
type: String,
required: true
},
defaultShow: {
type: String,
}
// 是否显示table 1:显示 0:不显示
},
computed: {
showTable() {
return this.defaultShow === '1'
}
},
data() {
return {
......@@ -494,7 +488,7 @@ export default {
},
// 选中的sheet下坐表
sheetForm: {
sheetIndex: 0,
sheetIndex: null,
},
rules: {},
// 选择sheet下拉框
......@@ -504,250 +498,265 @@ export default {
methods: {
// 提交按钮
submitForm() {
console.log('1111')
// 获取要预览的表格内容
sheetData(this.sheetForm.sheetIndex).then(res => {
let tempList = res.data
// 根据选择的sheet页不同 取值不同
// LD1 LDList
// LDA LDAList
// LDB LDBList
// WD1 WDAList
// WD2 WDBList
// projectAList LDA+LDB
// projectBList WD1+WD2
// projectCList (WD1+WD2)-(LDA+LDB)
// projectDList WD1-LDA
if (this.sheetForm.sheetIndex === 0) {
// 模板1 LD1 LDA LDB WD1 WD2 LDA+LDB WD1+WD2 (WD1+WD2)-(LDA+LDB)
let LDList = []
let LDAList = []
let LDBList = []
let WDAList = []
let WDBList = []
let projectAList = []
let projetcBList = []
let projectCList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// LDA
LDAList.push(tempList[i][1])
// LDB
LDBList.push(tempList[i][2])
// WD1
WDAList.push(tempList[i][3])
// WD2
WDBList.push(tempList[i][4])
}
for (let i = 19; i <= 21; i++) {
projectAList.push(tempList[i][0])
projetcBList.push(tempList[i][1])
projectCList.push(tempList[i][2])
}
this.form.LD = LDList
this.form.LDA = LDAList
this.form.LDB = LDBList
this.form.WDAList = WDAList
this.form.WDBList = WDBList
this.form.projectAList = projectAList
this.form.projetcBList = projetcBList
this.form.projectCList = projectCList
this.form.projectDList = []
this.index = this.sheetForm.sheetIndex
this.dialogController.open = false
// 提交给父组件
}
if (this.sheetForm.sheetIndex === 1) {
// 模板2 LD1 LDA WD1 WD1-LDA
let LDList = []
let LDAList = []
let WDAList = []
let projectDList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// LDA
LDAList.push(tempList[i][1])
// WD1
WDAList.push(tempList[i][2])
}
for (let i = 19; i <= 21; i++) {
projectDList.push(tempList[i][0])
}
this.form.LD = LDList
this.form.LDA = LDAList
this.form.WDAList = WDAList
this.form.projectDList = projectDList
this.index = this.sheetForm.sheetIndex
this.form.LDB = []
this.form.WDBList = []
this.form.projectAList = []
this.form.projectCList = []
this.form.projetcBList = []
this.dialogController.open = false
}
if (this.sheetForm.sheetIndex === 2) {
// 模板3 LD1 LDA WD1 WD1-LDA
let LDList = []
let LDAList = []
let WDAList = []
let projectDList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// LDA
LDAList.push(tempList[i][1])
// WD1
WDAList.push(tempList[i][2])
}
for (let i = 19; i <= 21; i++) {
projectDList.push(tempList[i][0])
console.log('sheetIndex',this.sheetForm.sheetIndex)
if (this.sheetForm.sheetIndex !== null && this.sheetForm.sheetIndex !== '') {
console.log('111')
// 获取要预览的表格内容
sheetData(this.sheetForm.sheetIndex).then(res => {
let tempList = res.data
// 根据选择的sheet页不同 取值不同
// LD1 LDList
// LDA LDAList
// LDB LDBList
// WD1 WDAList
// WD2 WDBList
// projectAList LDA+LDB
// projectBList WD1+WD2
// projectCList (WD1+WD2)-(LDA+LDB)
// projectDList WD1-LDA
if (this.sheetForm.sheetIndex === 0) {
// 模板1 LD1 LDA LDB WD1 WD2 LDA+LDB WD1+WD2 (WD1+WD2)-(LDA+LDB)
let LDList = []
let LDAList = []
let LDBList = []
let WDAList = []
let WDBList = []
let projectAList = []
let projetcBList = []
let projectCList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// LDA
LDAList.push(tempList[i][1])
// LDB
LDBList.push(tempList[i][2])
// WD1
WDAList.push(tempList[i][3])
// WD2
WDBList.push(tempList[i][4])
}
for (let i = 19; i <= 21; i++) {
projectAList.push(tempList[i][0])
projetcBList.push(tempList[i][1])
projectCList.push(tempList[i][2])
}
this.form.LD = LDList
this.form.LDA = LDAList
this.form.LDB = LDBList
this.form.WDAList = WDAList
this.form.WDBList = WDBList
this.form.projectAList = projectAList
this.form.projetcBList = projetcBList
this.form.projectCList = projectCList
this.form.projectDList = []
this.index = this.sheetForm.sheetIndex
this.dialogController.open = false
// 提交给父组件
}
this.form.LD = LDList
this.form.LDA = LDAList
this.form.WDAList = WDAList
this.form.projectDList = projectDList
this.form.LDB = []
this.form.WDBList = []
this.form.projectAList = []
this.form.projectCList = []
this.form.projetcBList = []
this.index = this.sheetForm.sheetIndex
this.dialogController.open = false
}
if (this.sheetForm.sheetIndex === 3) {
// 模板4 LD1 WD1 WD1-LDA
let LDList = []
let WDAList = []
let projectDList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// WD1
WDAList.push(tempList[i][1])
}
for (let i = 19; i <= 21; i++) {
projectDList.push(tempList[i][0])
if (this.sheetForm.sheetIndex === 1) {
// 模板2 LD1 LDA WD1 WD1-LDA
let LDList = []
let LDAList = []
let WDAList = []
let projectDList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// LDA
LDAList.push(tempList[i][1])
// WD1
WDAList.push(tempList[i][2])
}
for (let i = 19; i <= 21; i++) {
projectDList.push(tempList[i][0])
}
this.form.LD = LDList
this.form.LDA = LDAList
this.form.WDAList = WDAList
this.form.projectDList = projectDList
this.index = this.sheetForm.sheetIndex
this.form.LDB = []
this.form.WDBList = []
this.form.projectAList = []
this.form.projectCList = []
this.form.projetcBList = []
this.dialogController.open = false
}
console.log('LDList', LDList)
console.log('WDAList', WDAList)
console.log('projectDList', projectDList)
this.form.LDA = LDList
this.form.WDAList = WDAList
this.form.projectDList = projectDList
this.form.LD = []
this.form.LDB = []
this.form.WDBList = []
this.form.projectAList = []
this.form.projectCList = []
this.form.projetcBList = []
this.index = this.sheetForm.sheetIndex
this.dialogController.open = false
}
if (this.sheetForm.sheetIndex === 4) {
// 模板1 LD1 LDA LDB WD1 WD2 LDA+LDB WD1+WD2 (WD1+WD2)-(LDA+LDB)
let LDList = []
let LDAList = []
let LDBList = []
let WDAList = []
let WDBList = []
let projectAList = []
let projetcBList = []
let projectCList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// LDA
LDAList.push(tempList[i][1])
// LDB
LDBList.push(tempList[i][2])
// WD1
WDAList.push(tempList[i][3])
// WD2
WDBList.push(tempList[i][4])
if (this.sheetForm.sheetIndex === 2) {
// 模板3 LD1 LDA WD1 WD1-LDA
let LDList = []
let LDAList = []
let WDAList = []
let projectDList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// LDA
LDAList.push(tempList[i][1])
// WD1
WDAList.push(tempList[i][2])
}
for (let i = 19; i <= 21; i++) {
projectDList.push(tempList[i][0])
}
this.form.LD = LDList
this.form.LDA = LDAList
this.form.WDAList = WDAList
this.form.projectDList = projectDList
this.form.LDB = []
this.form.WDBList = []
this.form.projectAList = []
this.form.projectCList = []
this.form.projetcBList = []
this.index = this.sheetForm.sheetIndex
this.dialogController.open = false
}
for (let i = 19; i <= 21; i++) {
projectAList.push(tempList[i][0])
projetcBList.push(tempList[i][1])
projectCList.push(tempList[i][2])
}
this.form.LD = LDList
this.form.LDA = LDAList
this.form.LDB = LDBList
this.form.WDAList = WDAList
this.form.WDBList = WDBList
this.form.projectAList = projectAList
this.form.projetcBList = projetcBList
this.form.projectCList = projectCList
this.form.projectDList = []
this.index = this.sheetForm.sheetIndex
this.dialogController.open = false
}
if (this.sheetForm.sheetIndex === 5) {
// 模板3 LD1 LDA WD1 WD1-LDA
let LDList = []
let LDAList = []
let WDAList = []
let projectDList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// LDA
LDAList.push(tempList[i][1])
// WD1
WDAList.push(tempList[i][2])
if (this.sheetForm.sheetIndex === 3) {
// 模板4 LD1 WD1 WD1-LDA
let LDList = []
let WDAList = []
let projectDList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// WD1
WDAList.push(tempList[i][1])
}
for (let i = 19; i <= 21; i++) {
projectDList.push(tempList[i][0])
}
console.log('LDList', LDList)
console.log('WDAList', WDAList)
console.log('projectDList', projectDList)
this.form.LDA = LDList
this.form.WDAList = WDAList
this.form.projectDList = projectDList
this.form.LD = []
this.form.LDB = []
this.form.WDBList = []
this.form.projectAList = []
this.form.projectCList = []
this.form.projetcBList = []
this.index = this.sheetForm.sheetIndex
this.dialogController.open = false
}
for (let i = 19; i <= 21; i++) {
projectDList.push(tempList[i][0])
if (this.sheetForm.sheetIndex === 4) {
// 模板1 LD1 LDA LDB WD1 WD2 LDA+LDB WD1+WD2 (WD1+WD2)-(LDA+LDB)
let LDList = []
let LDAList = []
let LDBList = []
let WDAList = []
let WDBList = []
let projectAList = []
let projetcBList = []
let projectCList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// LDA
LDAList.push(tempList[i][1])
// LDB
LDBList.push(tempList[i][2])
// WD1
WDAList.push(tempList[i][3])
// WD2
WDBList.push(tempList[i][4])
}
for (let i = 19; i <= 21; i++) {
projectAList.push(tempList[i][0])
projetcBList.push(tempList[i][1])
projectCList.push(tempList[i][2])
}
this.form.LD = LDList
this.form.LDA = LDAList
this.form.LDB = LDBList
this.form.WDAList = WDAList
this.form.WDBList = WDBList
this.form.projectAList = projectAList
this.form.projetcBList = projetcBList
this.form.projectCList = projectCList
this.form.projectDList = []
this.index = this.sheetForm.sheetIndex
this.dialogController.open = false
}
this.form.LD = LDList
this.form.LDA = LDAList
this.form.WDAList = WDAList
this.form.projectDList = projectDList
this.index = this.sheetForm.sheetIndex
this.form.LDB = []
this.form.WDBList = []
this.form.projectAList = []
this.form.projectCList = []
this.form.projetcBList = []
this.dialogController.open = false
}
if (this.sheetForm.sheetIndex === 6) {
// 模板3 LD1 LDA WD1 WD1-LDA
let LDList = []
let LDAList = []
let WDAList = []
let projectDList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// LDA
LDAList.push(tempList[i][1])
// WD1
WDAList.push(tempList[i][2])
if (this.sheetForm.sheetIndex === 5) {
// 模板3 LD1 LDA WD1 WD1-LDA
let LDList = []
let LDAList = []
let WDAList = []
let projectDList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// LDA
LDAList.push(tempList[i][1])
// WD1
WDAList.push(tempList[i][2])
}
for (let i = 19; i <= 21; i++) {
projectDList.push(tempList[i][0])
}
this.form.LD = LDList
this.form.LDA = LDAList
this.form.WDAList = WDAList
this.form.projectDList = projectDList
this.index = this.sheetForm.sheetIndex
this.form.LDB = []
this.form.WDBList = []
this.form.projectAList = []
this.form.projectCList = []
this.form.projetcBList = []
this.dialogController.open = false
}
for (let i = 19; i <= 21; i++) {
projectDList.push(tempList[i][0])
if (this.sheetForm.sheetIndex === 6) {
// 模板3 LD1 LDA WD1 WD1-LDA
let LDList = []
let LDAList = []
let WDAList = []
let projectDList = []
for (let i = 1; i <= 17; i++) {
// LD1
LDList.push(tempList[i][0])
// LDA
LDAList.push(tempList[i][1])
// WD1
WDAList.push(tempList[i][2])
}
for (let i = 19; i <= 21; i++) {
projectDList.push(tempList[i][0])
}
this.form.LD = LDList
this.form.LDA = LDAList
this.form.WDAList = WDAList
this.form.projectDList = projectDList
this.form.LDB = []
this.form.WDBList = []
this.form.projectAList = []
this.form.projectCList = []
this.form.projetcBList = []
this.index = this.sheetForm.sheetIndex
this.dialogController.open = false
}
this.form.LD = LDList
this.form.LDA = LDAList
this.form.WDAList = WDAList
this.form.projectDList = projectDList
this.form.LDB = []
this.form.WDBList = []
this.form.projectAList = []
this.form.projectCList = []
this.form.projetcBList = []
this.index = this.sheetForm.sheetIndex
this.dialogController.open = false
}
console.log('form',this.form)
this.showTable = true
this.$emit('sheetIndex',this.index)
this.$emit('sheetIndex',this.index)
this.$emit('tarFrom',this.form)
})
} else {
this.form.LD = []
this.form.LDA = []
this.form.WDAList = []
this.form.projectDList = []
this.form.LDB = []
this.form.WDBList = []
this.form.projectAList = []
this.form.projectCList = []
this.form.projetcBList = []
this.index = this.sheetForm.sheetIndex
this.dialogController.open = false
this.$emit('sheetIndex',null)
this.$emit('tarFrom',this.form)
this.$emit('ShowTabel','1');
})
}
},
// 取消按钮
cancel() {
......
......@@ -2321,7 +2321,7 @@
</el-tab-pane>
<el-tab-pane label="标签四" name="fourthly">
<div class="fourTarContainer" style="height: 1100px">
<tagfour @ShowTabel="getIsShowTabel" :default-show="inspectJbAl2o3List.isShowTabel" :default-index="inspectJbAl2o3List.sheetIndex" :default-controls="controlsForm.approveStatus" :default-object="tabfourForm" @sheetIndex="handleSheetIndex" @tarFrom="handleTarForm"></tagfour>
<tagfour @ShowTabel="getIsShowTabel" :default-index="inspectJbAl2o3List.sheetIndex" :default-controls="controlsForm.approveStatus" :default-object="tabfourForm" @sheetIndex="handleSheetIndex" @tarFrom="handleTarForm"></tagfour>
</div>
</el-tab-pane>
</el-tabs>
......@@ -2946,7 +2946,7 @@ export default {
recode1: [],
recode2: [],
recode3: [],
sheetIndex: 0,
sheetIndex: null,
ld: null,
lda: null,
ldb: null,
......@@ -4189,8 +4189,6 @@ export default {
this.inspectJbAl2o3List.oneJcDate = response.data.oneJcDate
this.inspectJbAl2o3List.twoJcUser = response.data.twoJcUser
this.inspectJbAl2o3List.twoJcDate = response.data.twoJcDate
this.inspectJbAl2o3List.isShowTabel = response.data.isShowTabel
console.log('isShowTabel',response.data.isShowTabel)
this.inspectJbAl2o3List.limitOne = response.data.limitOne
this.inspectJbAl2o3List.limitTwo = response.data.limitTwo
if (response.data.sheetIndex) {
......@@ -4832,8 +4830,7 @@ export default {
projecta: null,
projectb: null,
projectc: null,
projectd: null,
isShowTabel: '0',
projectd: null
}
},
/**
......@@ -4919,6 +4916,7 @@ export default {
this.getRecordInfo(response.data.incomeInspectInfo.businessId)
this.controlsForm.approveStatus = '0'
this.controlsForm.controls = '2'
this.inspectJbAl2o3List.sheetIndex = null
this.submitLoadIng = false
} else {
this.submitLoadIng = false
......@@ -4999,6 +4997,7 @@ export default {
this.presentLoading = false
this.controlsForm.approveStatus = '0'
this.controlsForm.controls = '2'
this.inspectJbAl2o3List.sheetIndex = null
this.msgSuccess('提交成功')
this.resetInspectInfo()
this.resetinspectJbAl2o3List()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment