index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div class="dataWeido 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%">
  28. <el-row style="padding: 0 0 0 80px">
  29. <el-col :span="24">
  30. <el-col :span="12" style="width: 240px">
  31. <search-work-company
  32. :value="parmValue.companyNo"
  33. :names="''"
  34. :size="searchSize"
  35. :is-detail="id !== 'add'"
  36. :placeholder="'业务公司'"
  37. @searchChange="supplierChange"
  38. />
  39. </el-col>
  40. <el-col :span="12" style="width: 300px; padding: 0 0 0 10px">
  41. <search-supplier
  42. :size="searchSize"
  43. :placeholder="'供应商公司'"
  44. :disabled="parmValue.companyNo === ''"
  45. :value="parmValue.supplier_code"
  46. @searchChange="selectSupplier"
  47. />
  48. </el-col>
  49. <el-col :span="12" style="width: 200px; padding-left: 10px">
  50. <search-stock
  51. :isDetail="true"
  52. :size="searchSize"
  53. :value="parmValue.stock_code"
  54. :disabled="supplier_code === ''"
  55. :placeholder="'出库仓库'"
  56. :isRelation="true"
  57. :companyCode="supplier_code"
  58. :names="''"
  59. @searchChange="selectStock"
  60. />
  61. </el-col>
  62. <!-- 搜索 -->
  63. <el-col :span="4" style="width: 54px">
  64. <el-button
  65. :size="searchSize"
  66. type="primary"
  67. class="fr"
  68. icon="el-icon-search"
  69. label=""
  70. @click="searchList"
  71. ></el-button>
  72. </el-col>
  73. <!-- 重置 -->
  74. <el-col
  75. :span="4"
  76. style="width: 54px; margin-left: 10px"
  77. class="mr5"
  78. >
  79. <el-button
  80. :size="searchSize"
  81. class="fr"
  82. type="warning"
  83. @click="restSearch"
  84. >重置</el-button
  85. >
  86. </el-col>
  87. </el-col>
  88. </el-row>
  89. </div>
  90. </template>
  91. <template #expand="{ scope }">
  92. <el-table
  93. :data="scope.row.child"
  94. style="width: 100%; paddind: 20px"
  95. border
  96. size="small"
  97. >
  98. <el-table-column
  99. label="商品编码"
  100. prop="spuCode"
  101. width="160"
  102. ></el-table-column>
  103. <el-table-column
  104. label="商品名称"
  105. prop="good_name"
  106. min-width="120"
  107. show-overflow-tooltip
  108. ></el-table-column>
  109. <el-table-column
  110. label="规格"
  111. prop="attribute"
  112. show-overflow-tooltip
  113. min-width="120"
  114. >
  115. <template slot-scope="scope">
  116. <span
  117. v-for="(si, sii) in scope.row.specinfo"
  118. :key="sii + si.spec_value_id"
  119. >{{ sii === 0 ? "" : "-" }}{{ si.spec_name }}[{{
  120. si.spec_value
  121. }}]</span
  122. >
  123. </template>
  124. </el-table-column>
  125. <el-table-column label="分类" min-width="120" show-overflow-tooltip>
  126. <template slot-scope="scope">
  127. <span
  128. v-for="(si, sii) in scope.row.can"
  129. :key="sii + si.spec_value_id"
  130. >{{ sii === 0 ? "" : "_" }}{{ si.name }}</span
  131. >
  132. </template></el-table-column
  133. >
  134. <el-table-column
  135. label="品牌"
  136. prop="brand_name"
  137. show-overflow-tooltip
  138. width="100"
  139. ></el-table-column>
  140. <el-table-column
  141. label="单位"
  142. prop="unit"
  143. show-overflow-tooltip
  144. width="80"
  145. ></el-table-column>
  146. <el-table-column
  147. label="当前库存"
  148. show-overflow-tooltip
  149. prop="total_stock"
  150. width="80"
  151. ></el-table-column>
  152. <el-table-column
  153. label="待入库存"
  154. show-overflow-tooltip
  155. prop="wait_in_stock"
  156. width="80"
  157. ></el-table-column>
  158. <el-table-column
  159. label="待出库存"
  160. show-overflow-tooltip
  161. prop="wait_out_stock"
  162. width="80"
  163. ></el-table-column>
  164. <el-table-column
  165. label="可用库存"
  166. show-overflow-tooltip
  167. prop="usable_stock"
  168. width="80"
  169. ></el-table-column>
  170. <el-table-column
  171. label="在途库存"
  172. show-overflow-tooltip
  173. prop="intra_stock"
  174. width="80"
  175. ></el-table-column>
  176. </el-table>
  177. </template>
  178. </ex-table>
  179. <add-edit
  180. :id="modelId"
  181. :sitem="sitem"
  182. :show-model="showModel"
  183. :is-detail="isDetail"
  184. @refresh="searchList"
  185. @cancel="showModel = false"
  186. />
  187. </div>
  188. <div v-else>
  189. <no-auth></no-auth>
  190. </div>
  191. </div>
  192. </template>
  193. <script>
  194. import mixinPage from "@/mixins/elPaginationHandle";
  195. import resToken from "@/mixins/resToken";
  196. import asyncRequest from "@/apis/service/stock/dataWeido";
  197. import columns from "./columns";
  198. import { mapGetters } from "vuex";
  199. export default {
  200. name: "dataWeido",
  201. mixins: [mixinPage, resToken],
  202. computed: {
  203. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  204. powers() {
  205. let tran =
  206. this.$store.getters.btnList.find(
  207. (item) => item.menu_route == "stockCount"
  208. ) || {};
  209. if (tran && tran.action && tran.action.length > 0) {
  210. return tran.action;
  211. } else {
  212. return [];
  213. }
  214. },
  215. },
  216. data() {
  217. return {
  218. loading: false,
  219. stock_code: "",
  220. supplier_code: "",
  221. parmValue: {
  222. companyNo: "",
  223. supplier_code: [],
  224. stock_code: [],
  225. page: 1, // 页码
  226. size: 15, // 每页显示条数
  227. },
  228. // 表格 - 数据
  229. tableData: [],
  230. // 表格 - 参数
  231. table: {
  232. stripe: true,
  233. border: true,
  234. _defaultHeader_: ["setcol"],
  235. },
  236. // 表格 - 分页
  237. pageInfo: {
  238. size: 15,
  239. curr: 1,
  240. total: 0,
  241. },
  242. // 表格 - 列参数
  243. columns: columns,
  244. };
  245. },
  246. mounted() {
  247. this.searchList();
  248. },
  249. methods: {
  250. //业务公司选择
  251. async supplierChange(e) {
  252. const { code } = e;
  253. this.parmValue.companyNo = code || ""; //业务公司编码
  254. this.parmValue.supplier_code = [];
  255. this.supplier_code = "";
  256. this.parmValue.stock_code = [];
  257. this.stock_code = "";
  258. this.parmValue.page = 1;
  259. this.pageInfo.curr = 1;
  260. await this.searchList();
  261. },
  262. // 选择供应商仓库
  263. async selectStock(e) {
  264. const { code } = e;
  265. this.parmValue.stock_code = code ? [code] : [];
  266. this.stock_code = code || "";
  267. this.parmValue.stock_code = [];
  268. this.stock_code = "";
  269. this.parmValue.page = 1;
  270. this.pageInfo.curr = 1;
  271. await this.searchList();
  272. },
  273. // 选择供应商
  274. async selectSupplier(e) {
  275. const { code } = e;
  276. this.parmValue.supplier_code = code ? [code] : [];
  277. this.supplier_code = code || "";
  278. this.parmValue.stock_code = [];
  279. this.stock_code = "";
  280. this.parmValue.page = 1;
  281. this.pageInfo.curr = 1;
  282. await this.searchList();
  283. },
  284. restSearch() {
  285. // 表格 - 分页
  286. this.pageInfo = {
  287. size: 15,
  288. curr: 1,
  289. total: 0,
  290. };
  291. this.parmValue = {
  292. companyNo: "",
  293. supplier_code: [],
  294. stock_code: [], //仓库编码
  295. page: 1, // 页码
  296. size: 15, // 每页显示条数
  297. };
  298. this.searchList();
  299. },
  300. async searchList() {
  301. this.loading = true;
  302. let model = JSON.parse(JSON.stringify(this.parmValue));
  303. model.supplierNo = model.supplier_code.toString() || "";
  304. model.wsm_code = model.stock_code.toString() || "";
  305. delete model["supplier_code"];
  306. delete model["stock_code"];
  307. const res = await asyncRequest.list(model);
  308. if (res && res.code === 0 && res.data) {
  309. this.tableData = res.data.list;
  310. this.pageInfo.total = Number(res.data.count);
  311. } else if (res && res.code >= 100 && res.code <= 104) {
  312. await this.logout();
  313. } else {
  314. this.tableData = [];
  315. this.pageInfo.total = 0;
  316. }
  317. this.loading = false;
  318. },
  319. },
  320. };
  321. </script>