index.vue 11 KB

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