index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <script>
  2. import test from "@/components/form-test/index.vue";
  3. import query from "@/components/query/index.vue";
  4. import byTable from "@/components/by-table/index.js";
  5. import addInbound from "./addInbound.vue";
  6. import * as API from "@/api/inbound-outbound/inbound/index.js";
  7. import { warehouseSelectList } from "@/api/product-material/warehouse/index.js";
  8. export default {
  9. components: {
  10. test,
  11. byTable,
  12. query,
  13. addInbound,
  14. },
  15. data() {
  16. return {
  17. warehouseTypeList: [],
  18. warehouseSelectList: [],
  19. btnForm: {
  20. otherButton: {
  21. list: [
  22. {
  23. name: "采购入库",
  24. methodsText: "add",
  25. type: "primary",
  26. add: () => {
  27. this.handleAdd(10);
  28. },
  29. },
  30. {
  31. name: "手动入库",
  32. methodsText: "add",
  33. type: "defualt",
  34. add: () => {
  35. this.handleAdd(20);
  36. },
  37. },
  38. {
  39. name: "入库质检",
  40. methodsText: "add",
  41. type: "defualt",
  42. add: () => {
  43. this.handleAdd();
  44. },
  45. },
  46. ],
  47. },
  48. },
  49. queryParams: {
  50. pageNum: 1,
  51. pageSize: 10,
  52. keyword: "",
  53. warehouseId: "",
  54. status: "",
  55. code: "",
  56. goodsCode: "",
  57. goodsName: "",
  58. applyUserId: "",
  59. startTime: "",
  60. endTime: "",
  61. },
  62. selectConfig: [
  63. {
  64. label: "收获仓库",
  65. prop: "type",
  66. data: [],
  67. },
  68. {
  69. label: "入库状态",
  70. prop: "type",
  71. data: [],
  72. },
  73. ],
  74. tableList: [],
  75. loading: false,
  76. inboundType: null, // 入库类型 10 采购入库 20 手动入库
  77. titleText: "",
  78. open: false,
  79. form: {
  80. id: "",
  81. changeDetailsList: [],
  82. },
  83. };
  84. },
  85. created() {
  86. const businessDictData = JSON.parse(
  87. window.localStorage.getItem("businessDict")
  88. );
  89. this.warehouseTypeList = businessDictData.find(
  90. (item) => item.code === "warehouseType"
  91. ).children;
  92. this.selectConfig[0].data = this.warehouseTypeList.map((item) => ({
  93. label: item.dictValue,
  94. value: item.dictKey,
  95. }));
  96. warehouseSelectList().then((res) => {
  97. this.warehouseSelectList = res.data.data;
  98. });
  99. // this.getList();
  100. },
  101. methods: {
  102. getList() {
  103. this.loading = true;
  104. API.outboundList(this.queryParams).then(
  105. (res) => {
  106. console.log(res, "qq");
  107. this.tableList = res.data.data.records;
  108. this.total = res.data.data.total;
  109. this.loading = false;
  110. },
  111. (err) => {
  112. console.log("outboundList: " + err);
  113. this.loading = false;
  114. }
  115. );
  116. },
  117. handleQuery() {
  118. this.getList();
  119. },
  120. handleAdd(type) {
  121. this.form = {
  122. id: "",
  123. changeDetailsList: [],
  124. };
  125. if (type === 10) {
  126. this.titleText = "add";
  127. } else {
  128. this.titleText = "manual";
  129. }
  130. this.inboundType = type;
  131. this.open = true;
  132. },
  133. handleCancel() {
  134. this.form = {
  135. id: "",
  136. changeDetailsList: [],
  137. };
  138. this.open = false;
  139. },
  140. handleEdit(row) {
  141. this.titleText = "edit";
  142. this.form = row;
  143. this.open = true;
  144. if (this.form.fileInfoList === "") {
  145. this.form.fileInfoList = [];
  146. }
  147. this.$nextTick(() => {
  148. this.$refs.addInbound.loading = true;
  149. this.$refs.addInbound.countryChange(this.form.countryId);
  150. this.$refs.addInbound.provinceChange(this.form.provinceId);
  151. this.$refs.addInbound.loading = false;
  152. });
  153. },
  154. handleSubmit() {
  155. if (this.inboundType === 10) {
  156. API.purchaseAdd(this.form).then(
  157. () => {
  158. this.msgSuccess(this.$t("addSuccess"));
  159. this.$refs.addInbound.loading = false;
  160. this.open = false;
  161. this.getList();
  162. },
  163. (err) => {
  164. console.log("purchaseAdd: " + err);
  165. this.$refs.addInbound.loading = false;
  166. }
  167. );
  168. } else {
  169. API.manualAdd(this.form).then(
  170. () => {
  171. this.msgSuccess(this.$t("addSuccess"));
  172. this.open = false;
  173. this.$refs.addInbound.loading = false;
  174. this.getList();
  175. },
  176. (err) => {
  177. console.log("manualAdd: " + err);
  178. this.$refs.addInbound.loading = false;
  179. }
  180. );
  181. }
  182. },
  183. handleDelete(row) {
  184. this.$confirm(this.$t("askDeleteData"), {
  185. confirmButtonText: this.$t("submitText"),
  186. cancelButtonText: this.$t("cancelText"),
  187. type: "warning",
  188. }).then(() => {
  189. API.outboundDel({ id: row.id }).then(() => {
  190. this.msgSuccess(this.$t("deleteSuccess"));
  191. this.getList();
  192. });
  193. });
  194. },
  195. showAddress(row) {
  196. return (
  197. <div>
  198. {row.countryName} , {row.provinceName} , {row.cityName}
  199. </div>
  200. );
  201. },
  202. },
  203. };
  204. </script>
  205. <template>
  206. <div class="box-card">
  207. <el-card class="header">
  208. <test :form-config="btnForm"></test>
  209. </el-card>
  210. <el-card class="body-main">
  211. <query
  212. :selectConfig="selectConfig"
  213. :req="queryParams"
  214. :isShowMore="true"
  215. @handleQuery="handleQuery"
  216. @handleMore="
  217. () => {
  218. queryDialog = true;
  219. }
  220. "
  221. ></query>
  222. <el-table :data="tableList" v-loading="loading">
  223. <el-table-column
  224. :label="$t('inbound_outbound.outbound.outboundOddNumbers')"
  225. align="center"
  226. prop="code"
  227. />
  228. <el-table-column
  229. :label="$t('inbound_outbound.outbound.salesOddNumbers')"
  230. align="center"
  231. prop="name"
  232. />
  233. <el-table-column
  234. :label="$t('inbound_outbound.outbound.customerType')"
  235. align="center"
  236. :formatter="showAddress"
  237. />
  238. <el-table-column
  239. :label="$t('inbound_outbound.outbound.customerCode')"
  240. align="center"
  241. prop="contacts"
  242. />
  243. <el-table-column
  244. :label="$t('inbound_outbound.outbound.customerNmae')"
  245. align="center"
  246. prop="phone"
  247. />
  248. <el-table-column
  249. :label="$t('inbound_outbound.outbound.outboundQuantity')"
  250. align="center"
  251. prop="phone"
  252. />
  253. <el-table-column
  254. :label="$t('inbound_outbound.outbound.createTime')"
  255. align="center"
  256. prop="phone"
  257. />
  258. <el-table-column
  259. :label="$t('inbound_outbound.outbound.remarks')"
  260. align="center"
  261. prop="phone"
  262. />
  263. <el-table-column :label="$t('operation')" align="center" width="120">
  264. <template slot-scope="scope">
  265. <el-button type="text" @click="handleEdit(scope.row)"
  266. >{{ $t("edit") }}
  267. </el-button>
  268. <el-button type="text" @click="handleDelete(scope.row)"
  269. >{{ $t("delete") }}
  270. </el-button>
  271. </template>
  272. </el-table-column>
  273. </el-table>
  274. </el-card>
  275. <el-dialog
  276. :title="titleText === 'manual' ? '手动入库' : '采购入库'"
  277. :visible.sync="open"
  278. v-if="open"
  279. width="80%"
  280. top="60px"
  281. >
  282. <add-inbound
  283. :form="form"
  284. :warehouseSelectList="warehouseSelectList"
  285. :warehouseTypeList="warehouseTypeList"
  286. :inboundType="inboundType"
  287. @submit="handleSubmit"
  288. @cancel="handleCancel"
  289. ref="addInbound"
  290. ></add-inbound>
  291. </el-dialog>
  292. </div>
  293. </template>
  294. <style lang="scss" scoped>
  295. .box-card {
  296. height: calc(100vh - 110px);
  297. overflow-y: auto;
  298. display: flex;
  299. flex-direction: column;
  300. .header {
  301. // height: 100px;
  302. margin-bottom: 10px;
  303. box-sizing: border-box;
  304. }
  305. .body-main {
  306. flex: 1;
  307. }
  308. }
  309. </style>