index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <basic-container v-if="show">
  3. <avue-crud :option="option"
  4. :data="dataList"
  5. :table-loading="loading"
  6. ref="crud"
  7. v-model="form"
  8. :page.sync="page"
  9. :search.sync="search"
  10. @row-del="rowDel"
  11. :before-open="beforeOpen"
  12. :before-close="beforeClose"
  13. @search-change="searchChange"
  14. @search-reset="searchReset"
  15. @selection-change="selectionChange"
  16. @current-change="currentChange"
  17. @size-change="sizeChange"
  18. @refresh-change="refreshChange"
  19. @saveColumn="saveColumn"
  20. @resetColumn="resetColumn"
  21. @on-load="onLoad">
  22. <template slot="corpIdSearch">
  23. <select-component
  24. v-model="search.corpId"
  25. :configuration="configuration"
  26. ></select-component>
  27. </template>
  28. <template slot="storageIdSearch">
  29. <warehouse-select
  30. v-model="search.storageId"
  31. :configuration="sConfiguration"
  32. ></warehouse-select>
  33. </template>
  34. <template slot="menuLeft">
  35. <el-button size="small"
  36. type="success"
  37. :disabled="selectionList.length != 1"
  38. @click.stop="copyBill"
  39. >复制单据
  40. </el-button>
  41. </template>
  42. <template slot-scope="scope" slot="menu">
  43. <el-button
  44. type="text"
  45. icon="el-icon-delete"
  46. size="small"
  47. @click.stop="rowDel(scope.row,scope.index)"
  48. >删除
  49. </el-button>
  50. </template>
  51. <template slot-scope="scope" slot="orderNo">
  52. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.orderNo }}</span>
  53. </template>
  54. <template slot-scope="scope" slot="corpsName">
  55. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.corpsName }}</span>
  56. </template>
  57. <template slot-scope="scope" slot="totalQuantity">
  58. <span>{{ scope.row.totalQuantity | roundNumbers}}</span>
  59. </template>
  60. </avue-crud>
  61. </basic-container>
  62. <detail-page
  63. ref="detail"
  64. @goBack="goBack"
  65. :detailData="detailData"
  66. v-else
  67. ></detail-page>
  68. </template>
  69. <script>
  70. import option from "./config/mainList.json";
  71. import {selectReceiptList,
  72. removeReceiptList,} from "@/api/importTrade/receipt"
  73. import detailPage from "./detailsPageEdit.vue";
  74. import { roundNumbers } from "@/util/validate";
  75. export default {
  76. name: "customerInformation",
  77. data() {
  78. return {
  79. form: {},
  80. show:true,
  81. loading:false,
  82. detailData:{},
  83. selectionList:[],
  84. option: {},
  85. search: {},
  86. configuration:{
  87. multipleChoices:false,
  88. multiple:false,
  89. disabled:false,
  90. searchShow:true,
  91. collapseTags:false,
  92. clearable:true,
  93. placeholder:'请点击右边按钮选择',
  94. dicData:[]
  95. },
  96. sConfiguration:{
  97. multipleChoices:false,
  98. multiple:false,
  99. disabled:false,
  100. searchShow:true,
  101. collapseTags:false,
  102. clearable:true,
  103. placeholder:'请点击右边按钮选择',
  104. dicData:[]
  105. },
  106. parentId: 0,
  107. dataList: [],
  108. page: {
  109. pageSize: 10,
  110. pagerCount: 5,
  111. total: 0,
  112. }
  113. }
  114. },
  115. filters: {
  116. roundNumbers(val){
  117. return roundNumbers(val);
  118. }
  119. },
  120. components:{
  121. detailPage
  122. },
  123. async created() {
  124. this.option = await this.getColumnData(this.getColumnName(40), option);
  125. },
  126. activated() {
  127. if(!this.show && !this.$store.getters.takeStatus){
  128. this.show = true;
  129. }
  130. setTimeout(() => {
  131. if(this.$route.query.params && this.show){
  132. this.detailData={
  133. params:this.$route.query.params
  134. }
  135. this.show = false;
  136. this.$store.commit("TAKE_IN_DETAIL");
  137. }
  138. }, 100);
  139. },
  140. mounted() {
  141. // this.option.height = window.innerHeight - 200;
  142. },
  143. methods: {
  144. //删除列表后面的删除按钮触发触发(row, index, done)
  145. rowDel(row, index, done) {
  146. this.$confirm("确定将选择数据删除?", {
  147. confirmButtonText: "确定",
  148. cancelButtonText: "取消",
  149. type: "warning"
  150. }).then(() => {
  151. return removeReceiptList(row.id);
  152. }).then(() => {
  153. this.$message({
  154. type: "success",
  155. message: "操作成功!"
  156. });
  157. this.page.currentPage = 1;
  158. this.onLoad(this.page);
  159. });
  160. },
  161. copyBill(){
  162. this.detailData = {
  163. id: this.selectionList[0].id,
  164. status: 'copy'
  165. };
  166. this.show = false;
  167. this.$store.commit("TAKE_IN_DETAIL");
  168. },
  169. //查看跳转页面
  170. beforeOpenPage(row, status) {
  171. let lockData = {
  172. moduleName: 'sh',
  173. tableName: 'business_delivery',
  174. billId: row.id,
  175. no: localStorage.getItem('browserID'),
  176. billNo:row.orderNo
  177. }
  178. this.detailData = {
  179. id: row.id,
  180. view:true,
  181. status: status,
  182. lockData:lockData
  183. };
  184. this.show = false;
  185. this.$store.commit("TAKE_IN_DETAIL");
  186. },
  187. //新增跳转页面
  188. beforeOpen(row, status) {
  189. this.detailData = {
  190. id: row.id,
  191. status: status
  192. };
  193. this.show = false;
  194. this.$store.commit("TAKE_IN_DETAIL");
  195. },
  196. editOpen(row, status) {
  197. this.detailData = {
  198. id: row.id,
  199. status: status
  200. };
  201. this.show = false;
  202. this.$store.commit("TAKE_IN_DETAIL");
  203. },
  204. //点击新增时触发
  205. beforeClose(done) {
  206. this.parentId = "";
  207. const column = this.findObject(this.option.column, "parentId");
  208. column.value = "";
  209. column.addDisabled = false;
  210. done();
  211. },
  212. //点击搜索按钮触发
  213. searchChange(params, done) {
  214. this.page.currentPage = 1;
  215. this.onLoad(this.page, params);
  216. done()
  217. },
  218. searchReset() {
  219. console.log('1')
  220. },
  221. selectionChange(row) {
  222. this.selectionList = row
  223. },
  224. currentChange(val) {
  225. this.page.currentPage = val
  226. },
  227. sizeChange() {
  228. console.log('1')
  229. },
  230. refreshChange(params,done) {
  231. this.onLoad(this.page,params)
  232. },
  233. paramsAdjustment(params) {
  234. params = Object.assign({}, this.search);
  235. if (params.businessDate && params.businessDate.length !==0 ) { //发货
  236. params.businessStartDate = params.businessDate[0]+ " " + "00:00:00";
  237. params.businessEndDate = params.businessDate[1] + " " + "23:59:59";
  238. this.$delete(params,'businessDate')
  239. }
  240. if (params.createTime && params.createTime.length !==0 ) {
  241. params.createStartTime = params.createTime[0]+ " " + "00:00:00";
  242. params.createEndTime = params.createTime[1] + " " + "23:59:59";
  243. this.$delete(params,'createTime')
  244. }
  245. return params
  246. },
  247. onLoad(page, params) {
  248. this.loading = true
  249. params = this.paramsAdjustment(params)
  250. params.size = page.pageSize
  251. params.current = page.currentPage
  252. selectReceiptList(params).then(res => {
  253. this.dataList = res.data.data.records
  254. this.page.total = res.data.data.total
  255. }).finally(()=>{
  256. this.loading = false
  257. })
  258. },
  259. goBack() {
  260. this.detailData=this.$options.data().detailData
  261. this.show = true;
  262. this.onLoad(this.page,this.search)
  263. },
  264. //列保存触发
  265. async saveColumn() {
  266. const inSave = await this.saveColumnData(
  267. this.getColumnName(40),
  268. this.option
  269. );
  270. if (inSave) {
  271. this.$message.success("保存成功");
  272. //关闭窗口
  273. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  274. }
  275. },
  276. async resetColumn() {
  277. const inSave = await this.delColumnData(
  278. this.getColumnName(40),
  279. option
  280. );
  281. if (inSave) {
  282. this.$message.success("重置成功");
  283. this.option = option;
  284. //关闭窗口
  285. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  286. }
  287. },
  288. }
  289. }
  290. </script>
  291. <style scoped>
  292. </style>