yyb
12 小时以前 c7262ac9c1ac9f844f79b9193734c96644e3a165
报工增加按人员或按组报工
已修改5个文件
191 ■■■■■ 文件已修改
common/http.api.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/product/outputRegister/addProductOut.vue 补丁 | 查看 | 原始文档 | blame | 历史
pages/product/report/components/saveForm.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/product/report/index.scss 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/product/report/index.vue 155 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
common/http.api.js
@@ -489,6 +489,7 @@
            //获取任务类型
            getAssemblyProcessType:(params = {}) => vm.$u.get('/admin/dict/type/assembly_process_type')
        },
        // jdhj-mes
        // 报工
        workReporting: {
            // 获取车间订单列表
@@ -499,6 +500,8 @@
            operationTask: (params = {}) => vm.$u.get('/mes/operationTask/'+ params.id),
            // 提交
            submitPDA: (params = {}) => vm.$u.post('/mes/product/submitPDA', params),
            // 获取人员
            getPersonByDutyRecordId: (params = {}) => vm.$u.get('/mes/dutyRecord/getPersonByDutyRecordId/'+ params.id),
        },
        // 报工
        cancelReporting: {
pages/product/outputRegister/addProductOut.vue
pages/product/report/components/saveForm.vue
@@ -167,6 +167,10 @@
      }
      this.operationTaskList.operationTaskId = this.operationTaskList.id;
      this.form.operationTaskId = this.operationTaskList.id;
      this.form.status = this.operationTaskList.status;
      this.form.Persons = this.operationTaskList.Persons;
      this.form.productStaffIds = this.operationTaskList.productStaffIds;
      this.form.productStaffs = this.operationTaskList.productStaffs;
      this.operationTaskList.productOutputList = []; // 创建一个空数组
      this.operationTaskList.productOutputList.push(this.form); // 向数组中添加元素
      console.log("this.operationTaskList", this.operationTaskList);
pages/product/report/index.scss
@@ -1,3 +1,32 @@
        /* 弹窗样式 */
        /* 复选框样式 */
    .checkbox-item {
        width: 230px;
        display: flex;
        align-items: center;
        padding: 20rpx 0;
        border-bottom: 1rpx solid #f5f5f5;
        background-color: #f8f9fa;
        .label {
            position: relative;
            left: 130px;
        }
    }
    .popup-content {
        padding: 30rpx;
        max-height: 70vh;
        overflow-y: auto;
    }
    .popup-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 20rpx;
        border-bottom: 1rpx solid #eee;
        margin-bottom: 20rpx;
    }
    .packing-registration-param {
  padding: 40rpx 30rpx 10rpx 30rpx;
  height: 350px;
pages/product/report/index.vue
@@ -80,20 +80,16 @@
          <u-radio name="false">否</u-radio>
        </u-radio-group>
      </u-form-item>
<!--      <u-form-item label="工序">
        <u-checkbox-group>
          <u-checkbox
            :name="item.name"
            v-for="(item, index) in checkboxList"
            :key="index"
            v-model="item.value"
            @change="changeCheckbox"
            :disabled="subdisabled || item.disabled"
          >
            {{ item.name }}
          </u-checkbox>
        </u-checkbox-group>
      </u-form-item> -->
      <u-form-item label="报工方式" prop="status">
        <u-radio-group v-model="form.status" :disabled="subdisabled" @change="handleReportTypeChange">
          <u-radio name="false">按班组报工</u-radio>
          <u-radio name="true">按人员报工</u-radio>
        </u-radio-group>
      </u-form-item>
      <u-form-item label="人员名称" :border-bottom="false" prop="Persons">
                <u-input v-model="form.Persons" type="select" placeholder="请选择"
                    @click="openselectedPersons" :disabled="!canSelectPerson || subdisabled"/>
            </u-form-item>
      <u-form-item label="产出列表" :border-bottom="false"></u-form-item>
    </u-form>
    <view class="wrap">
@@ -205,6 +201,19 @@
        </view>
      </view>
    </u-modal>
    <u-modal v-model="personShowModal" title="" :show-cancel-button="true" :show-confirm-button="true"
            @confirm="confirmSelection" @cancel="cancelSelection">
            <view class="popup-content">
                <view class="popup-header">
                    <checkbox-group @change="checkboxChange">
                        <label class="checkbox-item" v-for="(item, index) in selectedPersons" :key="index">
                            <checkbox :value="item.staffId" :checked="item.checked" />
                            <text class="label">{{ item.staffName }}</text>
                        </label>
                    </checkbox-group>
                </view>
            </view>
        </u-modal>
    <scan></scan>
  </div>
</template>
@@ -235,6 +244,7 @@
      //   },
      // ],
      InventoryReceiptList: [],
        selectedPersons: [],
      form: {
        workstationId: "",
        work: "",
@@ -251,7 +261,13 @@
        materialCost: "",
        // autoReport: false,
        simplifyMaterials: 'false',
        status: 'false',
        Persons: '',
        productStaffIds: [],
        productStaffs:[]
      },
      personList: [],
      canSelectPerson: false,
      rules: {
        work: [
          {
@@ -295,6 +311,20 @@
            trigger: ["change"],
          },
        ],
        status: [
          {
            required: true,
            message: "请选择报工方式",
            trigger: ["change"],
          },
        ],
        Persons: [
          {
            required: true,
            message: "请选择人员",
            trigger: ["change"],
          },
        ],
      },
      showSave: false,
      operationTaskId: "",
@@ -302,6 +332,8 @@
      codeInfoId: "",
      detailedList: {},
      showModal: false,
      personShowModal: false,
            checkboxList: [],
    };
  },
  // 点击提交按钮的事件处理函数
