|
@@ -21,8 +21,13 @@
|
|
|
]"
|
|
|
@get-list="getList"
|
|
|
>
|
|
|
- <template #slotName="{ item }">
|
|
|
- {{ item.createTime }}
|
|
|
+ <template #fileSlot="{ item }">
|
|
|
+ <div
|
|
|
+ style="cursor: pointer; color: #409eff"
|
|
|
+ @click="handleClickFile(item)"
|
|
|
+ >
|
|
|
+ {{ item.fileName }}
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</byTable>
|
|
|
</div>
|
|
@@ -42,17 +47,33 @@
|
|
|
<template #slot>
|
|
|
<div>
|
|
|
<el-upload
|
|
|
- v-model:file-list="fileList"
|
|
|
+ v-model:fileList="fileList"
|
|
|
class="upload-demo"
|
|
|
action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
- :limit="1"
|
|
|
+ :limit="3"
|
|
|
:data="uploadData"
|
|
|
:on-preview="handlePreview"
|
|
|
:on-remove="handleRemove"
|
|
|
:on-success="handleSuccess"
|
|
|
:before-upload="handleBeforeUpload"
|
|
|
+ accept="pdf"
|
|
|
>
|
|
|
<el-button type="primary">点击上传</el-button>
|
|
|
+ <template #file>
|
|
|
+ <div>
|
|
|
+ <div style="margin-top: 15px">
|
|
|
+ <el-tag
|
|
|
+ class="ml-2"
|
|
|
+ type="info"
|
|
|
+ v-for="(item, index) in fileList"
|
|
|
+ :key="index"
|
|
|
+ closable
|
|
|
+ @close="handleClose(index)"
|
|
|
+ >{{ item.fileName }}</el-tag
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</el-upload>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -127,7 +148,6 @@ const config = computed(() => {
|
|
|
attrs: {
|
|
|
label: "工序名称",
|
|
|
prop: "name",
|
|
|
- width: 150,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -139,18 +159,12 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "工序文件",
|
|
|
- prop: "type",
|
|
|
- width: 120,
|
|
|
- },
|
|
|
- render(type) {
|
|
|
- return type == 1
|
|
|
- ? "普通车间"
|
|
|
- : type == 2
|
|
|
- ? "半自动化车间"
|
|
|
- : type == "3"
|
|
|
- ? "自动化车间"
|
|
|
- : "";
|
|
|
+ prop: "fileName",
|
|
|
+ slot: "fileSlot",
|
|
|
},
|
|
|
+ // render(fileName) {
|
|
|
+ // return <div>fileName</div>;
|
|
|
+ // },
|
|
|
},
|
|
|
|
|
|
{
|
|
@@ -266,49 +280,85 @@ const openModal = () => {
|
|
|
};
|
|
|
|
|
|
const submitForm = () => {
|
|
|
- console.log(fileList.value, "ass");
|
|
|
- // byform.value.handleSubmit((valid) => {
|
|
|
- // submitLoading.value = true;
|
|
|
- // proxy.post("/productionProcesses/" + modalType.value, formData.data).then(
|
|
|
- // (res) => {
|
|
|
- // ElMessage({
|
|
|
- // message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
|
- // type: "success",
|
|
|
- // });
|
|
|
- // dialogVisible.value = false;
|
|
|
- // submitLoading.value = false;
|
|
|
- // getList();
|
|
|
- // },
|
|
|
- // (err) => {
|
|
|
- // console.log(err, "aswwwww");
|
|
|
- // submitLoading.value = false;
|
|
|
- // }
|
|
|
- // );
|
|
|
- // });
|
|
|
+ if (fileList.value.length > 0) {
|
|
|
+ byform.value.handleSubmit((valid) => {
|
|
|
+ formData.data.fileList = fileList.value;
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy.post("/productionProcesses/" + modalType.value, formData.data).then(
|
|
|
+ (res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ fileList.value = [];
|
|
|
+ dialogVisible.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log(err, "aswwwww");
|
|
|
+ submitLoading.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ return ElMessage({
|
|
|
+ message: "请上传附件!",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const getDtl = (row) => {
|
|
|
modalType.value = "edit";
|
|
|
proxy.post("/productionProcesses/detail", { id: row.id }).then((res) => {
|
|
|
- res.type = res.type + "";
|
|
|
+ fileList.value = [
|
|
|
+ {
|
|
|
+ id: "",
|
|
|
+ fileName: res.fileName,
|
|
|
+ path: "",
|
|
|
+ },
|
|
|
+ ];
|
|
|
formData.data = res;
|
|
|
- console.log(formData);
|
|
|
dialogVisible.value = true;
|
|
|
});
|
|
|
};
|
|
|
const handleBeforeUpload = async (file) => {
|
|
|
const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
uploadData.value = res.uploadBody;
|
|
|
+ fileList.value = [
|
|
|
+ {
|
|
|
+ id: res.id,
|
|
|
+ fileName: res.fileName,
|
|
|
+ path: res.fileUrl,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+};
|
|
|
+const handleClickFile = (row) => {
|
|
|
+ ElMessage({
|
|
|
+ message: "数据请求中,请稍后!",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ let id = row.id;
|
|
|
+ proxy.post("/fileInfo/getList", { businessIdList: [id] }).then((res) => {
|
|
|
+ const file = res[id];
|
|
|
+ window.open(file.fileUrl, "_blank");
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
-const handlePreview = () => {};
|
|
|
-const handleSuccess = (res) => {
|
|
|
- console.log(res);
|
|
|
+const handlePreview = (file) => {
|
|
|
+ console.log(file);
|
|
|
+};
|
|
|
+const handleSuccess = (file) => {
|
|
|
+ console.log(file);
|
|
|
+};
|
|
|
+const handleRemove = (file) => {
|
|
|
+ fileList.value = [];
|
|
|
};
|
|
|
-const handleRemove = (res) => {
|
|
|
- console.log(res);
|
|
|
+const handleClose = (index) => {
|
|
|
+ fileList.value.splice(index, 1);
|
|
|
};
|
|
|
-// getList();
|
|
|
+getList();
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|