spring
8 天以前 ced45351fc130e30d3fe47dc49ed388bb474eea8
src/views/consumablesLogistics/dispatchLog/Record.vue
@@ -28,8 +28,13 @@
         </div>
         <div>
            <el-button @click="handleOut">导出</el-button>
            <el-button type="danger" plain @click="handleDelete">删除</el-button>
            <el-button type="primary" plain @click="handlePrint">打印</el-button>
            <el-button
               type="danger"
               plain
               @click="handleDelete"
               v-if="hasCDispatchCancel"
            >删除</el-button>
            <!-- <el-button type="primary" plain @click="handlePrint">打印</el-button> -->
         </div>
      </div>
      <div class="table_list">
@@ -72,41 +77,38 @@
               show-overflow-tooltip
            />
            <el-table-column
               label="出库数量"
               prop="stockOutNum"
               label="数量"
               prop="qualitity"
               show-overflow-tooltip
            />
            <el-table-column
               label="净重(吨)"
               prop="netWeight"
            <!-- <el-table-column
               label="采购员"
               prop="purchaser"
               show-overflow-tooltip
            />
            /> -->
            <el-table-column
               label="出库人"
               prop="createBy"
               show-overflow-tooltip
            />
        <el-table-column label="来源"
            <el-table-column label="操作" width="160" align="center">
               <template #default="scope">
                  <el-button
                     v-if="hasCDispatchEdit"
                     type="primary"
                     size="mini"
                     @click="handleEdit(scope.row)"
                  >编辑</el-button>
               </template>
            </el-table-column>
        <!-- <el-table-column label="来源"
                         prop="recordType"
                         show-overflow-tooltip>
          <template #default="scope">
            {{ getRecordType(scope.row.recordType) }}
          </template>
        </el-table-column>
        <el-table-column
            label="车牌"
            prop="licensePlateNo"
            show-overflow-tooltip
        />
      <el-table-column label="操作"
                         width="120"
                         align="center">
          <template #default="scope">
            <el-button type="primary"
                       size="mini"
                       @click="handlePreview(scope.row)">导出过磅单</el-button>
          </template>
        </el-table-column>
        </el-table-column> -->
        <!-- 不再展示过磅相关字段与导出操作 -->
         </el-table>
         <pagination
            v-show="total > 0"
@@ -118,21 +120,56 @@
         />
      </div>
   </div>
   <el-dialog
      title="编辑出库信息"
      v-model="isShowEditModal"
      width="600px"
   >
      <el-form
         ref="editFormRef"
         :model="editForm"
         label-width="90px"
      >
         <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>
      <template #footer>
         <el-button @click="closeEditModal">取消</el-button>
         <el-button type="primary" @click="handleEditSubmit">确定</el-button>
      </template>
   </el-dialog>
</template>
<script setup>
import pagination from "@/components/PIMTable/Pagination.vue";
import { ref, reactive, toRefs, getCurrentInstance } from "vue";
import { ref, reactive, toRefs, getCurrentInstance, computed } from "vue";
import { ElMessageBox } from "element-plus";
import useUserStore from "@/store/modules/user";
import { getCurrentDate } from "@/utils/index.js";
import {
   getConsumablesOutRecordPage,
   delConsumablesOutRecord,
   editStockOut,
} from "@/api/consumablesLogistics/consumablesOutRecord.js";
import {
  findAllQualifiedStockOutRecordTypeOptions, findAllUnQualifiedStockOutRecordTypeOptions,
} from "@/api/basicData/enum.js";
import { checkPermi } from "@/utils/permission.js";
const userStore = useUserStore();
const { proxy } = getCurrentInstance();
@@ -155,6 +192,44 @@
  }
})
const hasCDispatchEdit = computed(() => checkPermi(['c_dispatch_edit']));
const hasCDispatchCancel = computed(() => checkPermi(['c_dispatch_cancel']));
// 编辑弹框数据
const isShowEditModal = ref(false);
const editFormRef = ref();
const editForm = reactive({
   id: undefined,
   qualitity: undefined,
});
const handleEdit = (row) => {
   editForm.id = row.id;
   editForm.qualitity = row.qualitity;
   isShowEditModal.value = true;
};
const closeEditModal = () => {
   isShowEditModal.value = false;
   editForm.id = undefined;
   editForm.qualitity = undefined;
   editFormRef.value?.clearValidate?.();
};
const handleEditSubmit = () => {
   editFormRef.value?.validate?.((valid) => {
      if (!valid) return;
      const { purchaser, ...payload } = editForm || {};
      editStockOut(payload).then(() => {
         closeEditModal();
         proxy.$modal.msgSuccess("编辑成功");
         getList();
      });
   });
};
// 打印相关
const printPreviewVisible = ref(false);
const printData = ref([]);