From 89a699602d78bb55c6ac70c5e9fd0306429d5e23 Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期二, 29 四月 2025 09:31:15 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/eam/equipment/modules/EamEquipmentAttachmentModal.vue |  138 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 138 insertions(+), 0 deletions(-)

diff --git a/src/views/eam/equipment/modules/EamEquipmentAttachmentModal.vue b/src/views/eam/equipment/modules/EamEquipmentAttachmentModal.vue
new file mode 100644
index 0000000..190d5db
--- /dev/null
+++ b/src/views/eam/equipment/modules/EamEquipmentAttachmentModal.vue
@@ -0,0 +1,138 @@
+<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: "EamEquipmentAttachmentModal",
+    props: {
+      equipmentId: {
+        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/equipmentAttachment/add",
+          edit: "/eam/equipmentAttachment/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 () {
+        const that = this;
+        // 瑙﹀彂琛ㄥ崟楠岃瘉
+         this.$refs.form.validate(valid => {
+          if (valid) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            that.model.equipmentId = that.equipmentId;
+            httpAction(httpurl, that.model, method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+                that.close();
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+            })
+          }else{
+             return false;
+          }
+        })
+      },
+      handleCancel () {
+        this.close()
+      },
+
+
+    }
+  }
+</script>
+
+<style lang="less" scoped>
+
+</style>
\ No newline at end of file

--
Gitblit v1.9.3