detail.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <basic-container>
  3. <avue-crud ref="crud" :data="dataList" :option="option" v-model="form" :search.sync="search" :table-loading="loading"
  4. @saveColumn="saveColumn" @resetColumn="resetColumn" @search-change="searchChange" @current-change="currentChange"
  5. @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
  6. <template slot="billno" slot-scope="{ row, index }">
  7. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(row, index)">{{ row.billno }}</span>
  8. </template>
  9. </avue-crud>
  10. </basic-container>
  11. </template>
  12. <script>
  13. import option from "./config/detail.json";
  14. import LTdetail from './config/LTdetail.json'
  15. import {AppPartsStockDataDetails, stockDataDetails} from "@/api/basicData/inventoryAccount";
  16. export default {
  17. name: "detail",
  18. data() {
  19. return {
  20. option: {},
  21. dataList: [],
  22. form: {},
  23. page: {
  24. pageSize: 10,
  25. pagerCount: 5,
  26. total: 0,
  27. },
  28. search: {},
  29. loading: false,
  30. params: null,
  31. }
  32. },
  33. async created() {
  34. // this.option = option
  35. console.log('打开了');
  36. if (JSON.parse(localStorage.getItem('saber-tenantId')).content == 883868){
  37. this.option = LTdetail;
  38. }else {
  39. this.option = await this.getColumnData(this.getColumnName(279), option);
  40. }
  41. this.$store.commit("DOMAS_IN_DETAIL");
  42. },
  43. activated() {
  44. this.$store.commit("DOMAS_IN_DETAIL");
  45. if (this.$route.query.type == 'JL'){
  46. this.params = {
  47. goodsId: this.$route.query.goodsId,
  48. storageId: this.$route.query.stockId
  49. }
  50. }else {
  51. this.params = {
  52. goodsId: this.$route.query.goodsId,
  53. stockId: this.$route.query.stockId,
  54. dot:this.$route.query.dot
  55. }
  56. }
  57. this.onLoad(this.page)
  58. },
  59. methods: {
  60. onLoad(page, params) {
  61. if (!this.params) return
  62. params = { ...params, ...this.params }
  63. this.dataList.forEach(item => {
  64. this.$refs.crud.toggleRowExpansion(item, false)
  65. })
  66. this.loading = true;
  67. if (this.$route.query.type == 'JL') {
  68. AppPartsStockDataDetails(params).then(res=>{
  69. console.log(res)
  70. this.dataList = res.data.data ? res.data.data : [];
  71. this.page.total = res.data.data.total;
  72. if (this.page.total) {
  73. this.option.height = window.innerHeight - 260;
  74. }
  75. }).finally(() => {
  76. this.loading = false;
  77. });
  78. }else {
  79. stockDataDetails(params)
  80. .then(res => {
  81. console.log('res', res);
  82. this.dataList = res.data.data ? res.data.data : [];
  83. this.page.total = res.data.data.total;
  84. if (this.page.total) {
  85. this.option.height = window.innerHeight - 260;
  86. }
  87. })
  88. .finally(() => {
  89. this.loading = false;
  90. });
  91. }
  92. },
  93. searchChange(params, done) {
  94. this.onLoad(this.page, params);
  95. done();
  96. },
  97. currentChange(val) {
  98. this.page.currentPage = val;
  99. },
  100. sizeChange(val) {
  101. this.page.currentPage = 1;
  102. this.page.pageSize = val;
  103. },
  104. refreshChange() {
  105. this.dataList.forEach(item => {
  106. this.$refs.crud.toggleRowExpansion(item, false)
  107. })
  108. this.page.currentPage = 1;
  109. this.onLoad(this.page, this.search);
  110. },
  111. async saveColumn() {
  112. const inSave = await this.saveColumnData(
  113. this.getColumnName(279),
  114. this.option
  115. );
  116. if (inSave) {
  117. this.$message.success("保存成功");
  118. //关闭窗口
  119. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  120. }
  121. },
  122. async resetColumn() {
  123. this.option = option;
  124. const inSave = await this.delColumnData(
  125. this.getColumnName(279),
  126. option
  127. );
  128. if (inSave) {
  129. this.$message.success("重置成功");
  130. //关闭窗口
  131. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  132. }
  133. },
  134. // 跳转
  135. beforeOpenPage(row, index) {
  136. if(row.bizTypeName == '盘点') {
  137. console.log(this.$store.getters,139)
  138. if (this.$store.getters.Inventory) {
  139. this.$alert("明细账已存在,请保存关闭明细账再进行操作", "温馨提示", {
  140. confirmButtonText: "确定",
  141. type: "warning",
  142. callback: action => {
  143. console.log(action);
  144. }
  145. });
  146. }else {
  147. this.$router.$avueRouter.closeTag("/tirePartsMall/salesManagement/Inventory/index");
  148. this.$router.push({
  149. path: "/tirePartsMall/salesManagement/Inventory/index",
  150. query: {
  151. orderId: row.id
  152. },
  153. });
  154. }
  155. }else {
  156. if (this.$store.getters.inboundAndOutbound) {
  157. this.$alert("明细账已存在,请保存关闭明细账再进行操作", "温馨提示", {
  158. confirmButtonText: "确定",
  159. type: "warning",
  160. callback: action => {
  161. console.log(action);
  162. }
  163. });
  164. } else {
  165. if (row.bizTypeName == '出库') {
  166. this.$router.$avueRouter.closeTag("/tirePartsMall/salesManagement/outboundWorkOrder/index");
  167. this.$router.push({
  168. path: "/tirePartsMall/salesManagement/outboundWorkOrder/index",
  169. query: {
  170. id: row.id
  171. },
  172. });
  173. }else if (row.bizTypeName == '销售') {
  174. this.$router.$avueRouter.closeTag("/salesOrder/index");
  175. this.$router.push({
  176. path: "/salesOrder/index",
  177. query: {
  178. orderId: row.id
  179. },
  180. });
  181. } else if (row.bizTypeName == '采购') {
  182. this.$router.$avueRouter.closeTag("/purchaseOrder/index");
  183. this.$router.push({
  184. path: "/purchaseOrder/index",
  185. query: {
  186. orderId: row.id
  187. },
  188. });
  189. } else if (row.bizTypeName == '调出') {
  190. if (this.$store.getters.Allocateandtransfer) {
  191. this.$alert("调拨明细已存在,请保存关闭明细账再进行操作", "温馨提示", {
  192. confirmButtonText: "确定",
  193. type: "warning",
  194. callback: action => {
  195. console.log(action);
  196. }
  197. });
  198. }else {
  199. this.$router.$avueRouter.closeTag("/tirePartsMall/salesManagement/outboundWorkOrderL/index");
  200. this.$router.push({
  201. path: "/tirePartsMall/salesManagement/outboundWorkOrderL/index",
  202. query: {
  203. id: row.id
  204. },
  205. });
  206. }
  207. } else {
  208. this.$router.$avueRouter.closeTag("/tirePartsMall/purchasingManagement/warehouseEntryOrder/index");
  209. this.$router.push({
  210. path: "/tirePartsMall/purchasingManagement/warehouseEntryOrder/index",
  211. query: {
  212. id: row.id
  213. },
  214. });
  215. }
  216. }
  217. }
  218. },
  219. },
  220. }
  221. </script>
  222. <style scoped></style>