@@ -355,8 +387,71 @@
    "form.taskNo": function (newVal, oldVal) {
      this.subdisabled = false;
    },
    'form.status'(newVal) {
      this.selectedPersons = this.selectedPersons.map(item => ({
        ...item,
        checked: newVal === 'false'
      }));
    }
  },
  methods: {
    // 处理报工方式变更
    handleReportTypeChange() {
      // 切换报工方式时清空人员名称
      this.form.Persons = '';
      this.form.productStaffs = [];
      this.form.productStaffIds = [];
    },
    // 人员名称
                openselectedPersons() {
                this.personShowModal = true;
    },
                  // 复选框变化事件
    checkboxChange(e) {
      console.log('e',e)
                const values = e.target.value || [];
                if (this.form.status === 'true') {
                    // 单选模式,只允许选择一个人
                    const previouslySelected = this.selectedPersons.find(item => item.checked);
                    const newlySelected = values.length > 0 ? values[values.length - 1] : null;
                    if (previouslySelected && newlySelected && previouslySelected.staffId !== newlySelected) {
                        // 已有选中项且选择了新的项,提示只能选择一个人
                        this.$u.toast('按人员报工时只能选择一位人员');
                        // 保持原选择
                        this.selectedPersons = this.selectedPersons.map(item => ({
                            ...item,
                            checked: item.staffId === previouslySelected.staffId
            }));
                    } else {
                        // 首次选择或取消选择
                        this.selectedPersons = this.selectedPersons.map(item => ({
                            ...item,
                            checked: newlySelected ? item.staffId === newlySelected : false
            }));
                    }
                } else {
                    // 多选模式
                    this.selectedPersons = this.selectedPersons.map(item => ({
                        ...item,
                        checked: values.includes(item.staffId)
                    }));
                }
    },
                  // 确认选择
            confirmSelection() {
        const selected = this.selectedPersons.filter(item => item.checked);
                // 根据报工方式设置人员名称
                if (this.form.status === 'true' && selected.length > 0) {
                    this.form.Persons = selected[0].staffName;
                } else {
                    this.form.Persons = selected.map(item => item.staffName).join(',');
                }
                this.form.productStaffs = selected.map(item => item.staffNo);
                this.form.productStaffIds = selected.map(item => item.staffId);
    },
      cancelSelection(){},
    // 铜杆报工
    CopperReportingWork(val) {
      const copperList = {};
@@ -368,6 +463,10 @@
      copperList.specificationType = val.ST
      copperList.grossWeight = val.TR
      copperList.operationTaskId = this.form.id
      copperList.status = this.form.status;
      copperList.Persons = this.form.Persons;
      copperList.productStaffIds = this.form.productStaffIds;
      copperList.productStaffs = this.form.productStaffs;
      this.form.productOutputList = [];
      this.form.operationTaskId = this.form.id;
      this.form.productOutputList.push(copperList);
@@ -382,6 +481,26 @@
    radioChange() {
      // 处理单选框变化事件
    },
    // 获取人员列表
    getPersonList(dutyId) {
      console.log('111111')
      try {
        this.$u.api.workReporting.getPersonByDutyRecordId({ id: dutyId }).then((res) => {
        this.selectedPersons = res.data.map(item => ({
          ...item,
          checked: this.form.status === 'false'
        }));
      })
      .catch(err => {
        console.log(err)
      })
      } catch (err) {
        console.log(err)
      }
    },
    confirmModle() {
      console.log("点击确认后获取取消报工记录");
      // 处理确认逻辑
@@ -481,12 +600,16 @@
        materialCost: val.materialCost,
        // autoReport: false,
        simplifyMaterials: 'false',
        status: 'false',
        Persons:'',
      };
      this.checkboxList[1].value = false;
      this.checkboxList[0].value = false;
      if (this.form.materialCost == "倒冲") {
        this.simplifyDisabled = true;
      }
      // 如果有dutyNo,获取人员列表
      if (val.dutyId) {
        this.getPersonList(val.dutyId);
      }
    },
  },
};