index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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-scope="{ row, index }" slot="id">
  13. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.cname }}
  14. </span>
  15. </template> -->
  16. <template slot-scope="{ row, index }" slot="menu">
  17. <el-tooltip class="item" effect="dark" content="盘存" placement="top">
  18. <i class="tradingIcon icon-inStock" @click="rowCell(row, index)" />
  19. </el-tooltip>
  20. <!-- <el-tooltip class="item" effect="dark" content="删除" placement="top">
  21. <i class="tradingIcon icon-del" />
  22. </el-tooltip>
  23. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  24. <i class="tradingIcon icon-edit" />
  25. </el-tooltip>
  26. <el-tooltip class="item" effect="dark" content="收款" placement="top">
  27. <i class="tradingIcon icon-proceeds" />
  28. </el-tooltip>
  29. <el-tooltip class="item" effect="dark" content="发货" placement="top">
  30. <i class="tradingIcon icon-deliver" />
  31. </el-tooltip>
  32. <el-tooltip class="item" effect="dark" content="对账" placement="top">
  33. <i class="tradingIcon icon-reconciliation" />
  34. </el-tooltip> -->
  35. <!-- <el-button type="text" size="small" @click.stop="editOpen(row, 2)">
  36. 查看
  37. </el-button>
  38. <el-button type="text" size="small" @click.stop="rowDel(row, index)">
  39. 删除
  40. </el-button> -->
  41. </template>
  42. </avue-crud>
  43. </basic-container>
  44. <details-page v-if="!show" @goBack="goBack()" :detailData="detailData" />
  45. </div>
  46. </template>
  47. <script>
  48. import detailsPage from "./detailsPage";
  49. import { option } from "./js/optionList";
  50. import { getList, getAllgoods } from "@/api/basicData/Inventory";
  51. export default {
  52. name: "index",
  53. data() {
  54. return {
  55. src: '',
  56. show: true,
  57. loading: false,
  58. search: {},
  59. detailData: {},
  60. dataList: [],
  61. selectionList: [],
  62. page: {
  63. pageSize: 20,
  64. currentPage: 1,
  65. total: 0,
  66. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  67. },
  68. option: {},
  69. };
  70. },
  71. components: {
  72. detailsPage
  73. },
  74. async created() {
  75. this.option = await this.getColumnData(this.getColumnName(219), option);
  76. this.option.height = window.innerHeight - 210;
  77. this.getAllWorkDicts()
  78. },
  79. methods: {
  80. getAllWorkDicts() {
  81. this.getWorkDicts("label").then(res => {
  82. this.findObject(this.option.column, "label").dicData = res.data.data;
  83. });
  84. this.getWorkDicts("unit").then(res => {
  85. this.findObject(this.option.column, "unit").dicData = res.data.data;
  86. });
  87. this.getWorkDicts("goods_status").then(res => {
  88. this.findObject(this.option.column, "status").dicData = res.data.data;
  89. });
  90. getAllgoods().then(res => {
  91. this.findObject(this.option.column, "goods").dicData = res.data.data
  92. });
  93. this.$refs.crud.init();
  94. },
  95. searchCriteriaSwitch(type) {
  96. if (type) {
  97. this.option.height = this.option.height - 42;
  98. } else {
  99. this.option.height = this.option.height + 42;
  100. }
  101. this.$refs.crud.getTableHeight();
  102. },
  103. cellStyle() {
  104. return "padding:0;height:40px;";
  105. },
  106. //点击搜索按钮触发
  107. searchChange(params, done) {
  108. this.page.currentPage = 1;
  109. this.onLoad(this.page, params);
  110. done();
  111. },
  112. refreshChange() {
  113. this.onLoad(this.page, this.search);
  114. },
  115. rowCell(row, index) {
  116. this.$refs.crud.rowEdit(row, index)
  117. },
  118. newAdd() {
  119. this.show = false;
  120. },
  121. onLoad(page, params = {}) {
  122. let data = this.deepClone(Object.assign(params, this.search));
  123. this.loading = true;
  124. getList(
  125. page.currentPage,
  126. page.pageSize,
  127. data
  128. )
  129. .then(res => {
  130. this.dataList = res.data.data.records ? res.data.data.records : [];
  131. this.page.total = res.data.data.total;
  132. })
  133. .finally(() => {
  134. this.loading = false;
  135. });
  136. },
  137. currentChange(val) {
  138. this.page.currentPage = val;
  139. },
  140. sizeChange(val) {
  141. this.page.currentPage = 1;
  142. this.page.pageSize = val;
  143. },
  144. rowDel(row, index, done) {
  145. this.$confirm("确定删除数据?", {
  146. confirmButtonText: "确定",
  147. cancelButtonText: "取消",
  148. type: "warning"
  149. }).then(() => {
  150. // remove(row.id).then(res => {
  151. // if (res.data.code == 200) {
  152. // this.$message({
  153. // type: "success",
  154. // message: "删除成功!"
  155. // });
  156. // this.onLoad(this.page, this.search);
  157. // }
  158. // });
  159. });
  160. },
  161. async saveColumn() {
  162. const inSave = await this.saveColumnData(
  163. this.getColumnName(219),
  164. this.option
  165. );
  166. if (inSave) {
  167. this.$nextTick(() => {
  168. this.$refs.crud.doLayout();
  169. });
  170. this.$message.success("保存成功");
  171. //关闭窗口
  172. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  173. }
  174. },
  175. async resetColumn() {
  176. this.option = option;
  177. const inSave = await this.delColumnData(this.getColumnName(219), option);
  178. if (inSave) {
  179. this.$nextTick(() => {
  180. this.$refs.crud.doLayout();
  181. });
  182. this.getAllWorkDicts()
  183. this.$message.success("重置成功");
  184. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  185. }
  186. },
  187. //返回列表
  188. goBack() {
  189. this.detailData = this.$options.data().detailData;
  190. this.show = true;
  191. this.onLoad(this.page, this.search);
  192. },
  193. }
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. .page-crad ::v-deep .basic-container__card {
  198. height: 94.2vh;
  199. }
  200. .stat-td {
  201. text-align: center;
  202. position: relative;
  203. }
  204. .stat-img {
  205. width: 95%;
  206. height: 100px;
  207. }
  208. .stat-tip {
  209. position: absolute;
  210. left: 15px;
  211. top: 5px;
  212. .money {
  213. color: #fff;
  214. font-size: 28px;
  215. text-align: left;
  216. font-weight: 600;
  217. }
  218. .title {
  219. color: #fff;
  220. font-size: 14px;
  221. text-align: left;
  222. margin-top: 5px;
  223. margin-bottom: 0px;
  224. }
  225. }
  226. </style>