index.vue 11 KB

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