|
@@ -37,7 +37,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { importCheckStandard } from '@/api/check/checkstandard'
|
|
|
+import { importCheckStandard, importCheckStandardOldVersion } from '@/api/check/checkstandard'
|
|
|
|
|
|
export default {
|
|
|
name: 'SbModelBomImportForm',
|
|
@@ -45,7 +45,6 @@ export default {
|
|
|
return {
|
|
|
confirmLoading: false,
|
|
|
modalTitle: null,
|
|
|
- sbId: null,
|
|
|
form: this.$form.createForm(this),
|
|
|
visible: false,
|
|
|
type: null,
|
|
@@ -74,11 +73,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- base (sbId) {
|
|
|
+ base (type) {
|
|
|
this.visible = true
|
|
|
- this.sbId = sbId
|
|
|
this.modalTitle = '保养标准导入'
|
|
|
- this.type = 1
|
|
|
+ this.type = type
|
|
|
},
|
|
|
handleRemove (file) {
|
|
|
const index = this.fileList.indexOf(file)
|
|
@@ -122,28 +120,53 @@ export default {
|
|
|
this.fileList.forEach(function (file) {
|
|
|
formData.append('files', file, file.name)
|
|
|
})
|
|
|
- importCheckStandard(formData)
|
|
|
- .then((res) => {
|
|
|
- // 循环添加到formData中
|
|
|
- const resultArr = res.data.split(';')
|
|
|
- const result = []
|
|
|
- for (let i = 0; i < resultArr.length; i++) {
|
|
|
- const r = resultArr[i]
|
|
|
- if (r.indexOf('成功') === 0) {
|
|
|
- result.push({ id: i, name: r, status: '成功' })
|
|
|
- } else if (r.indexOf('失败') === 0) {
|
|
|
- result.push({ id: i, name: r, status: '失败', reason: r.split(':')[2] })
|
|
|
+ if (this.type !== 1) {
|
|
|
+ importCheckStandard(formData)
|
|
|
+ .then((res) => {
|
|
|
+ // 循环添加到formData中
|
|
|
+ const resultArr = res.data.split(';')
|
|
|
+ const result = []
|
|
|
+ for (let i = 0; i < resultArr.length; i++) {
|
|
|
+ const r = resultArr[i]
|
|
|
+ if (r.indexOf('成功') === 0) {
|
|
|
+ result.push({ id: i, name: r, status: '成功' })
|
|
|
+ } else if (r.indexOf('失败') === 0) {
|
|
|
+ result.push({ id: i, name: r, status: '失败', reason: r.split(':')[2] })
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- this.$message.success('导入结束,请查看结果表格')
|
|
|
- this.data = result
|
|
|
- // this.handleCancel(values)
|
|
|
- this.BaseTool.ListForm.clearOneList(this)
|
|
|
- this.fileList = []
|
|
|
- this.BaseTool.ListForm.pushOneListAddMore(this, res.data)
|
|
|
- }).catch(() => {
|
|
|
- this.confirmLoading = false
|
|
|
- })
|
|
|
+ this.$message.success('导入结束,请查看结果表格')
|
|
|
+ this.data = result
|
|
|
+ // this.handleCancel(values)
|
|
|
+ this.BaseTool.ListForm.clearOneList(this)
|
|
|
+ this.fileList = []
|
|
|
+ this.BaseTool.ListForm.pushOneListAddMore(this, res.data)
|
|
|
+ }).catch(() => {
|
|
|
+ this.confirmLoading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ importCheckStandardOldVersion(formData)
|
|
|
+ .then((res) => {
|
|
|
+ // 循环添加到formData中
|
|
|
+ const resultArr = res.data.split(';')
|
|
|
+ const result = []
|
|
|
+ for (let i = 0; i < resultArr.length; i++) {
|
|
|
+ const r = resultArr[i]
|
|
|
+ if (r.indexOf('成功') === 0) {
|
|
|
+ result.push({ id: i, name: r, status: '成功' })
|
|
|
+ } else if (r.indexOf('失败') === 0) {
|
|
|
+ result.push({ id: i, name: r, status: '失败', reason: r.split(':')[2] })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$message.success('导入结束,请查看结果表格')
|
|
|
+ this.data = result
|
|
|
+ // this.handleCancel(values)
|
|
|
+ this.BaseTool.ListForm.clearOneList(this)
|
|
|
+ this.fileList = []
|
|
|
+ this.BaseTool.ListForm.pushOneListAddMore(this, res.data)
|
|
|
+ }).catch(() => {
|
|
|
+ this.confirmLoading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
handleCancel (values) {
|