From bb2db0bb61ab0deac5c03a94b68c5fd833d8ee44 Mon Sep 17 00:00:00 2001
From: “linengliang” <vanSuperEnergy@163.com>
Date: 星期二, 17 十月 2023 17:29:43 +0800
Subject: [PATCH] 保养变更申请单

---
 src/views/eam/EquipmentMaintenancePlanList.vue                       |    4 
 src/views/eam/modules/maintenancePlan/MaintenancePlanChangeModel.vue |  368 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/views/eam/EquipmentMaintenancePlanDetailList.vue                 |   37 +++-
 3 files changed, 397 insertions(+), 12 deletions(-)

diff --git a/src/views/eam/EquipmentMaintenancePlanDetailList.vue b/src/views/eam/EquipmentMaintenancePlanDetailList.vue
index c500bf0..4b92518 100644
--- a/src/views/eam/EquipmentMaintenancePlanDetailList.vue
+++ b/src/views/eam/EquipmentMaintenancePlanDetailList.vue
@@ -61,11 +61,11 @@
         </template>
 
         <span slot="action" slot-scope="text, record">
-          <a @click="handleEdit(record)">缂栬緫</a>
-          <a-divider type="vertical" />
+          <!-- <a-divider type="vertical" />
           <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
             <a>鍒犻櫎</a>
-          </a-popconfirm>
+          </a-popconfirm>  -->
+          <a @click="handleEdit(record)" :disabled="mainStatus!=='distributed'">璁″垝鍙樻洿</a>
         </span>
         <span
           slot="num"
@@ -79,19 +79,26 @@
       </a-table>
     </div>
     <standard-detail-model :mainId="standardId" ref="standardDetail"></standard-detail-model>
