gaoluyang
7 天以前 52cb1a8a22e92ce5b8af50deb93fe7441fa350cd
src/views/productionManagement/operationScheduling/components/formDia.vue
@@ -24,6 +24,23 @@
                  <el-input v-model="scope.row.process" placeholder="请输入工序" />
          </template>
        </el-table-column>
      <el-table-column label="产线" prop="productionLine" width="150">
          <template #default="scope">
            <el-select
              v-model="scope.row.productionLine"
              placeholder="选择产线"
              style="width: 100%;"
              clearable
            >
              <el-option
                v-for="line in productionLines"
                :key="line.value"
                :label="line.label"
                :value="line.value"
              />
            </el-select>
          </template>
        </el-table-column>
        <el-table-column label="单位" prop="unit" width="90">
          <template #default="scope">
            <el-input v-model="scope.row.unit" placeholder="请输入单位" />
@@ -71,6 +88,9 @@
                     v-model="scope.row.schedulingUserId"
                     placeholder="选择人员"
                     style="width: 100%;"
              filterable
              default-first-option
              :reserve-keyword="false"
                  >
                     <el-option
                        v-for="user in userList"
@@ -119,31 +139,47 @@
const pendingNum = ref(0);
const userList = ref([])
const receive = ref('')
const sunqianUserId = ref('')
// 产线选项
const productionLines = ref([
  { label: '产线1', value: '产线1' },
  { label: '产线2', value: '产线2' },
  { label: '产线3', value: '产线3' },
  { label: '产线4', value: '产线4' }
])
// 打开弹框
const openDialog = (type, row) => {
  operationType.value = type;
  dialogFormVisible.value = true;
   userListNoPageByTenantId().then((res) => {
      userList.value = res.data;
   });
   pendingNum.value = row?.pendingNum ?? 0;
   unitFromRow.value = row?.unit ?? '';
   idFromRow.value = row?.id ?? '';
   specificationModelFromRow.value = row?.specificationModel ?? '';
   tableData.value = [createRow()];
   userListNoPageByTenantId().then((res) => {
      userList.value = res.data;
      // 找到孙倩的用户ID并设置为默认值
      const sunqianUser = userList.value.find(user => user.nickName === '孙倩');
      if (sunqianUser) {
         sunqianUserId.value = sunqianUser.userId;
      }
      // 在用户列表加载完成后创建行数据,并将产线数据带入
      tableData.value = [createRow(row)];
   });
}
const createRow = () => ({
const createRow = (row) => ({
   id: idFromRow.value,
   process: '',
   process: '包装',
   schedulingDate: '',
   schedulingNum: null,
   schedulingUserId: '',
   schedulingUserId: sunqianUserId.value, // 默认设置为孙倩的用户ID
   workHours: null,
   unit: unitFromRow.value,
   remark: '',
   type: specificationModelFromRow.value,
   productionLine: row?.productionLine ?? '', // 从行数据中获取产线信息
});
const submitForm = () => {
@@ -156,7 +192,8 @@
         row.schedulingNum === '' || row.schedulingNum === null ||
         !row.schedulingUserId ||
         row.workHours === '' || row.workHours === null ||
         !row.unit
         !row.unit ||
         !row.productionLine
      ) {
         proxy.$modal.msgError(`第${i + 1}行数据未填写完整`);
         return;