Browse Source

送检反馈——表单编辑

LLL 1 year ago
parent
commit
7c762c7707
1 changed files with 126 additions and 41 deletions
  1. 126 41
      src/views/module_cmms/submission/modulesFK/SubmissionEquipmentFormFK.vue

+ 126 - 41
src/views/module_cmms/submission/modulesFK/SubmissionEquipmentFormFK.vue

@@ -30,17 +30,57 @@
     </div>
     <!-- 查询区域-END -->
 
-    <a-table
-      ref="table"
-      size="small"
-      :scroll="{x:true}"
-      bordered
-      rowKey="id"
-      :columns="columns"
-      :dataSource="sjsbdataPoint"
-      :pagination="false"
-      class="j-table-force-nowrap">
-    </a-table>
+<!--    <a-button @click="handleFK">提交反馈</a-button>-->
+    <a-form-model
+      :model="formModel"
+      :rules="formRules"
+      ref="form">
+      <a-form-item>
+        <a-table
+          size="small"
+          :scroll="{x:true}"
+          bordered
+          rowKey="id"
+          :columns="columns"
+          :dataSource="formModel.sjsbdataPoint"
+          :pagination="false"
+          class="j-table-force-nowrap">
+
+          <template slot="remark" slot-scope="text, record,index">
+            <a-form-model-item :prop="'sjsbdataPoint.'+index+'.remark'" :rules="formRules.remark" style="margin-bottom: 0px;">
+              <a-input v-model="record.remark" placeholder="请输入备注"></a-input>
+            </a-form-model-item>
+          </template>
+          <template slot="teamConfirm" slot-scope="text, record,index">
+            <a-form-model-item :prop="'sjsbdataPoint.'+index+'.teamConfirm'" :rules="formRules.teamConfirm" style="margin-bottom: 0px;">
+              <a-input v-model="record.teamConfirm" placeholder="请输入班组确认"></a-input>
+            </a-form-model-item>
+          </template>
+          <template slot="submissionReturnDate" slot-scope="text, record,index">
+            <a-form-model-item :prop="'sjsbdataPoint.'+index+'.submissionReturnDate'" :rules="formRules.submissionReturnDate" style="margin-bottom: 0px;">
+              <a-date-picker placeholder="请选择送回日期"  v-model="record.submissionReturnDate" :show-time="true" value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
+            </a-form-model-item>
+          </template>
+          <template slot="submissionDate" slot-scope="text, record,index">
+            <a-form-model-item :prop="'sjsbdataPoint.'+index+'.submissionDate'" :rules="formRules.submissionDate" style="margin-bottom: 0px;">
+              <a-date-picker placeholder="请选择检定日期"  v-model="record.submissionDate" :show-time="true" value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
+            </a-form-model-item>
+          </template>
+
+          <template slot="submissionStatus" slot-scope="text, record,index">
+            <a-form-model-item :prop="'sjsbdataPoint.'+index+'.submissionStatus'" :rules="formRules.submissionStatus" style="margin-bottom: 0px;">
+              <j-dict-select-tag placeholder="请选择送检状态" v-model="record.submissionStatus" dictCode="submission_status"/>
+            </a-form-model-item>
+          </template>
+          <template slot="submissionResult" slot-scope="text, record,index">
+            <a-form-model-item :prop="'sjsbdataPoint.'+index+'.submissionResult'" :rules="formRules.submissionResult" style="margin-bottom: 0px;">
+              <j-dict-select-tag placeholder="请选择检定结果" v-model="record.submissionResult" dictCode="device_verification_result"/>
+            </a-form-model-item>
+          </template>
+
+        </a-table>
+      </a-form-item>
+    </a-form-model>
   </div>
 </template>
 
