123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- <script>
- import test from "@/components/form-test/index.vue";
- import query from "@/components/query/index.vue";
- import byTable from "@/components/by-table/index.js";
- import addInbound from "./addInbound.vue";
- import * as API from "@/api/inbound-outbound/inbound/index.js";
- import { warehouseSelectList } from "@/api/product-material/warehouse/index.js";
- export default {
- components: {
- test,
- byTable,
- query,
- addInbound,
- },
- data() {
- return {
- warehouseTypeList: [],
- warehouseSelectList: [],
- btnForm: {
- otherButton: {
- list: [
- {
- name: "采购入库",
- methodsText: "add",
- type: "primary",
- add: () => {
- this.handleAdd(10);
- },
- },
- {
- name: "手动入库",
- methodsText: "add",
- type: "defualt",
- add: () => {
- this.handleAdd(20);
- },
- },
- {
- name: "入库质检",
- methodsText: "add",
- type: "defualt",
- add: () => {
- this.handleAdd();
- },
- },
- ],
- },
- },
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- keyword: "",
- warehouseId: "",
- status: "",
- code: "",
- goodsCode: "",
- goodsName: "",
- applyUserId: "",
- startTime: "",
- endTime: "",
- },
- selectConfig: [
- {
- label: "收获仓库",
- prop: "type",
- data: [],
- },
- {
- label: "入库状态",
- prop: "type",
- data: [],
- },
- ],
- tableList: [],
- loading: false,
- inboundType: null, // 入库类型 10 采购入库 20 手动入库
- titleText: "",
- open: false,
- form: {
- id: "",
- changeDetailsList: [],
- },
- };
- },
- created() {
- const businessDictData = JSON.parse(
- window.localStorage.getItem("businessDict")
- );
- this.warehouseTypeList = businessDictData.find(
- (item) => item.code === "warehouseType"
- ).children;
- this.selectConfig[0].data = this.warehouseTypeList.map((item) => ({
- label: item.dictValue,
- value: item.dictKey,
- }));
- warehouseSelectList().then((res) => {
- this.warehouseSelectList = res.data.data;
- });
- // this.getList();
- },
- methods: {
- getList() {
- this.loading = true;
- API.outboundList(this.queryParams).then(
- (res) => {
- console.log(res, "qq");
- this.tableList = res.data.data.records;
- this.total = res.data.data.total;
- this.loading = false;
- },
- (err) => {
- console.log("outboundList: " + err);
- this.loading = false;
- }
- );
- },
- handleQuery() {
- this.getList();
- },
- handleAdd(type) {
- this.form = {
- id: "",
- changeDetailsList: [],
- };
- if (type === 10) {
- this.titleText = "add";
- } else {
- this.titleText = "manual";
- }
- this.inboundType = type;
- this.open = true;
- },
- handleCancel() {
- this.form = {
- id: "",
- changeDetailsList: [],
- };
- this.open = false;
- },
- handleEdit(row) {
- this.titleText = "edit";
- this.form = row;
- this.open = true;
- if (this.form.fileInfoList === "") {
- this.form.fileInfoList = [];
- }
- this.$nextTick(() => {
- this.$refs.addInbound.loading = true;
- this.$refs.addInbound.countryChange(this.form.countryId);
- this.$refs.addInbound.provinceChange(this.form.provinceId);
- this.$refs.addInbound.loading = false;
- });
- },
- handleSubmit() {
- if (this.inboundType === 10) {
- API.purchaseAdd(this.form).then(
- () => {
- this.msgSuccess(this.$t("addSuccess"));
- this.$refs.addInbound.loading = false;
- this.open = false;
- this.getList();
- },
- (err) => {
- console.log("purchaseAdd: " + err);
- this.$refs.addInbound.loading = false;
- }
- );
- } else {
- API.manualAdd(this.form).then(
- () => {
- this.msgSuccess(this.$t("addSuccess"));
- this.open = false;
- this.$refs.addInbound.loading = false;
- this.getList();
- },
- (err) => {
- console.log("manualAdd: " + err);
- this.$refs.addInbound.loading = false;
- }
- );
- }
- },
- handleDelete(row) {
- this.$confirm(this.$t("askDeleteData"), {
- confirmButtonText: this.$t("submitText"),
- cancelButtonText: this.$t("cancelText"),
- type: "warning",
- }).then(() => {
- API.outboundDel({ id: row.id }).then(() => {
- this.msgSuccess(this.$t("deleteSuccess"));
- this.getList();
- });
- });
- },
- showAddress(row) {
- return (
- <div>
- {row.countryName} , {row.provinceName} , {row.cityName}
- </div>
- );
- },
- },
- };
- </script>
- <template>
- <div class="box-card">
- <el-card class="header">
- <test :form-config="btnForm"></test>
- </el-card>
- <el-card class="body-main">
- <query
- :selectConfig="selectConfig"
- :req="queryParams"
- :isShowMore="true"
- @handleQuery="handleQuery"
- @handleMore="
- () => {
- queryDialog = true;
- }
- "
- ></query>
- <el-table :data="tableList" v-loading="loading">
- <el-table-column
- :label="$t('inbound_outbound.outbound.outboundOddNumbers')"
- align="center"
- prop="code"
- />
- <el-table-column
- :label="$t('inbound_outbound.outbound.salesOddNumbers')"
- align="center"
- prop="name"
- />
- <el-table-column
- :label="$t('inbound_outbound.outbound.customerType')"
- align="center"
- :formatter="showAddress"
- />
- <el-table-column
- :label="$t('inbound_outbound.outbound.customerCode')"
- align="center"
- prop="contacts"
- />
- <el-table-column
- :label="$t('inbound_outbound.outbound.customerNmae')"
- align="center"
- prop="phone"
- />
- <el-table-column
- :label="$t('inbound_outbound.outbound.outboundQuantity')"
- align="center"
- prop="phone"
- />
- <el-table-column
- :label="$t('inbound_outbound.outbound.createTime')"
- align="center"
- prop="phone"
- />
- <el-table-column
- :label="$t('inbound_outbound.outbound.remarks')"
- align="center"
- prop="phone"
- />
- <el-table-column :label="$t('operation')" align="center" width="120">
- <template slot-scope="scope">
- <el-button type="text" @click="handleEdit(scope.row)"
- >{{ $t("edit") }}
- </el-button>
- <el-button type="text" @click="handleDelete(scope.row)"
- >{{ $t("delete") }}
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-card>
- <el-dialog
- :title="titleText === 'manual' ? '手动入库' : '采购入库'"
- :visible.sync="open"
- v-if="open"
- width="80%"
- top="60px"
- >
- <add-inbound
- :form="form"
- :warehouseSelectList="warehouseSelectList"
- :warehouseTypeList="warehouseTypeList"
- :inboundType="inboundType"
- @submit="handleSubmit"
- @cancel="handleCancel"
- ref="addInbound"
- ></add-inbound>
- </el-dialog>
- </div>
- </template>
- <style lang="scss" scoped>
- .box-card {
- height: calc(100vh - 110px);
- overflow-y: auto;
- display: flex;
- flex-direction: column;
- .header {
- // height: 100px;
- margin-bottom: 10px;
- box-sizing: border-box;
- }
- .body-main {
- flex: 1;
- }
- }
- </style>
|