index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div class="spaceCount pagePadding" style="padding: 0">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. <ex-table
  7. v-loading="loading"
  8. :table="table"
  9. :data="tableData"
  10. :columns="columns"
  11. :page="pageInfo"
  12. :size="size"
  13. @page-curr-change="handlePageChange"
  14. @page-size-change="handleSizeChange"
  15. @screen-reset="
  16. pageInfo.curr = 1;
  17. parmValue.page = 1;
  18. searchList();
  19. "
  20. @screen-submit="
  21. pageInfo.curr = 1;
  22. parmValue.page = 1;
  23. searchList();
  24. "
  25. >
  26. <template #table-header="{}">
  27. <div style="width: 100%" class="min">
  28. <el-row style="padding: 0 0 0 80px">
  29. <el-col :span="12" style="width: 300px">
  30. <search-work-company
  31. :value="parmValue.companyNo"
  32. :names="''"
  33. :size="searchSize"
  34. :is-detail="id !== 'add'"
  35. :placeholder="'业务公司'"
  36. @searchChange="supplierChange"
  37. />
  38. </el-col>
  39. <el-col :span="10" style="width: 330px; padding: 0 0 0 10px">
  40. <el-input
  41. v-model="parmValue.type_code"
  42. :size="searchSize"
  43. placeholder="商品属性编码"
  44. />
  45. </el-col>
  46. <!-- 重置 -->
  47. <el-col :span="4" style="width: 66px" class="fr">
  48. <el-button
  49. :size="searchSize"
  50. class="fl"
  51. type="warning"
  52. @click="restSearch"
  53. >重置</el-button
  54. >
  55. </el-col>
  56. </el-row>
  57. <el-row style="padding: 10px 0 0 0">
  58. <el-col :span="12" style="width: 380px">
  59. <search-supplier
  60. :size="searchSize"
  61. :placeholder="'供应商公司'"
  62. :disabled="parmValue.companyNo === ''"
  63. :value="parmValue.supplier_code"
  64. @searchChange="selectSupplier"
  65. />
  66. </el-col>
  67. <el-col :span="12" style="width: 330px; padding:0 0 0 10px">
  68. <search-stock
  69. :isDetail="true"
  70. :size="searchSize"
  71. :value="parmValue.stock_code"
  72. :disabled="supplier_code === ''"
  73. :placeholder="'出库仓库'"
  74. :isRelation="true"
  75. :companyCode="supplier_code"
  76. :names="''"
  77. @searchChange="selectStock"
  78. />
  79. </el-col>
  80. <!-- 刷新 -->
  81. <el-col :span="4" style="width: 66px" class="fr">
  82. <el-button
  83. :size="searchSize"
  84. type="primary"
  85. label=""
  86. @click="searchList"
  87. >刷新</el-button
  88. >
  89. </el-col>
  90. </el-row>
  91. </div>
  92. </template>
  93. <template #specinfo="{ scope }">
  94. <span
  95. v-for="(si, sii) in scope.row.specinfo"
  96. :key="sii + si.spec_value_id"
  97. >{{ sii === 0 ? "" : "-" }}{{ si.spec_name }}[{{
  98. si.spec_value
  99. }}]</span
  100. >
  101. </template>
  102. <template #can="{ scope }">
  103. <span v-for="(si, sii) in scope.row.cat_info" :key="sii + si.id"
  104. >{{ sii === 0 ? "" : "-" }}{{ si.name }}</span
  105. >
  106. </template>
  107. </ex-table>
  108. </div>
  109. <div v-else>
  110. <no-auth></no-auth>
  111. </div>
  112. </div>
  113. </template>
  114. <script>
  115. import mixinPage from "@/mixins/elPaginationHandle";
  116. import resToken from "@/mixins/resToken";
  117. import asyncRequest from "@/apis/service/stock/spaceCount";
  118. import columns from "./columns";
  119. import { mapGetters } from "vuex";
  120. export default {
  121. name: "spaceCount",
  122. mixins: [mixinPage, resToken],
  123. components: {},
  124. computed: {
  125. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  126. powers() {
  127. let tran =
  128. this.$store.getters.btnList.find(
  129. (item) => item.menu_route == "stockCount"
  130. ) || {};
  131. if (tran && tran.action && tran.action.length > 0) {
  132. return tran.action;
  133. } else {
  134. return [];
  135. }
  136. },
  137. },
  138. data() {
  139. return {
  140. stock_code: "",
  141. supplier_code: "",
  142. parmValue: {
  143. supplier_code: [], //供应商编码
  144. stock_code: [], //仓库编码
  145. companyNo: "",
  146. start: "",
  147. end: "",
  148. type_code: "", //商品编码
  149. page: 1, // 页码
  150. size: 15, // 每页显示条数
  151. },
  152. loading: true,
  153. // 表格 - 数据
  154. tableData: [],
  155. // 表格 - 参数
  156. table: {
  157. stripe: true,
  158. border: true,
  159. _defaultHeader_: ["setcol"],
  160. },
  161. // 表格 - 分页
  162. pageInfo: {
  163. size: 15,
  164. curr: 1,
  165. total: 0,
  166. },
  167. // 表格 - 列参数
  168. columns: columns,
  169. };
  170. },
  171. mounted() {
  172. this.searchList();
  173. },
  174. methods: {
  175. //业务公司选择
  176. async supplierChange(e) {
  177. const { code } = e;
  178. this.parmValue.companyNo = code || ""; //业务公司编码
  179. this.parmValue.supplier_code = [];
  180. this.supplier_code = "";
  181. this.parmValue.stock_code = [];
  182. this.stock_code = "";
  183. this.parmValue.page = 1;
  184. this.pageInfo.curr = 1;
  185. await this.searchList();
  186. },
  187. // 选择时间操作
  188. async handleTime(e) {
  189. this.parmValue.start = e.startTime || "";
  190. this.parmValue.end = e.endTime || "";
  191. this.parmValue.page = 1;
  192. this.pageInfo.curr = 1;
  193. await this.searchList();
  194. },
  195. // 选择供应商仓库
  196. async selectStock(e) {
  197. const { code } = e;
  198. this.parmValue.stock_code = code ? [code] : [];
  199. this.stock_code = code || "";
  200. this.parmValue.stock_code = [];
  201. this.stock_code = "";
  202. this.parmValue.page = 1;
  203. this.pageInfo.curr = 1;
  204. await this.searchList();
  205. },
  206. // 选择供应商
  207. async selectSupplier(e) {
  208. const { code } = e;
  209. this.parmValue.supplier_code = code ? [code] : [];
  210. this.supplier_code = code || "";
  211. this.parmValue.stock_code = [];
  212. this.stock_code = "";
  213. this.parmValue.page = 1;
  214. this.pageInfo.curr = 1;
  215. await this.searchList();
  216. },
  217. restSearch() {
  218. // 表格 - 分页
  219. this.pageInfo = {
  220. size: 15,
  221. curr: 1,
  222. total: 0,
  223. };
  224. this.parmValue = {
  225. start: "",
  226. end: "",
  227. companyNo: "",
  228. type_code: "", //商品编码
  229. supplier_code: [],
  230. stock_code: [], //仓库编码
  231. page: 1, // 页码
  232. size: 15, // 每页显示条数
  233. };
  234. this.searchList();
  235. },
  236. async searchList() {
  237. this.loading = true;
  238. let model = JSON.parse(JSON.stringify(this.parmValue));
  239. model.supplierNo = model.supplier_code.toString() || "";
  240. model.wsm_code = model.stock_code.toString() || "";
  241. delete model["supplier_code"];
  242. delete model["stock_code"];
  243. const res = await asyncRequest.list(model);
  244. if (res && res.code === 0 && res.data) {
  245. this.tableData = res.data.list;
  246. this.tableData.forEach((e) => {
  247. e.supplier_wsm_name =
  248. e.supplier_name === e.wsm_name
  249. ? e.supplier_name
  250. : e.supplier_name + "/" + e.wsm_name;
  251. });
  252. this.pageInfo.total = Number(res.data.count);
  253. } else if (res && res.code >= 100 && res.code <= 104) {
  254. await this.logout();
  255. } else {
  256. this.tableData = [];
  257. this.pageInfo.total = 0;
  258. }
  259. this.loading = false;
  260. },
  261. },
  262. };
  263. </script>