index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <div class="allot pagePadding">
  3. <div v-if="powers.some((i) => i == '001')">
  4. <ex-table
  5. v-loading="loading"
  6. :table="table"
  7. :data="tableData"
  8. :columns="columns"
  9. :page="pageInfo"
  10. :size="size"
  11. @page-curr-change="handlePageChange"
  12. @page-size-change="handleSizeChange"
  13. @screen-reset="
  14. pageInfo.curr = 1;
  15. parmValue.page = 1;
  16. searchList();
  17. "
  18. @screen-submit="
  19. pageInfo.curr = 1;
  20. parmValue.page = 1;
  21. searchList();
  22. "
  23. >
  24. <template #table-header="{}">
  25. <div style="width: 100%">
  26. <el-row style="padding: 0px 0 0 80px">
  27. <el-col :span="24">
  28. <el-col :span="4" style="width: 130px">
  29. <el-select
  30. v-model="parmValue.status"
  31. :size="searchSize"
  32. style="width: 100%"
  33. placeholder="调拨状态"
  34. @change="
  35. pageInfo.curr = 1;
  36. parmValue.page = 1;
  37. searchList();
  38. "
  39. >
  40. <el-option
  41. v-for="item in statusOptions"
  42. :key="item.id"
  43. :label="item.label"
  44. :value="item.id"
  45. >
  46. </el-option>
  47. </el-select>
  48. </el-col>
  49. <el-col :span="6" style="width: 303px; padding: 0 0 0 10px">
  50. <period-date-picker
  51. :type="1"
  52. :width="'135px'"
  53. :size="searchSize"
  54. :start="parmValue.start"
  55. :end="parmValue.end"
  56. @timeReturned="handleTime"
  57. />
  58. </el-col>
  59. <el-col :span="4" style="width: 140px; padding: 0 0 0 10px">
  60. <el-input
  61. :size="searchSize"
  62. v-model="parmValue.company_name"
  63. :maxlength="40"
  64. @change="
  65. pageInfo.curr = 1;
  66. parmValue.page = 1;
  67. searchList();
  68. "
  69. placeholder="创建人部门"
  70. ></el-input>
  71. </el-col>
  72. <el-col :span="4" style="width: 175px; padding: 0 0 0 10px">
  73. <el-input
  74. :size="searchSize"
  75. v-model="parmValue.allot_code"
  76. :maxlength="40"
  77. placeholder="调拨编号"
  78. />
  79. </el-col>
  80. <el-col :span="3" style="width: 66px; float: right">
  81. <el-button
  82. :size="searchSize"
  83. type="primary"
  84. style="float: right"
  85. @click="searchList"
  86. >
  87. 刷新
  88. </el-button>
  89. </el-col>
  90. <el-col :span="4" style="width: 66px; float: right">
  91. <el-button
  92. type="warning"
  93. class="mr5"
  94. style="float: right"
  95. :size="searchSize"
  96. @click="restSearch"
  97. >
  98. 重置
  99. </el-button>
  100. </el-col>
  101. </el-col>
  102. </el-row>
  103. <el-row style="padding: 10px 0 0 0px">
  104. <el-col :span="4" style="width: 125px">
  105. <el-dropdown @command="handleClick($event)" :size="searchSize">
  106. <el-button :size="searchSize">
  107. {{ sselect }}
  108. <i class="el-icon-arrow-down el-icon--right" :size="searchSize"></i>
  109. </el-button>
  110. <el-dropdown-menu slot="dropdown">
  111. <el-dropdown-item
  112. v-for="item in options"
  113. :key="item"
  114. :command="item"
  115. >{{ item }}</el-dropdown-item
  116. >
  117. </el-dropdown-menu>
  118. </el-dropdown>
  119. </el-col>
  120. <!-- <el-col :span="12" style="width: 260px; padding: 0 0 0 10px">
  121. <search-work-company
  122. :value="parmValue.companyNo"
  123. :names="''"
  124. :size="searchSize"
  125. :is-detail="id !== 'add'"
  126. :placeholder="'业务公司'"
  127. @searchChange="companyNoChange"
  128. />
  129. </el-col> -->
  130. <!-- <el-col :span="4" style="width: 260px; padding: 0 0 0 10px">
  131. <search-supplier
  132. :size="searchSize"
  133. :value="parmValue.supplierNo"
  134. :placeholder="'公司名称'"
  135. :disabled="false"
  136. :isDetail="false"
  137. @searchChange="supplierChange"
  138. />
  139. </el-col> -->
  140. <el-col :span="4" style="width: 262px; padding: 0 0 0 10px">
  141. <search-stock
  142. :size="searchSize"
  143. :value="parmValue.stockNo"
  144. :placeholder="'仓库名称'"
  145. :disabled="false"
  146. :isDetail="false"
  147. :isRelation="true"
  148. :companyNo="parmValue.companyNo"
  149. @searchChange="stockChange"
  150. />
  151. </el-col>
  152. <el-col :span="4" style="width: 66px; float: right">
  153. <el-button
  154. v-if="!isSupertube"
  155. type="success"
  156. class="fr"
  157. style="float: right"
  158. :size="searchSize"
  159. @click="openModal('add', false)"
  160. >
  161. 新建
  162. </el-button>
  163. </el-col>
  164. </el-row>
  165. </div>
  166. </template>
  167. <template #status="{ scope }">
  168. <el-tag
  169. :size="tablebtnSize"
  170. :type="
  171. scope.row.status == '0'
  172. ? 'info'
  173. : scope.row.status == '5'
  174. ? 'success'
  175. : 'warning'
  176. "
  177. v-text="
  178. (statusOptions.find((item) => item.id == scope.row.status) || {}).label ||
  179. '--'
  180. "
  181. ></el-tag>
  182. </template>
  183. <template #operation="{ scope }">
  184. <el-tooltip
  185. v-if="powers.some((i) => i == '007')"
  186. effect="dark"
  187. content="详情"
  188. placement="top"
  189. >
  190. <i
  191. class="el-icon-view tb-icon"
  192. @click="getRouter('allotDetail', scope.row.id)"
  193. ></i>
  194. </el-tooltip>
  195. </template>
  196. </ex-table>
  197. <add-edit
  198. :id="modelId"
  199. :sitem="{}"
  200. :show-model="showModel"
  201. :is-detail="isDetail"
  202. @refresh="searchList"
  203. @cancel="showModel = false"
  204. />
  205. </div>
  206. <div v-else>
  207. <no-auth></no-auth>
  208. </div>
  209. </div>
  210. </template>
  211. <script>
  212. import mixinPage from "@/mixins/elPaginationHandle";
  213. import resToken from "@/mixins/resToken";
  214. import { statusList } from "@/assets/js/statusList";
  215. import asyncRequest from "@/apis/service/stock/allot";
  216. import companyHelper from "@/mixins/companyHelper";
  217. import columns from "./columns"; //表格列参数
  218. import addEdit from "./addEdit";
  219. import { mapGetters } from "vuex";
  220. export default {
  221. name: "allot",
  222. mixins: [mixinPage, resToken, companyHelper],
  223. components: {
  224. addEdit,
  225. },
  226. computed: {
  227. ...mapGetters(["tablebtnSize", "searchSize", "size", "isSupertube"]),
  228. powers() {
  229. const tran =
  230. this.$store.getters.btnList.find((item) => item.menu_route == "allot") || {};
  231. const { action } = tran ?? {};
  232. return action ?? [];
  233. },
  234. },
  235. data() {
  236. return {
  237. supplierNo: "",
  238. // 状态
  239. statusOptions: [
  240. { id: "0", label: "待发起流程" },
  241. { id: "1", label: "待入库方同意入库" },
  242. { id: "2", label: "待出库方发货" },
  243. { id: "3", label: "待入库方验货提交" },
  244. { id: "4", label: "待验货审核" },
  245. { id: "5", label: "调拨已完成" },
  246. { id: "6", label: "调拨驳回" },
  247. ],
  248. statusList: statusList,
  249. options: ["按出库方筛选", "按入库方筛选"],
  250. loading: true,
  251. sselect: "按出库方筛选",
  252. showModel: false,
  253. isDetail: false,
  254. modelId: 0,
  255. parmValue: {
  256. companyNo: "",
  257. start: "", //开始日期
  258. end: "", //结束日期
  259. allot_code: "", //调拨编号
  260. supplierNo: [], //供应商code
  261. company_name: "", //创建人部门
  262. stockNo: [], //仓库code
  263. page: 1,
  264. size: 15,
  265. },
  266. // 表格 - 数据
  267. tableData: [],
  268. // 表格 - 参数
  269. table: {
  270. stripe: true,
  271. border: true,
  272. _defaultHeader_: ["setcol"],
  273. },
  274. // 表格 - 分页
  275. pageInfo: {
  276. size: 15,
  277. curr: 1,
  278. total: 0,
  279. },
  280. columns: columns,
  281. };
  282. },
  283. mounted() {
  284. const { back } = this.$route.query;
  285. if (back) {
  286. this.parmValue = JSON.parse(back);
  287. const { page, size } = this.parmValue;
  288. this.pageInfo = {
  289. size: size,
  290. curr: page,
  291. total: 0,
  292. };
  293. //多选条件
  294. this.sselect = this.parmValue.sselect;
  295. } else {
  296. this.sselect = "按出库方筛选";
  297. }
  298. this.searchList();
  299. },
  300. methods: {
  301. getRouter(toRouter, queryId) {
  302. if (toRouter && queryId) {
  303. let model = {
  304. id: queryId,
  305. };
  306. //有多选框的条件
  307. this.parmValue.sselect = this.sselect;
  308. //
  309. let routerModel = {
  310. options: JSON.parse(JSON.stringify(this.parmValue)),
  311. router: this.$route.path,
  312. };
  313. model.preModel = JSON.stringify(routerModel);
  314. this.routeGoto(toRouter, model);
  315. } else {
  316. this.$message.warning("暂未找到相关流程!");
  317. }
  318. },
  319. // 时间选择
  320. async handleTime(val) {
  321. this.parmValue.start = val.startTime || "";
  322. this.parmValue.end = val.endTime || "";
  323. this.parmValue.page = 1;
  324. this.pageInfo.curr = 1;
  325. await this.searchList();
  326. },
  327. handleClick(e) {
  328. this.sselect = e;
  329. },
  330. // 重置搜索框
  331. restSearch() {
  332. this.sselect = "按出库方筛选";
  333. this.supplierNo = "";
  334. // 表格 - 分页
  335. this.pageInfo = {
  336. size: 15,
  337. curr: 1,
  338. total: 0,
  339. };
  340. this.parmValue = {
  341. companyNo: "",
  342. company_name: "", //创建人部门
  343. start: "", //开始日期
  344. end: "", //结束日期
  345. allot_code: "", //调拨编号
  346. supplierNo: [], //供应商code
  347. stockNo: [], //仓库code
  348. page: 1,
  349. size: 15,
  350. };
  351. this.searchList();
  352. },
  353. //业务公司选择
  354. async companyNoChange(e) {
  355. const { code } = e;
  356. this.parmValue.companyNo = code || ""; //业务公司编码
  357. this.parmValue.page = 1;
  358. this.pageInfo.curr = 1;
  359. await this.searchList();
  360. },
  361. async supplierChange(e) {
  362. const { code } = e;
  363. this.parmValue.supplierNo = code ? [code] : []; //供应商编码
  364. this.parmValue.page = 1;
  365. this.pageInfo.curr = 1;
  366. await this.searchList();
  367. },
  368. async stockChange(e) {
  369. const { code } = e;
  370. this.parmValue.stockNo = code ? [code] : [];
  371. this.parmValue.page = 1;
  372. this.pageInfo.curr = 1;
  373. await this.searchList();
  374. },
  375. openModal(id, isDetail) {
  376. if(id === 'add' && !this.currentCompany){
  377. this.$message.warning('请选择一家业务公司')
  378. return
  379. }
  380. this.showModel = true;
  381. this.modelId = id;
  382. this.isDetail = isDetail;
  383. },
  384. onCompanyChangeInner() {
  385. this.stockNo
  386. this.pageInfo.curr = 1
  387. this.parmValue.page = 1
  388. this.parmValue.companyNo = this.currentCompany
  389. this.searchList()
  390. },
  391. // 获取调拨列表
  392. async searchList() {
  393. if (
  394. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  395. (this.parmValue.start == "" && this.parmValue.end != "")
  396. ) {
  397. this.$message.warning("开始时间和结束时间不能为空");
  398. return;
  399. }
  400. this.loading = true;
  401. let model = JSON.parse(JSON.stringify(this.parmValue));
  402. let supplierNo = model.supplierNo.length == 1 ? model.supplierNo[0] : "",
  403. stockNo = model.stockNo.length == 1 ? model.stockNo[0] : "";
  404. delete model["supplierNo"];
  405. delete model["stockNo"];
  406. model.wsm_out = this.sselect == "按出库方筛选" ? stockNo : "";
  407. model.wsm_in = this.sselect != "按出库方筛选" ? stockNo : "";
  408. model.wsm_out_supplierNo = this.sselect == "按出库方筛选" ? supplierNo : "";
  409. model.wsm_in_supplierNo = this.sselect != "按出库方筛选" ? supplierNo : "";
  410. const res = await asyncRequest.list(model);
  411. if (res && res.code === 0 && res.data) {
  412. this.tableData = res.data.list;
  413. this.pageInfo.total = Number(res.data.count);
  414. } else if (res && res.code >= 100 && res.code <= 104) {
  415. await this.logout();
  416. } else {
  417. this.tableData = [];
  418. this.pageInfo.total = 0;
  419. }
  420. this.loading = false;
  421. },
  422. },
  423. };
  424. </script>
  425. <style lang="scss" scoped>
  426. .el-dropdown-link {
  427. cursor: pointer;
  428. color: #6954f0;
  429. }
  430. .el-icon-arrow-down {
  431. font-size: 12px;
  432. }
  433. </style>