index.vue 8.2 KB

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