index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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="false"
  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="6" style="width: 292px">
  31. <PeriodDatePicker
  32. :start="parmValue.total_low"
  33. :end="parmValue.total_up"
  34. :type="1"
  35. :width="'135px'"
  36. :title="'预警量'"
  37. :size="searchSize"
  38. @numReturned="numReturned($event, 0)"
  39. />
  40. </el-col>
  41. <el-col :span="4" style="width: 120px; padding: 0 0 0 10px">
  42. <el-input
  43. :size="searchSize"
  44. v-model="parmValue.allot_sn"
  45. :maxlength="40"
  46. placeholder="调拨编号"
  47. />
  48. </el-col>
  49. <el-col :span="4" style="width: 160px; padding: 0 0 0 10px">
  50. <el-input
  51. :size="searchSize"
  52. v-model="parmValue.stayStock_name"
  53. :maxlength="40"
  54. placeholder="入库仓库名称"
  55. />
  56. </el-col>
  57. <el-col :span="4" style="width: 160px; padding: 0 0 0 10px">
  58. <el-input
  59. :size="searchSize"
  60. v-model="parmValue.stayOutStock_name"
  61. :maxlength="40"
  62. placeholder="出库仓库名称"
  63. />
  64. </el-col>
  65. <el-col :span="4" style="width: 76px; margin-left: 10px">
  66. <el-button
  67. style="width: 100%"
  68. type="primary"
  69. class="fr"
  70. :size="searchSize"
  71. @click="addSearch"
  72. >
  73. 新建
  74. </el-button>
  75. </el-col>
  76. <el-col :span="4" style="width: 76px; margin-left: 10px">
  77. <el-button
  78. style="width: 100%"
  79. type="primary"
  80. class="fr mr10"
  81. icon="el-icon-search"
  82. :size="searchSize"
  83. @click="searchList"
  84. >
  85. 搜索
  86. </el-button>
  87. </el-col>
  88. <el-col
  89. :span="4"
  90. style="width: 76px; margin-left: 20px"
  91. >
  92. <el-button
  93. style="width: 100%"
  94. type="warning"
  95. class="fr mr5"
  96. :size="searchSize"
  97. @click="restSearch"
  98. >
  99. 重置
  100. </el-button>
  101. </el-col>
  102. </el-col>
  103. </el-row>
  104. </div>
  105. </template>
  106. <template #status="{ scope }">
  107. <el-tag
  108. :size="tablebtnSize"
  109. :type="scope.row.status == '0' ? 'warning' : ''"
  110. v-text="
  111. (statusOptions.find((item) => item.id == scope.row.status) || {})
  112. .label || '--'
  113. "
  114. ></el-tag>
  115. </template>
  116. <template #operation="{ scope }">
  117. <!-- 重置密码 -->
  118. <!-- <el-tooltip
  119. v-if="powers.some((item) => item == '002')"
  120. effect="dark"
  121. content="重置密码"
  122. placement="top"
  123. >
  124. <i
  125. class="el-icon-refresh-left tb-icon"
  126. @click="openPasswordModal(scope.row.id, false)"
  127. ></i>
  128. </el-tooltip> -->
  129. <el-tooltip
  130. v-if="powers.some((item) => item == '007')"
  131. effect="dark"
  132. content="详情"
  133. placement="top"
  134. >
  135. <i
  136. class="el-icon-view tb-icon"
  137. @click="openModal(scope.row.id, true, scope.row)"
  138. ></i>
  139. </el-tooltip>
  140. <!-- 修改 -->
  141. <!-- <el-tooltip
  142. v-if="powers.some((item) => item == '005')"
  143. effect="dark"
  144. content="修改"
  145. placement="top"
  146. >
  147. <i
  148. class="el-icon-edit tb-icon"
  149. @click="openModal(scope.row.id, false, scope.row)"
  150. ></i>
  151. </el-tooltip> -->
  152. <!-- 禁用 -->
  153. <!-- <el-tooltip
  154. v-if="
  155. powers.some((item) => item == '004') && scope.row.status === '1'
  156. "
  157. effect="dark"
  158. content="禁用"
  159. placement="top"
  160. >
  161. <i
  162. class="el-icon-video-pause tb-icon"
  163. @click="statusConfirm(scope.row.id, scope.row.status)"
  164. ></i>
  165. </el-tooltip> -->
  166. <!-- 启用 -->
  167. <!-- <el-tooltip
  168. v-if="
  169. powers.some((item) => item == '004') && scope.row.status === '0'
  170. "
  171. effect="dark"
  172. content="启用"
  173. placement="top"
  174. >
  175. <i
  176. class="el-icon-video-play tb-icon"
  177. @click="statusConfirm(scope.row.id, scope.row.status)"
  178. ></i>
  179. </el-tooltip> -->
  180. </template>
  181. </ex-table>
  182. <add-edit
  183. :id="modelId"
  184. :sitem="sitem"
  185. :show-model="showModel"
  186. :is-detail="isDetail"
  187. @refresh="searchList"
  188. @cancel="showModel = false"
  189. />
  190. </div>
  191. <div v-else>
  192. <no-auth></no-auth>
  193. </div>
  194. <add-edit
  195. :showModel="showModel"
  196. :id="modelId"
  197. :isDetail="isDetail"
  198. @refresh="searchList"
  199. @cancel="showModel = false"
  200. ></add-edit>
  201. </div>
  202. </template>
  203. <script>
  204. import mixinPage from "@/mixins/elPaginationHandle";
  205. import resToken from "@/mixins/resToken";
  206. import ExTable from "@/components/ExTableNew.vue";
  207. import statusList from "@/assets/js/statusList";
  208. // import asyncRequest from "@/apis/service/stock/allot";
  209. import asyncRequest from "@/mock/service/stock/allot";
  210. import addEdit from "./addEdit";
  211. import { mapGetters } from "vuex";
  212. import PeriodDatePicker from "@/components/PeriodDatePicker";
  213. import AllotFlow from "@/views/stock/allotFlow";
  214. export default {
  215. name: "allot",
  216. mixins: [mixinPage, resToken],
  217. components: {
  218. addEdit,
  219. ExTable,
  220. PeriodDatePicker,
  221. },
  222. computed: {
  223. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  224. powers() {
  225. let tran =
  226. this.$store.getters.btnList.find(
  227. (item) => item.menu_route == "allot"
  228. ) || {};
  229. if (tran && tran.action && tran.action.length > 0) {
  230. return tran.action;
  231. } else {
  232. return [];
  233. }
  234. },
  235. },
  236. data() {
  237. return {
  238. sitem: null,
  239. // 状态
  240. statusOptions: [
  241. { id: "0", label: "禁用" },
  242. { id: "1", label: "启用" },
  243. ],
  244. statusList: statusList,
  245. loading: true,
  246. showModel: false,
  247. isDetail: false,
  248. modelId: 0,
  249. parmValue: {
  250. total_low: "", //开始日期
  251. total_up: "", //结束日期
  252. allot_sn: "", //调拨编号
  253. stayStock_name: "", //入仓库名称
  254. stayOutStock_name: "", //出仓库名称
  255. },
  256. tableData: [],
  257. passwordModel: false,
  258. passwordModelId: 0,
  259. isPasswordDetail: false,
  260. // 表格 - 数据
  261. tableData: [],
  262. // 表格 - 参数
  263. table: {
  264. stripe: true,
  265. border: true,
  266. _defaultHeader_: ["setcol"],
  267. },
  268. // 表格 - 分页
  269. pageInfo: {
  270. size: 15,
  271. curr: 1,
  272. total: 0,
  273. },
  274. // 表格 - 列参数
  275. columns: [
  276. {
  277. prop: "allot_sn",
  278. label: "调拨编号",
  279. },
  280. {
  281. prop: "applicant",
  282. label: "申请人",
  283. },
  284. {
  285. prop: "stayStock_name",
  286. label: "入库仓库名称",
  287. },
  288. {
  289. prop: "stayOutStock_name",
  290. label: "出库仓库名称",
  291. },
  292. {
  293. prop: "express_cost",
  294. label: "物流总费用",
  295. },
  296. {
  297. prop: "status",
  298. label: "当前状态",
  299. // sortable: true,
  300. },
  301. {
  302. prop: "apply_time",
  303. label: "申请时间",
  304. },
  305. {
  306. prop: "",
  307. label: "操作",
  308. _noset_: true,
  309. _slot_: "operation",
  310. },
  311. ],
  312. };
  313. },
  314. mounted() {
  315. this.searchList();
  316. },
  317. methods: {
  318. addSearch() {
  319. //跳转到新建页面
  320. console.log("新建申请");
  321. this.$router.push({
  322. path: "allotFlow",
  323. component: AllotFlow,
  324. });
  325. },
  326. restSearch() {
  327. this.parmValue = {
  328. name: "", // 业务员名字
  329. username: "", // 账号
  330. status: "", //
  331. page: 1, // 页码
  332. size: 10, // 每页显示条数
  333. };
  334. this.searchList();
  335. },
  336. openModal(id, isDetail, sitem) {
  337. this.showModel = true;
  338. this.modelId = id;
  339. this.isDetail = isDetail;
  340. this.sitem = sitem;
  341. },
  342. async deleteById(id, status) {
  343. // await this.$confirm("确定要删除?", {
  344. // confirmButtonText: "确定",
  345. // cancelButtonText: "取消",
  346. // type: "warning",
  347. // })
  348. // .then(async () => {
  349. // const model = {
  350. // id: id,
  351. // status: status === "1" ? "0" : "1",
  352. // };
  353. // const res = await asyncRequest.status(model);
  354. // if (res && res.code === 0) {
  355. // this.$notify.success({
  356. // title: "删除成功",
  357. // message: "",
  358. // });
  359. // this.searchList();
  360. // } else if (res && res.code >= 100 && res.code <= 104) {
  361. // await this.logout();
  362. // } else {
  363. // this.$message.warning(res.message);
  364. // }
  365. // })
  366. // .catch(() => {
  367. // console.log("取消");
  368. // });
  369. },
  370. async searchList() {
  371. // this.loading = true;
  372. // const res = await asyncRequest.list(this.parmValue);
  373. // if (res && res.code === 0 && res.data) {
  374. // this.tableData = res.data.list;
  375. // this.pageInfo.total = Number(res.data.count);
  376. // } else if (res && res.code >= 100 && res.code <= 104) {
  377. // await this.logout();
  378. // } else {
  379. // this.tableData = [];
  380. // this.pageInfo.total = 0;
  381. // }
  382. // this.loading = false;
  383. },
  384. async statusConfirm(id, status) {
  385. // let str = status === "1" ? "禁用" : "启用";
  386. // await this.$confirm("确定要改为" + str + "?", {
  387. // confirmButtonText: "确定",
  388. // cancelButtonText: "取消",
  389. // type: "warning",
  390. // })
  391. // .then(async () => {
  392. // this.loading = true;
  393. // const model = {
  394. // id: id,
  395. // status: status === "1" ? "0" : "1",
  396. // };
  397. // const res = await asyncRequest.status(model);
  398. // if (res && res.code === 0) {
  399. // this.loading = false;
  400. // this.$notify.success({
  401. // title: "状态修改成功!",
  402. // message: "",
  403. // });
  404. // await this.searchList();
  405. // } else if (res && res.code >= 100 && res.code <= 104) {
  406. // await this.logout();
  407. // } else {
  408. // this.$message.warning(res.message);
  409. // }
  410. // })
  411. // .catch(() => {
  412. // console.log("取消");
  413. // });
  414. },
  415. },
  416. };
  417. </script>
  418. <style lang="scss" scoped>
  419. @media screen and (max-width: 1223px) {
  420. .mr10 {
  421. margin-top: 10px;
  422. }
  423. }
  424. </style>