index.vue 12 KB

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