zenglf
2023-08-19 8611a1ba1696e76cced04ff5d658ba138a05dafd
src/views/eam/modules/repairorder/moudles/RepairOrderActualHoursReport.vue
@@ -25,6 +25,7 @@
            :value="text"
            :read-only="true"
            @change="(e) => handleChange(e, record.key, col, index)"
            :disabled="repairOrderStatus=='4'"
          />
          <a-input-number
            :value="text"
@@ -32,7 +33,7 @@
            :min="0"
            :max="99999"
            @change="(e)=>handleChange(e, record.key, col, index)"
            :disabled="record.disabled"
            :disabled="repairOrderStatus=='4'"
          />
        </div>
@@ -41,7 +42,10 @@
        slot='action'
        slot-scope='text, record,index'
      >
        <a @click="handleDeleteFake(index)" v-if="record.isLock=='no'&&mainId.status=='3'">删除</a>
        <a
          :disabled="repairOrderStatus=='4'"
          @click="handleDelete(index)"
        >删除</a>
      </span>
    </a-table>
    <a-button
@@ -49,8 +53,9 @@
      type="dashed"
      icon="plus"
      @click="addHour"
      :disabled="mainId.status=='4'"
      :disabled="this.repairOrderStatus=='4' || this.repairOrderStatus=='2'"
    >添加实际工时
      <!-- :disabled="mainId.status=='4'" -->
    </a-button>
    <div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
      <a-row :style="{textAlign:'right'}">
@@ -64,12 +69,12 @@
          @click="handleOk(1)"
          type="primary"
          :style="{marginRight: '8px'}"
          :disabled="mainId.status=='4'"
          :disabled="this.repairOrderStatus=='4' || this.repairOrderStatus=='2'"
        >暂存</a-button>
        <a-button
          @click="handleOk(0)"
          type="primary"
          :disabled="mainId.status=='4'"
          :disabled="this.repairOrderStatus=='4' || this.repairOrderStatus=='2'"
        >保存</a-button>
      </a-row>
      <!-- :disabled="false" -->
@@ -94,10 +99,29 @@
    JEllipsis,
    ActualHourUserSelect
  },
  // props: {
  //   mainId: {
  //     type: Object,
  //     required: false,
  //     default: {}
  //   }
  // },
  props: {
    mainId: {
      type: Object,
    }
    repairOrderId: {
      type: String,
      required: false,
      default: '-1'
    },
    repairOrderStatus: {
      type: String,
      required: false,
      default: ''
    },
    teamId: {
      type: String,
      required: false,
      default: ''
    },
  },
  data() {
    return {
@@ -149,6 +173,16 @@
      dataSource: [],
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '*人员编码',
          dataIndex: 'username',
          align: "center",
@@ -185,30 +219,20 @@
      changeIndex: 0
    }
  },
  created() {
    // this.queryParam['maintenanceOrderId'] = this.dailyMaintenanceOrderId;
    // this.queryParam['equipmentId'] = this.equipmentId
    // this.loadData(1);
  },
  watch: {
    mainId: {
    repairOrderId: {
      immediate: true,
      handler(val) {
        console.log(val)
        if (!this.mainId.id) {
          this.clearList()
        } else {
          this.queryParam['repairOrderId'] = val.id
          this.loadData(1)
        }
        this.clearList();
        this.queryParam['repairOrderId'] = val
        this.loadData(1)
      }
    }
    },
  },
  methods: {
    addHour() {
      this.dataSource.push({ userId: '', repairOrderId: this.mainId.id, actualHour: 0, username: '', realname: '' })
      this.dataSource.push({ userId: '', repairOrderId: this.repairOrderId, actualHour: 0, username: '', realname: '' })
    },
    handleCancel() {
      this.$bus.$emit('closeDrawer');
@@ -219,9 +243,10 @@
      this.disableSubmit = false;
      this.visible = false;
    },
    handleDeleteFake(index) {
      this.dataSource.pop(index);
    handleDelete(text, record, index) {
      this.dataSource.splice(index, 1);
    },
    handleOk(saveStatus) {
      const that = this
      if (saveStatus == 0) {
@@ -245,9 +270,10 @@
        if (!err) {
          that.confirmLoading = true
          let formData = {}
          formData.repairOrderId = that.mainId.id;
          // formData.repairOrderId = that.mainId.id;
          formData.repairOrderId = that.repairOrderId;
          formData.repairOrderActualWorkHoursList = that.dataSource;
          formData.equipmentId = that.equipmentId;
          // formData.equipmentId = that.equipmentId;
          let obj = obj = postAction(this.url.confirmHour, formData)
          obj.then((res) => {
            if (res.success) {
@@ -281,7 +307,8 @@
    },
    onSearchUser(index) {
      this.recordIndex = index
      this.$refs.actualUserSelect.list(this.mainId.teamId)
      // this.$refs.actualUserSelect.list(this.mainId.teamId)
      this.$refs.actualUserSelect.list(this.teamId)
      this.$refs.actualUserSelect.title = '人员选择'
    },
    sendUserRecord(data, val) {