index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <div class="salesOrder 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="4" style="width: 120px">
  30. <el-dropdown @command="handleClick($event)" :size="searchSize">
  31. <el-button :size="searchSize" style="width: 120px">
  32. {{ sselect }}
  33. <i
  34. class="el-icon-arrow-down el-icon--right"
  35. :size="searchSize"
  36. ></i>
  37. </el-button>
  38. <el-dropdown-menu slot="dropdown">
  39. <el-dropdown-item
  40. v-for="item in options"
  41. :key="item"
  42. :command="item"
  43. >{{ item }}</el-dropdown-item
  44. >
  45. </el-dropdown-menu>
  46. </el-dropdown>
  47. </el-col>
  48. <el-col :span="6" style="width: 303px; padding: 0 0 0 10px">
  49. <period-date-picker
  50. :type="1"
  51. :width="'135px'"
  52. :size="searchSize"
  53. :start="timeOBJ.start"
  54. :end="timeOBJ.end"
  55. @timeReturned="handleTime"
  56. />
  57. </el-col>
  58. <el-col :span="4" style="width: 150px; padding: 0 0 0 10px">
  59. <el-select
  60. :size="searchSize"
  61. v-model="parmValue.status"
  62. filterable
  63. clearable
  64. placeholder="采购单状态"
  65. style="width: 100%"
  66. @change="
  67. pageInfo.curr = 1;
  68. parmValue.page = 1;
  69. searchList();
  70. "
  71. >
  72. <el-option
  73. v-for="item in statusList"
  74. :key="'status' + item.code"
  75. :label="item.name"
  76. :value="item.code"
  77. />
  78. </el-select>
  79. </el-col>
  80. <!-- <el-col :span="4" style="width: 370px; padding: 0 0 0 10px">
  81. <search-supplier
  82. :size="searchSize"
  83. :value="parmValue.supplierNo"
  84. :placeholder="'入库公司名称'"
  85. :disabled="false"
  86. :isDetail="false"
  87. @searchChange="supplierChange"
  88. />
  89. </el-col>
  90. <el-col :span="4" style="width: 220px; padding: 0 0 0 10px">
  91. <search-stock
  92. :size="searchSize"
  93. :value="parmValue.stockNo"
  94. :placeholder="'入库仓库名称'"
  95. :disabled="false"
  96. :isDetail="false"
  97. :isRelation="true"
  98. :companyCode="supplierNo"
  99. @searchChange="stockChange"
  100. />
  101. </el-col> -->
  102. <el-col :span="3" style="width: 66px; float: right">
  103. <el-button
  104. :size="searchSize"
  105. type="primary"
  106. style="float: right; margin-left: 5px"
  107. @click="searchList"
  108. >
  109. 刷新
  110. </el-button>
  111. </el-col>
  112. </el-row>
  113. <el-row style="padding: 10px 0 0 0">
  114. <el-col :span="6" style="width: 500px">
  115. <el-input
  116. placeholder="关键字"
  117. v-model="input"
  118. :size="searchSize"
  119. class="input-with-select"
  120. >
  121. <el-select
  122. v-model="select"
  123. style="width: 125px"
  124. slot="prepend"
  125. placeholder="请选择"
  126. >
  127. <el-option label="销售订单编号" value="1"></el-option>
  128. <!-- <el-option label="入库单编号" value="2"></el-option> -->
  129. <!-- <el-option label="备库编号" value="3"></el-option> -->
  130. <el-option label="商品属性编号" value="4"></el-option>
  131. <el-option label="产品名称" value="5"></el-option>
  132. <el-option label="申请人" value="6"></el-option>
  133. <!-- <el-option label="采购供应商编号" value="7"></el-option> -->
  134. </el-select>
  135. <el-button slot="append" icon="el-icon-search"></el-button>
  136. </el-input>
  137. </el-col>
  138. <el-col :span="4" style="width: 66px; float: right">
  139. <el-button
  140. type="warning"
  141. class="fr"
  142. :size="searchSize"
  143. @click="restSearch"
  144. >
  145. 重置
  146. </el-button>
  147. </el-col>
  148. <el-col
  149. :span="3"
  150. style="width: 66px; float: right"
  151. v-if="powers.some((item) => item == '003')"
  152. >
  153. <el-button
  154. :size="searchSize"
  155. type="success"
  156. style="float: right"
  157. @click="openModal('add', false, {})"
  158. >
  159. 新建
  160. </el-button>
  161. </el-col>
  162. </el-row>
  163. </div>
  164. </template>
  165. <template #status="{ scope }">
  166. <el-tag
  167. :size="tablebtnSize"
  168. :type="scope.row.status == '0' ? 'warning' : ''"
  169. v-text="
  170. (statusOptions.find((item) => item.id == scope.row.status) || {})
  171. .label || '--'
  172. "
  173. ></el-tag>
  174. </template>
  175. <!-- v-if="powers.some((item) => item == '007')" -->
  176. <template #operation="{ scope }">
  177. <el-tooltip effect="dark" content="详情" placement="top">
  178. <i
  179. class="el-icon-view tb-icon"
  180. @click="routeGoto('salesOrderDetail', { id: scope.row.id })"
  181. ></i>
  182. </el-tooltip>
  183. </template>
  184. </ex-table>
  185. <add-edit
  186. :id="modelId"
  187. :sitem="sitem"
  188. :show-model="showModel"
  189. :is-detail="isDetail"
  190. @refresh="searchList"
  191. @cancel="showModel = false"
  192. />
  193. </div>
  194. <div v-else>
  195. <no-auth></no-auth>
  196. </div>
  197. </div>
  198. </template>
  199. <script>
  200. import mixinPage from "@/mixins/elPaginationHandle";
  201. import resToken from "@/mixins/resToken";
  202. import statusList from "@/assets/js/statusList";
  203. import asyncRequest from "@/apis/service/sellOut/salesOrder";
  204. import columns from "./columns"; //表格列参数
  205. import addEdit from "./components/addEdit";
  206. import { mapGetters } from "vuex";
  207. export default {
  208. name: "salesOrder",
  209. mixins: [mixinPage, resToken],
  210. components: {
  211. addEdit,
  212. },
  213. computed: {
  214. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  215. powers() {
  216. let tran =
  217. this.$store.getters.btnList.find(
  218. (item) => item.menu_route == "salesOrder"
  219. ) || {};
  220. if (tran && tran.action && tran.action.length > 0) {
  221. return tran.action;
  222. } else {
  223. return [];
  224. }
  225. },
  226. },
  227. data() {
  228. return {
  229. sitem: null,
  230. select: "1",
  231. input: "",
  232. timeOBJ: {
  233. start: "", //起始时间
  234. end: "", // 结束时间
  235. },
  236. options: ["创建时间", "最晚入库时间"],
  237. sselect: "创建时间",
  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. ],
  247. statusList: statusList,
  248. loading: false,
  249. showModel: false,
  250. isDetail: false,
  251. modelId: 0,
  252. parmValue: {
  253. order_type: "1", //订单类型1为销售 2为咨询
  254. bk_code: "", // 备库编码
  255. wsm_in_code: "", // 入库单号
  256. cgdNo: "", // 采购单编码
  257. apply_name: "", // 申请人
  258. good_name: "", // 产品名称
  259. good_code: "", // 产品属性编号
  260. status: "", //状态
  261. wsm_code: "", //入货仓库编码
  262. start: "", //新建起始时间
  263. end: "", // 新建结束时间
  264. last_start: "", //最后入库时间开始
  265. last_end: "", //最后入库时间结束
  266. page: 1, // 页码
  267. size: 15, // 每页显示条数
  268. supplierNo: "",
  269. wsm_supplierNo: "",
  270. },
  271. tableData: [],
  272. passwordModel: false,
  273. passwordModelId: 0,
  274. isPasswordDetail: false,
  275. // 表格 - 数据
  276. tableData: [],
  277. // 表格 - 参数
  278. table: {
  279. stripe: true,
  280. border: true,
  281. _defaultHeader_: ["setcol"],
  282. },
  283. // 表格 - 分页
  284. pageInfo: {
  285. size: 15,
  286. curr: 1,
  287. total: 0,
  288. },
  289. // 表格 - 列参数
  290. columns: columns,
  291. };
  292. },
  293. mounted() {
  294. this.searchList();
  295. },
  296. methods: {
  297. restSearch() {
  298. this.sselect = "创建时间";
  299. this.select = "1";
  300. this.input = "";
  301. this.timeOBJ = {
  302. start: "", //起始时间
  303. end: "", // 结束时间
  304. };
  305. this.parmValue = {
  306. order_type: "1", //订单类型1为销售 2为咨询
  307. bk_code: "", // 备库编码
  308. wsm_in_code: "", // 入库单号
  309. cgdNo: "", // 采购单编码
  310. apply_name: "", // 申请人
  311. good_name: "", // 产品名称
  312. good_code: "", // 产品属性编号
  313. status: "", //状态
  314. wsm_code: "", //入货仓库编码
  315. start: "", //新建起始时间
  316. end: "", // 新建结束时间
  317. last_start: "", //最后入库时间开始
  318. last_end: "", //最后入库时间结束
  319. page: 1, // 页码
  320. size: 15, // 每页显示条数
  321. };
  322. // 表格 - 分页
  323. this.pageInfo = {
  324. size: 15,
  325. curr: 1,
  326. total: 0,
  327. };
  328. this.searchList();
  329. },
  330. async handleClick(e) {
  331. this.sselect = e;
  332. this.parmValue.start = e === "创建时间" ? this.timeOBJ.start : "";
  333. this.parmValue.end = e === "创建时间" ? this.timeOBJ.end : "";
  334. this.parmValue.last_start = e !== "创建时间" ? this.timeOBJ.start : "";
  335. this.parmValue.last_end = e !== "创建时间" ? this.timeOBJ.end : "";
  336. if (
  337. !(
  338. (this.timeOBJ.start !== "" && this.timeOBJ.end === "") ||
  339. (this.timeOBJ.start === "" && this.timeOBJ.end !== "")
  340. )
  341. ) {
  342. this.parmValue.page = 1;
  343. this.pageInfo.curr = 1;
  344. await this.searchList();
  345. }
  346. },
  347. openModal(id, isDetail, sitem) {
  348. this.modelId = id;
  349. this.isDetail = isDetail;
  350. this.sitem = sitem;
  351. this.showModel = true;
  352. },
  353. async supplierChange(e) {
  354. if (e && e.id) {
  355. this.parmValue.supplierNo = [e.code];
  356. this.supplierNo = e.code;
  357. } else {
  358. this.parmValue.supplierNo = [];
  359. this.supplierNo = "";
  360. }
  361. this.parmValue.stockNo = [];
  362. this.parmValue.page = 1;
  363. this.pageInfo.curr = 1;
  364. await this.searchList();
  365. },
  366. async stockChange(e) {
  367. if (e && e.id) {
  368. this.parmValue.stockNo = [e.code];
  369. } else {
  370. this.parmValue.stockNo = [];
  371. }
  372. console.log(e);
  373. this.parmValue.page = 1;
  374. this.pageInfo.curr = 1;
  375. await this.searchList();
  376. },
  377. async searchList() {
  378. this.loading = true;
  379. this.parmValue.cgdNo = this.select === "1" ? this.input : ""; // 采购单编码
  380. this.parmValue.wsm_in_code = this.select === "2" ? this.input : ""; // 入库单号
  381. this.parmValue.bk_code = this.select === "3" ? this.input : ""; // 备库编码
  382. this.parmValue.good_code = this.select === "4" ? this.input : ""; // 产品属性编号
  383. this.parmValue.good_name = this.select === "5" ? this.input : ""; // 产品名称
  384. this.parmValue.apply_name = this.select === "6" ? this.input : ""; // 申请人
  385. this.parmValue.supplierNo = this.select === "7" ? this.input : ""; // 采购供应商编号
  386. this.parmValue.order_type = "1"; //订单类型1为销售订单 2为咨询订单
  387. const res = await asyncRequest.list(this.parmValue);
  388. if (res && res.code === 0 && res.data) {
  389. this.tableData = res.data.list;
  390. this.tableData.forEach((v) => {
  391. v.good_class = "";
  392. if (v.can && v.can.length > 0) {
  393. v.can.forEach((x, i) => {
  394. v.good_class += i === 0 ? x.name : "/" + x.name;
  395. });
  396. }
  397. });
  398. console.log(this.tableData);
  399. this.pageInfo.total = Number(res.data.count);
  400. } else if (res && res.code >= 100 && res.code <= 104) {
  401. await this.logout();
  402. } else {
  403. this.tableData = [];
  404. this.pageInfo.total = 0;
  405. }
  406. this.loading = false;
  407. },
  408. // 时间
  409. async handleTime(e) {
  410. if (e.startTime !== "") {
  411. this.timeOBJ.start = e.startTime;
  412. } else {
  413. this.timeOBJ.start = "";
  414. }
  415. if (e.endTime !== "") {
  416. this.timeOBJ.end = e.endTime;
  417. } else {
  418. this.timeOBJ.end = "";
  419. }
  420. await this.handleClick(this.sselect);
  421. },
  422. },
  423. };
  424. </script>
  425. <style lang="scss" scoped>
  426. .salesOrder {
  427. // text-align: right;
  428. }
  429. </style>