|
@@ -0,0 +1,300 @@
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ :title="'选择商品'"
|
|
|
+ :center="true"
|
|
|
+ align="left"
|
|
|
+ top="8vh"
|
|
|
+ width="1040px"
|
|
|
+ @close="showModelThis = false"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :visible.sync="showModelThis"
|
|
|
+ v-loading="loading"
|
|
|
+ element-loading-text="拼命加载中"
|
|
|
+ element-loading-spinner="el-icon-loading"
|
|
|
+ element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <el-card style="margin-top: -20px" class="modal-form-style">
|
|
|
+ <ex-table
|
|
|
+ v-loading="loading"
|
|
|
+ :table="table"
|
|
|
+ :data="tableData"
|
|
|
+ :columns="columns"
|
|
|
+ :page="pageInfo"
|
|
|
+ :size="size"
|
|
|
+ @page-curr-change="handlePageChange"
|
|
|
+ @page-size-change="handleSizeChange"
|
|
|
+ @screen-reset="
|
|
|
+ pageInfo.curr = 1;
|
|
|
+ parmValue.page = 1;
|
|
|
+ searchList();
|
|
|
+ "
|
|
|
+ @screen-submit="
|
|
|
+ pageInfo.curr = 1;
|
|
|
+ parmValue.page = 1;
|
|
|
+ searchList();
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <template #table-header="{ selection }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-row style="margin-top: -15px">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-col :span="4" style="width: 280px; padding: 0">
|
|
|
+ <el-select
|
|
|
+ v-model="supplierCode"
|
|
|
+ multiple
|
|
|
+ filterable
|
|
|
+ remote
|
|
|
+ :multiple-limit="1"
|
|
|
+ reserve-keyword
|
|
|
+ :size="searchSize"
|
|
|
+ clearable
|
|
|
+ style="width: 100%"
|
|
|
+ :placeholder="'供应商名称'"
|
|
|
+ :remote-method="remoteMethod"
|
|
|
+ :loading="selectLoading"
|
|
|
+ @change="supplierChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in options"
|
|
|
+ :key="item.id + index"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.code + ''"
|
|
|
+ :disabled="item.status !== '1'"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4" style="width: 190px; padding: 0 0 0 10px">
|
|
|
+ <el-input
|
|
|
+ :size="searchSize"
|
|
|
+ v-model="parmValue.good_code"
|
|
|
+ :maxlength="40"
|
|
|
+ clearable
|
|
|
+ placeholder="商品编号"
|
|
|
+ />
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4" style="width: 180px; padding: 0 0 0 10px">
|
|
|
+ <el-input
|
|
|
+ :size="searchSize"
|
|
|
+ v-model="parmValue.good_name"
|
|
|
+ :maxlength="40"
|
|
|
+ clearable
|
|
|
+ placeholder="商品名称"
|
|
|
+ />
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="4" style="width: 54px">
|
|
|
+ <el-button
|
|
|
+ :size="searchSize"
|
|
|
+ type="primary"
|
|
|
+ class="fr"
|
|
|
+ icon="el-icon-search"
|
|
|
+ @click="searchList"
|
|
|
+ /></el-col>
|
|
|
+ <el-col :span="4" style="width: 66px">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ class="fr"
|
|
|
+ :size="searchSize"
|
|
|
+ @click="restSearch"
|
|
|
+ >
|
|
|
+ 重置
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="3" style="width: 66px">
|
|
|
+ <el-button
|
|
|
+ :size="searchSize"
|
|
|
+ type="primary"
|
|
|
+ style="float: right; margin-left: 5px"
|
|
|
+ @click="searchList"
|
|
|
+ >
|
|
|
+ 刷新
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="3" style="width: 66px; float: right">
|
|
|
+ <el-button
|
|
|
+ :size="searchSize"
|
|
|
+ type="success"
|
|
|
+ style="float: right; margin-left: 5px"
|
|
|
+ @click="resultList(selection)"
|
|
|
+ >
|
|
|
+ 保存
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </ex-table>
|
|
|
+ </el-card>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import asyncRequest from "@/apis/components/search-good-online-modal";
|
|
|
+import resToken from "@/mixins/resToken";
|
|
|
+import mixinPage from "@/mixins/elPaginationHandle";
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import columns from "./columns";
|
|
|
+export default {
|
|
|
+ name: "searchGoodOnlineModal",
|
|
|
+ mixins: [resToken, mixinPage],
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["tablebtnSize", "searchSize", "size"]),
|
|
|
+ },
|
|
|
+ props: ["showModel", "once"],
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 属性集合
|
|
|
+ * @param {Boolean} showModel : 是否弹出弹窗 必填
|
|
|
+ * @param {Boolean} once : 是否只选一条 非必填
|
|
|
+ */
|
|
|
+ /**
|
|
|
+ * 事件集合
|
|
|
+ * @searchChange : 选中值变化调用 抛出选中数据
|
|
|
+ */
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ options: [],
|
|
|
+ selectLoading: false,
|
|
|
+ searchName: "",
|
|
|
+ supplierCode: [],
|
|
|
+ loading: true,
|
|
|
+ showModelThis: false,
|
|
|
+ parmValue: {
|
|
|
+ type_code: "", // 商品属性code
|
|
|
+ supplierNo: "", // 供应商code
|
|
|
+ good_code: "", // 商品编码
|
|
|
+ good_name: "", // 商品名称
|
|
|
+ wsmcode: "", //仓库code
|
|
|
+ page: 1, // 页码
|
|
|
+ size: 15, // 每页显示条数
|
|
|
+ },
|
|
|
+ tableData: [],
|
|
|
+ passwordModel: false,
|
|
|
+ passwordModelId: 0,
|
|
|
+ isPasswordDetail: false,
|
|
|
+ // 表格 - 数据
|
|
|
+ tableData: [],
|
|
|
+ // 表格 - 参数
|
|
|
+ table: {
|
|
|
+ stripe: true,
|
|
|
+ border: true,
|
|
|
+ // _defaultHeader_: ["setcol"],
|
|
|
+ },
|
|
|
+ // 表格 - 分页
|
|
|
+ pageInfo: {
|
|
|
+ size: 15,
|
|
|
+ curr: 1,
|
|
|
+ total: 0,
|
|
|
+ },
|
|
|
+ // 表格 - 列参数
|
|
|
+ columns: columns,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ showModel: function (val) {
|
|
|
+ this.showModelThis = val;
|
|
|
+ if (val) {
|
|
|
+ this.supplierCode = [];
|
|
|
+ this.searchList();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ showModelThis(val) {
|
|
|
+ if (!val) {
|
|
|
+ this.$emit("cancel");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ supplierChange(e) {
|
|
|
+ if (e && e.length === 1) {
|
|
|
+ this.parmValue.supplierNo = e[0];
|
|
|
+ } else {
|
|
|
+ this.parmValue.supplierNo = "";
|
|
|
+ }
|
|
|
+ this.parmValue.page = 1;
|
|
|
+ this.searchList();
|
|
|
+ },
|
|
|
+ restSearch() {
|
|
|
+ this.supplierCode = [];
|
|
|
+ this.parmValue = {
|
|
|
+ type_code: "", // 商品属性code
|
|
|
+ supplierNo: "", // 供应商code
|
|
|
+ good_code: "", // 商品编码
|
|
|
+ good_name: "", // 商品名称
|
|
|
+ wsmcode: "", //仓库code
|
|
|
+ page: 1, // 页码
|
|
|
+ size: 15, // 每页显示条数
|
|
|
+ };
|
|
|
+ // 表格 - 分页
|
|
|
+ this.pageInfo = {
|
|
|
+ size: 15,
|
|
|
+ curr: 1,
|
|
|
+ total: 0,
|
|
|
+ };
|
|
|
+ this.searchList();
|
|
|
+ },
|
|
|
+ async searchList() {
|
|
|
+ this.loading = true;
|
|
|
+ const res = await asyncRequest.list(this.parmValue);
|
|
|
+ if (res && res.code === 0 && res.data) {
|
|
|
+ this.tableData = res.data.list;
|
|
|
+ // this.tableData.map((v) => {
|
|
|
+ // // v.sale_price = this.setNum(v.sale_price);
|
|
|
+ // // v.sale_fee = this.setNum(v.sale_fee);
|
|
|
+ // // // v.num =
|
|
|
+ // // //pa (v.sale_price);
|
|
|
+ // return v;
|
|
|
+ // });
|
|
|
+ //
|
|
|
+ this.pageInfo.total = Number(res.data.count);
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.tableData = [];
|
|
|
+ this.pageInfo.total = 0;
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
+ },
|
|
|
+ async remoteMethod(query) {
|
|
|
+ this.selectLoading = true;
|
|
|
+ if (query !== "") {
|
|
|
+ this.options = [];
|
|
|
+ let formValue = {
|
|
|
+ page: 1,
|
|
|
+ size: 100,
|
|
|
+ name: query,
|
|
|
+ code: "",
|
|
|
+ };
|
|
|
+
|
|
|
+ let res = await asyncRequest.supplierList(formValue);
|
|
|
+ if (res && res.code === 0 && res.data) {
|
|
|
+ const { list } = res.data;
|
|
|
+ this.options = list;
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.options = [];
|
|
|
+ }
|
|
|
+ this.selectLoading = false;
|
|
|
+ },
|
|
|
+ async resultList(selection) {
|
|
|
+ if (selection && selection.length > 1 && this.once) {
|
|
|
+ this.$message.warning("只能选择一条商品信息!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.showModelThis = false;
|
|
|
+ this.$emit("resultList", selection);
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+</style>
|