|
@@ -32,13 +32,13 @@
|
|
|
</p>
|
|
|
<template slot="footer">
|
|
|
<a-button :loading="confirmLoading" v-show="data.length===0" type="primary" @click="save()">确定</a-button>
|
|
|
- <a-button :loading="confirmLoading" type="primary" @click="handleCancel">关闭</a-button>
|
|
|
+ <a-button type="primary" @click="handleCancel">关闭</a-button>
|
|
|
</template>
|
|
|
</a-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { importCheckStandard, importCheckStandardOldVersion } from '@/api/check/checkstandard'
|
|
|
+import { importCheckStandard, importCheckStandardOldVersion, importCheckStandardByUpdate } from '@/api/check/checkstandard'
|
|
|
|
|
|
export default {
|
|
|
name: 'SbModelBomImportForm',
|
|
@@ -121,7 +121,7 @@ export default {
|
|
|
this.fileList.forEach(function (file) {
|
|
|
formData.append('files', file, file.name)
|
|
|
})
|
|
|
- if (this.type !== 1) {
|
|
|
+ if (this.type === 0) {
|
|
|
importCheckStandard(formData)
|
|
|
.then((res) => {
|
|
|
// 循环添加到formData中
|
|
@@ -144,7 +144,7 @@ export default {
|
|
|
}).catch(() => {
|
|
|
this.confirmLoading = false
|
|
|
})
|
|
|
- } else {
|
|
|
+ } else if (this.type === 1) {
|
|
|
importCheckStandardOldVersion(formData)
|
|
|
.then((res) => {
|
|
|
// 循环添加到formData中
|
|
@@ -167,6 +167,29 @@ export default {
|
|
|
}).catch(() => {
|
|
|
this.confirmLoading = false
|
|
|
})
|
|
|
+ } else {
|
|
|
+ importCheckStandardByUpdate(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
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|