+    <maintenance-plan-change-model ref="modalForm" @ok="modalFormOk"></maintenance-plan-change-model>
   </a-card>
 </template>
 
 <script>
 
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
-  import StandardDetailModel from './modules/maintenancePlan/StandardDetailModel.vue'
+  import StandardDetailModel from './modules/maintenancePlan/StandardDetailModel'
+  import MaintenancePlanChangeModel from './modules/maintenancePlan/MaintenancePlanChangeModel.vue'
   export default {
     name: "EquipmentMaintenancePlanDetailList",
     mixins:[JeecgListMixin],
-    components: {StandardDetailModel},
+    components: {StandardDetailModel, MaintenancePlanChangeModel},
     props:{
       mainId:{
+        type:String,
+        default:'',
+        required:false
+      },
+      mainStatus:{
         type:String,
         default:'',
         required:false
@@ -130,39 +137,47 @@
             title:'淇濆吇鏍囧噯',
             align:"center",
             dataIndex: 'standardNum',
-            width:300,
+            width:250,
             scopedSlots: { customRender: 'num' }
           },
           {
             title:'璁惧缁熶竴缂栫爜',
             align:"center",
             dataIndex: 'equipmentNum',
-            width:300,
+            width:250,
           },
           {
             title:'璁惧鍚嶇О',
             align:"center",
             dataIndex: 'equipmentName',
-            width:300,
+            width:250,
           },
           {
             title:'璁惧鍨嬪彿',
             align:"center",
             dataIndex: 'model',
-            width:300,
+            width:250,
           },
           {
             title:'璁″垝寮�濮嬫椂闂�',
             align:"center",
             dataIndex: 'planStartTime',
-            width:300,
+            width:280,
           },
           {
             title:'璁″垝缁撴潫鏃堕棿',
             align:"center",
             dataIndex: 'planEndTime',
-            width:300,
+            width:280,
           },
+          {
+            title: '鎿嶄綔',
+            dataIndex: 'action',
+            align:"center",
+            fixed:"right",
+            width:200,
+            scopedSlots: { customRender: 'action' },
+          }
         ],
         url: {
           list: "/eam/equipmentMaintenancePlan/listEquipmentMaintenancePlanDetailByMainId",
diff --git a/src/views/eam/EquipmentMaintenancePlanList.vue b/src/views/eam/EquipmentMaintenancePlanList.vue
index edbe67b..cd119cb 100644
--- a/src/views/eam/EquipmentMaintenancePlanList.vue
+++ b/src/views/eam/EquipmentMaintenancePlanList.vue
@@ -102,7 +102,7 @@
 
     <a-tabs defaultActiveKey="1">
       <a-tab-pane tab="淇濆吇璁″垝鏄庣粏" key="1" >
-        <EquipmentMaintenancePlanDetailList :mainId="equipmentMaintenancePlanDetailMainId" />
+        <EquipmentMaintenancePlanDetailList :mainId="equipmentMaintenancePlanDetailMainId" :mainStatus="mainStatus" />
       </a-tab-pane>
     </a-tabs>
 
@@ -221,6 +221,7 @@
         selectedMainId:'',
         superFieldList:[],
         equipmentMaintenancePlanDetailMainId: '',
+        mainStatus:'',
       }
     },
     created() {
@@ -253,6 +254,7 @@
         this.selectedRowKeys = selectedRowKeys;
         this.selectionRows = selectionRows;
         this.equipmentMaintenancePlanDetailMainId = selectionRows[0]['id']
+        this.mainStatus = selectionRows[0]['status']
       },
       loadData(arg) {
         if(!this.url.list){
diff --git a/src/views/eam/modules/maintenancePlan/MaintenancePlanChangeModel.vue b/src/views/eam/modules/maintenancePlan/MaintenancePlanChangeModel.vue
new file mode 100644
index 0000000..e509fb5
--- /dev/null
+++ b/src/views/eam/modules/maintenancePlan/MaintenancePlanChangeModel.vue
@@ -0,0 +1,368 @@
+<template>
+  <a-modal
+    :width="1250"
+    :visible="visible"
+    :maskClosable="false"
+    :confirmLoading="confirmLoading"
+    @ok="handleOk"
+    @cancel="handleCancel"
+    cancelText="鍏抽棴"
+  >
+    <!-- :title="title" -->
+
+    <a-spin :spinning="confirmLoading">
+      <a-form :form="form">
+        <a-divider
+          orientation="center"
+          style="font-size: large;font-style: normal;font-size: 30px;color: #66aeed;"
+        > 鐢熶骇璁惧淇濆吇璁″垝鍙樻洿鐢宠鍗� </a-divider>
+
+        <a-row :gutter="24">
+          <a-col :lg="12">
+            <a-form-item
+              label="璁惧鍚嶇О:"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                :disabled="true"
+                allow-clear
+                placeholder="璇疯緭鍏ヨ澶囧悕绉�"
+                v-decorator="['equipmentName', validatorRules.equipmentName ]"
+              />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              label="鍨嬪彿:"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                :disabled="true"
+                allow-clear
+                placeholder="璇疯緭鍏ュ瀷鍙�"
+                v-decorator="['equipmentModel', validatorRules.equipmentModel ]"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+
+        <a-row :gutter="24">
+          <a-col :lg="12">
+            <a-form-item
+              label="缁熶竴缂栧彿:"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                :disabled="true"
+                allow-clear
+                placeholder="璇疯緭鍏ョ粺涓�缂栧彿"
+                v-decorator="['equipmentNum', validatorRules.equipmentNum ]"
+              />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              label="鍘熻鍒掓椂闂�:"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <j-date
+                :disabled="true"
+                v-decorator="['planStartTime', validatorRules.planStartTime ]"
+                placeholder="璇烽�夋嫨鏃ユ湡"
+                style="width: 100%"
+                :showTime="true"
+                dateFormat="YYYY-MM-DD HH:mm:ss"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :lg="12">
+            <a-form-item
+              label="鐢宠鍗曚綅:"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                allow-clear
+                placeholder="璇疯緭鍏ョ敵璇峰崟浣�"
+                v-decorator="['applyUnit', validatorRules.applyUnit ]"
+              />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item
+              label="鏃ユ湡:"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <j-date
+                v-decorator="['applyTime', validatorRules.applyTime ]"
+                placeholder="璇烽�夋嫨鏃ユ湡"
+                style="width: 100%"
+                :showTime="true"
+                dateFormat="YYYY-MM-DD"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :lg="12">
+            <a-form-item
+              label="璁″垝鍛�:"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <a-input
+                allow-clear
+                placeholder="璇疯緭鍏ヨ鍒掑憳"
+                v-decorator="['planUser', validatorRules.planUser ]"
+              />
+            </a-form-item>
+          </a-col>
+
+          <a-col :span="12">
+            <a-form-item
+              label="鐢宠寤朵繚鏃堕棿:"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <j-date
+                v-decorator="['planDelayTime', validatorRules.planDelayTime ]"
+                placeholder="璇烽�夋嫨鏃ユ湡"
+                style="width: 100%"
+                :showTime="true"
+                dateFormat="YYYY-MM-DD HH:mm:ss"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-model-item
+              label="涓婁紶"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <!-- prop="file" -->
+              <j-upload
+                :returnUrl="false"
+                :isMultiple="false"
+                v-decorator="['annex', validatorRules.annex]"
+              ></j-upload>
+
+              <!-- v-model="model.annex" -->
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :span="24">
+            <a-form-item
+              :labelCol="{span:3}"
+              :wrapperCol="{span:21}"
+              label="寤朵繚锛堟垨鍙樻洿锛夊師鍥�:"
+            >
+              <a-textarea
+                placeholder="璇疯緭鍏ュ欢淇濓紙鎴栧彉鏇达級鍘熷洜"
+                allow-clear
+                rows="4"
+                v-decorator="['delayReason', validatorRules.delayReason]"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+
+      </a-form>
+    </a-spin>
+
+    <template slot="footer">
+      <a-button
+        :style="{marginRight: '8px'}"
+        @click="handleCancel"
+      >
+        鍏抽棴
+      </a-button>
+      <a-button
+        :disabled="confirmLoading"
+        :loading="confirmLoading"
+        @click="handleOk"
+        type="primary"
+      >纭畾</a-button>
+    </template>
+
+  </a-modal>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { getAction, postAction, requestPut } from '@/api/manage'
+import { duplicateCheck } from '@/api/api'
+
+export default {
+  name: 'MaintenanceOrderChangeModal',
+  data() {
+    return {
+      title: "鎿嶄綔",
+      visible: false,
+      model: {},
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 6 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 18 },
+      },
+      confirmLoading: false,
+      form: this.$form.createForm(this),
+      validatorRules: {
+        applyUnit: {
+          rules: [
+            { required: true, message: '璇疯緭鍏ョ敵璇峰崟浣�!' },
+          ]
+        },
+        applyTime: {
+          rules: [
+            { required: true, message: '璇疯緭鍏ョ敵璇锋棩鏈�!' },
+          ]
+        },
+        annex: {
+          rules: [
+            { required: true, message: '璇蜂笂浼犻檮浠�!' },
+          ]
+        },
+        planUser: {
+          rules: [
+            { required: true, message: '璇疯緭鍏ヨ鍒掑憳!' },
+          ]
+        },
+        planDelayTime: {
+          rules: [
+            { required: true, message: '璇烽�夋嫨鐢宠寤朵繚鏃堕棿!' },
+          ]
+        },
+        delayReason: {
+          rules: [
+            { required: true, message: '璇疯緭鍏ュ欢淇濆師鍥�!' },
+          ]
+        },
+      },
+      url: {
+        add: "/eam/planChangeApply/addForPlan",
+      },
+    }
+  },
+  created() {
+  },
+  methods: {
+
+    edit(record) {
+      this.form.resetFields();
+      this.model = Object.assign({}, record);
+      this.visible = true;
+      this.$nextTick(() => {
+        this.form.setFieldsValue(pick(this.model, 'equipmentNum', 'equipmentName', 'model','planId', 'planStartTime'));
+        this.form.setFieldsValue({ applyTime: record.currentDateTime });
+      });
+    },
+
+
+    handleOk() {
+
+      const that = this;
+      // 瑙﹀彂琛ㄥ崟楠岃瘉
+      that.form.validateFields((err, values) => {
+        if (!err) {
+          this.$confirm({
+            title: '璁″垝鍙樻洿',
+            content: '鎻愮ず锛氳鍒掑彉鏇村悗灏嗗欢闀夸繚鍏昏鍒掑紑濮嬫椂闂达紝璇疯皑鎱庢搷浣滐紒',
+            okText: '纭',
+            cancelText: '鍙栨秷',
+            onOk() {
+              let formData = Object.assign(that.model, values);
+              that.confirmLoading = true;
+              // formData.annexName = that.model.annex[0].fileName;
+              // formData.annexSize = that.model.annex[0].fileSize;
+              // formData.annexPath = that.model.annex[0].filePath;
+              formData.annexName = formData.annex[0].fileName;
+              formData.annexSize = formData.annex[0].fileSize;
+              formData.annexPath = formData.annex[0].filePath;
+              postAction(that.url.add, formData).then((res) => {
+                if (res.success) {
+                  that.$message.success(res.message);
+                  that.$emit('ok', new Date());
+                } else {
+                  that.$message.warning(res.message);
+                }
+              }).finally(() => {
+                that.confirmLoading = false;
+                that.close();
+              })
+            },
+          })
+        }
+      })
+    },
+
+    // handleOk() {
+    //   const that = this;
+    //   // 瑙﹀彂琛ㄥ崟楠岃瘉
+    //   that.form.validateFields((err, values) => {
+    //     if (!err) {
+    //       let formData = Object.assign(this.model, values);
+    //       that.confirmLoading = true;
+    //       formData.id = "";
+    //       postAction(that.url.add, formData).then((res) => {
+    //         if (res.success) {
+    //           that.$message.success(res.message);
+    //           that.$emit('ok', new Date());
+    //         } else {
+    //           that.$message.warning(res.message);
+    //         }
+    //       }).finally(() => {
+    //         that.confirmLoading = false;
+    //         that.close();
+    //       })
+
+    //     }
+    //   })
+    // },
+
+    handleCancel() {
+      this.close();
+    },
+
+    close() {
+      this.$emit('close');
+      this.visible = false;
+    },
+  }
+
+}
+</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