xiugai
This commit is contained in:
parent
371ee6ecf4
commit
f24cfcb9ea
|
@ -113,4 +113,13 @@ export function saleMtest(id, data) {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//复验上传
|
||||||
|
export function itemfiles(id, data) {
|
||||||
|
return request({
|
||||||
|
url: `/inm/fifoitem/${id}/`,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -48,20 +48,24 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="文件">
|
||||||
|
<template slot-scope="scope" v-if="scope.row.files">
|
||||||
|
|
||||||
|
<div v-for="item in scope.row.files_" v-bind:key="item.id">
|
||||||
|
<el-link :href="item.path" target="_blank" type="primary">{{
|
||||||
|
item.name
|
||||||
|
}}</el-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column align="center" label="操作" width="220px">
|
<el-table-column align="center" label="操作" width="220px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link
|
<el-link type="primary" @click="handleMaterial(scope)" v-if="scope.row.need_test"
|
||||||
|
|
||||||
type="primary"
|
|
||||||
@click="handleMaterial(scope)"
|
|
||||||
>复验</el-link
|
>复验</el-link
|
||||||
>
|
>
|
||||||
<el-link
|
|
||||||
|
<el-link type="primary" @click="handleEdit(scope)">上传</el-link>
|
||||||
type="primary"
|
|
||||||
@click="handlefile(scope)"
|
|
||||||
>上传</el-link
|
|
||||||
>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -73,8 +77,65 @@
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
title="上传文件"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Form"
|
||||||
|
:model="FIFOItem"
|
||||||
|
label-width="100px"
|
||||||
|
label-position="right"
|
||||||
|
|
||||||
|
>
|
||||||
|
<el-form-item label="是否需要复验" prop="need_test">
|
||||||
|
<el-switch v-model="FIFOItem.need_test"></el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-dialog title="物料检查表" :close-on-click-modal="false" :visible.sync="outerVisible">
|
<el-form-item label="文件列表">
|
||||||
|
<el-upload
|
||||||
|
|
||||||
|
ref="upload"
|
||||||
|
:action="upUrl"
|
||||||
|
:before-upload="beforeUpload"
|
||||||
|
:on-success="handleUpSuccess"
|
||||||
|
:headers="upHeaders"
|
||||||
|
multiple
|
||||||
|
accept="image/*,.ppt,.pdf,.doc,.docx,.xls,.xlsx"
|
||||||
|
>
|
||||||
|
<el-button size="small" type="primary">上传文件</el-button>
|
||||||
|
<span class="el-upload__tip">
|
||||||
|
可上传多个pdf,word,ppt,excel,图片文件,单文件大小不超过50M
|
||||||
|
</span>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
<div
|
||||||
|
v-for="(item, index) in fileList"
|
||||||
|
v-bind:key="item.id"
|
||||||
|
style="margin-top: 2px;"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
class="el-icon-delete"
|
||||||
|
@click="deleteFile(index)"
|
||||||
|
style="color: red"
|
||||||
|
|
||||||
|
></i>
|
||||||
|
<el-link :href="item.path" target="_blank" type="primary">{{
|
||||||
|
item.name
|
||||||
|
}}</el-link>
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
<div style="text-align: right">
|
||||||
|
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="confirm()">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
title="物料检查表"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:visible.sync="outerVisible"
|
||||||
|
>
|
||||||
<el-select style="width: 100%" v-model="recordform" placeholder="请选择">
|
<el-select style="width: 100%" v-model="recordform" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in recordformList"
|
v-for="item in recordformList"
|
||||||
|
@ -209,14 +270,18 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getfifodetailList } from "@/api/inm";
|
import { getfifodetailList,itemfiles } from "@/api/inm";
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from "@/utils/permission";
|
||||||
import { getMaterialList, getrecordformList, getrffieldList } from "@/api/mtm";
|
import { getMaterialList, getrecordformList, getrffieldList } from "@/api/mtm";
|
||||||
import { createTestrecord } from "@/api/inm";
|
import { createTestrecord } from "@/api/inm";
|
||||||
import { getUserList } from "@/api/user";
|
|
||||||
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
import { genTree } from "@/utils";
|
import { genTree } from "@/utils";
|
||||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||||
|
const defaultfile = {
|
||||||
|
files:[],
|
||||||
|
need_test:false,
|
||||||
|
};
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination },
|
components: { Pagination },
|
||||||
data() {
|
data() {
|
||||||
|
@ -227,6 +292,10 @@ export default {
|
||||||
fifodetailList: {
|
fifodetailList: {
|
||||||
count: 0,
|
count: 0,
|
||||||
},
|
},
|
||||||
|
upHeaders: upHeaders(),
|
||||||
|
upUrl: upUrl(),
|
||||||
|
fileList: [],
|
||||||
|
FIFOItem:defaultfile,
|
||||||
listQuery: {
|
listQuery: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
|
@ -242,18 +311,26 @@ export default {
|
||||||
listQueryrecordform: {
|
listQueryrecordform: {
|
||||||
page: 0,
|
page: 0,
|
||||||
},
|
},
|
||||||
|
fileData:{},
|
||||||
outerVisible: false,
|
outerVisible: false,
|
||||||
innerVisible: false,
|
innerVisible: false,
|
||||||
|
dialogVisible: false,
|
||||||
|
dialogType: "new",
|
||||||
testrecord: {},
|
testrecord: {},
|
||||||
rule1: {
|
rule1: {
|
||||||
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||||
},
|
},
|
||||||
|
fileList: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
watch: {},
|
watch: {},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkPermission,
|
checkPermission,
|
||||||
|
@ -269,11 +346,75 @@ export default {
|
||||||
this.listLoading = false;
|
this.listLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//上传物料文件
|
|
||||||
handlefile(scope)
|
|
||||||
{
|
handleUpSuccess(res, file, filelist) {
|
||||||
|
this.fileList.push({
|
||||||
|
id: res.data.id,
|
||||||
|
name: res.data.name,
|
||||||
|
path: res.data.path,
|
||||||
|
});
|
||||||
|
this.handleRemove(file);
|
||||||
},
|
},
|
||||||
|
handleRemove(file) {
|
||||||
|
// 实现删除文件
|
||||||
|
let fileList = this.$refs.upload.uploadFiles;
|
||||||
|
let index = fileList.findIndex((fileItem) => {
|
||||||
|
return fileItem.uid === file.uid;
|
||||||
|
});
|
||||||
|
fileList.splice(index, 1);
|
||||||
|
},
|
||||||
|
beforeUpload(file) {
|
||||||
|
const isLt2M = file.size / 1024 / 1024 < 50;
|
||||||
|
if (!isLt2M) {
|
||||||
|
this.$message.error("单文件不能超过50MB!");
|
||||||
|
}
|
||||||
|
return isLt2M;
|
||||||
|
},
|
||||||
|
deleteFile(index) {
|
||||||
|
this.$confirm("确定删除该文件, 是否继续?", { type: "error" })
|
||||||
|
.then(() => {
|
||||||
|
this.fileList.splice(index, 1);
|
||||||
|
})
|
||||||
|
.catch((e) => {});
|
||||||
|
},
|
||||||
|
yeschange(val) {
|
||||||
|
if (!val) {
|
||||||
|
this.fileList = [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleEdit(scope) {
|
||||||
|
this.FIFOItem = Object.assign({}, scope.row); // copy obj
|
||||||
|
this.fileList=[],
|
||||||
|
this.dialogVisible = true;
|
||||||
|
for (var i = 0; i < this.FIFOItem.files_.length; i++) {
|
||||||
|
this.fileList.push({
|
||||||
|
id: this.FIFOItem.files_[i].id,
|
||||||
|
name: this.FIFOItem.files_[i].name,
|
||||||
|
path: this.FIFOItem.files_[i].path,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
confirm() {
|
||||||
|
var files = [];
|
||||||
|
for (var i = 0; i < this.fileList.length; i++) {
|
||||||
|
files.push(this.fileList[i].id);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.fileData.files=files;
|
||||||
|
this.fileData.need_test=this.FIFOItem.need_test;
|
||||||
|
console.log(this.fileData)
|
||||||
|
itemfiles(this.FIFOItem.id,this.fileData).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.getList();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
handleMaterial(scope) {
|
handleMaterial(scope) {
|
||||||
//调该物料对应的检查表
|
//调该物料对应的检查表
|
||||||
this.outerVisible = true;
|
this.outerVisible = true;
|
||||||
|
@ -302,10 +443,9 @@ export default {
|
||||||
let _this = this;
|
let _this = this;
|
||||||
_this.field = []; //检查项目
|
_this.field = []; //检查项目
|
||||||
this.fieldList.forEach((item) => {
|
this.fieldList.forEach((item) => {
|
||||||
|
|
||||||
_this.field.push({
|
_this.field.push({
|
||||||
form_field:item.id,
|
form_field: item.id,
|
||||||
field_value:item.sort
|
field_value: item.sort,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue