correlationDialog.vue 7.68 KB
<template>
  <div>
    <GLDialog bigTitle="关联技师"
              :visible.sync="dialogShow"
              class="detail-content-warn"
              width="700px"
              mode="big"
              :close-on-click-modal="false"
              :before-close="handleClose"
              @onOk="handleAddConfirm"
              @onCancel="dialogShow = false">
      <div v-loading="loading">
        <div class="form_div">
          <div class="tipsDiv">
            <div class="tipsText">
              <img src="../images/icon-warning.png"
                   class="imgCla" />
              首次登记出库将标记为出库时间,若产生物料多退少补请更正实际出库数量
            </div>
          </div>
          <el-form label-width="160px"
                   :model="infoForm"
                   ref="editRef"
                   :rules="formRules"
                   :inline="true">
            <el-form-item label="选择领料技师:"
                          prop="technician">
              <el-select v-model="infoForm.technician"
                         filterable
                         placeholder="请选择"
                         class="default-width">
                <el-option v-for="(item, key) in baseData.technicianList"
                           :key="key"
                           :label="item.staffName"
                           :value="item.staffPhone"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="出库商品:">
              {{ paramsObj.upgradeGoodsName }}
            </el-form-item>
            <el-form-item label="实际出库数量:"
                          prop="reduceStockNum">
              <el-input-number v-model="infoForm.reduceStockNum"
                               placeholder="输入数值"
                               :precision="2"
                               :step="0.01"
                               :min="0"
                               :max="999999.99"></el-input-number>
              <span class="unit">{{ infoForm.unit }}</span>
            </el-form-item>
            <el-form-item label="备注:">
              <el-input v-model="infoForm.remark"
                        type="textarea"
                        maxlength="50"
                        placeholder="请输入备注"
                        show-word-limit
                        :rows="4"
                        class="default-width" />
            </el-form-item>
          </el-form>
        </div>
      </div>
    </GLDialog>
  </div>
</template>

<script>
import { baseConfig } from '@/main'
export default {
  name: 'CorrelationDialog',
  components: {},
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    paramsObj: {
      type: Object,
      default: null
    }
  },
  computed: {
    dialogShow: {
      get() {
        return this.visible
      },
      set(val) {
        this.$emit('dialogClose', { flag: val })
      }
    }
  },
  mounted() {
    this.getData()
    this.getRoleTechnicianList()
  },
  data() {
    return {
      sessionInfo: this.$globalState.session,
      dialogConfig: {
        config: {
          title: '关联技师',
          width: '600px'
        }
      },
      infoForm: {
        technician: '',
        reduceStockNum: '',
        remark: '',
        unit: ''
      },
      editChildRef: 'editChildRef',
      formRules: {
        technician: [{ required: true, message: '请选择领料技师', trigger: 'change' }],
        reduceStockNum: [{ required: true, message: '请输入0~999999的数字,支持小数2位', trigger: 'change' }]
      },
      loading: true,
      baseData: {
        technicianList: []
      }
    }
  },
  methods: {
    getData() {
      this.infoForm.reduceStockNum = this.paramsObj.reduceStockNum
      this.infoForm.remark = this.paramsObj.remark
      this.infoForm.unit = this.$membraneTypeList.includes(this.paramsObj.goodsType) ? '米' : '件'
    },

    // 查询领料技师
    getRoleTechnicianList() {
      const params = {}
      params.yqMerchantId = this.paramsObj.yqMerchantId
      this.$apis.stockManage.getRoleTechnician(params).then(res => {
        this.baseData.technicianList = res
        this.loading = false
        if (this.paramsObj.technicianPhone) {
          this.infoForm.technician = this.paramsObj.technicianPhone
        }
      })
    },

    handleAddConfirm() {
      this.$refs.editRef.validate(valid => {
        if (valid) {
          var params = this.$common.utils.deepClone(this.infoForm)
          params.id = this.paramsObj.id
          params.technicianPhone = params.technician
          params.technicianName = this.baseData.technicianList.find(item => item.staffPhone === params.technician)?.staffName
          this.$apis.stockManage.technicianUpdate(params).then(res => {
            this.$notify({
              type: 'success',
              title: '操作成功'
            })
            this.dialogShow = true
          })
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.detail-content-warn {
  .div-title {
    width: 1040px;
    height: 30px;
    border-bottom: 1px solid #e5e5e5;
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    margin: 10px 0 20px 0;
  }
  .el-icon-circle-close {
    color: #ffffff;
  }

  .form_div {
    color: #333333;
    .tipsDiv {
      display: flex;
      justify-content: center; /* 水平居中 */
      align-items: center; /* 垂直居中 */
      // flex-direction: column;
      background: #f47f131a;
      height: 28px;
      margin-bottom: 25px;
      .tipsText {
        display: flex;
        align-items: center; /* 垂直居中 */
        // font-weight: 500;
        font-size: 13px;
        color: #ff8d1a;
      }
      .imgCla {
        margin-right: 8px;
        width: 20px;
        height: 20px;
      }
    }

    .el-form-item__content {
      display: inline-block;
      width: calc(100% - 150px);
      line-height: 24px;
    }

    .el-form-item__label {
      padding: 0;
      line-height: 24px;
    }
    .el-form-item {
      width: 100%;
      margin-bottom: 20px;
    }

    .edit-sub-block {
      // padding: 0 10px;

      .detail-txt {
        display: inline-block;
        width: 200px;
        vertical-align: bottom;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      ::v-deep .el-form-item__content {
        max-width: calc(100% - 110px);
        word-break: break-all;
      }
      .itemDiv {
        display: flex;
        .halfItem {
          width: 33%;
        }
      }
      .onLineItem {
        ::v-deep .el-form-item__content {
          max-width: 80%;
        }
      }
    }

    .edit-sub-block-two {
      .el-form-item__label {
        padding: 0;
      }
      .el-form-item {
        // width: 300px;
        margin: 0px;
      }
    }
    .busi-info {
      box-sizing: border-box;
      width: 890px;
      border-radius: 4px;
      border: 1px solid #e5e5e5;
      padding: 6px 0;
      color: #333333;
      font-size: 14px;
      margin-bottom: 14px;
      .info-row {
        height: 20px;
        line-height: 20px;
        margin-bottom: 16px;
      }
      .info-row:last-child {
        margin-bottom: 0;
      }
      .info-item {
        display: inline-block;
        width: 50%;
        height: 20px;
        line-height: 20px;
        margin-bottom: 6px;
        .item-label {
          display: inline-block;
          width: 150px;
          color: #666666;
          text-align: right;
        }
      }
    }
  }
  .receiptBtn {
    margin-left: 20px;
  }
  .imgCon {
    text-align: center;
    margin-bottom: 50px;
  }
  .imgSize {
    width: 1040px;
  }
  .default-width {
    width: 350px;
  }
  .unit {
    padding-left: 10px;
  }
}
</style>