horse soft 基础框架前端界面
autumnal_wind@yeah.net
2024-04-24 35ee655485b646ebb62796677ccc16ab70b9f740
src/views/system/goodsIn/index.vue
@@ -139,7 +139,7 @@
</template>
<script setup name="GoodsIn" lang="ts">
import { listGoodsIn, getGoodsIn, delGoodsIn, addGoodsIn, updateGoodsIn } from '@/api/system/goodsIn';
import { listGoodsIn, delGoodsIn, addGoodsIn, updateGoodsIn } from '@/api/system/goodsIn';
import { GoodsInVO, GoodsInQuery, GoodsInForm } from '@/api/system/goodsIn/types';
import DetailForm from "@/views/system/goodsIn/components/detailForm.vue";
@@ -157,10 +157,10 @@
const queryFormRef = ref<ElFormInstance>();
const detailFormRef = ref();
const dialog = reactive<DialogOption>({
  visible: false,
  title: ''
});
// const dialog = reactive<DialogOption>({
//   visible: false,
//   title: ''
// });
const queryParams= ref({
  pageNum: 1,
@@ -187,11 +187,11 @@
  inTime: undefined,
  inOperator: undefined,
}
const data = reactive<PageData<GoodsInForm, GoodsInQuery>>({
  form: {...initFormData}
})
// const data = reactive<PageData<GoodsInForm, GoodsInQuery>>({
//   form: {...initFormData}
// })
const { form } = toRefs(data);
// const { form } = toRefs(data);
// const openForm = (type: string, id?: number) => {
//   detailFormRef.value.openForm(type, id)
@@ -209,16 +209,16 @@
  detailFormRef.value.openForm(type, id)
}
/** 取消按钮 */
const cancel = () => {
  reset();
  dialog.visible = false;
}
// const cancel = () => {
//   reset();
//   dialog.visible = false;
// }
/** 表单重置 */
const reset = () => {
  form.value = {...initFormData};
  detailFormRef.value?.resetFields();
}
// const reset = () => {
//   form.value = {...initFormData};
//   detailFormRef.value?.resetFields();
// }
/** 搜索按钮操作 */
const handleQuery = () => {
@@ -240,13 +240,13 @@
}
/** 新增按钮操作 */
const handleAdd = () => {
  // reset();
  // dialog.visible = true;
  // dialog.title = "添加入库登记";
  detailFormRef.value.openForm('add',0)
}
// const handleAdd = () => {
//   // reset();
//   // dialog.visible = true;
//   // dialog.title = "添加入库登记";
//
//   detailFormRef.value.openForm('add',0)
// }
/** 修改按钮操作 */
const handleUpdate = async (row?: GoodsInVO) => {
@@ -260,21 +260,21 @@
}
/** 提交按钮 */
const submitForm = () => {
  detailFormRef.value?.validate(async (valid: boolean) => {
    if (valid) {
      buttonLoading.value = true;
      if (form.value.inId) {
        await updateGoodsIn(form.value).finally(() =>  buttonLoading.value = false);
      } else {
        await addGoodsIn(form.value).finally(() =>  buttonLoading.value = false);
      }
      proxy?.$modal.msgSuccess("修改成功");
      dialog.visible = false;
      await getList();
    }
  });
}
// const submitForm = () => {
//   detailFormRef.value?.validate(async (valid: boolean) => {
//     if (valid) {
//       buttonLoading.value = true;
//       if (form.value.inId) {
//         await updateGoodsIn(form.value).finally(() =>  buttonLoading.value = false);
//       } else {
//         await addGoodsIn(form.value).finally(() =>  buttonLoading.value = false);
//       }
//       proxy?.$modal.msgSuccess("修改成功");
//       dialog.visible = false;
//       await getList();
//     }
//   });
// }
/** 删除按钮操作 */
const handleDelete = async (row?: GoodsInVO) => {