spring
17 小时以前 ce92cb3a3645ca473798698522f477c8c2eb2e7f
src/pages/consumablesLogistics/receiptManagement/Record.vue
@@ -37,7 +37,12 @@
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
      </div>
      <div>
        <el-button type="danger" plain @click="handleDelete">删除</el-button>
        <el-button
          v-if="hasCReceiptCancel"
          type="danger"
          plain
          @click="handleDelete"
        >删除</el-button>
      </div>
    </div>
@@ -56,11 +61,21 @@
        <el-table-column label="产品名称" prop="productName" min-width="160" show-overflow-tooltip />
        <el-table-column label="规格型号" prop="model" min-width="160" show-overflow-tooltip />
        <el-table-column label="单位" prop="unit" width="100" show-overflow-tooltip />
        <el-table-column label="入库数量" prop="stockInNum" width="110" show-overflow-tooltip />
        <el-table-column label="入库数量" prop="qualitity" width="110" show-overflow-tooltip />
        <el-table-column label="入库人" prop="createBy" width="120" show-overflow-tooltip />
        <el-table-column label="来源" prop="recordType" width="140" show-overflow-tooltip>
          <template #default="scope">
            {{ getRecordType(scope.row.recordType) }}
          </template>
        </el-table-column>
        <el-table-column label="操作" width="120" align="center">
          <template #default="scope">
            <el-button
              v-if="hasCReceiptEdit"
              type="primary"
              size="mini"
              @click="handleEdit(scope.row)"
            >编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
@@ -73,20 +88,67 @@
        @pagination="paginationChange"
      />
    </div>
    <el-dialog
      v-model="isShowEditModal"
      title="编辑入库"
      width="600"
      @close="closeEditModal"
    >
      <el-form
        label-width="100px"
        :model="editForm"
        label-position="top"
        ref="editFormRef"
      >
        <el-form-item
          label="数量"
          prop="qualitity"
          :rules="[{ required: true, message: '请输入数量', trigger: ['blur', 'change'] }]"
        >
          <el-input-number
            v-model="editForm.qualitity"
            :min="0"
            :step="1"
            :precision="0"
            controls-position="right"
            style="width: 100%"
            placeholder="请输入数量"
          />
        </el-form-item>
        <el-form-item
          label="采购员"
          prop="purchaser"
          :rules="[{ required: true, message: '请输入采购员', trigger: ['blur', 'change'] }]"
        >
          <el-input v-model="editForm.purchaser" placeholder="请输入采购员" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="handleEditSubmit">确认</el-button>
          <el-button @click="closeEditModal">取消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
<script setup>
import { onMounted, reactive, ref, toRefs, watch } from "vue";
import { computed, onMounted, reactive, ref, toRefs, watch } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import Pagination from "@/components/PIMTable/Pagination.vue";
import {
  batchDeleteConsumablesInRecords,
  getConsumablesInRecordListPage,
  editStockInStock,
} from "@/api/consumablesLogistics/consumablesInRecord.js";
import {
  findAllQualifiedStockInRecordTypeOptions,
} from "@/api/basicData/enum.js";
import { checkPermi } from "@/utils/permission.js";
const props = defineProps({
  type: {
@@ -95,6 +157,9 @@
    default: "0",
  },
});
const hasCReceiptEdit = computed(() => checkPermi(['c_receipt_edit']))
const hasCReceiptCancel = computed(() => checkPermi(['c_receipt_cancel']))
const tableData = ref([]);
const selectedRows = ref([]);
@@ -158,6 +223,7 @@
};
const handleDelete = () => {
  if (!hasCReceiptCancel.value) return
  const ids = selectedRows.value.map(i => i.id).filter(Boolean);
  if (ids.length === 0) {
    ElMessage.warning("请选择数据");
@@ -176,6 +242,38 @@
    .catch(() => {});
};
// 编辑入库
const isShowEditModal = ref(false);
const editFormRef = ref(null);
const editForm = ref({});
const handleEdit = (row) => {
  if (!hasCReceiptEdit.value) return
  editForm.value = {
    id: row?.id,
    qualitity: row?.qualitity,
    purchaser: row?.purchaser,
  };
  isShowEditModal.value = true;
};
const closeEditModal = () => {
  isShowEditModal.value = false;
  editForm.value = {};
  editFormRef.value?.clearValidate?.();
};
const handleEditSubmit = () => {
  editFormRef.value?.validate?.((valid) => {
    if (!valid) return;
    editStockInStock(editForm.value).then(() => {
      closeEditModal();
      ElMessage.success("编辑成功");
      getList();
    });
  });
};
watch(
  () => props.type,
  () => {