add:新增配粉开单检测结果导入功能
This commit is contained in:
@@ -56,4 +56,11 @@ export function print(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
export default { audit, cancel, getform, submit, getView, pointCard, preview, print }
|
||||
export function excelImport(data) {
|
||||
return request({
|
||||
url: 'api/formula/importDetection',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export default { audit, cancel, getform, submit, getView, pointCard, preview, print, excelImport }
|
||||
|
||||
@@ -138,6 +138,31 @@
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="hcp标准值">
|
||||
<label slot="label">hcp标准值:</label>
|
||||
<el-input-number
|
||||
v-model="form.hcp_standard"
|
||||
:controls="false"
|
||||
:precision="2"
|
||||
:min="1"
|
||||
:max="9999"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="hcp检测值">
|
||||
<label slot="label">hcp检测值:</label>
|
||||
<el-input-number
|
||||
v-model="form.ball_time"
|
||||
:controls="false"
|
||||
:precision="2"
|
||||
:min="1"
|
||||
:max="9999"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="产品系列" prop="product_series_id">
|
||||
<el-select
|
||||
v-model="form.product_series_id"
|
||||
|
||||
@@ -153,6 +153,16 @@
|
||||
>
|
||||
查看记录卡
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
@click="saveDetection()"
|
||||
>
|
||||
导入检测结果
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
@@ -190,6 +200,9 @@
|
||||
<el-table-column prop="pcsn" min-width="130" label="批次" />
|
||||
<el-table-column prop="detail_count" min-width="100" label="明细数" />
|
||||
<el-table-column prop="masterbucket_qty" min-width="100" label="重量" :formatter="crud.formatNum3" />
|
||||
<el-table-column prop="ball_time" min-width="100" label="球磨时间" />
|
||||
<el-table-column prop="hcp_standard" min-width="100" label="hcp标准值" />
|
||||
<el-table-column prop="hcp_detection" min-width="100" label="hcp检测值" />
|
||||
<el-table-column prop="status" :formatter="stateFormat" min-width="80" label="状态" />
|
||||
<el-table-column prop="is_audit" :formatter="stateFormat2" min-width="80" label="是否审核" />
|
||||
<el-table-column prop="audit_time" min-width="140" label="审核时间" />
|
||||
@@ -242,6 +255,40 @@
|
||||
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="导入检测Excel文件"
|
||||
append-to-body
|
||||
:visible.sync="dialogUpload2"
|
||||
destroy-on-close
|
||||
width="400px"
|
||||
:show-close="true"
|
||||
@close="upclose"
|
||||
>
|
||||
<el-upload
|
||||
ref="upload"
|
||||
class="upload-demo"
|
||||
action=""
|
||||
drag
|
||||
:limit="1"
|
||||
:auto-upload="false"
|
||||
:multiple="false"
|
||||
:show-file-list="true"
|
||||
:on-change="uploadByJsqd"
|
||||
:file-list="fileList"
|
||||
accept=".xlsx,.xls"
|
||||
>
|
||||
<i class="el-icon-upload" />
|
||||
<div class="el-upload__text">
|
||||
将文件拖到此处,或
|
||||
<em>点击上传</em>
|
||||
</div>
|
||||
<div slot="tip" class="el-upload__tip">只能上传Excel文件,且不超过10MB</div>
|
||||
</el-upload>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogUpload2 = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<PicDialog ref="child" :dialog-show.sync="PicDialog" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -285,6 +332,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
dialogUpload: false,
|
||||
dialogUpload2: false,
|
||||
PicDialog: false,
|
||||
formula_id: null,
|
||||
headers: { 'Authorization': getToken() },
|
||||
@@ -303,7 +351,9 @@ export default {
|
||||
currentRow: null,
|
||||
query_flag: true,
|
||||
checkrows: [],
|
||||
XLList: []
|
||||
XLList: [],
|
||||
fileList: [],
|
||||
file1: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -368,6 +418,45 @@ export default {
|
||||
this.handleCurrentChange()
|
||||
}
|
||||
},
|
||||
// 文件发生改变就会触发的事件
|
||||
uploadByJsqd(file) {
|
||||
this.file1 = file
|
||||
},
|
||||
// 文件校验方法
|
||||
beforeAvatarUpload(file) {
|
||||
// 不能导入大小超过2Mb的文件
|
||||
if (file.size > 10 * 1024 * 1024) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
submit() {
|
||||
if (this.beforeAvatarUpload(this.file1)) {
|
||||
this.fileList.name = this.file1.name
|
||||
this.fileList.url = ''
|
||||
var formdata = new FormData()
|
||||
formdata.append('file', this.file1.raw)
|
||||
formula.excelImport(formdata).then((res) => {
|
||||
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.dialogUpload2 = false
|
||||
this.fileList = []
|
||||
this.file1 = ''
|
||||
this.crud.toQuery()
|
||||
}).catch(err => {
|
||||
this.dialogUpload2 = false
|
||||
this.fileList = []
|
||||
this.file1 = ''
|
||||
})
|
||||
this.dialogUpload2 = false
|
||||
this.fileList = []
|
||||
this.file1 = ''
|
||||
} else {
|
||||
this.crud.notify('文件过大,请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||
this.dialogUpload = false
|
||||
this.fileList = []
|
||||
this.file1 = ''
|
||||
}
|
||||
},
|
||||
stateFormat(row) {
|
||||
return this.dict.label.formula_status[row.status]
|
||||
},
|
||||
@@ -485,6 +574,14 @@ export default {
|
||||
this.formula_id = data.formula_id
|
||||
this.dialogUpload = true
|
||||
},
|
||||
saveDetection() {
|
||||
this.dialogUpload2 = true
|
||||
},
|
||||
upclose() {
|
||||
this.dialogUpload2 = false
|
||||
this.fileList = []
|
||||
this.file1 = ''
|
||||
},
|
||||
beforeUpload(file) {
|
||||
let isLt2M = true
|
||||
isLt2M = file.size / 1024 / 1024 < 50
|
||||
|
||||
Reference in New Issue
Block a user