|
@@ -211,12 +211,50 @@
|
|
|
<el-button type="primary" @click="clickDownload()" size="large">下载PDF</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="交接单" v-if="openHandoverSlip" v-model="openHandoverSlip" width="600">
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="handoverSlipForm">
|
|
|
+ <template #file>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-upload
|
|
|
+ v-model:fileList="handoverSlipForm.fileList"
|
|
|
+ action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
+ :data="uploadData"
|
|
|
+ multiple
|
|
|
+ :before-upload="uploadFile"
|
|
|
+ :on-success="handleSuccess"
|
|
|
+ :on-preview="onPreviewFile">
|
|
|
+ <el-button type="primary" plain>选择</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #indication>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-upload
|
|
|
+ v-model:fileList="handoverSlipForm.packageFileList"
|
|
|
+ action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
+ :data="indicationUploadData"
|
|
|
+ multiple
|
|
|
+ :before-upload="indicationUploadFile"
|
|
|
+ :on-success="handleSuccess"
|
|
|
+ :on-preview="onPreviewFile">
|
|
|
+ <el-button type="primary" plain>选择</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openHandoverSlip = false" size="large">关 闭</el-button>
|
|
|
+ <el-button type="primary" @click="submitHandoverSlip()" size="large">确 定</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { computed, ref } from "vue";
|
|
|
import byTable from "@/components/byTable/index";
|
|
|
+import byForm from "@/components/byForm/index";
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
|
|
@@ -348,7 +386,7 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "操作",
|
|
|
- width: 120,
|
|
|
+ width: 160,
|
|
|
align: "center",
|
|
|
fixed: "right",
|
|
|
},
|
|
@@ -356,6 +394,17 @@ const config = computed(() => {
|
|
|
return [
|
|
|
{
|
|
|
attrs: {
|
|
|
+ label: "交接单",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ clickHandoverSlip(row);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
label: "打印",
|
|
|
type: "primary",
|
|
|
text: true,
|
|
@@ -493,6 +542,149 @@ const statistics = (label, index) => {
|
|
|
}
|
|
|
return num;
|
|
|
};
|
|
|
+const openHandoverSlip = ref(false);
|
|
|
+const handoverSlipForm = ref({
|
|
|
+ id: "",
|
|
|
+ code: "",
|
|
|
+ buyCorporationName: "",
|
|
|
+ fileList: [],
|
|
|
+ packageFileList: [],
|
|
|
+});
|
|
|
+const formOption = reactive({
|
|
|
+ inline: true,
|
|
|
+ labelWidth: 100,
|
|
|
+ itemWidth: 100,
|
|
|
+ rules: [],
|
|
|
+});
|
|
|
+const formConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "code",
|
|
|
+ label: "样品单编号",
|
|
|
+ itemType: "text",
|
|
|
+ disabled: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "buyCorporationName",
|
|
|
+ label: "客户名称",
|
|
|
+ itemType: "text",
|
|
|
+ disabled: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "file",
|
|
|
+ label: "交接单",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "indication",
|
|
|
+ label: "包装指示",
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const uploadData = ref({});
|
|
|
+const indicationUploadData = ref({});
|
|
|
+const clickHandoverSlip = (item) => {
|
|
|
+ handoverSlipForm.value.id = item.id;
|
|
|
+ handoverSlipForm.value.code = item.code;
|
|
|
+ handoverSlipForm.value.buyCorporationName = item.buyCorporationName;
|
|
|
+ if (item.fileInfoVos && item.fileInfoVos.length > 0) {
|
|
|
+ handoverSlipForm.value.fileList = item.fileInfoVos.map((item) => {
|
|
|
+ return {
|
|
|
+ raw: item,
|
|
|
+ name: item.fileName,
|
|
|
+ url: item.fileUrl,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ handoverSlipForm.value.fileList = [];
|
|
|
+ }
|
|
|
+ if (item.packageFileInfoVOList && item.packageFileInfoVOList.length > 0) {
|
|
|
+ handoverSlipForm.value.packageFileList = item.packageFileInfoVOList.map((item) => {
|
|
|
+ return {
|
|
|
+ raw: item,
|
|
|
+ name: item.fileName,
|
|
|
+ url: item.fileUrl,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ handoverSlipForm.value.packageFileList = [];
|
|
|
+ }
|
|
|
+ openHandoverSlip.value = true;
|
|
|
+};
|
|
|
+const uploadFile = async (file) => {
|
|
|
+ const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
+ uploadData.value = res.uploadBody;
|
|
|
+ file.id = res.id;
|
|
|
+ file.fileName = res.fileName;
|
|
|
+ file.fileUrl = res.fileUrl;
|
|
|
+ file.uploadState = true;
|
|
|
+ return true;
|
|
|
+};
|
|
|
+const indicationUploadFile = async (file) => {
|
|
|
+ const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
+ indicationUploadData.value = res.uploadBody;
|
|
|
+ file.id = res.id;
|
|
|
+ file.fileName = res.fileName;
|
|
|
+ file.fileUrl = res.fileUrl;
|
|
|
+ file.uploadState = true;
|
|
|
+ return true;
|
|
|
+};
|
|
|
+const handleSuccess = (any, UploadFile) => {
|
|
|
+ UploadFile.raw.uploadState = false;
|
|
|
+};
|
|
|
+const onPreviewFile = (file) => {
|
|
|
+ window.open(file.raw.fileUrl, "_blank");
|
|
|
+};
|
|
|
+const submitHandoverSlip = () => {
|
|
|
+ if (handoverSlipForm.value.fileList && handoverSlipForm.value.fileList.length > 0) {
|
|
|
+ for (let i = 0; i < handoverSlipForm.value.fileList.length; i++) {
|
|
|
+ if (handoverSlipForm.value.fileList[i].raw.uploadState) {
|
|
|
+ return ElMessage("文件上传中,请稍后提交");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (handoverSlipForm.value.packageFileList && handoverSlipForm.value.packageFileList.length > 0) {
|
|
|
+ for (let i = 0; i < handoverSlipForm.value.packageFileList.length; i++) {
|
|
|
+ if (handoverSlipForm.value.packageFileList[i].raw.uploadState) {
|
|
|
+ return ElMessage("文件上传中,请稍后提交");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let data = proxy.deepClone(handoverSlipForm.value);
|
|
|
+ if (data.fileList && data.fileList.length > 0) {
|
|
|
+ data.fileList = data.fileList.map((item) => {
|
|
|
+ return {
|
|
|
+ id: item.raw.id,
|
|
|
+ fileName: item.raw.fileName,
|
|
|
+ fileUrl: item.raw.fileUrl,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ data.fileList = [];
|
|
|
+ }
|
|
|
+ if (data.packageFileList && data.packageFileList.length > 0) {
|
|
|
+ data.packageFileList = data.packageFileList.map((item) => {
|
|
|
+ return {
|
|
|
+ id: item.raw.id,
|
|
|
+ fileName: item.raw.fileName,
|
|
|
+ fileUrl: item.raw.fileUrl,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ data.packageFileList = [];
|
|
|
+ }
|
|
|
+ proxy.post("/contract/contractHandover", data).then(() => {
|
|
|
+ ElMessage({
|
|
|
+ message: "操作成功!",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ openHandoverSlip.value = false;
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|