index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading" :data="dataList"
  5. ref="crud" :key="key" @on-load="onLoad" @search-change="searchChange" @row-del="rowDel"
  6. @refresh-change="refreshChange" @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 274.4)"
  7. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 274.4)" :page.sync="page">
  8. <template slot-scope="{type,size,row,index}" slot="menu">
  9. <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
  10. <el-button :size="size" :type="type" :disabled="row.status != '录入' && row.status != '待确认' && row.item>=1 || row.businessSource == '外部销售' || row.numberRows>=1" @click="$refs.crud.rowDel(row, index)">删除</el-button>
  11. </template>
  12. <template slot="corpNameSearch">
  13. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  14. </template>
  15. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  16. <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新建订单</el-button>
  17. <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>
  18. </template>
  19. <template slot-scope="{ row, index }" slot="ordNo">
  20. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.ordNo }}
  21. </span>
  22. </template>
  23. <template slot-scope="{ row, index }" slot="srcOrdNo">
  24. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 3)">{{ row.srcOrdNo }}
  25. </span>
  26. </template>
  27. </avue-crud>
  28. </basic-container>
  29. <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
  30. </div>
  31. </template>
  32. <script>
  33. import { getList, remove } from "@/api/tirePartsMall/salesManagement/saleOrder";
  34. import detailsPage from "./detailsPage"
  35. export default {
  36. name: "index",
  37. components: {
  38. detailsPage
  39. },
  40. data() {
  41. return {
  42. detailsOpen: false,
  43. loading: false,
  44. search: {},
  45. form: {},
  46. dataList: [],
  47. detailData: {},
  48. page: {
  49. pageSize: 20,
  50. currentPage: 1,
  51. total: 0,
  52. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  53. },
  54. key: 0,
  55. option: {},
  56. optionList: {
  57. viewBtn: false,
  58. editBtn: false,
  59. delBtn: false,
  60. addBtn: false,
  61. index: true,
  62. span: 8,
  63. border: true,
  64. height: "auto",
  65. searchMenuPosition: "right",
  66. align: "center",
  67. size: "small",
  68. menuWidth: 50,
  69. searchSpan: 8,
  70. searchIcon: true,
  71. searchIndex: 2,
  72. highlightCurrentRow: true,
  73. dialogWidth: "70%",
  74. summaryText: "合计",
  75. showSummary: true,
  76. sumColumnList: [],
  77. column: [{
  78. label: '采购单号',
  79. prop: "ordNo",
  80. search: true,
  81. overHidden: true,
  82. },
  83. // {
  84. // label: '来源单号',
  85. // prop: "srcOrdNo",
  86. // search: true,
  87. // overHidden: true,
  88. // },
  89. // {
  90. // label: "业务来源",
  91. // prop: "businessSource",
  92. // overHidden: true,
  93. // search: true,
  94. // type: 'select',
  95. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=business_Source",
  96. // props: {
  97. // label: "dictValue",
  98. // value: "dictKey"
  99. // }
  100. // },
  101. {
  102. label: '所属公司',
  103. prop: "salesCompanyName",
  104. overHidden: true,
  105. }, {
  106. label: '业务对象',
  107. prop: "customerId",
  108. search: true,
  109. overHidden: true,
  110. type: 'select',
  111. props: {
  112. label: 'cname',
  113. value: 'id'
  114. },
  115. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=KH',
  116. }, {
  117. label: '仓库',
  118. prop: "storageId",
  119. search: true,
  120. overHidden: true,
  121. type: 'select',
  122. props: {
  123. label: 'cname',
  124. value: 'id'
  125. },
  126. dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  127. }, {
  128. label: '行数',
  129. prop: "numberRows",
  130. overHidden: true,
  131. }, {
  132. label: '数量',
  133. prop: "goodsTotalNum",
  134. overHidden: true,
  135. }, {
  136. label: '金额',
  137. prop: "totalMoney",
  138. overHidden: true,
  139. }, {
  140. label: '状态',
  141. prop: "status",
  142. search: true,
  143. overHidden: true,
  144. type: 'select',
  145. dicUrl: "/api/blade-system/dict-biz/dictionary?code=sales_Status",
  146. props: {
  147. label: "dictValue",
  148. value: "dictKey"
  149. }
  150. },
  151. // {
  152. // label: '应结日期',
  153. // prop: "dueDate",
  154. // overHidden: true,
  155. // },
  156. {
  157. label: "制单人",
  158. prop: "createUserName",
  159. searchProp: "createUser",
  160. overHidden: true,
  161. width: 100,
  162. filterable: true,
  163. remote: true,
  164. type: "select",
  165. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  166. props: {
  167. label: "account",
  168. value: "id",
  169. res: 'data.records'
  170. }
  171. }, {
  172. label: "制单日期",
  173. prop: "createTime",
  174. searchProp: "createTimeList",
  175. type: "date",
  176. overHidden: true,
  177. width: 100,
  178. searchRange: true,
  179. searchDefaultTime: ["00:00:00", "23:59:59"],
  180. format: "yyyy-MM-dd",
  181. valueFormat: "yyyy-MM-dd HH:mm:ss"
  182. }, {
  183. label: "更新人",
  184. prop: "updateUserName",
  185. searchProp: "updateUser",
  186. overHidden: true,
  187. width: 100,
  188. filterable: true,
  189. remote: true,
  190. type: "select",
  191. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  192. props: {
  193. label: "account",
  194. value: "id",
  195. res: 'data.records'
  196. }
  197. }, {
  198. label: "更新日期",
  199. prop: "updateTime",
  200. searchProp: "updateTimeList",
  201. type: "date",
  202. overHidden: true,
  203. width: 100,
  204. searchRange: true,
  205. searchDefaultTime: ["00:00:00", "23:59:59"],
  206. format: "yyyy-MM-dd",
  207. valueFormat: "yyyy-MM-dd HH:mm:ss"
  208. }]
  209. }
  210. }
  211. },
  212. activated() {
  213. console.log(213213213213);
  214. setTimeout(() => {
  215. console.log(this.$route.query.check);
  216. if (this.$route.query.check) {
  217. this.editOpen({ id: this.$route.query.check.srcBillId }, 1)
  218. }
  219. this.detailData = {
  220. id: this.$route.query.check.billId,
  221. check: this.$route.query.check,
  222. auditId: this.$route.query.check.id
  223. };
  224. }, 100);
  225. },
  226. async created() {
  227. this.option = await this.getColumnData(this.getColumnName(274.4), this.optionList);
  228. this.key++
  229. let i = 0;
  230. this.option.column.forEach(item => {
  231. if (item.search) i++
  232. })
  233. if (i % 3 !== 0) {
  234. const num = 3 - Number(i % 3)
  235. this.option.searchMenuSpan = num * 8;
  236. this.option.searchMenuPosition = "right";
  237. }
  238. },
  239. methods: {
  240. check(row) {
  241. this.form = row
  242. this.detailsOpen = true
  243. },
  244. backToList(type) {
  245. this.form = {}
  246. this.detailsOpen = false
  247. if (type === 0) {
  248. this.detailData = {}
  249. }
  250. this.onLoad(this.page, this.search)
  251. },
  252. editOpen(row, status) {
  253. this.form = row
  254. this.detailData = {
  255. id: row.id,
  256. status: status
  257. };
  258. console.log(status);
  259. this.detailsOpen = true;
  260. },
  261. //刷新
  262. refreshChange() {
  263. this.onLoad(this.page, this.search)
  264. },
  265. rowDel(form, index) {
  266. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  267. confirmButtonText: '确定',
  268. cancelButtonText: '取消',
  269. type: 'warning'
  270. }).then(() => {
  271. remove({id:form.id}).then(res => {
  272. this.$message({
  273. type: 'success',
  274. message: '删除成功!'
  275. });
  276. this.dataList.splice(index, 1);
  277. this.onLoad(this.page)
  278. })
  279. }).catch(() => {
  280. });
  281. },
  282. searchChange(params, done) {
  283. done();
  284. this.onLoad(this.page, params)
  285. },
  286. onLoad(page, params = {}) {
  287. params = {
  288. ...params,
  289. current: page.currentPage,
  290. size: page.pageSize,
  291. bsType: "CG",
  292. ...Object.assign(params, this.search)
  293. }
  294. this.loading = true
  295. getList(params).then(res => {
  296. this.dataList = res.data.data.records
  297. this.page.total = res.data.data.total
  298. this.loading = false
  299. }).finally(() => {
  300. this.loading = false
  301. })
  302. },
  303. //自定义列保存
  304. async saveColumnTwo(ref, option, optionBack, code) {
  305. /**
  306. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  307. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  308. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  309. */
  310. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  311. if (inSave) {
  312. this.$message.success("保存成功");
  313. //关闭窗口
  314. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  315. }
  316. },
  317. //自定义列重置
  318. async resetColumnTwo(ref, option, optionBack, code) {
  319. this[option] = this[optionBack];
  320. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  321. if (inSave) {
  322. this.$message.success("重置成功");
  323. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  324. }
  325. }
  326. }
  327. }
  328. </script>
  329. <style scoped></style>