代码更新
This commit is contained in:
@@ -157,12 +157,19 @@
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="priority" label="优先级" align="center">-->
|
||||
<!-- <template scope="scope">-->
|
||||
<!-- <el-input v-show="!scope.row.edit" v-model="scope.row.priority" size="mini" />-->
|
||||
<!-- <span v-show="scope.row.edit">{{ scope.row.priority }}</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column prop="priority" label="优先级" align="center">-->
|
||||
<!-- <template scope="scope">-->
|
||||
<!-- <el-input v-show="!scope.row.edit" v-model="scope.row.priority" size="mini" />-->
|
||||
<!-- <span v-show="scope.row.edit">{{ scope.row.priority }}</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column prop="template_id" label="上传模板" align="center" width="200px">
|
||||
<template scope="scope">
|
||||
<el-input v-model="scope.row.template_id" size="mini" style="width: 140px" disabled>
|
||||
<el-button slot="append" icon="el-icon-plus" @click="openDialog(scope)" />
|
||||
</el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="170" fixed="right">
|
||||
<template scope="scope">
|
||||
@@ -195,6 +202,38 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- Excel模板上传弹出框-->
|
||||
<el-dialog
|
||||
title="提示"
|
||||
:visible.sync="dialogUpload"
|
||||
append-to-body
|
||||
width="30%"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:limit="1"
|
||||
:headers="headers"
|
||||
class="upload-demo"
|
||||
:auto-upload="false"
|
||||
drag
|
||||
:action="baseApi +'/api/produceshiftorder/pictures'"
|
||||
multiple
|
||||
:before-upload="beforeUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:on-error="handleError"
|
||||
:on-success="handleSuccess"
|
||||
>
|
||||
<i class="el-icon-upload" />
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div slot="tip" class="el-upload__tip">只能上传不超过50MB的文件!</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="info" @click="dialogUpload = false">取消</el-button>
|
||||
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<MaterDtl
|
||||
:dialog-show.sync="materShow"
|
||||
:is-single="true"
|
||||
@@ -212,10 +251,12 @@
|
||||
<script>
|
||||
import crudProduceshiftorder from '@/api/acs/order/order'
|
||||
import MaterDtl from '@/views/acs/order/MaterDialog'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { mapGetters } from 'vuex'
|
||||
import CustomerDtl from '@/views/acs/order/CustomerDialog'
|
||||
import CRUD, { crud, form } from '@crud/crud'
|
||||
const defaultForm = { tableData: [], order_code: null, material_code: null, material_spec: null,
|
||||
outer_diameter: null, wall_thickness: null }
|
||||
outer_diameter: null, wall_thickness: null, detail_count: 0 }
|
||||
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
@@ -240,10 +281,14 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
headers: { 'Authorization': getToken() },
|
||||
dialogVisible: false,
|
||||
dialogVisible2: false,
|
||||
dialogUpload: false,
|
||||
materShow: false,
|
||||
customerShow: false,
|
||||
dtlJson: null,
|
||||
dtlIndex: null,
|
||||
dtlShow: false,
|
||||
templateList: [],
|
||||
opendtlParam: null,
|
||||
@@ -291,6 +336,12 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'baseApi',
|
||||
'fileUploadApi'
|
||||
])
|
||||
},
|
||||
created() {
|
||||
debugger
|
||||
crudProduceshiftorder.selectTemplateList().then(data => {
|
||||
@@ -363,13 +414,65 @@ export default {
|
||||
this.nowrow = row
|
||||
},
|
||||
async insertdtl() {
|
||||
this.form.tableData.push({ material_code: '', priority: '1' })
|
||||
this.form.tableData.push({ material_code: '', priority: '1', customer_code: '' })
|
||||
this.form.detail_count = this.form.tableData.length
|
||||
},
|
||||
deleteRow(index, rows) {
|
||||
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].plan_qty)
|
||||
rows.splice(index, 1)
|
||||
this.form.detail_count = this.form.tableData.length
|
||||
},
|
||||
openDialog(val) {
|
||||
debugger
|
||||
if (val.row.customer_code === '') {
|
||||
return this.crud.notify('请选择客户', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
}
|
||||
this.dtlJson = val.row
|
||||
this.dtlIndex = val.$index
|
||||
this.dialogUpload = true
|
||||
},
|
||||
handleClose() {
|
||||
this.dialogUpload = false
|
||||
},
|
||||
beforeUpload(file) {
|
||||
let isLt2M = true
|
||||
isLt2M = file.size / 1024 / 1024 < 50
|
||||
if (!isLt2M) {
|
||||
this.loading = false
|
||||
this.$message.error('上传文件大小不能超过 50MB!')
|
||||
}
|
||||
return isLt2M
|
||||
},
|
||||
handleExceed(files, fileList) {
|
||||
this.crud.notify('当前限制最多能选择 1 个文件', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||
},
|
||||
// 监听上传失败
|
||||
handleError(e, file, fileList) {
|
||||
const msg = JSON.parse(e.message)
|
||||
this.$notify({
|
||||
title: msg.message,
|
||||
type: 'error',
|
||||
duration: 2500
|
||||
})
|
||||
this.loading = false
|
||||
},
|
||||
handleSuccess(files, fileList) {
|
||||
debugger
|
||||
this.dtlJson.template_id = files.id
|
||||
const arr = this.form.tableData
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (i === this.dtlIndex) {
|
||||
arr[i] = this.dtlJson
|
||||
}
|
||||
}
|
||||
this.form.tableData = arr
|
||||
this.crud.notify('上传成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.$refs.upload.clearFiles()
|
||||
this.dialogUpload = false
|
||||
this.crud.toQuery()
|
||||
},
|
||||
submitUpload() {
|
||||
const flag = this.$refs.upload.submit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user