From b4edf6ce42debe4edcc85414d9f6c0d41f480587 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期五, 20 六月 2025 11:36:06 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/eam/purchase/modules/EamPurchasePlanAttachmentModal.vue |  143 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 143 insertions(+), 0 deletions(-)

diff --git a/src/views/eam/purchase/modules/EamPurchasePlanAttachmentModal.vue b/src/views/eam/purchase/modules/EamPurchasePlanAttachmentModal.vue
new file mode 100644
index 0000000..d50a53c
--- /dev/null
+++ b/src/views/eam/purchase/modules/EamPurchasePlanAttachmentModal.vue
@@ -0,0 +1,143 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="800"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    switchFullscreen
+    @ok="handleOk"
+    @cancel="handleCancel"
+    cancelText="鍏抽棴">
+
+    <a-spin :spinning="confirmLoading">
+      <a-form-model ref="form" :model="model" :rules="validatorRules">
+        <a-form-model-item
+          label="涓婁紶"
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          v-if="!editable"
+          prop="fileList">
+          <lx-upload :returnUrl="false"
+                     :isMultiple="false"
+                     v-model="model.fileList"
+                     biz="test">
+          </lx-upload>
+        </a-form-model-item>
+        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fileName" label="鏂囦欢鍚嶇О" v-if="editable">
+          <a-input placeholder="璇疯緭鍏ユ枃浠跺悕绉�" v-model="model.fileName" />
+        </a-form-model-item>
+        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="description" label="鎻忚堪">
+          <a-textarea placeholder="璇疯緭鍏ユ弿杩�" v-model="model.description" />
+        </a-form-model-item>
+      </a-form-model>
+    </a-spin>
+  </j-modal>
+</template>
+
+<script>
+import { httpAction } from '@/api/manage'
+
+export default {
+    name: "EamPurchasePlanAttachmentModal",
+    props: {
+      planId: {
+        type: String,
+        required: false,
+        default: '-1'
+      }
+    },
+    data () {
+      return {
+        title:"鎿嶄綔",
+        visible: false,
+        model: {},
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+
+        confirmLoading: false,
+        validatorRules:{
+          fileName: [
+            { required: true, message: '璇疯緭鍏ユ枃浠跺悕绉�!' }
+          ]
+        },
+        url: {
+          add: "/eam/eamPurchasePlanAttachment/add",
+          edit: "/eam/eamPurchasePlanAttachment/edit",
+        },
+        editable: false,
+      }
+    },
+    created () {
+    },
+    methods: {
+      add () {
+        this.editable = false;
+        //鍒濆鍖栭粯璁ゅ��
+        this.model = {};
+        this.visible = true
+      },
+      edit (record) {
+        this.editable = true;
+        this.model = Object.assign({}, record)
+        this.visible = true
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+        this.$refs.form.clearValidate();
+      },
+      handleOk () {
+        // 瑙﹀彂琛ㄥ崟楠岃瘉
+         this.$refs.form.validate(valid => {
+           console.log(this.planId)
+          if (valid) {
+            if (this.planId == null || this.planId === '-1') {
+              this.$message.warning('璇峰厛閫夋嫨閲囪喘璁″垝!');
+              return
+            }
+            this.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            this.model.planId = this.planId;
+            console.log(this.model)
+            httpAction(httpurl, this.model, method).then((res)=>{
+              if(res.success){
+                this.$message.success(res.message);
+                this.$emit('ok');
+                this.close();
+              }else{
+                this.$message.warning(res.message);
+              }
+            }).finally(() => {
+              this.confirmLoading = false;
+            })
+          }else{
+             return false;
+          }
+        })
+      },
+      handleCancel () {
+        this.close()
+      },
+
+
+    }
+  }
+</script>
+
+<style lang="less" scoped>
+
+</style>
\ No newline at end of file

--
Gitblit v1.9.3