123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- <template>
- <div class="tenant">
- <!-- <Banner /> -->
- <div class="content">
- <byTable
- :source="sourceList.data"
- :pagination="sourceList.pagination"
- :config="config"
- :loading="loading"
- highlight-current-row
- :selectConfig="selectConfig"
- :table-events="{
- //element talbe事件都能传
- select: select,
- }"
- :action-list="[]"
- @get-list="getList"
- >
- <template #slotName="{ item }">
- {{ item.createTime }}
- </template>
- </byTable>
- </div>
- <el-dialog
- title="出库"
- v-model="dialogVisible"
- width="500"
- v-loading="loading"
- >
- <byForm
- :formConfig="formConfig"
- :formOption="formOption"
- v-model="formData.data"
- :rules="rules"
- ref="byform"
- >
- </byForm>
- <template #footer>
- <el-button @click="dialogVisible = false" size="large">取 消</el-button>
- <el-button
- type="primary"
- @click="submitForm('byform')"
- size="large"
- :loading="submitLoading"
- >
- 确 定
- </el-button>
- </template>
- </el-dialog>
- </div>
- </template>
-
- <script setup>
- /* eslint-disable vue/no-unused-components */
- import { ElMessage, ElMessageBox } from "element-plus";
- import byTable from "@/components/byTable/index";
- import byForm from "@/components/byForm/index";
- import { computed, defineComponent, ref } from "vue";
- import useUserStore from "@/store/modules/user";
- const loading = ref(false);
- const submitLoading = ref(false);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 3,
- pageNum: 1,
- pageSize: 10,
- type: 1,
- },
- });
- let dialogVisible = ref(false);
- let roomDialogVisible = ref(false);
- let modalType = ref("add");
- let rules = ref({
- type: [
- { required: true, message: "请选择仓库类型", trigger: ["blur", "change"] },
- ],
- warehouseId: [
- { required: true, message: "请选择仓库名称", trigger: "change" },
- ],
- quantity: [{ required: true, message: "请输入入库数量", trigger: "blur" }],
- });
- const { proxy } = getCurrentInstance();
- const selectConfig = reactive([
- {
- label: "数据来源",
- prop: "type",
- data: [],
- },
- {
- label: "出库状态",
- prop: "type",
- data: [],
- },
- ]);
- const inboundType = ref([
- {
- label: "未入库",
- value: "0",
- },
- {
- label: "部分入库",
- value: "1",
- },
- {
- label: "入库完成",
- value: "2",
- },
- ]);
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "数据来源",
- prop: "businessType",
- },
- render(type) {
- return businessType.find((x) => x.value == type).label;
- },
- },
- {
- attrs: {
- label: "单号",
- prop: "code",
- },
- },
- {
- attrs: {
- label: "物品类型",
- prop: "logisticsCompanyName",
- },
- },
- {
- attrs: {
- label: "物品编码",
- prop: "receiptWarehouseName",
- },
- },
- {
- attrs: {
- label: "物品名称",
- prop: "operatorName",
- },
- },
- {
- attrs: {
- label: "型号规格",
- prop: "createTime",
- },
- },
- {
- attrs: {
- label: "单位",
- prop: "createTime",
- },
- },
- {
- attrs: {
- label: "待出库",
- prop: "createTime",
- },
- },
- {
- attrs: {
- label: "出库状态",
- prop: "status",
- },
- render(status) {
- return status == 0 ? "未入库" : status == 1 ? "部分入库" : "";
- },
- },
- {
- attrs: {
- label: "操作",
- width: "100",
- align: "right",
- },
- // 渲染 el-button,一般用在最后一列。
- renderHTML(row) {
- return [
- {
- attrs: {
- label: "出库",
- type: "primary",
- text: true,
- disabled: row.status > 1,
- },
- el: "button",
- click() {
- getDtl(row);
- },
- },
- ];
- },
- },
- ];
- });
- let formData = reactive({
- data: {},
- treeData: [],
- });
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- rules: [],
- });
- const byform = ref(null);
- const treeData = ref([]);
- const formConfig = reactive([
- {
- type: "title",
- title: "待出库信息",
- },
- {
- type: "select",
- prop: "businessType",
- label: "数据来源",
- required: true,
- disabled: true,
- itemWidth: 100,
- data: [],
- },
- {
- type: "input",
- prop: "businessType",
- label: "单号",
- required: true,
- disabled: true,
- itemWidth: 100,
- data: [],
- },
- {
- type: "input",
- prop: "businessType",
- label: "物品名称",
- required: true,
- disabled: true,
- itemWidth: 100,
- data: [],
- },
- {
- type: "input",
- prop: "businessType",
- label: "待出库数量",
- required: true,
- disabled: true,
- itemWidth: 40,
- data: [],
- },
- {
- type: "title",
- title: "本次出库",
- },
- {
- type: "select",
- prop: "warehouseId",
- label: "仓库名称",
- itemWidth: 100,
- isLoad: {
- url: "/warehouse/page",
- req: {
- pageNum: 1,
- pageSize: 9999,
- },
- labelKey: "name",
- labelVal: "id",
- method: "post",
- resUrl: "rows",
- },
- },
- {
- type: "input",
- prop: "code",
- label: "出库数量",
- disabled: false,
- itemWidth: 33,
- },
- ]);
- const getList = async (req) => {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- loading.value = true;
- proxy
- .post("/stockWait/pageByWdly", sourceList.value.pagination)
- .then((message) => {
- console.log(message);
- sourceList.value.data = message.rows.map((x) => ({
- ...x,
- ...JSON.parse(x.victoriatouristJson),
- }));
- sourceList.value.pagination.total = message.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- const openModal = () => {
- dialogVisible.value = true;
- modalType.value = "add";
- formData.data = {};
- };
- const submitForm = () => {
- byform.value.handleSubmit((valid) => {
- const list = formData.data.stockWaitDetailsList;
- const total = list.reduce((total, x) => (total += Number(x.quantity)), 0);
- if (!(total > 0)) {
- return ElMessage({
- message: `本次入库不能为0!`,
- type: "info",
- });
- }
- for (let i = 0; i < list.length; i++) {
- const e = list[i];
- if (Number(e.receiptQuantity) + e.quantity > Number(e.arrivalQuantity)) {
- return ElMessage({
- message: "本次入库加已入库数量不可大于发货数量!",
- type: "info",
- });
- }
- }
- submitLoading.value = true;
- proxy.post("/stockWait/addByWdly", formData.data).then(
- (res) => {
- ElMessage({
- message: "操作成功",
- type: "success",
- });
- dialogVisible.value = false;
- submitLoading.value = false;
- getList();
- },
- (err) => (submitLoading.value = false)
- );
- });
- };
- const getDtl = (row) => {
- modalType.value = "edit";
- // proxy.post("/stockWait/detailByWdly", { id: row.id }).then((res) => {
- // const json = JSON.parse(res.victoriatouristJson);
- // formData.data = {
- // type: "1",
- // businessType: res.businessType,
- // warehouseId: "",
- // code: json.code,
- // stockWaitDetailsList: res.stockWaitDetailsList.map((x) => ({
- // ...x,
- // arrivalQuantity: x.quantity,
- // quantity: 0,
- // })),
- // };
- // dialogVisible.value = true;
- // });
- dialogVisible.value = true;
- };
- const warehouseType = ref([]);
- const getDict = () => {
- // // 币种数据
- proxy
- .post("/dictTenantData/page", {
- pageNum: 1,
- pageSize: 999,
- tenantId: useUserStore().user.tenantId,
- dictCode: "warehouse_type",
- })
- .then((res) => {
- warehouseType.value = res.rows;
- formConfig[0].data = res.rows.map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- });
- };
- const businessType = [
- { label: "线边回仓", value: "1" },
- { label: "完工入库", value: "2" },
- { label: "采购到货", value: "3" },
- { label: "退货出库", value: "4" },
- ];
- getList();
- getDict();
- onMounted(() => {
- selectConfig[0].data = inboundType.value;
- });
- </script>
-
- <style lang="scss" scoped>
- .tenant {
- padding: 20px;
- }
- </style>
|