qushaowei
2024-03-28 e7eca504e167de53fd97e5c2cc1fc039a8e758cc
src/views/eam/modules/daily3MaintenanceOrder/Maintenance3ReceiptModal.vue
@@ -7,14 +7,20 @@
    cancelText="关闭"
    @cancel="handleCancel"
    :confirmLoading="confirmLoading"
    title="附录4"
  >
    <!-- :title="title" -->
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <span
          class="ant-descriptions-title"
          style="font-size: large;font-size: 15px;float: right;"
        >{{this.model.receiptsNum}}</span>
        <a-divider
          orientation="center"
          style="font-size: large;font-style: normal;font-size: 30px;color: #66aeed;"
        > 生产设备三级保养验收单 </a-divider>
        > {{this.model.receiptsName}} </a-divider>
        <!-- 生产设备三级保养验收单 -->
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-item
@@ -77,6 +83,7 @@
                auto-size
                placeholder="请输入保养内容"
                @change="(e)=>handleChange(e, record.key, col, index)"
                :disabled="true"
              />
              <a-textarea
                :value="text"
@@ -85,7 +92,7 @@
                auto-size
                placeholder="请输入保养标准"
                @change="(e)=>handleChange(e, record.key, col, index)"
                :disabled="false"
                :disabled="true"
              />
              <a-select
                v-if="col.dataIndex == 'firstInspect'"
@@ -96,6 +103,13 @@
                <a-select-option value="1">通过</a-select-option>
                <a-select-option value="2">未通过</a-select-option>
              </a-select>
              <a-input
                v-if="col.dataIndex == 'firstInspect' && record.firstInspect == '2'"
                :value="record.firstNotPass"
                @change="(e)=>handleChange2(e, record.key, col, index)"
                :disabled="false"
                placeholder="请填写验收未通过原因"
              />
              <a-select
                v-if="col.dataIndex == 'secondInspect'"
                :value="text"
@@ -105,35 +119,32 @@
                <a-select-option value="1">通过</a-select-option>
                <a-select-option value="2">未通过</a-select-option>
              </a-select>
              <!-- <a-input
                v-if="col.dataIndex == 'secondInspect' && record.secondInspect == '2'"
                :value="record.secondNotPass"
                @change="(e)=>handleChange2(e, record.key, col, index)"
                :disabled="false"
                placeholder="请填写验收未通过原因"
              /> -->
            </div>
          </template>
        </a-table>
        <!-- <div :style="{height: '140px',width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-item
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                label="验收结果"
              >
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col :span="24">
              <a-form-item
                :labelCol="{span:3}"
                :wrapperCol="{span:21}"
                label="备注"
                label="验收未通过原因"
              >
                <a-textarea
                  allow-clear
                  :rows='5'
                  :disabled="disableSubmit"
                  :placeholder="disableSubmit?'':'请输入备注'"
                  v-decorator="['remark', {}]"
                  :placeholder="disableSubmit?'':'请输入验收未通过原因'"
                  v-decorator="['notPassReason', {}]"
                />
              </a-form-item>
            </a-col>
          </a-row>
@@ -234,6 +245,23 @@
          dataIndex: 'standard',
          scopedSlots: { customRender: 'standard' }
        },
        // {
        //   title: '验收次数',
        //   children: [
        //     {
        //       title: '第一次检',
        //       dataIndex: 'firstInspect',
        //       align: 'center',
        //       scopedSlots: { customRender: 'firstInspect' }
        //     },
        //     {
        //       title: '第二次检',
        //       dataIndex: 'secondInspect',
        //       align: 'center',
        //       scopedSlots: { customRender: 'secondInspect' }
        //     },
        //   ],
        // },
        {
          title: '第一次检',
          align: 'center',
@@ -268,6 +296,7 @@
        add: "/eam/maintenanceThreeAcceptance/add",
        getMaintenance3Receipt: "/eam/maintenanceThreeAcceptance/getMaintenanceThreeAcceptanceList",
        list: "/eam/dailyMaintenanceOrder/getMaintenanceCycleByStandardId",
        getSysFileName: "/eam/sysFileName/getSysFileName",
      },
    }
  },
@@ -280,12 +309,15 @@
    edit(record) {
      let that = this;
      if (record.receipts == "" || record.receipts == null) {
        this.getSysFileName()
      }
      this.form.resetFields();
      this.model = Object.assign({}, record);
      this.visible = true;
      this.getMaintenance3Receipt()
      that.$nextTick(() => {
        // that.form.setFieldsValue(pick(that.model, 'num', 'teamId', 'remark'));
        that.form.setFieldsValue(pick(that.model, 'notPassReason'));
      });
    },
@@ -311,6 +343,13 @@
      const that = this;
      // 触发表单验证
      for (let i = 0; i < that.dataSource.length; i++) {
        let o = that.dataSource[i]
        if (o.firstInspect == "2" && o.secondInspect == "2") {
          that.$message.warning("验收单第" + (i + 1) + "行,两次检验均为不通过,请重新检验该项保养内容!");
          return
        }
      }
      that.form.validateFields((err, values) => {
        if (!err) {
          this.$confirm({
@@ -355,7 +394,7 @@
          target['standard'] = value.target.value;
        }
        if (column.dataIndex == 'firstInspect') {
          target[column.dataIndex] = value;
          target["firstInspect"] = value;
        }
        if (column.dataIndex == 'secondInspect') {
          target[column.dataIndex] = value;
@@ -365,6 +404,32 @@
      }
    },
    handleChange2(value, key, column, index, record) {
      let that = this;
      const temp = [...that.dataSource];
      const target = temp.filter(item => key === item.key)[index];
      if (target) {
        // target[column.dataIndex] = value;
        if ('firstInspect' == column.dataIndex) {
          target['firstNotPass'] = value.target.value;
        }
        // if ('secondInspect' == column.dataIndex) {
        //   target['secondNotPass'] = value.target.value;
        // }
        //显示带过来的数据
        that.dataSource = temp;
      }
    },
    getSysFileName() {
      getAction(this.url.getSysFileName, { name: '19' }).then((res) => {
        if (res.success) {
          this.model = Object.assign(this.model, res.result[0]);
        }
      })
    },
  },
}
</script>