@@ -64,15 +104,18 @@ export default {
       csId: '',
       //送检工单设备查询参数
       queryParam: {},
-      // 送检设备及相关数据
-      sjsbdataPoint: [],
-      model:{
+      // // 送检设备及相关数据
+      // sjsbdataPoint: [],
+      formModel: {
+        // 送检设备及相关数据
+        sjsbdataPoint: [],
       },
+      formRules:{},
       description: '送检工单设备表管理页面',
       // 表头
       columns: [
         {
-          title: '#',
+          title: '序号',
           dataIndex: '',
           key:'rowIndex',
           width:60,
@@ -81,11 +124,11 @@ export default {
             return parseInt(index)+1;
           }
         },
-        {
-          title:'送检工单id',
-          align:"center",
-          dataIndex: 'cmmsSubmissionId'
-        },
+        // {
+        //   title:'送检工单id',
+        //   align:"center",
+        //   dataIndex: 'cmmsSubmissionId'
+        // },
         {
           title:'设备',
           align:"center",
@@ -94,71 +137,113 @@ export default {
         {
           title:'检定日期',
           align:"center",
-          dataIndex: 'submissionDate'
+          dataIndex: 'submissionDate',
+          scopedSlots: { customRender: 'submissionDate' }
         },
         {
           title:'检定结果',
           align:"center",
-          dataIndex: 'submissionResult_dictText'
-        },
-        {
-          title:'有效日期',
-          align:"center",
-          dataIndex: 'submissionEffectiveDate'
+          width:90,
+          dataIndex: 'submissionResult_dictText',
+          scopedSlots: { customRender: 'submissionResult' }
         },
         {
           title:'班组确认',
           align:"center",
-          dataIndex: 'teamConfirm'
+          dataIndex: 'teamConfirm',
+          scopedSlots: { customRender: 'teamConfirm' }
         },
         {
           title:'备注',
           align:"center",
-          dataIndex: 'remark'
+          dataIndex: 'remark',
+          scopedSlots: { customRender: 'remark' }
         },
         {
           title:'送检状态',
           align:"center",
-          dataIndex: 'submissionStatus_dictText'
+          width:100,
+          dataIndex: 'submissionStatus_dictText',
+          scopedSlots: { customRender: 'submissionStatus' }
         },
         {
           title:'送回日期',
           align:"center",
-          dataIndex: 'submissionReturnDate'
+          dataIndex: 'submissionReturnDate',
+          scopedSlots: { customRender: 'submissionReturnDate' }
         },
         {
-          title: '操作',
-          dataIndex: 'action',
+          title:'有效日期',
           align:"center",
-          fixed:"right",
-          width:147,
-          scopedSlots: { customRender: 'fk' }
-        }
+          dataIndex: 'submissionEffectiveDate'
+        },
+        // {
+        //   title: '操作',
+        //   dataIndex: 'action',
+        //   align:"center",
+        //   fixed:"right",
+        //   width:147,
+        //   scopedSlots: { customRender: 'fk' }
+        // }
       ],
       url: {
         list: "/cmmsSubmissionEquipment/cmmsSubmissionEquipment/list",
-
+        fk: "/cmmsSubmissionEquipment/cmmsSubmissionEquipment/fk",
       },
     }
   },
   methods: {
+    handleFK(){
+    },
     getSJSBOptions(cmmsSubmissionId) {
       this.csId = cmmsSubmissionId
       getAction(this.url.list, {cmmsSubmissionId:cmmsSubmissionId}).then((res) => {
-        this.sjsbdataPoint = res.result.records
+        this.formModel.sjsbdataPoint = res.result.records
       })
     },
     getSJSBOptions2() {
       this.queryParam.cmmsSubmissionId = this.csId
       getAction(this.url.list, this.queryParam).then((res) => {
-        this.sjsbdataPoint = res.result.records
+        this.formModel.sjsbdataPoint = res.result.records
       })
     },
     getSJSBOptions3() {
       this.queryParam = {}
       this.queryParam.cmmsSubmissionId = this.csId
       getAction(this.url.list, this.queryParam).then((res) => {
-        this.sjsbdataPoint = res.result.records
+        this.formModel.sjsbdataPoint = res.result.records
+      })
+    },
+    submitForm () {
+      const that = this;
+      // 触发表单验证
+      this.$refs.form.validate(valid => {
+        if (valid) {
+          that.confirmLoading = true;
+          let httpurl = '';
+          let method = '';
+          httpurl+=this.url.fk;
+          method = 'put';
+          // if(!this.model.id){
+          //   httpurl+=this.url.add;
+          //   method = 'post';
+          // }else{
+          //   httpurl+=this.url.edit;
+          //   method = 'put';
+          // }
+          console.log("this.formModel.sjsbdataPoint",this.formModel.sjsbdataPoint)
+          httpAction(httpurl,this.formModel.sjsbdataPoint,method).then((res)=>{
+            if(res.success){
+              that.$message.success(res.message);
+              that.$emit('ok');
+            }else{
+              that.$message.warning(res.message);
+            }
+          }).finally(() => {
+            that.confirmLoading = false;
+          })
+        }
+
       })
     },
   }