index.vue 7.8 KB

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