index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <div class="terrace pagePadding">
  3. <ex-table
  4. v-loading="loading"
  5. v-if="powers.some((i) => i == '001')"
  6. :table="table"
  7. :data="tableData"
  8. :columns="columns"
  9. :page="pageInfo"
  10. :size="size"
  11. @page-curr-change="handlePageChange"
  12. @page-size-change="handleSizeChange"
  13. @screen-reset="
  14. pageInfo.curr = 1;
  15. parmValue.page = 1;
  16. searchList();
  17. "
  18. @screen-submit="
  19. pageInfo.curr = 1;
  20. parmValue.page = 1;
  21. searchList();
  22. "
  23. >
  24. <template #table-header="{}">
  25. <div style="width: 100%">
  26. <el-row style="padding: 0 0 10px 80px">
  27. <period-date-picker
  28. :type="1"
  29. :width="'135px'"
  30. :size="searchSize"
  31. :start="parmValue.start"
  32. :end="parmValue.end"
  33. @timeReturned="handleTime"
  34. />
  35. <el-col :span="4" style="width: 373px; margin-left: 15px">
  36. <el-input
  37. size="mini"
  38. v-model="value"
  39. @blur="
  40. pageInfo.curr = 1;
  41. parmValue.page = 1;
  42. searchList();
  43. "
  44. >
  45. <el-select
  46. v-model="select"
  47. style="width: 125px"
  48. slot="prepend"
  49. placeholder="关键字类型"
  50. @change="
  51. pageInfo.curr = 1;
  52. parmValue.page = 1;
  53. searchList();
  54. "
  55. >
  56. <el-option
  57. v-for="key in Object.keys(mapSelectValue2Query)"
  58. :label="mapSelectValue2Query[key]"
  59. :value="key"
  60. :key="key"
  61. ></el-option>
  62. </el-select>
  63. </el-input>
  64. </el-col>
  65. <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
  66. <el-button type="primary" :size="searchSize" @click="searchList"
  67. >刷新</el-button
  68. >
  69. </el-col>
  70. <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
  71. <el-button type="warning" :size="searchSize" @click="restSearch"
  72. >重置</el-button
  73. >
  74. </el-col>
  75. <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
  76. <el-button type="primary" :size="searchSize" @click="openModal({}, '003')"
  77. >添加</el-button
  78. >
  79. </el-col>
  80. </el-row>
  81. <el-row>
  82. <el-col :span="6" style="margin-right: 15px">
  83. <search-customer
  84. size="mini"
  85. :value="parmValue.customer_code"
  86. :names="customerName"
  87. @searchChange="handleCustomerChange"
  88. placeholder="购买方公司"
  89. />
  90. </el-col>
  91. <el-col :span="6">
  92. <search-supplier
  93. size="mini"
  94. placeholder="销售方公司"
  95. :value="parmValue.supplierNo"
  96. :disabled="false"
  97. :isDetail="false"
  98. @searchChange="handleSupplierChange"
  99. />
  100. </el-col>
  101. <el-col :span="3" style="margin-left: 10px">
  102. <el-input
  103. v-model="parmValue.lower_price"
  104. size="mini"
  105. placeholder="最小销售价"
  106. @blur="
  107. pageInfo.curr = 1;
  108. parmValue.page = 1;
  109. searchList();
  110. "
  111. />
  112. </el-col>
  113. <el-col :span="3" style="margin-left: 10px">
  114. <el-input
  115. v-model="parmValue.upper_price"
  116. size="mini"
  117. placeholder="最大销售价"
  118. @blur="
  119. pageInfo.curr = 1;
  120. parmValue.page = 1;
  121. searchList();
  122. "
  123. />
  124. </el-col>
  125. </el-row>
  126. </div>
  127. </template>
  128. <template #status="{ scope }">
  129. <el-tag
  130. :size="tablebtnSize"
  131. :type="scope.row.status + '' == '0' ? 'warning' : ''"
  132. v-text="
  133. (statusOptions.find((item) => item.id == scope.row.status + '') || {})
  134. .label || '--'
  135. "
  136. ></el-tag>
  137. </template>
  138. <template #order_type="{ scope }">
  139. <el-tag
  140. :size="tablebtnSize"
  141. v-text="
  142. (xs_order_type_options.find((item) => item.id == scope.row.order_type) || {})
  143. .label || '--'
  144. "
  145. ></el-tag>
  146. </template>
  147. <template #order_source="{ scope }">
  148. <el-tag
  149. :size="tablebtnSize"
  150. v-text="
  151. (
  152. xs_order_source_options.find((item) => item.id == scope.row.order_source) ||
  153. {}
  154. ).label || '--'
  155. "
  156. ></el-tag>
  157. </template>
  158. <template #operation="{ scope }">
  159. <el-tooltip
  160. v-if="powers.some((i) => i == '007')"
  161. effect="dark"
  162. content="详情"
  163. placement="top"
  164. >
  165. <i class="el-icon-view tb-icon" @click="openModal(scope.row, '007')"></i>
  166. </el-tooltip>
  167. <el-tooltip
  168. v-if="powers.some((i) => i == '005')"
  169. effect="dark"
  170. content="修改"
  171. placement="top"
  172. >
  173. <i class="el-icon-edit tb-icon" @click="openModal(scope.row, '005')"></i>
  174. </el-tooltip>
  175. </template>
  176. </ex-table>
  177. <no-auth v-else></no-auth>
  178. <!-- 弹窗 新增/修改 -->
  179. <add-edit
  180. :id="modelId"
  181. :show-model="showModel"
  182. :sitem="sitem"
  183. @refresh="searchList"
  184. @cancel="showModel = false"
  185. />
  186. </div>
  187. </template>
  188. <script>
  189. import asyncRequest from "@/apis/service/netOrderEntry/netOrderEnter";
  190. import { statusList } from "@/assets/js/statusList";
  191. import mixinPage from "@/mixins/elPaginationHandle";
  192. import roleLevel from "@/assets/js/roleLevel";
  193. import resToken from "@/mixins/resToken";
  194. import { mapGetters } from "vuex";
  195. import addEdit from "./addEdit";
  196. import { xs_order_type_options, xs_order_source_options } from "@/assets/js/statusList";
  197. export default {
  198. name: "netOrderEnter",
  199. mixins: [mixinPage, resToken],
  200. components: {
  201. addEdit,
  202. },
  203. computed: {
  204. //组件SIZE设置
  205. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  206. powers() {
  207. const { btnList } = this.$store.getters;
  208. const tran = btnList.find((i) => i.menu_route == "netOrderEnter") || {};
  209. const { action } = tran ?? {};
  210. return action ?? [];
  211. },
  212. },
  213. data() {
  214. const mapSelectValue2Query = {
  215. orderCode: "确认单编号",
  216. cgdNo: "采购单编号",
  217. // sale_name: "销售员",
  218. // cgd_sale: "采购员"
  219. };
  220. return {
  221. xs_order_type_options,
  222. xs_order_source_options,
  223. statusList: statusList,
  224. roleLevel: roleLevel,
  225. loading: true,
  226. showModel: false,
  227. modelId: "000",
  228. select: "orderCode",
  229. sitem: {},
  230. customerName: "",
  231. mapSelectValue2Query,
  232. value: "",
  233. parmValue: {
  234. page: 1, // 页码
  235. size: 15, // 每页显示条数
  236. start: "",
  237. end: "",
  238. customer_code: "",
  239. supplierNo: "",
  240. lower_price: "",
  241. upper_price: "",
  242. },
  243. // 表格 - 数据
  244. tableData: [],
  245. // 表格 - 参数
  246. table: {
  247. stripe: true,
  248. border: true,
  249. _defaultHeader_: ["setcol"],
  250. },
  251. statusOptions: [
  252. { id: "0", label: "待发货" },
  253. { id: "1", label: "待发货完成" },
  254. { id: "2", label: "发货已完成" },
  255. { id: "3", label: "订单已取消" },
  256. ],
  257. // 表格 - 分页
  258. pageInfo: {
  259. size: 15,
  260. curr: 1,
  261. total: 0,
  262. },
  263. columns: [
  264. {
  265. prop: "orderCode",
  266. label: "订单编号",
  267. width: "155px",
  268. },
  269. {
  270. prop: "cgdNo",
  271. label: "采购单编号",
  272. width: "155px",
  273. },
  274. {
  275. prop: "good_name",
  276. label: "商品名称",
  277. width: "150",
  278. },
  279. // {
  280. // prop: 'good_class',
  281. // label: '商品分类',
  282. // width: '120'
  283. // },
  284. {
  285. prop: "good_num",
  286. label: "商品数量",
  287. },
  288. {
  289. prop: "sale_price",
  290. label: "销售单价",
  291. },
  292. {
  293. prop: "total_price",
  294. label: "总价",
  295. },
  296. {
  297. prop: "status",
  298. label: "订单状态",
  299. _slot_: "status",
  300. width: "120px",
  301. },
  302. {
  303. prop: "order_source",
  304. label: "订单来源",
  305. _slot_: "order_source",
  306. width: "90px",
  307. },
  308. {
  309. prop: "order_type",
  310. label: "商品来源",
  311. _slot_: "order_type",
  312. width: "90px",
  313. },
  314. // {
  315. // prop: 'useage',
  316. // label: '订单用途',
  317. // width: '100px'
  318. // },
  319. {
  320. prop: "customer_code",
  321. label: "客户公司编码",
  322. width: "155px",
  323. },
  324. {
  325. prop: "customerName",
  326. label: "企业客户名称",
  327. width: "125px",
  328. },
  329. {
  330. prop: "supplierName",
  331. label: "销售方公司",
  332. width: "125px",
  333. },
  334. {
  335. prop: "company_name",
  336. label: "订单创建人部门",
  337. minWidth: "120px",
  338. },
  339. {
  340. prop: "apply_name",
  341. label: "订单创建人",
  342. width: "85px",
  343. },
  344. {
  345. prop: "cgder",
  346. label: "供应商负责人",
  347. width: "95",
  348. },
  349. {
  350. prop: "good_creater",
  351. label: "商品创建人",
  352. width: "85px",
  353. },
  354. {
  355. prop: "addtime",
  356. label: "创建时间",
  357. width: "145px",
  358. },
  359. {
  360. prop: "",
  361. label: "操作",
  362. fixed: "right",
  363. _noset_: true,
  364. width: "80px",
  365. _slot_: "operation",
  366. },
  367. ],
  368. };
  369. },
  370. mounted() {
  371. this.searchList();
  372. },
  373. methods: {
  374. restSearch() {
  375. // 表格 - 分页
  376. this.pageInfo = {
  377. size: 15,
  378. curr: 1,
  379. total: 0,
  380. };
  381. this.parmValue = {
  382. page: 1, // 页码
  383. size: 15, // 每页显示条数
  384. start: "",
  385. end: "",
  386. customer_code: "",
  387. supplierNo: "",
  388. };
  389. this.value = "";
  390. this.searchList();
  391. },
  392. // 新建/编辑/详情
  393. openModal(row, type) {
  394. // const { status } = row;
  395. // if (type === "005" && status === "1") {
  396. // this.$message.warning("禁用后,才可以修改!");
  397. // return;
  398. // }
  399. this.sitem = row;
  400. this.modelId = type;
  401. this.showModel = true;
  402. },
  403. // 时间
  404. async handleTime(e) {
  405. this.parmValue.start = e.startTime || "";
  406. this.parmValue.end = e.endTime || "";
  407. if (
  408. (this.parmValue.start !== "" && this.parmValue.end !== "") ||
  409. (this.parmValue.start === "" && this.parmValue.end === "")
  410. ) {
  411. this.pageInfo.curr = 1;
  412. this.parmValue.page = 1;
  413. await this.searchList();
  414. }
  415. },
  416. handleCustomerChange(e) {
  417. this.parmValue.customer_code = e.code ? [e.code] : "";
  418. this.customerName = e.label;
  419. this.searchList();
  420. },
  421. handleSupplierChange(e) {
  422. this.parmValue.supplierNo = e.code ? [e.code] : "";
  423. this.searchList();
  424. },
  425. /**
  426. * 启用/禁用
  427. * @param {String} id id
  428. * @param {String} status 0-禁用 1-启用
  429. */
  430. async changeStatus(id, status) {
  431. await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
  432. confirmButtonText: "确定",
  433. cancelButtonText: "取消",
  434. type: "warning",
  435. })
  436. .then(async () => {
  437. this.loading = true;
  438. const model = {
  439. id: id,
  440. status: status === "1" ? "0" : "1",
  441. };
  442. const res = await asyncRequest.status(model);
  443. if (res && res.code === 0) {
  444. this.loading = false;
  445. this.$notify.success({
  446. title: "状态修改成功!",
  447. message: "",
  448. });
  449. await this.searchList();
  450. } else if (res && res.code >= 100 && res.code <= 104) {
  451. await this.logout();
  452. } else {
  453. this.loading = false;
  454. this.$message.warning(res.message);
  455. }
  456. })
  457. .catch(() => {
  458. console.log("取消");
  459. });
  460. },
  461. // 刷新表格
  462. async searchList() {
  463. const vm = this;
  464. if (
  465. (vm.parmValue.start !== "" && vm.parmValue.end === "") ||
  466. (vm.parmValue.start == "" && vm.parmValue.end != "")
  467. ) {
  468. vm.$message.warning("开始时间和结束时间不能为空");
  469. return;
  470. }
  471. vm.loading = true;
  472. const res = await asyncRequest.list({
  473. ...vm.parmValue,
  474. ...(vm.value ? { [vm.select]: vm.value } : {}),
  475. ...(vm.parmValue.customer_code
  476. ? { customer_code: vm.parmValue.customer_code[0] }
  477. : {}),
  478. ...(vm.parmValue.supplierNo ? { supplierNo: vm.parmValue.supplierNo[0] } : {}),
  479. });
  480. if (res && res.code === 0 && res.data) {
  481. vm.tableData = res.data.list;
  482. vm.pageInfo.total = Number(res.data.count);
  483. } else if (res && res.code >= 100 && res.code <= 104) {
  484. await vm.logout();
  485. } else {
  486. vm.tableData = [];
  487. vm.pageInfo.total = 0;
  488. }
  489. vm.loading = false;
  490. },
  491. },
  492. };
  493. </script>
  494. <style lang="scss" scoped></style>