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/dailyMaintenanceStandard/DailyMaintenanceStandardModal.vue |  951 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 951 insertions(+), 0 deletions(-)

diff --git a/src/views/eam/modules/dailyMaintenanceStandard/DailyMaintenanceStandardModal.vue b/src/views/eam/modules/dailyMaintenanceStandard/DailyMaintenanceStandardModal.vue
new file mode 100644
index 0000000..6088e91
--- /dev/null
+++ b/src/views/eam/modules/dailyMaintenanceStandard/DailyMaintenanceStandardModal.vue
@@ -0,0 +1,951 @@
+<template>
+  <a-modal
+    :title="title"
+    :width="1500"
+    :visible="visible"
+    :maskClosable="false"
+    @ok="handleOk"
+    cancelText="鍏抽棴"
+    @cancel="handleCancel"
+    :confirmLoading="confirmLoading"
+  >
+
+    <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
+                allowClear
+                :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-input-search
+                :disabled="disableSubmit"
+                placeholder="璇烽�夋嫨瀵硅薄閮ㄩ棬"
+                enter-button
+                @search="onDepartList()"
+                :read-only="true"
+                v-decorator="['useDepartName', validatorRules.useDepartName]"
+              /> -->
+              <a-tree-select
+                style="width: 100%"
+                :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
+                :tree-data="treeData"
+                placeholder="璇烽�夋嫨閮ㄩ棬"
+                tree-default-expand-all
+                v-decorator="['departId', validatorRules.useId ]"
+              />
+            </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_equipment,name,id,status!='0' and del_flag!='1'"
+                v-decorator="['equipmentId', validatorRules.equipmentId]"
+                @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-input-search
+                :disabled="disableSubmit"
+                placeholder="璇烽�夋嫨璁惧"
+                enter-button
+                @search="onEquipmentList()"
+                :read-only="true"
+                v-decorator="['equipmentName', validatorRules.equipmentName]"
+              />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              label="璐d换鐝粍"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                allow-clear
+                :disabled="true"
+                :placeholder="disableSubmit?'':'璇疯緭鍏ヨ矗浠荤彮缁�'"
+                v-decorator="['teamName', {} ]"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row
+          hidden
+          :gutter="24"
+        >
+          <a-col :span="12">
+            <a-form-item
+              label="璁惧Id"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                allow-clear
+                :disabled="true"
+                :placeholder="disableSubmit?'':'璇疯緭鍏ヨ澶囩紪鐮�/鍚嶇О/鍨嬪彿'"
+                v-decorator="['equipmentId', validatorRules.equipmentId ]"
+              />
+            </a-form-item>
+          </a-col>
+          <!-- <a-col :span="12">
+            <a-form-item
+              label="瀵硅薄閮ㄩ棬Id"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                allow-clear
+                :disabled="true"
+                :placeholder="disableSubmit?'':'璇疯緭鍏ュ璞¢儴闂╥d'"
+                v-decorator="['departId', validatorRules.useId ]"
+              />
+            </a-form-item>
+          </a-col> -->
+          <a-col :span="12">
+            <a-form-item
+              label="鐝粍Id"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                allow-clear
+                :disabled="true"
+                :placeholder="disableSubmit?'':'璇疯緭鍏ョ彮缁刬d'"
+                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="assign_mode"
+                v-decorator="['assignMode', validatorRules.assignMode]"
+              />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              label="鐗堟湰"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                allowClear
+                :disabled="true"
+                :placeholder="disableSubmit?'':'璇疯緭鍏ョ増鏈彿'"
+                v-decorator="[ 'version', validatorRules.version]"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col
+            v-if="this.isRevise == true"
+            :span="12"
+          >
+            <a-form-item
+              label="鍘嗗彶鐗堟湰"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                allowClear
+                :disabled="true"
+                :placeholder="disableSubmit?'':'璇疯緭鍏ュ巻鍙茬増鏈彿'"
+                v-decorator="[ 'historyVersion', validatorRules.historyVersion]"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :span="24">
+            <a-form-item
+              label="澶囨敞"
+              :labelCol="{span:3}"
+              :wrapperCol="{span:21}"
+            >
+              <a-textarea
+                allowClear
+                :disabled="disableSubmit"
+                :placeholder="disableSubmit?'':'璇疯緭鍏ュ娉�'"
+                v-decorator="[ 'remark', validatorRules.remark]"
+              />
+            </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="sys_depart,depart_name,id,version = '7' and del_flag!='1'"
+                v-decorator="['departId', validatorRules.departId]"
+                @change="(e)=>handle2Change(e)"
+              />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              label="璐d换鐝粍"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                allowClear
+                :disabled="disableSubmit"
+                :placeholder="disableSubmit?'':'璇疯緭鍏ユ爣鍑嗙紪鐮�'"
+                v-decorator="[ 'teamId', validatorRules.teamId]"
+              />
+            </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"
+    >
+      <template
+        v-for="col in columns"
+        :slot="col.dataIndex"
+        slot-scope='text, record, index'
+      >
+        <div :key="col.dataIndex">
+
+          <a-select
+            v-if="col.dataIndex == 'maintenanceCycleId'"
+            :value="text"
+            :options="record.maintenanceCycles"
+            @change="(e) => handleChange(e, record.key, col, index)"
+            style="width: 100%"
+            :disabled="false"
+          />
+          <a-textarea
+            :value="text"
+            v-if="col.dataIndex == 'maintenanceRequire'"
+            :maxLength="500"
+            auto-size
+            placeholder="璇疯緭鍏ュ畨鍏ㄨ姹�"
+            @change="(e)=>handleChange(e, record.key, col, index)"
+          />
+          <a-textarea
+            :value="text"
+            v-if="col.dataIndex == 'location'"
+            :maxLength="500"
+            auto-size
+            placeholder="璇疯緭鍏ヤ繚鍏讳綅缃�"
+            @change="(e)=>handleChange(e, record.key, col, index)"
+            :disabled="true"
+          />
+          <j-image-upload
+            :value="text"
+            v-if="col.dataIndex == 'photo'"
+            :isMultiple="false"
+            auto-size
+            placeholder="璇蜂笂浼犲浘鐗�"
+            @change="(e)=>handleChange(e, record.key, col, index)"
+          >
+          </j-image-upload>
+          <j-dict-select-tag
+            v-if="col.dataIndex == 'maintenanceRole'"
+            :value="text"
+            allow-clear
+            :triggerChange="true"
+            dictCode="maintenance_role"
+            placeholder="璇烽�夋嫨淇濆吇瑙掕壊"
+            style="width: 100%"
+            @change="(e)=>handleChange(e, record.key, col, index)"
+          />
+        </div>
+      </template>
+
+      <span
+        slot="action"
+        slot-scope="text, record, index"
+      >
+        <a-popconfirm
+          title="纭畾鍒犻櫎鍚�?"
+          @confirm="() => handleDelete(text,record, index)"
+        >
+          <a>鍒犻櫎</a>
+        </a-popconfirm>
+      </span>
+
+      <!-- <span
+        slot="photo"
+        slot-scope="text,record"
+      >
+        <Tooltip
+          placement="top"
+          title="棰勮鍥剧墖"
+        >
+          <img
+            v-if=" record.upload.path && (record.upload.format.toLowerCase()=='jpg'||record.upload.format.toLowerCase()=='bmp'||record.upload.format.toLowerCase()=='png'||record.upload.format.toLowerCase()=='jpeg'||record.upload.format.toLowerCase()=='gif')"
+            width="30"
+            height="14"
+            border="1"
+            draggable="false"
+            preview="1"
+            :preview-text="''"
+            :src="record.upload.src"
+          />
+        </Tooltip>
+        <a
+          v-if="record.upload.path && record.upload.format.toLowerCase()=='pdf'"
+          href="javascript:;"
+          @click="view(record.upload)"
+        >
+          棰勮
+        </a>
+
+        <a-divider
+          v-if="record.upload.path && (record.upload.format.toLowerCase()=='jpg'||record.upload.format.toLowerCase()=='bmp'||record.upload.format.toLowerCase()=='png'||record.upload.format.toLowerCase()=='jpeg'||record.upload.format.toLowerCase()=='gif'||record.upload.format.toLowerCase()=='pdf')"
+          type="vertical"
+        />
+        <a
+          href="javascript:;"
+          @click="handleUpload(record)"
+        >涓婁紶</a>
+      </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>
+
+    <pdf-view ref="pdfview"></pdf-view>
+    <upload-model
+      ref="modalForm"
+      @ok="modalFormOk"
+    ></upload-model>
+
+    <equipment-list
+      ref="EquipmentList"
+      @sendEquipmentRecord='sendEquipmentRecord'
+    ></equipment-list>
+
+    <depart-list
+      ref="DepartList"
+      @sendDepartRecord='sendDepartRecord'
+    ></depart-list>
+
+    <j-select-maintenance-standard-modal ref="maintenanceStandardModalForm"></j-select-maintenance-standard-modal>
+  </a-modal>
+
+</template>
+
+<script>
+import { getAction, postAction, requestPut, deleteAction } from '@/api/manage'
+import pick from 'lodash.pick'
+import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
+import { duplicateCheck } from '@/api/api'
+import Tooltip from 'ant-design-vue/es/tooltip'
+import JSelectMaintenanceStandardModal from './JSelectMaintenanceStandardModal'
+import UploadModel from './UploadModel'
+
+import { preview } from 'vue-photo-preview'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
+import Vue from 'vue'
+import PdfView from '@views/common/PdfView'
+import { getFileAccessHttpUrl } from '@/api/manage';
+import EquipmentList from '.././dailyInspectionStandard/EquipmentList'
+import DepartList from '.././dailyInspectionStandard/DepartList'
+
+export default {
+  name: "MaintenanceStandardModal",
+  components: {
+    JMultiSelectTag,
+    Tooltip,
+    JSelectMaintenanceStandardModal,
+    UploadModel,
+    PdfView,
+    preview,
+    EquipmentList,
+    DepartList
+  },
+  data() {
+    return {
+      columns: [
+        {
+          title: '#',
+          dataIndex: '',
+          key: 'rowIndex',
+          align: 'center',
+          customRender: function (t, r, index) {
+            return parseInt(index) + 1
+          },
+          width: 50,
+        },
+        // {
+        //   title: 'id',
+        //   align: 'center',
+        //   dataIndex: 'id'
+        // },
+        {
+          title: '淇濆吇椤圭洰',
+          align: 'center',
+          dataIndex: 'name'
+        },
+
+        {
+          title: '淇濆吇鏍囧噯',
+          align: 'center',
+          dataIndex: 'standard'
+        },
+        {
+          title: '鏂规硶',
+          align: 'center',
+          dataIndex: 'maintenanceMethodName'
+        },
+        {
+          title: '宸ュ叿',
+          align: 'center',
+          dataIndex: 'maintenanceTool'
+        },
+        {
+          title: '缁翠繚涓撲笟',
+          align: 'center',
+          dataIndex: 'maintenanceSpecialtyName'
+        },
+        {
+          title: '瀹夊叏瑕佹眰',
+          align: 'center',
+          dataIndex: 'maintenanceRequire',
+          scopedSlots: { customRender: 'maintenanceRequire' },
+          width: 150,
+        },
+        {
+          title: '宸ユ椂瀹氶',
+          align: 'center',
+          dataIndex: 'workingHourQuota'
+        },
+        {
+          title: '绀烘剰鍥�',
+          align: 'center',
+          dataIndex: 'photo',
+          scopedSlots: { customRender: 'photo' },
+          width: 150,
+        },
+        {
+          title: '淇濆吇閮ㄤ綅',
+          align: 'center',
+          dataIndex: 'location',
+          scopedSlots: { customRender: 'location' },
+          width: 150,
+        },
+        {
+          title: '鍛ㄦ湡',
+          align: 'center',
+          dataIndex: 'maintenanceCycleId',
+          scopedSlots: { customRender: 'maintenanceCycleId' },
+          width: 150,
+        },
+        {
+          title: '淇濆吇瑙掕壊',
+          align: 'center',
+          dataIndex: 'maintenanceRole',
+          scopedSlots: { customRender: 'maintenanceRole' },
+          width: 150,
+        },
+        {
+          title: '鎿嶄綔',
+          align: 'center',
+          dataIndex: 'action',
+          scopedSlots: {
+            customRender: 'action'
+          },
+        }
+      ],
+      title: "鎿嶄綔",
+      visible: false,
+      visible4Confirm: false,
+      disableSubmit: false,
+      codeDisable: true,
+      isRevise: false,
+      model: {},
+      upload: {},
+      maintenanceCycles: {},
+      treeData: [],
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 6 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 18 },
+      },
+      confirmLoading: false,
+      form: this.$form.createForm(this),
+      validatorRules: {
+        num: {
+          rules: [
+            { required: true, message: '璇疯緭鍏ョ紪鐮�!' },
+          ]
+        },
+        teamName: {
+          rules: [
+            { required: true, message: '璇烽�夋嫨璐d换鐝粍!' },
+          ]
+        },
+        useDepartName: {
+          rules: [
+            { required: true, message: '璇烽�夋嫨瀵硅薄閮ㄩ棬!' },
+          ]
+        },
+        equipmentName: {
+          rules: [
+            { required: true, message: '璇烽�夋嫨璁惧!' },
+          ]
+        },
+        assignMode: {
+          rules: [
+            { required: true, message: '璇烽�夋嫨娲惧伐鏂瑰紡!' },
+          ]
+        },
+        version: {
+          rules: [
+            { required: true, message: '璇疯緭鍏ョ増鏈�!' },
+          ]
+        },
+        historyVersion: {
+          rules: [
+            { required: true, message: '璇疯緭鍏ュ巻鍙茬増鏈�!' },
+          ]
+        },
+      },
+      url: {
+        list: "/eam/maintenanceStandardDetail/getMaintenanceStandardDetailListByIds",
+        add: "/eam/maintenanceStandard/add",
+        edit: "/eam/maintenanceStandard/edit",
+        addDetail: "/eam/maintenanceStandardDetail/add",
+        getMaintenanceCycle: "/eam/maintenanceStandardDetail/getMaintenanceCycle",
+        realDelete: "/eam/maintenanceStandardDetail/realDelete",
+        revise: '/eam/maintenanceStandard/revise',
+        getReviseVersion: "/eam/maintenanceStandard/getReviseVersion",
+        loadOptions: '/sys/sysDepart/loadDepartTreeOptions',
+      },
+
+      dataSource: [],
+      departId: '',
+    }
+  },
+
+
+  mounted() {
+    this.$bus.$on('selectionRows', (data) => {
+      for (let i = 0; i < data.length; i++) {
+        let id = this.getUuiD(15);
+        this.dataSource.push({
+          id: id,
+          maintenanceProjectId: data[i].id,
+          name: data[i].name,
+          standard: data[i].standard,
+          maintenanceMethodName: data[i].maintenanceMethod_dictText,
+          maintenanceTool: data[i].maintenanceTool,
+          location: data[i].location,
+          maintenanceSpecialtyName: data[i].maintenanceSpecialtyId_dictText,
+          maintenanceRequire: data[i].maintenanceRequire,
+          workingHourQuota: data[i].workingHourQuota,
+          // upload: this.upload,
+          maintenanceCycles: this.maintenanceCycles,
+        })
+
+        // let formData = {};
+        // this.confirmLoading = true;
+        // formData.maintenanceStandardDetailList = this.dataSource
+        // postAction(this.url.addDetail, formData).then((res) => {
+        //   if (res.success) {
+        //     // this.$message.success(res.message);
+        //     // this.$emit('ok');
+        //   } else {
+        //     // that.$message.warning(res.message);
+        //   }
+        // }).finally(() => {
+        //   this.confirmLoading = false;
+        // })
+
+      }
+    })
+  },
+
+  // created() {
+  //   var upload = {};
+  //   upload.path = null;
+  //   upload.format = 'jpg';
+  //   this.upload = upload;
+  // },
+
+
+  methods: {
+
+    //閫夋嫨淇濆吇椤圭洰
+    selectMaintenanceProjects: function () {
+      let ids = [];
+      for (let i = 0; i < this.dataSource.length; i++) {
+        ids.push(this.dataSource[i].maintenanceProjectId);
+      }
+      this.$refs.maintenanceStandardModalForm.showModals(ids);
+      this.$refs.maintenanceStandardModalForm.title = '閫夋嫨淇濆吇椤圭洰';
+      this.$refs.maintenanceStandardModalForm.disableSubmit = false;
+    },
+
+    add() {
+      this.edit({ maintenanceStandardDetaillist: [] })
+    },
+
+    edit(record) {
+      let that = this;
+      this.initOptions();
+      this.getMaintenanceCycle()
+      this.dataSource = [];
+      this.form.resetFields();
+      this.model = Object.assign({}, record);
+      this.visible = true;
+      if (record.maintenanceStandardDetaillist != undefined) {
+        const temp = [...record.maintenanceStandardDetaillist];
+        // for (let i = 0; i < temp.length; i++) {
+        //   let r = temp[i].upload;
+        //   r.src = this.getSrc(temp[i].upload);
+        // }
+        that.dataSource = temp;
+      }
+      that.$nextTick(() => {
+        that.form.setFieldsValue(pick(that.model, 'num', 'departId', 'teamId', 'equipmentId', 'equipmentName', 'useDepartName', 'useId', 'teamName', 'assignMode', 'version', 'remark'));
+      });
+      if (record.id) {
+        this.codeDisable = true;
+        that.$nextTick(() => {
+          if (that.isRevise) {
+            requestPut(that.url.getReviseVersion, record).then((res) => {
+              if (res.success) {
+                that.form.setFieldsValue({ version: res.result, historyVersion: record.version })
+              }
+            })
+          }
+        }, 200);
+      } else {
+        this.codeDisable = false;
+        that.$nextTick(() => {
+          that.form.setFieldsValue({ "version": "1.0", })
+        });
+      }
+    },
+
+    initOptions() {
+      getAction(this.url.loadOptions).then(res => {
+        if (res.success) {
+          this.treeData = res.result
+        } else {
+          this.$message.warning(res.message)
+        }
+      })
+    },
+
+
+    onEquipmentList() {
+      let data = this.form.getFieldsValue(['departId']);
+      if (data.departId == null || data.departId == "") {
+        this.$message.warning("璇峰厛閫夋嫨瀵硅薄閮ㄩ棬锛�");
+        return
+      }
+      this.$refs.EquipmentList.list(data.departId);
+      this.$refs.EquipmentList.title = "閫夋嫨璁惧淇℃伅";
+    },
+    sendEquipmentRecord(data) {
+      this.dataSource = [];
+      let record = data.record;
+      this.form.setFieldsValue({ equipmentId: record.id, equipmentName: record.num + "/" + record.name + "/" + record.model, teamId: record.teamId, teamName: record.teamId_dictText });
+    },
+
+    onDepartList() {
+      this.$refs.DepartList.list();
+      this.$refs.DepartList.title = "閫夋嫨瀵硅薄閮ㄩ棬";
+    },
+    sendDepartRecord(data) {
+      this.dataSource = [];
+      let record = data.record;
+      this.form.setFieldsValue({ useId: record.id, useDepartName: record.departName, departId: record.id });
+    },
+
+    close() {
+      this.$emit('close');
+      this.visible = false;
+    },
+
+    handleCancel() {
+      this.realDelete()
+      this.close();
+    },
+
+    handleOk() {
+      console.log("123")
+      const that = this;
+      this.form.validateFields((err, values) => {
+        if (!err) {
+          that.confirmLoading = true;
+          let formData = Object.assign(this.model, values);
+          if (that.dataSource.length === 0) {
+            that.$message.warning("璇烽�夋嫨淇濆吇椤圭洰锛�");
+            that.confirmLoading = false;
+            return
+          }
+          formData.maintenanceStandardDetaillist = that.dataSource;
+          formData.type = 'daily';
+          let obj;
+          if (!this.model.id) {
+            formData.versionStatus = '1'
+            obj = postAction(this.url.add, formData);
+          } else {
+            if (this.isRevise) {
+              formData.versionStatus = '1'
+              obj = postAction(this.url.revise, formData);
+            } else {
+              obj = requestPut(this.url.edit, formData, { id: this.model.id });
+            }
+          }
+          obj.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();
+          })
+        }
+      })
+    },
+
+    handleDelete(text, record, index) {
+      this.dataSource.splice(index, 1);
+    },
+
+    realDelete() {
+      var that = this
+      deleteAction(that.url.realDelete).then(res => {
+        if (res.success) {
+          //閲嶆柊璁$畻鍒嗛〉闂
+          // that.reCalculatePage(1)
+          // that.$message.success(res.message)
+          // that.loadData()
+        } else {
+          // that.$message.warning(res.message)
+        }
+      })
+    },
+
+    getMaintenanceCycle() {
+      getAction(this.url.getMaintenanceCycle).then((res) => {
+        if (res.success) {
+          this.maintenanceCycles = res.result
+        }
+      })
+    },
+
+    handle2Change(val) {
+      this.dataSource = [];
+    },
+
+    handleChange(value, key, column, index) {
+      let that = this;
+      const temp = [...that.dataSource];
+      const target = temp.filter(item => key === item.key)[index];
+      if (target) {
+        if (column.dataIndex == 'maintenanceCycleId') {
+          target[column.dataIndex] = value;
+        }
+        if (column.dataIndex == 'maintenanceRequire') {
+          target[column.dataIndex] = value.target.value;
+        }
+        if ('photo' == column.dataIndex) {
+          target['photo'] = value;
+        }
+        if (column.dataIndex == 'location') {
+          target[column.dataIndex] = value.target.value;
+        }
+        if (column.dataIndex == 'maintenanceRole') {
+          target[column.dataIndex] = value;
+        }
+        //鏄剧ず甯﹁繃鏉ョ殑鏁版嵁
+        that.dataSource = temp;
+      }
+    },
+
+    handleUpload: function (record) {
+      this.$refs.modalForm.edit(record);
+      this.$refs.modalForm.title = "鏂囦欢涓婁紶";
+      this.$refs.modalForm.disableSubmit = false;
+    },
+
+    modalFormOk() {
+      let ids = [];
+      for (let i = 0; i < this.dataSource.length; i++) {
+        ids.push(this.dataSource[i].id);
+      }
+      postAction(this.url.list, { ids: ids }).then(res => {
+        if (res.success) {
+
+          this.dataSource = res.result.records || res.result
+          for (let i = 0; i < this.dataSource.length; i++) {
+            let r = this.dataSource[i].upload;
+            r.src = this.getSrc(this.dataSource[i].upload);
+          }
+
+        } else {
+          this.$message.warning(res.message)
+        }
+      })
+    },
+
+    getSrc(record) {
+
+      if (!record.path) {
+        return '';
+      }
+      //鏈湴锛歭ocal\Minio锛歮inio\闃块噷浜戯細alioss
+      if (record.uploadType == 'local') {
+
+        let ssoLoginFlag = Vue.ls.get("ssoLoginFlag");
+        let deployMode = Vue.ls.get("deployMode");
+
+        if (ssoLoginFlag && deployMode == "container") {
+          var baseProject = Vue.ls.get("baseProject");
+          console.log("baseProject==>" + baseProject)
+
+          var hostname = window.location.protocol + "//" + window.location.host;
+          var url = hostname + '/' + baseProject + '/sys/common/static';
+          return getFileAccessHttpUrl(record.path + record.encodeName, url, window._CONFIG['hyperTextTransfer'])
+        } else {
+          //鏍规嵁鍙戝竷鐘舵�佷慨鏀筯ttps 鎴� http
+          return getFileAccessHttpUrl(record.path + record.encodeName, this.url.urlDownload, window._CONFIG['hyperTextTransfer'])
+        }
+
+      } else if (record.uploadType == 'alioss') {
+
+        const OSS = require('ali-oss')
+        const client = new OSS({
+          // region浠ユ澀宸炰负渚嬶紙oss-cn-hangzhou锛夛紝鍏朵粬region鎸夊疄闄呮儏鍐靛~鍐欍��
+          region: window._CONFIG['region'],
+          // 闃块噷浜戜富璐﹀彿AccessKey鎷ユ湁鎵�鏈堿PI鐨勮闂潈闄愶紝椋庨櫓寰堥珮銆傚己鐑堝缓璁偍鍒涘缓骞朵娇鐢≧AM璐﹀彿杩涜API璁块棶鎴栨棩甯歌繍缁达紝璇风櫥褰昍AM鎺у埗鍙板垱寤篟AM璐﹀彿銆�
+          accessKeyId: window._CONFIG['accessKeyId'],
+          accessKeySecret: window._CONFIG['accessKeySecret'],
+          bucket: window._CONFIG['bucket'],
+        })
+        // object-key琛ㄧず浠嶰SS涓嬭浇鏂囦欢鏃堕渶瑕佹寚瀹氬寘鍚枃浠跺悗缂�鍦ㄥ唴鐨勫畬鏁磋矾寰勶紝渚嬪abc/efg/123.jpg銆�
+        return client.signatureUrl(record.path)
+      }
+    },
+
+    view(record) {
+      this.$refs.pdfview.showPdf(record.src);
+    },
+
+    getUuiD(randomLength) {
+      return Number(
+        Math.random()
+          .toString()
+          .substr(2, randomLength) + Date.now()
+      ).toString(36)
+    },
+
+  },
+}
+</script>
+
+<style lang="less" scoped>
+/deep/ .frozenRowClass {
+  color: #c9c9c9;
+}
+.fontweight {
+  font-weight: bold;
+}
+.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