index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <div>
  3. <basic-container v-show="show" class="page-crad">
  4. <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
  5. @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  7. @resetColumn="resetColumn" :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch">
  8. <template slot="menuLeft">
  9. <el-button type="primary" size="mini" @click.stop="newAdd()">新建采购单
  10. </el-button>
  11. </template>
  12. <template slot="corpIdSearch">
  13. <crop-select v-model="search.corpId" corpType="GYS"></crop-select>
  14. </template>
  15. <template slot-scope="{ row, index }" slot="corpId">
  16. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 1)">{{ row.corpsName }}
  17. </span>
  18. </template>
  19. <template slot-scope="{ row, index }" slot="sysNo">
  20. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 1)">{{ row.sysNo }}
  21. </span>
  22. </template>
  23. <template slot="businesDateSearch">
  24. <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
  25. format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']"
  26. :picker-options="pickerOptions">
  27. </el-date-picker>
  28. </template>
  29. <template slot-scope="{ row, index }" slot="menu">
  30. <!-- <el-tooltip class="item" effect="dark" content="新建采购订单" placement="top">
  31. <i class="tradingIcon icon-add" />
  32. </el-tooltip>
  33. <el-tooltip class="item" effect="dark" content="付款" placement="top">
  34. <i class="tradingIcon icon-proceeds" />
  35. </el-tooltip>
  36. <el-tooltip class="item" effect="dark" content="发货" placement="top">
  37. <i class="tradingIcon icon-deliver" />
  38. </el-tooltip>
  39. <el-tooltip class="item" effect="dark" content="对账" placement="top">
  40. <i class="tradingIcon icon-reconciliation" />
  41. </el-tooltip> -->
  42. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  43. <i class="tradingIcon icon-edit" @click.stop="editOpen(row, 2)"/>
  44. </el-tooltip>
  45. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  46. <i class="tradingIcon icon-del" v-if="row.confirmStatus == 0" @click.stop="rowDel(row, index)"/>
  47. </el-tooltip>
  48. <!--<el-button type="text" size="small" @click.stop="editOpen(row, 2)">-->
  49. <!-- 查看-->
  50. <!--</el-button>-->
  51. <!--<el-button type="text" size="small" v-if="row.confirmStatus == 0" @click.stop="rowDel(row, index)">-->
  52. <!-- 删除-->
  53. <!--</el-button>-->
  54. </template>
  55. </avue-crud>
  56. </basic-container>
  57. <details-page v-if="!show" @goBack="goBack()" :detailData="detailData" />
  58. </div>
  59. </template>
  60. <script>
  61. import detailsPage from "./detailsPage";
  62. import { option } from "./js/optionList";
  63. import {getList, getCorpsAll, gainUser, getCorpType, orderRemove} from "@/api/basicData/salesOrder";
  64. export default {
  65. name: "index",
  66. data() {
  67. return {
  68. src: '',
  69. show: true,
  70. loading: false,
  71. search: {},
  72. detailData: {},
  73. dataList: [],
  74. selectionList: [],
  75. page: {
  76. pageSize: 20,
  77. currentPage: 1,
  78. total: 0,
  79. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  80. },
  81. option: {},
  82. pickerOptions: {
  83. shortcuts: [
  84. {
  85. text: '当天',
  86. onClick(picker) {
  87. const date = new Date();
  88. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
  89. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  90. picker.$emit('pick', [start, end]);
  91. }
  92. },
  93. {
  94. text: '昨天',
  95. onClick(picker) {
  96. const date = new Date();
  97. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 0, 0, 0);
  98. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 23, 59, 59);
  99. picker.$emit('pick', [start, end]);
  100. }
  101. }, {
  102. text: '当月',
  103. onClick(picker) {
  104. const date = new Date();
  105. const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
  106. const end = new Date(date.getFullYear(), date.getMonth() + 1, 0, 23, 59, 59);
  107. picker.$emit('pick', [start, end]);
  108. }
  109. }, {
  110. text: '当季',
  111. onClick(picker) {
  112. const date = new Date();
  113. const start = new Date(date.getFullYear(), parseInt(date.getMonth() / 3) * 3, 1, 0, 0, 0);
  114. const end = new Date(date.getFullYear(), parseInt(date.getMonth() / 3) * 3 + 3, 0, 23, 59, 59);
  115. picker.$emit('pick', [start, end]);
  116. }
  117. }, {
  118. text: '当年',
  119. onClick(picker) {
  120. const date = new Date();
  121. const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
  122. const end = new Date(date.getFullYear() + 1, 0, 0, 23, 59, 59);
  123. picker.$emit('pick', [start, end]);
  124. }
  125. }, {
  126. text: '最近一周',
  127. onClick(picker) {
  128. const date = new Date();
  129. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7, 0, 0, 0);
  130. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  131. picker.$emit('pick', [start, end]);
  132. }
  133. }, {
  134. text: '最近二周',
  135. onClick(picker) {
  136. const date = new Date();
  137. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7 * 2, 0, 0, 0);
  138. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  139. picker.$emit('pick', [start, end]);
  140. }
  141. }, {
  142. text: '最近三周',
  143. onClick(picker) {
  144. const date = new Date();
  145. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7 * 3, 0, 0, 0);
  146. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  147. picker.$emit('pick', [start, end]);
  148. }
  149. }]
  150. },
  151. };
  152. },
  153. components: {
  154. detailsPage
  155. },
  156. async created() {
  157. this.getWorkDicts("payment_status").then(res => {
  158. const arr = res.data.data.map(item => {
  159. item.dictKey = Number(item.dictKey)
  160. return item
  161. })
  162. this.findObject(this.option.column, "actualPaymentStatus").dicData = arr
  163. });
  164. this.getWorkDicts("order_status_pjjl").then(res => {
  165. const arr = res.data.data.map(item => {
  166. item.dictKey = Number(item.dictKey)
  167. return item
  168. })
  169. this.findObject(this.option.column, "status").dicData = arr
  170. });
  171. this.option = await this.getColumnData(this.getColumnName(213), option);
  172. this.option.height = window.innerHeight - 210;
  173. this.getAllWorkDicts()
  174. },
  175. activated() {
  176. this.$refs.crud.refreshTable();
  177. if (!this.$store.getters.pjcgStatus&&!this.show) {
  178. this.show = true;
  179. }
  180. if (this.$route.query.orderId) {
  181. setTimeout(() => {
  182. this.editOpen({ id: this.$route.query.orderId }, 1);
  183. }, 100);
  184. }
  185. },
  186. methods: {
  187. getAllWorkDicts() {
  188. gainUser().then(res => {
  189. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  190. })
  191. getCorpType({ corpType: 'GYS' }).then(res => {
  192. this.findObject(this.option.column, "corpType").dicData= res.data.data
  193. });
  194. this.$refs.crud.init();
  195. },
  196. searchCriteriaSwitch(type) {
  197. if (type) {
  198. this.option.height = this.option.height - 138;
  199. } else {
  200. this.option.height = this.option.height + 138;
  201. }
  202. this.$refs.crud.getTableHeight();
  203. },
  204. cellStyle() {
  205. return "padding:0;height:40px;";
  206. },
  207. //点击搜索按钮触发
  208. searchChange(params, done) {
  209. this.page.currentPage = 1;
  210. this.onLoad(this.page, params);
  211. done();
  212. },
  213. refreshChange() {
  214. this.onLoad(this.page, this.search);
  215. },
  216. newAdd() {
  217. this.show = false;
  218. this.$store.commit("IN_PJCG_STATUS");
  219. },
  220. onLoad(page, params = {}) {
  221. let data = this.deepClone(Object.assign(params, this.search));
  222. data.billType = 'CG';
  223. data.tradeType = 'YPJ';
  224. if (data.businesDate) {
  225. data.orderStartDate = data.businesDate[0];
  226. data.orderEndDate = data.businesDate[1];
  227. }
  228. delete data.businesDate
  229. this.loading = true;
  230. getList(
  231. page.currentPage,
  232. page.pageSize,
  233. data
  234. ).then(res => {
  235. this.dataList = res.data.data.records ? res.data.data.records : [];
  236. this.page.total = res.data.data.total;
  237. this.$nextTick(() => {
  238. this.$refs.crud.doLayout();
  239. });
  240. }).finally(() => {
  241. this.loading = false;
  242. });
  243. },
  244. editOpen(row, status) {
  245. this.detailData = {
  246. id: row.id,
  247. status: status
  248. };
  249. this.show = false;
  250. this.$store.commit("IN_PJCG_STATUS");
  251. },
  252. currentChange(val) {
  253. this.page.currentPage = val;
  254. },
  255. sizeChange(val) {
  256. this.page.currentPage = 1;
  257. this.page.pageSize = val;
  258. },
  259. rowDel(row, index, done) {
  260. this.$confirm("确定删除数据?", {
  261. confirmButtonText: "确定",
  262. cancelButtonText: "取消",
  263. type: "warning"
  264. }).then(() => {
  265. orderRemove(row.id).then(res => {
  266. if (res.data.code == 200) {
  267. this.$message({
  268. type: "success",
  269. message: "删除成功!"
  270. });
  271. this.onLoad(this.page, this.search);
  272. }
  273. });
  274. });
  275. },
  276. async saveColumn() {
  277. const inSave = await this.saveColumnData(
  278. this.getColumnName(213),
  279. this.option
  280. );
  281. if (inSave) {
  282. this.$nextTick(() => {
  283. this.$refs.crud.doLayout();
  284. });
  285. this.$message.success("保存成功");
  286. //关闭窗口
  287. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  288. }
  289. },
  290. async resetColumn() {
  291. this.option = option;
  292. const inSave = await this.delColumnData(this.getColumnName(213), option);
  293. if (inSave) {
  294. this.$nextTick(() => {
  295. this.$refs.crud.doLayout();
  296. });
  297. this.getAllWorkDicts()
  298. this.$message.success("重置成功");
  299. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  300. }
  301. },
  302. //返回列表
  303. goBack() {
  304. this.detailData = this.$options.data().detailData;
  305. this.show = true;
  306. this.onLoad(this.page, this.search);
  307. this.$store.commit("OUT_PJCG_STATUS");
  308. },
  309. }
  310. }
  311. </script>
  312. <style lang="scss" scoped>
  313. .page-crad ::v-deep .basic-container__card {
  314. height: 94.2vh;
  315. }
  316. .stat-td {
  317. text-align: center;
  318. position: relative;
  319. }
  320. .stat-img {
  321. width: 95%;
  322. height: 100px;
  323. }
  324. .stat-tip {
  325. position: absolute;
  326. left: 15px;
  327. top: 5px;
  328. .money {
  329. color: #fff;
  330. font-size: 28px;
  331. text-align: left;
  332. font-weight: 600;
  333. }
  334. .title {
  335. color: #fff;
  336. font-size: 14px;
  337. text-align: left;
  338. margin-top: 5px;
  339. margin-bottom: 0px;
  340. }
  341. }
  342. </style>