From 92ff846fb659c62037a32b1d8c15eae9df9d9b54 Mon Sep 17 00:00:00 2001
From: zenglf <18502938215@163.com>
Date: 星期一, 18 九月 2023 13:24:30 +0800
Subject: [PATCH] Merge branch 'develop' of http://117.34.109.166:18448/r/vue_mdc_430

---
 src/views/eam/modules/repairorder/EquipmentDocumentModal.vue |  201 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 201 insertions(+), 0 deletions(-)

diff --git a/src/views/eam/modules/repairorder/EquipmentDocumentModal.vue b/src/views/eam/modules/repairorder/EquipmentDocumentModal.vue
new file mode 100644
index 0000000..9c6cc66
--- /dev/null
+++ b/src/views/eam/modules/repairorder/EquipmentDocumentModal.vue
@@ -0,0 +1,201 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    switchFullscreen
+    @ok="handleOk"
+    @cancel="handleCancel"
+    cancelText="鍏抽棴"
+  >
+    <a-spin :spinning="confirmLoading">
+      <a-form-model
+        ref="form"
+        :model="model"
+        :rules="validatorRules"
+      >
+        <a-row>
+          <a-col :span="24">
+            <a-form-model-item
+              label="鏂囨。缂栧彿"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="num"
+            >
+              <a-input
+                v-model="model.num"
+                placeholder="璇疯緭鍏ユ枃妗g紪鍙�"
+              ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item
+              label="鏂囨。绫诲瀷"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="documentTypeId"
+            >
+              <j-dict-select-tag
+                allow-clear
+                placeholder="璇烽�夋嫨鏂囨。绫诲瀷"
+                :triggerChange="true"
+                dictCode="mom_eam_document_type,name,id, del_flag!='1'"
+                v-model="model.documentTypeId"
+              />
+
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item
+              label="涓婁紶"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="file"
+            >
+              <j-upload
+                :returnUrl="false"
+                :isMultiple="false"
+                v-model="model.file"
+              ></j-upload>
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+      </a-form-model>
+    </a-spin>
+  </j-modal>
+</template>
+
+<script>
+
+import { httpAction } from '@/api/manage'
+import { validateDuplicateValue } from '@/utils/util'
+import { duplicateCheck } from '@/api/api'
+
+export default {
+  name: "EquipmentDocumentModal",
+  components: {
+  },
+  props: {
+    mainId: {
+      type: String,
+      required: false,
+      default: ''
+    }
+  },
+  data() {
+    return {
+      title: "鎿嶄綔",
+      width: 800,
+      visible: false,
+      model: {
+      },
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 },
+      },
+
+      confirmLoading: false,
+      validatorRules: {
+        num: [
+          { required: true, message: '璇疯緭鍏ユ枃妗g紪鍙�!' },
+          { validator: this.validateNum },
+          { max: 32, message: '瓒呰繃鏈�澶ц緭鍏ラ檺鍒�,璇风缉鍑忛暱搴�' }
+        ],
+        documentTypeId: [
+          { required: true, message: '璇烽�夋嫨鏂囦欢绫诲瀷!' },
+        ],
+        file: [
+          { required: true, message: '璇蜂笂浼犳枃浠�!' },
+        ]
+      },
+      url: {
+        add: "/eam/repairOrder/addEquipmentDocument",
+        edit: "/eam/repairOrder/editEquipmentDocument",
+      }
+
+    }
+  },
+  created() {
+    //澶囦唤model鍘熷鍊�
+    this.modelDefault = JSON.parse(JSON.stringify(this.model));
+  },
+  methods: {
+    add() {
+      this.edit(this.modelDefault);
+    },
+    edit(record) {
+      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) {
+          console.log(this.model.file)
+          that.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['name'] = this.model.file[0].fileName;
+          this.model['path'] = this.model.file[0].filePath;
+          this.model['size'] = this.model.file[0].fileSize;
+          this.model['repairOrderId'] = this.mainId
+          httpAction(httpurl, this.model, method).then((res) => {
+            if (res.success) {
+              that.$message.success(res.message);
+              that.$emit('ok');
+            } else {
+              that.$message.warning(res.message);
+            }
+          }).finally(() => {
+            that.confirmLoading = false;
+            that.close();
+          })
+        } else {
+          return false
+        }
+      })
+    },
+    handleCancel() {
+      this.close()
+    },
+    //琛ㄥ崟鏍¢獙
+    validateNum(rule, value, callback) {
+      var params = {
+        tableName: 'mom_eam_repair_order_operation_guidance',
+        fieldName: 'num',
+        fieldVal: value,
+        dataId: this.model.id,
+        //鏁版嵁搴撲腑瀛樺湪瀛楁del_flag骞朵娇鐢ㄨ瀛楁浣滀负鏈垹闄ょ瓥鐣ワ紝鐪熷垹闄わ細false 鍋囧垹闄わ細true
+        delFlag: '0',
+      };
+      duplicateCheck(params).then((res) => {
+        if (res.success) {
+          callback();
+        } else {
+          callback("缂栧彿宸插瓨鍦�!");
+        }
+      })
+    }
+
+
+  }
+}
+</script>

--
Gitblit v1.9.3