Skip to content

Commit

Permalink
Fix: Fix the TS code and Vue warning information of the product wanse…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jzow committed Dec 15, 2023
1 parent ec507af commit 2425a24
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 33 deletions.
24 changes: 12 additions & 12 deletions web/src/views/product/info/components/BatchEditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@
<script lang="ts">
import { ref, reactive } from 'vue';
import {
Button,
Button, Col,
Form,
FormItem,
InputNumber,
Modal, Popconfirm,
Modal, Row,
Select,
SelectOption,
Spin,
Expand All @@ -78,10 +78,10 @@ import {
import {getCategoryList} from "/@/api/product/productCategory"
import {UpdateBatchProductInfoReq} from "/@/api/product/model/productModel"
import {updateBatchProductInfo} from "/@/api/product/product"
import {useMessage} from "@/hooks/web/useMessage";
export default {
name: 'BatchEditModal',
emits: ['success'],
components: {
'a-modal': Modal,
'a-button': Button,
Expand All @@ -93,22 +93,22 @@ export default {
'a-select': Select,
'a-select-option': SelectOption,
'a-tree-select': TreeSelect,
'a-popconfirm': Popconfirm,
'a-row': Row,
'a-col': Col,
},
setup(_, context) {
const title = ref('批量编辑商品信息');
const openBatchEditModal = ref(false);
const color = ref(null);
const weight = ref(null);
const expiryNum = ref(null);
const categoryId = ref(null);
const enableSerialNumber = ref(null);
const enableBatchNumber = ref(null);
const remark = ref(null);
const color = ref('');
const weight = ref(0);
const expiryNum = ref(0);
const categoryId = ref(0);
const enableSerialNumber = ref('');
const enableBatchNumber = ref('');
const remark = ref('');
const categoryTree = reactive([]);
const productIds = ref([])
const {createMessage} = useMessage();
const confirmLoading = ref(false);
const formRef = ref();
Expand Down
9 changes: 5 additions & 4 deletions web/src/views/product/info/components/BatchSetPriceModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {Rule} from 'ant-design-vue/es/form';
export default {
name: 'BatchSetPriceModal',
emits: ['ok'],
components: {
'a-modal': Modal,
'a-button': Button,
Expand All @@ -37,7 +38,7 @@ export default {
const title = ref('批量设置');
const openPriceModal = ref(false);
const isReadOnly = ref(false);
const batchPrice = ref('');
const batchPrice = ref(0);
const batchType = ref('');
const model = reactive({});
const labelCol = {
Expand Down Expand Up @@ -71,7 +72,7 @@ export default {
}
};
const edit = (record) => {
const edit = () => {
openPriceModal.value = true
};
Expand All @@ -82,12 +83,12 @@ export default {
const handleOk = () => {
const price = batchPrice.value
context.emit('ok', price, batchType.value);
batchPrice.value = null;
batchPrice.value = 0;
close();
};
const handleCancel = () => {
batchPrice.value = null;
batchPrice.value = 0;
close();
};
Expand Down
9 changes: 5 additions & 4 deletions web/src/views/product/info/components/BatchSetStockModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
</template>

<script lang="ts">
import { ref, reactive, UnwrapRef } from 'vue';
import { ref, reactive} from 'vue';
import {Button, Form, FormItem, InputNumber, Modal, Spin} from "ant-design-vue";
export default {
name: 'BatchSetStockModal',
emits: ['ok'],
components: {
'a-modal': Modal,
'a-button': Button,
Expand All @@ -35,7 +36,7 @@ export default {
const title = ref('批量设置');
const openStockModal = ref(false);
const isReadOnly = ref(false);
const batchNumber = ref('');
const batchNumber = ref(0);
const batchType = ref('');
const model = reactive({});
const labelCol = {
Expand Down Expand Up @@ -72,12 +73,12 @@ export default {
const handleOk = () => {
const stockNumber = batchNumber.value
context.emit('ok', stockNumber, batchType.value);
batchNumber.value = null;
batchNumber.value = 0;
close();
};
const handleCancel = () => {
batchNumber.value = null;
batchNumber.value = 0;
close();
};
Expand Down
27 changes: 15 additions & 12 deletions web/src/views/product/info/components/ProductInfoModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,16 @@ import {
Tooltip,
TreeSelect,
Upload,
Tag,
Divider,
UploadChangeParam,
} from "ant-design-vue";
import {cloneDeep} from 'lodash-es';
import {getUnitList} from "/@/api/product/productUnit";
import {getCategoryList} from "/@/api/product/productCategory";
import {ProductUnitQueryReq} from "/@/api/product/model/productUnitModel";
import {DefaultOptionType} from "ant-design-vue/es/vc-tree-select/TreeSelect";
import {getProductCode, getProductInfoDetail, addOrUpdateProduct} from "@/api/product/product";
import {getProductInfoDetail, addOrUpdateProduct} from "@/api/product/product";
import {getAttributeById, getAttributeList} from "@/api/product/productAttribute";
import {useMessage} from "@/hooks/web/useMessage";
import BatchSetPriceModal from "@/views/product/info/components/BatchSetPriceModal.vue";
Expand All @@ -386,7 +388,7 @@ import {ProductAttributeListReq} from "@/api/product/model/productAttributeModel
import {ProductAttributeModel, ProductStockModel, Unit} from "@/views/product/info/model/productInfoModel";
import {meTable, stock, productInfo, formState} from "@/views/product/info/info.data";
const VNodes = {
const VNodes = defineComponent({
props: {
vnodes: {
type: Object,
Expand All @@ -396,7 +398,7 @@ const VNodes = {
render() {
return this.vnodes;
},
};
});
export default defineComponent({
name: 'ProductInfoModal',
Expand All @@ -423,6 +425,8 @@ export default defineComponent({
'v-nodes': VNodes,
'a-textarea': Textarea,
'plus-outlined': PlusOutlined,
'a-divider': Divider,
'a-tag': Tag,
BatchSetPriceModal,
BatchSetStockModal,
UnitModal,
Expand Down Expand Up @@ -454,8 +458,8 @@ export default defineComponent({
const skuTwo = reactive([]);
const skuThree = reactive([]);
const priceModalForm = ref<BatchSetPriceModal>();
const stockModalForm = ref<BatchSetStockModal>();
const priceModalForm = ref<any>();
const stockModalForm = ref<any>();
const [registerModal, {openModal}] = useModal();
const model = ref({});
Expand All @@ -477,7 +481,6 @@ export default defineComponent({
}
function handleCancel() {
close();
if (formState.productId) {
clearData()
}
Expand Down Expand Up @@ -1029,11 +1032,11 @@ export default defineComponent({
file.type === "image/bmp";
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isPNG) {
createMessage.error(`${file.name},该文件不是图片类型`);
createMessage.warn(`${file.name},该文件不是图片类型`);
return isPNG || Upload.LIST_IGNORE
}
if (!isLt2M) {
createMessage.error(`${file.name},该文件超过2MB大小限制`);
createMessage.warn(`${file.name},该文件超过2MB大小限制`);
return isLt2M || Upload.LIST_IGNORE
}
}
Expand Down Expand Up @@ -1116,20 +1119,20 @@ export default defineComponent({
async function handleOk() {
if (!formState.productName) {
createMessage.error('请输入商品名称');
createMessage.warn('请输入商品名称');
return;
}
if (unitChecked.value) {
if (!formState.productUnitId) {
createMessage.error('请选择商品单位');
createMessage.warn('请选择商品单位');
return;
}
} else if (!formState.productUnit) {
createMessage.error('请输入商品单位');
createMessage.warn('请输入商品单位');
return;
}
if (meTable.dataSource.length === 0) {
createMessage.error('请插入一行数据,录入商品条码价格信息');
createMessage.warn('请插入一行数据,录入商品条码价格信息');
return;
}
// 检查库存信息是否为空
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {BasicModal, useModalInner} from "@/components/Modal";
export default defineComponent({
name: 'productModal',
components: {BasicModal, BasicTable, TableAction},
emits: ['selectedRows', 'register', 'handleCheckSuccess'],
emits: ['register', 'handleCheckSuccess'],
setup(_, context) {
const getTitle = ref('选择商品');
const { createMessage } = useMessage();
Expand Down

0 comments on commit 2425a24

Please sign in to comment.