index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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-del" />
  35. </el-tooltip>
  36. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  37. <i class="tradingIcon icon-edit" />
  38. </el-tooltip>
  39. <el-tooltip class="item" effect="dark" content="付款" placement="top">
  40. <i class="tradingIcon icon-proceeds" />
  41. </el-tooltip>
  42. <el-tooltip class="item" effect="dark" content="发货" placement="top">
  43. <i class="tradingIcon icon-deliver" />
  44. </el-tooltip>
  45. <el-tooltip class="item" effect="dark" content="对账" placement="top">
  46. <i class="tradingIcon icon-reconciliation" />
  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" @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} 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.option = await this.getColumnData(this.getColumnName(213), option);
  158. this.option.height = window.innerHeight - 210;
  159. this.getAllWorkDicts()
  160. },
  161. activated() {
  162. this.$refs.crud.refreshTable();
  163. if (!this.$store.getters.pjcgStatus&&!this.show) {
  164. this.show = true;
  165. }
  166. if (this.$route.query.orderId) {
  167. setTimeout(() => {
  168. this.editOpen({ id: this.$route.query.orderId }, 1);
  169. }, 100);
  170. }
  171. },
  172. methods: {
  173. getAllWorkDicts() {
  174. gainUser().then(res => {
  175. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  176. })
  177. getCorpType({ corpType: 'GYS' }).then(res => {
  178. this.findObject(this.option.column, "corpType").dicData= res.data.data
  179. });
  180. this.$refs.crud.init();
  181. },
  182. searchCriteriaSwitch(type) {
  183. if (type) {
  184. this.option.height = this.option.height - 138;
  185. } else {
  186. this.option.height = this.option.height + 138;
  187. }
  188. this.$refs.crud.getTableHeight();
  189. },
  190. cellStyle() {
  191. return "padding:0;height:40px;";
  192. },
  193. //点击搜索按钮触发
  194. searchChange(params, done) {
  195. this.page.currentPage = 1;
  196. this.onLoad(this.page, params);
  197. done();
  198. },
  199. refreshChange() {
  200. this.onLoad(this.page, this.search);
  201. },
  202. newAdd() {
  203. this.show = false;
  204. this.$store.commit("IN_PJCG_STATUS");
  205. },
  206. onLoad(page, params = {}) {
  207. let data = this.deepClone(Object.assign(params, this.search));
  208. data.billType = 'CG';
  209. data.tradeType = 'YPJ';
  210. if (data.businesDate) {
  211. data.orderStartDate = data.businesDate[0];
  212. data.orderEndDate = data.businesDate[1];
  213. }
  214. delete data.businesDate
  215. this.loading = true;
  216. getList(
  217. page.currentPage,
  218. page.pageSize,
  219. data
  220. )
  221. .then(res => {
  222. this.dataList = res.data.data.records ? res.data.data.records : [];
  223. this.page.total = res.data.data.total;
  224. this.$nextTick(() => {
  225. this.$refs.crud.doLayout();
  226. });
  227. })
  228. .finally(() => {
  229. this.loading = false;
  230. });
  231. },
  232. editOpen(row, status) {
  233. this.detailData = {
  234. id: row.id,
  235. status: status
  236. };
  237. this.show = false;
  238. this.$store.commit("IN_PJCG_STATUS");
  239. },
  240. currentChange(val) {
  241. this.page.currentPage = val;
  242. },
  243. sizeChange(val) {
  244. this.page.currentPage = 1;
  245. this.page.pageSize = val;
  246. },
  247. rowDel(row, index, done) {
  248. this.$confirm("确定删除数据?", {
  249. confirmButtonText: "确定",
  250. cancelButtonText: "取消",
  251. type: "warning"
  252. }).then(() => {
  253. // remove(row.id).then(res => {
  254. // if (res.data.code == 200) {
  255. // this.$message({
  256. // type: "success",
  257. // message: "删除成功!"
  258. // });
  259. // this.onLoad(this.page, this.search);
  260. // }
  261. // });
  262. });
  263. },
  264. async saveColumn() {
  265. const inSave = await this.saveColumnData(
  266. this.getColumnName(213),
  267. this.option
  268. );
  269. if (inSave) {
  270. this.$nextTick(() => {
  271. this.$refs.crud.doLayout();
  272. });
  273. this.$message.success("保存成功");
  274. //关闭窗口
  275. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  276. }
  277. },
  278. async resetColumn() {
  279. this.option = option;
  280. const inSave = await this.delColumnData(this.getColumnName(213), option);
  281. if (inSave) {
  282. this.$nextTick(() => {
  283. this.$refs.crud.doLayout();
  284. });
  285. this.getAllWorkDicts()
  286. this.$message.success("重置成功");
  287. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  288. }
  289. },
  290. //返回列表
  291. goBack() {
  292. this.detailData = this.$options.data().detailData;
  293. this.show = true;
  294. this.onLoad(this.page, this.search);
  295. this.$store.commit("OUT_PJCG_STATUS");
  296. },
  297. }
  298. }
  299. </script>
  300. <style lang="scss" scoped>
  301. .page-crad ::v-deep .basic-container__card {
  302. height: 94.2vh;
  303. }
  304. .stat-td {
  305. text-align: center;
  306. position: relative;
  307. }
  308. .stat-img {
  309. width: 95%;
  310. height: 100px;
  311. }
  312. .stat-tip {
  313. position: absolute;
  314. left: 15px;
  315. top: 5px;
  316. .money {
  317. color: #fff;
  318. font-size: 28px;
  319. text-align: left;
  320. font-weight: 600;
  321. }
  322. .title {
  323. color: #fff;
  324. font-size: 14px;
  325. text-align: left;
  326. margin-top: 5px;
  327. margin-bottom: 0px;
  328. }
  329. }
  330. </style>