index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <div class="newApply pagePadding">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. <div class="box">
  7. <CompanySearch @searchCard="handClick"></CompanySearch>
  8. <StockSearch :companyName="company"></StockSearch>
  9. </div>
  10. <NewApply :myType="type"></NewApply>
  11. <InStock :myType="type" v-if="type != 1"></InStock>
  12. <GoStock :myType="type" v-if="type != 1 && type != 2"></GoStock>
  13. <InStockCheck
  14. :myType="type"
  15. v-if="type != 1 && type != 2 && type != 3"
  16. ></InStockCheck>
  17. <CheckStock :myType="type" v-if="type === 5"></CheckStock>
  18. <!-- <el-col :span="24" style="text-align: right; margin-top: 10px">
  19. <el-button type="primary" @click="save">保 存 </el-button>
  20. <el-button type="warning" @click="submitForm"
  21. >保 存 并 发 起 流 程
  22. </el-button>
  23. </el-col> -->
  24. <add-edit
  25. :id="modelId"
  26. :sitem="sitem"
  27. :show-model="showModel"
  28. :is-detail="isDetail"
  29. @refresh="searchList"
  30. @cancel="showModel = false"
  31. />
  32. </div>
  33. <div v-else>
  34. <no-auth></no-auth>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import mixinPage from "@/mixins/elPaginationHandle";
  40. import resToken from "@/mixins/resToken";
  41. import ExTable from "@/components/ExTableNew.vue";
  42. import statusList from "@/assets/js/statusList";
  43. // import asyncRequest from "@/apis/service/stock/newApply";
  44. import asyncRequest from "@/mock/service/stock/newApply";
  45. import addEdit from "./addEdit";
  46. import { mapGetters } from "vuex";
  47. import NewApply from "./components/newApply"; //新建申请页面
  48. import InStock from "./components/inStock-audit.vue"; //入库方审核界面
  49. import GoStock from "./components//goStock-audit.vue"; //出库方发货
  50. import InStockCheck from "./components/inStock-check.vue"; //入库方验货
  51. import CheckStock from "./components/checkStock.vue"; //验货审核
  52. import StockSearch from "./components/stockSearch.vue";
  53. import CompanySearch from "./components/companySearch.vue";
  54. export default {
  55. name: "newApply",
  56. mixins: [mixinPage, resToken],
  57. components: {
  58. addEdit,
  59. ExTable,
  60. NewApply,
  61. InStock,
  62. GoStock,
  63. InStockCheck,
  64. CheckStock,
  65. StockSearch,
  66. CompanySearch,
  67. },
  68. computed: {
  69. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  70. powers() {
  71. let tran =
  72. this.$store.getters.btnList.find(
  73. (item) => item.menu_route == "allotFlow"
  74. ) || {};
  75. if (tran && tran.action && tran.action.length > 0) {
  76. return tran.action;
  77. } else {
  78. return [];
  79. }
  80. },
  81. },
  82. data() {
  83. return {
  84. company: "",
  85. type: 1, //假数据,用于表示后台的操作流程节点
  86. /**
  87. * type=1,那么表示当前是新建申请流程,只显示新建申请组件。newApply
  88. * type=2,入库方审核流程 inStock-audit
  89. * type=3,出库方发货流程 goStock-audit
  90. * type=4,入库方验货流程 inStock-check
  91. * type=5,验货审核流程 checkStock
  92. *
  93. */
  94. selectStock_in: "", //选择的入库仓库名称
  95. selectStock_go: "", //选择的出库仓库名称
  96. stock_go: "", //出库仓库name
  97. stock_in: "", //入库仓库name
  98. options: [], //用于渲染二级仓库名
  99. ruleForm: {},
  100. rules: {
  101. //出入库规则
  102. stock_go_rule: [
  103. {
  104. required: true,
  105. message: "请选择出库仓库",
  106. trigger: "blur",
  107. },
  108. ],
  109. stock_in_rule: [
  110. {
  111. required: true,
  112. message: "请选择入库仓库",
  113. trigger: "blur",
  114. },
  115. ],
  116. },
  117. loading: true,
  118. showModel: false,
  119. isDetail: false,
  120. modelId: 0,
  121. tableData: [], //渲染表格
  122. //
  123. // 表格 - 数据
  124. tableData: [],
  125. // 表格 - 参数
  126. table: {
  127. stripe: true,
  128. border: true,
  129. _defaultHeader_: ["setcol"],
  130. },
  131. // 表格 - 分页
  132. pageInfo: {
  133. size: 15,
  134. curr: 1,
  135. total: 0,
  136. },
  137. // 表格 - 列参数
  138. columns: [
  139. {
  140. prop: "nickname",
  141. label: "商品编号",
  142. },
  143. {
  144. prop: "role_name",
  145. label: "商品名称",
  146. },
  147. {
  148. prop: "mobile",
  149. label: "数量",
  150. },
  151. {
  152. prop: "",
  153. label: "操作",
  154. fixed: "right",
  155. _noset_: true,
  156. _slot_: "operation",
  157. },
  158. ],
  159. // sitem: null,
  160. // // 状态
  161. // statusOptions: [
  162. // { id: "0", label: "禁用" },
  163. // { id: "1", label: "启用" },
  164. // ],
  165. parmValue: {
  166. //入参
  167. // name: "", // 业务员名字
  168. // username: "", // 账号
  169. // status: "", //
  170. // page: 1, // 页码
  171. // size: 15, // 每页显示条数
  172. },
  173. // passwordModel: false,
  174. // passwordModelId: 0,
  175. // isPasswordDetail: false,
  176. // statusList: statusList,
  177. };
  178. },
  179. mounted() {
  180. this.searchList();
  181. this.stockName(); //假数据,获取二级仓库名
  182. },
  183. methods: {
  184. handClick(value) {
  185. console.log("执行子组件事件", value);
  186. this.company = value;
  187. },
  188. restSearch() {
  189. //重置入参
  190. this.parmValue = {
  191. // name: "", // 业务员名字
  192. // username: "", // 账号
  193. // status: "", //
  194. // page: 1, // 页码
  195. // size: 10, // 每页显示条数
  196. };
  197. this.searchList();
  198. },
  199. openModal(id, isDetail, sitem) {
  200. this.showModel = true;
  201. this.modelId = id;
  202. this.isDetail = isDetail;
  203. this.sitem = sitem;
  204. },
  205. async deleteById(id, status) {
  206. // await this.$confirm("确定要删除?", {
  207. // confirmButtonText: "确定",
  208. // cancelButtonText: "取消",
  209. // type: "warning",
  210. // })
  211. // .then(async () => {
  212. // const model = {
  213. // id: id,
  214. // status: status === "1" ? "0" : "1",
  215. // };
  216. // const res = await asyncRequest.status(model);
  217. // if (res && res.code === 0) {
  218. // this.$notify.success({
  219. // title: "删除成功",
  220. // message: "",
  221. // });
  222. // this.searchList();
  223. // } else if (res && res.code >= 100 && res.code <= 104) {
  224. // await this.logout();
  225. // } else {
  226. // this.$message.warning(res.message);
  227. // }
  228. // })
  229. // .catch(() => {
  230. // console.log("取消");
  231. // });
  232. },
  233. async searchList() {
  234. // this.loading = true;
  235. // const res = await asyncRequest.list(this.parmValue);
  236. // if (res && res.code === 0 && res.data) {
  237. // this.tableData = res.data.list;
  238. // this.pageInfo.total = Number(res.data.count);
  239. // } else if (res && res.code >= 100 && res.code <= 104) {
  240. // await this.logout();
  241. // } else {
  242. // this.tableData = [];
  243. // this.pageInfo.total = 0;
  244. // }
  245. // this.loading = false;
  246. },
  247. async statusConfirm(id, status) {
  248. // let str = status === "1" ? "禁用" : "启用";
  249. // await this.$confirm("确定要改为" + str + "?", {
  250. // confirmButtonText: "确定",
  251. // cancelButtonText: "取消",
  252. // type: "warning",
  253. // })
  254. // .then(async () => {
  255. // this.loading = true;
  256. // const model = {
  257. // id: id,
  258. // status: status === "1" ? "0" : "1",
  259. // };
  260. // const res = await asyncRequest.status(model);
  261. // if (res && res.code === 0) {
  262. // this.loading = false;
  263. // this.$notify.success({
  264. // title: "状态修改成功!",
  265. // message: "",
  266. // });
  267. // await this.searchList();
  268. // } else if (res && res.code >= 100 && res.code <= 104) {
  269. // await this.logout();
  270. // } else {
  271. // this.$message.warning(res.message);
  272. // }
  273. // })
  274. // .catch(() => {
  275. // console.log("取消");
  276. // });
  277. },
  278. async stockName() {
  279. //获取多级仓库名称的方法
  280. const res = await asyncRequest.listAll(this.parmValue);
  281. // console.log(res.data);
  282. // this.openModal("005", true);
  283. // console.log(this.selectStock_go);
  284. // console.log(this.selectStock_in);
  285. // this.options = res.data;
  286. // console.log(this.options);
  287. let arr = res.data;
  288. // console.log(arr);
  289. arr.forEach((ele) => {
  290. //重新封装后台传递来的数据,转换格式
  291. let item = {
  292. value: ele.id,
  293. label: ele.name,
  294. children: [],
  295. };
  296. ele.child.forEach((elem) => {
  297. let model = {
  298. value: elem.id,
  299. label: elem.name,
  300. };
  301. item.children.push(model);
  302. });
  303. this.options.push(item);
  304. });
  305. this.options.forEach((ele) => {
  306. //从数据表中筛选出我们要用的数据
  307. if (ele.value === this.selectStock_go[0]) {
  308. ele.children.forEach((elem) => {
  309. if (elem.value === this.selectStock_go[1]) {
  310. this.stock_go = ele.label + "/" + elem.label;
  311. }
  312. });
  313. }
  314. if (ele.value === this.selectStock_in[0]) {
  315. ele.children.forEach((elem) => {
  316. if (elem.value === this.selectStock_in[1]) {
  317. this.stock_in = ele.label + "/" + elem.label;
  318. }
  319. });
  320. }
  321. });
  322. if (this.selectStock_in != "" || this.selectStock_go != "") {
  323. console.log("选择了一个项目");
  324. this.openModal("005", true);
  325. }
  326. // console.log(this.stock_go);
  327. // console.log(this.stock_in);
  328. // console.log(this.pageInfo.total);
  329. this.compareStock(); //比较出库仓库和入库仓库是否相同
  330. },
  331. compareStock() {
  332. // //比较出库仓库和入库仓库是否相同
  333. // if (
  334. // this.stock_go === this.stock_in &&
  335. // this.stock_go !== "" &&
  336. // this.stock_go != ""
  337. // ) {
  338. // console.log("出库仓库和入库仓库相同");
  339. // this.$message({
  340. // message: "出库仓库不能和入库仓库相同",
  341. // type: "error",
  342. // });
  343. // }
  344. },
  345. },
  346. };
  347. </script>
  348. <style lang="scss" >
  349. </style>