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/specialtyMaintenancePlan/SpecialtyMaintenancePlanModal.vue |  654 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 654 insertions(+), 0 deletions(-)

diff --git a/src/views/eam/modules/specialtyMaintenancePlan/SpecialtyMaintenancePlanModal.vue b/src/views/eam/modules/specialtyMaintenancePlan/SpecialtyMaintenancePlanModal.vue
new file mode 100644
index 0000000..24ac3de
--- /dev/null
+++ b/src/views/eam/modules/specialtyMaintenancePlan/SpecialtyMaintenancePlanModal.vue
@@ -0,0 +1,654 @@
+<template>
+  <a-modal
+    :title="title"
+    :width="1250"
+    :visible="visible"
+    :maskClosable="false"
+    :confirmLoading="confirmLoading"
+    :okButtonProps="{ props: {disabled: disableSubmit} }"
+    @ok="handleOk"
+    @cancel="handleCancel"
+    cancelText="鍏抽棴"
+  >
+    <a-spin :spinning="confirmLoading">
+      <a-form :form="form">
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item
+              label="淇濆吇鏂规缂栫爜"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                allow-clear
+                :disabled="disableSubmit"
+                :placeholder="disableSubmit?'':'璇疯緭鍏ヤ繚鍏绘柟妗堢紪鐮�'"
+                v-decorator="['num', validatorRules.num ]"
+              />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              label="瀵硅薄閮ㄩ棬"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <!-- <a-select
+                :placeholder="disableSubmit?'':'璇烽�夋嫨瀵硅薄閮ㄩ棬'"
+                :options="this.departs"
+                style="width: 100%"
+                :disabled="disableSubmit"
+                v-decorator="['departId', validatorRules.departId]"
+                @change="(e)=>handle2Change(e)"
+              /> -->
+              <a-tree-select
+                style="width: 100%"
+                :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
+                :tree-data="treeData"
+                placeholder="璇烽�夋嫨瀵硅薄閮ㄩ棬"
+                tree-default-expand-all
+                v-decorator="['departId', validatorRules.departId]"
+                @change="(e)=>handle2Change(e)"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item
+              label="淇濆吇鍛ㄦ湡"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-select
+                :placeholder="disableSubmit?'':'璇烽�夋嫨淇濆吇鍛ㄦ湡'"
+                :options="this.maintenanceCycles"
+                @change="(e)=>handle2Change(e)"
+                style="width: 100%"
+                :disabled="disableSubmit"
+                v-decorator="['maintenanceCycleId', validatorRules.maintenanceCycleId]"
+              />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              label="璐d换鐝粍"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <j-dict-select-tag
+                allow-clear
+                :disabled="disableSubmit"
+                :placeholder="disableSubmit?'':'璇烽�夋嫨璐d换鐝粍'"
+                :triggerChange="true"
+                dictCode="mom_base_team,name,id,status='1' and del_flag='0'"
+                v-decorator="['teamId', validatorRules.teamId]"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item
+              label="缁翠繚鏂瑰紡"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <j-dict-select-tag
+                allow-clear
+                :disabled="disableSubmit"
+                :placeholder="disableSubmit?'':'閫夋嫨缁翠繚鏂瑰紡'"
+                :triggerChange="true"
+                dictCode="maintenance_method"
+                v-decorator="['maintenanceMode', validatorRules.maintenanceMode]"
+                @change="(e)=>handle2Change(e)"
+              />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              label="淇濆吇绫诲瀷"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <j-dict-select-tag
+                allow-clear
+                :disabled="disableSubmit"
+                :placeholder="disableSubmit?'':'璇烽�変繚鍏荤被鍨�'"
+                :triggerChange="true"
+                dictCode="mom_eam_maintenance_type,name,id,del_flag!='1'"
+                v-decorator="['maintenanceTypeId', validatorRules.maintenanceTypeId]"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              label="淇濆吇璺嚎鍥�"
+            >
+              <a-upload-dragger
+                name="file"
+                :customRequest="customRequest"
+                @change="handleChange"
+                :file-list="fileList"
+                :multiple="false"
+              >
+                <p class="ant-upload-drag-icon">
+                  <a-icon type="inbox" />
+                </p>
+                <p class="ant-upload-text">
+                  鐐瑰嚮涓婁紶鎴栨嫋鎷藉浘鐗囪嚦璇ュ尯鍩熻繘琛屼笂浼�
+                </p>
+                <p class="ant-upload-hint">
+                  浠呮敮鎸佸崟鍥剧墖涓婁紶
+                </p>
+              </a-upload-dragger>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              label="鍥剧墖鍚嶇О"
+            >
+              <a-input
+                :disabled=true
+                placeholder="璇蜂笂浼犲浘鐗�"
+                v-decorator="['name', validatorRules.name ]"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              label="娲惧伐鏂瑰紡"
+            >
+              <j-dict-select-tag
+                allow-clear
+                :disabled="disableSubmit"
+                :placeholder="disableSubmit?'':'璇烽�夋嫨娲惧伐鏂瑰紡'"
+                :triggerChange="true"
+                dictCode="assign_mode"
+                v-decorator="['assignMode', validatorRules.assignMode]"
+              />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              label="澶囨敞"
+            >
+              <a-textarea
+                :disabled="disableSubmit"
+                placeholder="璇疯緭鍏ュ娉�"
+                allow-clear
+                v-decorator="['remark', validatorRules.remark]"
+              />
+            </a-form-item>
+          </a-col>
+
+        </a-row>
+      </a-form>
+    </a-spin>
+    <a-button
+      type="primary"
+      :style="{ marginRight: '8px',marginBottom:'8px' }"
+      :loading="confirmLoading"
+      @click="selectMaintenanceProjects()"
+    >涓撲笟淇濆吇鏍囧噯</a-button>
+    <a-table
+      ref="table"
+      bordered
+      size="middle"
+      rowKey='id'
+      :columns="columns"
+      :dataSource="dataSource"
+    >
+
+      <span
+        slot="action"
+        slot-scope="text, record, index"
+      >
+        <a-popconfirm
+          title="纭畾鍒犻櫎鍚�?"
+          @confirm="() => handleDelete(text,record, index)"
+        >
+          <a>鍒犻櫎</a>
+        </a-popconfirm>
+      </span>
+    </a-table>
+    <template slot="footer">
+      <a-button
+        :style="{marginRight: '8px'}"
+        @click="handleCancel()"
+      >
+        鍏抽棴
+      </a-button>
+
+      <a-button
+        @click="handleOk()"
+        type="primary"
+        :loading="confirmLoading"
+      >纭畾</a-button>
+    </template>
+    <j-select-specialty-maintenance-standard-modal ref="specialtyMaintenanceStandardModalForm"></j-select-specialty-maintenance-standard-modal>
+  </a-modal>
+</template>
+ 
+<script>
+import { getAction, postAction, postFileAction } from '@/api/manage'
+import Vue from 'vue'
+import JInput from '@/components/jeecg/JInput'
+import Tooltip from 'ant-design-vue/es/tooltip'
+import JEllipsis from "@/components/jeecg/JEllipsis";
+import { ajaxGetDictItems } from '@/api/api'
+import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types"
+import pick from 'lodash.pick'
+
+import JSelectSpecialtyMaintenanceStandardModal from './JSelectSpecialtyMaintenanceStandardModal'
+
+export default {
+  name: "SpecialtyMaintenancePlanModal",
+  components: {
+    JInput,
+    Tooltip,
+    JEllipsis,
+    JSelectSpecialtyMaintenanceStandardModal
+  },
+  data() {
+    return {
+      columns: [
+        {
+          title: '#',
+          dataIndex: '',
+          key: 'rowIndex',
+          align: 'center',
+          customRender: function (t, r, index) {
+            return parseInt(index) + 1
+          },
+          width: 50,
+        },
+        {
+          title: '涓撲笟淇濆吇鏍囧噯',
+          align: 'center',
+          dataIndex: 'num'
+        },
+        {
+          title: '鐗堟湰',
+          align: 'center',
+          dataIndex: 'version'
+        },
+        {
+          title: '鐗堟湰鐘舵��',
+          align: 'center',
+          dataIndex: 'versionStatusName'
+        },
+        {
+          title: '璁惧缂栫爜',
+          align: 'center',
+          dataIndex: 'equipmentNum'
+        },
+        {
+          title: '璁惧鍚嶇О',
+          align: 'center',
+          dataIndex: 'equipmentName'
+        },
+        {
+          title: '璁惧鍨嬪彿',
+          align: 'center',
+          dataIndex: 'equipmentModel'
+        },
+        {
+          title: '鎿嶄綔',
+          align: 'center',
+          dataIndex: 'action',
+          scopedSlots: {
+            customRender: 'action'
+          },
+        }
+      ],
+      title: "鎿嶄綔",
+      visible: false,
+      disableSubmit: false,
+      codeDisable: true,
+      model: {},
+      maintenanceCycles: [],
+      treeData: [],
+      departs: [],
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 6 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 18 },
+      },
+      confirmLoading: false,
+      form: this.$form.createForm(this),
+      headers: {},
+      validatorRules: {
+        num: {
+          rules: [
+            { required: true, message: '璇疯緭鍏ヤ繚鍏绘柟妗堢紪鐮�!' },
+          ]
+        },
+        maintenanceCycleId: {
+          rules: [
+            { required: true, message: '璇烽�夋嫨淇濆吇鍛ㄦ湡!' },
+          ]
+        },
+        departId: {
+          rules: [
+            { required: true, message: '璇烽�夋嫨瀵硅薄閮ㄩ棬!' },
+          ]
+        },
+        teamId: {
+          rules: [
+            { required: true, message: '璇烽�夋嫨璐d换鐝粍!' },
+          ]
+        },
+        maintenanceMode: {
+          rules: [
+            { required: true, message: '璇烽�夋嫨缁翠繚鏂瑰紡!' },
+          ]
+        },
+        assignMode: {
+          rules: [
+            { required: true, message: '璇烽�夋嫨娲惧伐鏂瑰紡!' },
+          ]
+        },
+        maintenanceTypeId: {
+          rules: [
+            { required: true, message: '璇烽�夋嫨淇濆吇绫诲瀷!' },
+          ]
+        },
+        name: {
+          rules: [
+            { required: true, message: '璇疯緭鍏ユ枃浠跺悕绉帮紒' },
+            { min: 0, max: 150, message: '鏈�闀� 30 涓瓧绗�', trigger: 'blur' },
+          ]
+        },
+        description: {
+          rules: [
+            { min: 0, max: 100, message: '鏈�闀� 100 涓瓧绗�', trigger: 'blur' },
+          ]
+        },
+      },
+      url: {
+        add: "/eam/specialtyMaintenancePlan/add",
+        edit: "/eam/specialtyMaintenancePlan/edit",
+        listByBusIdAndBusType: "/system/sysUploadRela/listByBusIdAndBusType",
+        getMaintenanceCycles: "/eam/maintenanceStandardDetail/getMaintenanceCycle",
+        getSysDeparts: "/eam/equipment/getSysDeparts",
+        loadOptions: '/sys/sysDepart/loadDepartTreeOptions',
+      },
+      dataSource: [],
+      //鐢ㄤ簬灞曠ず鏂囦欢
+      fileList: [],
+      fileObject: {},
+      //鐢ㄤ簬鍒ゆ柇闄勪欢鐨勭姸鎬�  add锛氭柊澧為〉闈㈢殑闄勪欢  edit锛氱紪杈戦〉闈㈢殑闄勪欢涓鸿淇敼i   editUpdate锛氱紪杈戦〉闈㈢殑闄勪欢琚慨鏀�
+      isFileChange: false,
+      uploadId: '',
+    }
+  },
+
+  mounted() {
+    this.$bus.$on('selectionRows', (data) => {
+      for (let i = 0; i < data.length; i++) {
+        this.dataSource.push({
+          id: data[i].id,
+          maintenanceStandardId: data[i].id,
+          num: data[i].num,
+          equipmentId: data[i].equipmentId,
+          version: data[i].version,
+          versionStatus: data[i].versionStatus,
+          versionStatusName: data[i].versionStatusName,
+          equipmentNum: data[i].equipmentNum,
+          equipmentName: data[i].equipmentName,
+          equipmentModel: data[i].equipmentModel,
+        })
+      }
+    })
+  },
+
+  created() {
+    this.getMaintenanceCycles()
+    // this.getSysDeparts()
+    const token = Vue.ls.get(ACCESS_TOKEN);
+    const tenantid = Vue.ls.get(TENANT_ID)
+    this.headers = {
+      'Content-Type': 'multipart/form-data',
+      "X-Access-Token": token,
+      'X-Access-Tenant': tenantid
+    };
+  },
+
+  methods: {
+
+    //涓撲繚鍏绘鏍囧噯
+    selectMaintenanceProjects: function () {
+      let dataDepartId = this.form.getFieldsValue(['departId']);
+      if (dataDepartId.departId === "" || dataDepartId.departId === null || dataDepartId.departId === undefined) {
+        this.$message.warning("璇烽�夋嫨瀵硅薄閮ㄩ棬锛�");
+        return
+      }
+      let data = this.form.getFieldsValue(['maintenanceCycleId']);
+      if (data.maintenanceCycleId === "" || data.maintenanceCycleId === null || data.maintenanceCycleId === undefined) {
+        this.$message.warning("璇烽�夋嫨淇濆吇鍛ㄦ湡锛�");
+        return
+      }
+      let dataMode = this.form.getFieldsValue(['maintenanceMode']);
+      if (dataMode.maintenanceMode === "" || dataMode.maintenanceMode === null || dataMode.maintenanceMode === undefined) {
+        this.$message.warning("璇烽�夋嫨缁翠繚鏂瑰紡锛�");
+        return
+      }
+      let ids = [];
+      for (let i = 0; i < this.dataSource.length; i++) {
+        ids.push(this.dataSource[i].maintenanceStandardId);
+      }
+      this.$refs.specialtyMaintenanceStandardModalForm.showModals(ids, dataDepartId.departId, data.maintenanceCycleId, dataMode.maintenanceMode);
+      this.$refs.specialtyMaintenanceStandardModalForm.title = '閫夋嫨淇濆吇椤圭洰';
+      this.$refs.specialtyMaintenanceStandardModalForm.disableSubmit = false;
+    },
+
+    customRequest(val) {
+      if (this.fileList.length == 0) {
+        this.fileObject = val;
+      }
+    },
+
+    handleChange(info) {
+      //榛樿缁欓檮浠剁姸鎬侊紝浠呮帶鍒舵牱寮�
+      let file = info.file;
+      //鏂囦欢鏇存敼锛屾爣璁版洿鏂�
+      if (this.model.id) {
+        this.isFileChange = true;
+      }
+      //鍒犻櫎
+      if (file.status == "removed") {
+        this.fileList = [];
+        this.fileObject.file = {};
+        this.form.setFieldsValue({ name: '' });
+        return false;
+      }
+      //鍗曟枃浠舵帶鍒�
+      if (this.fileList.length > 0) {
+        this.$message.warning("褰撳墠浠呭厑璁镐笂浼犱竴涓枃浠讹紒");
+        return false;
+      }
+      file.status = 'done';
+      //椤甸潰灞曠ず涓婁紶鏂囦欢
+      this.fileList.push(file);
+      this.form.setFieldsValue({ name: file.name });
+    },
+
+    add() {
+      this.edit({ specialtyMaintenancePlanDetailList: [] })
+    },
+
+    edit(record) {
+      let that = this;
+      that.visible = true;
+      that.isFileChange = false;
+      that.initOptions();
+      that.model = Object.assign({}, record);
+      that.$nextTick(() => {
+        that.form.setFieldsValue(pick(that.model, 'num', 'departId', 'teamId', 'teamName', 'assignMode', 'maintenanceCycleId', 'dutyDepartId', 'maintenanceTypeId', 'maintenanceMode', 'remark'))
+      });
+      that.fileList = [];
+      that.form.resetFields();
+
+      that.uploadId = ''
+      if (record.specialtyMaintenancePlanDetailList != undefined) {
+        const temp = [...record.specialtyMaintenancePlanDetailList];
+        that.dataSource = temp;
+      }
+      if (record.isNoPhotoFlag) {
+        //鑾峰彇褰撳墠鏂囦欢瀵瑰簲闄勪欢
+        getAction(that.url.listByBusIdAndBusType, { busId: record.id, busType: 'maintenance_path_photo' }).then((res) => {
+          if (res.success) {
+            for (let i = 0; i < res.result.length; i++) {
+              that.fileList.push({
+                uid: res.result[i].upload.id,
+                name: res.result[i].upload.name,
+                status: "done",
+              })
+              that.$nextTick(() => {
+                that.form.setFieldsValue({ name: res.result[i].upload.name });
+              });
+            }
+          }
+        })
+      }
+      if (record.id) {
+        this.codeDisable = true;
+      } else {
+        this.codeDisable = false;
+      }
+    },
+
+    close() {
+      this.$emit('close');
+      this.visible = false;
+    },
+
+    initOptions() {
+      getAction(this.url.loadOptions).then(res => {
+        if (res.success) {
+          this.treeData = res.result
+        } else {
+          this.$message.warning(res.message)
+        }
+      })
+    },
+
+    handleOk() {
+      const that = this;
+      // 瑙﹀彂琛ㄥ崟楠岃瘉
+      that.form.validateFields((err, values) => {
+        if (JSON.stringify(that.fileObject.file) == '{}' && that.uploadId == '' && that.fileList.length == 0) {
+          that.$message.warning("璇蜂笂浼犳枃浠�");
+          return false
+        }
+        if (that.dataSource.length == 0) {
+          that.$message.warning("璇烽�夋嫨涓撲笟鐐规鏍囧噯锛�");
+          return false
+        }
+        if (!err) {
+          that.confirmLoading = true;
+          let httpurl = ''
+          let method = ''
+          if (!that.model.id) {
+            httpurl += that.url.add;
+            method = 'post';
+          } else {
+            httpurl += that.url.edit;
+            method = 'put';
+          }
+          let formData = Object.assign(that.model, values);
+
+          formData.type = "maintenance_path_photo";
+          formData.uploadId = that.uploadId;
+          formData.fileType = "7";//鏂囦欢绫诲瀷  7锛氬浘鐗�
+          var saveDate = new FormData();
+
+          formData.isFileChange = that.isFileChange;
+          formData.specialtyMaintenancePlanDetails = that.dataSource;
+          saveDate.append("file", that.fileObject.file);
+          saveDate.append('data', JSON.stringify(formData));
+
+          postFileAction(httpurl, saveDate, this.headers).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();
+          })
+        }
+      }).catch((e) => { })
+    },
+
+    handleDelete(text, record, index) {
+      this.dataSource.splice(index, 1);
+    },
+
+    handleCancel() {
+      this.close();
+    },
+
+    handle2Change(val) {
+      this.dataSource = [];
+    },
+
+    getMaintenanceCycles() {
+      getAction(this.url.getMaintenanceCycles).then((res) => {
+        if (res.success) {
+          this.maintenanceCycles = res.result
+        }
+      })
+    },
+
+    getSysDeparts() {
+      getAction(this.url.getSysDeparts).then((res) => {
+        if (res.success) {
+          this.departs = res.result
+        }
+      })
+    },
+
+  },
+
+
+}
+</script>
+<style scoped>
+.ant-btn {
+  padding: 0 10px;
+  margin-left: 3px;
+}
+
+.ant-form-item-control {
+  line-height: 0px;
+}
+
+/** 涓昏〃鍗曡闂磋窛 */
+.ant-form .ant-form-item {
+  margin-bottom: 10px;
+}
+
+/** Tab椤甸潰琛岄棿璺� */
+.ant-tabs-content .ant-form-item {
+  margin-bottom: 0px;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3