index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <div>
  3. <basic-container v-show="isShow">
  4. <avue-crud :option="option"
  5. :data="dataList"
  6. ref="crud"
  7. v-model="form"
  8. :page.sync="page"
  9. :search.sync="search"
  10. :table-loading="loading"
  11. @row-del="rowDel"
  12. @row-update="rowUpdate"
  13. :before-open="beforeOpen"
  14. :before-close="beforeClose"
  15. @row-save="rowSave"
  16. @search-change="searchChange"
  17. @search-reset="searchReset"
  18. @selection-change="selectionChange"
  19. @current-change="currentChange"
  20. @size-change="sizeChange"
  21. @refresh-change="refreshChange"
  22. @on-load="onLoad"
  23. @tree-load="treeLoad"
  24. @saveColumn="saveColumn"
  25. @resetColumn="resetColumn"
  26. @search-criteria-switch="searchCriteriaSwitch"
  27. :cell-style="cellStyle">
  28. <template slot="menuLeft" slot-scope="{size}">
  29. <el-button type="success" :size="size" @click="copyOrder" :disabled="single">复制单据</el-button>
  30. <el-button type="info" :size="size" icon="el-icon-printer":loading="exportLoading"
  31. @click.stop="statement">报 表</el-button>
  32. </template>
  33. <template slot-scope="scope" slot="orgOrderNo">
  34. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.orgOrderNo }}</span>
  35. </template>
  36. <template slot="corpIdSearch">
  37. <crop-select
  38. v-model="search.corpId"
  39. corpType="KH"
  40. ></crop-select>
  41. </template>
  42. <template slot="salesCompanySearch">
  43. <select-component
  44. v-model="search.salesCompany"
  45. :configuration="configuration"
  46. ></select-component>
  47. </template>
  48. <template slot-scope="scope" slot="corpId">
  49. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.corpsName }}</span>
  50. </template>
  51. <template slot-scope="scope" slot="salesCompany">
  52. {{ scope.row.salesCompanyName }}
  53. </template>
  54. <template slot="storageIdSearch">
  55. <warehouseSelect
  56. v-model="search.storageId"
  57. :configuration="configurationWarehouse"
  58. ></warehouseSelect>
  59. </template>
  60. <template slot-scope="scope" slot="storageId">
  61. {{ scope.row.storageName }}
  62. </template>
  63. <template slot-scope="scope" slot="createUser">
  64. {{ scope.row.createUserName }}
  65. </template>
  66. <template slot-scope="scope" slot="menu">
  67. <!-- <el-button-->
  68. <!-- type="text"-->
  69. <!-- icon="el-icon-edit"-->
  70. <!-- size="small"-->
  71. <!-- @click.stop="editOpen(scope.row,scope.index)"-->
  72. <!-- >编辑-->
  73. <!-- </el-button>-->
  74. <el-button
  75. type="text"
  76. icon="el-icon-delete"
  77. size="small"
  78. @click.stop="rowDel(scope.row,scope.index)"
  79. >删除
  80. </el-button>
  81. </template>
  82. </avue-crud>
  83. </basic-container>
  84. <detail-page
  85. ref="detail"
  86. @goBack="goBack"
  87. :detailData="detailData"
  88. v-if="!isShow"
  89. ></detail-page>
  90. <report-dialog
  91. :switchDialog="switchDialog"
  92. :searchValue="statementData"
  93. reportName="国内贸易-客户确认"
  94. @onClose="onClose()"
  95. ></report-dialog>
  96. </div>
  97. </template>
  98. <script>
  99. import option from "./configuration/mainList.json";
  100. import {customerList, typeSave, deleteDetails} from "@/api/basicData/deliveryNotice"
  101. import detailPage from "./detailsPageEdit";
  102. import { defaultDate } from "@/util/date";
  103. import reportDialog from "@/components/report-dialog/main";
  104. export default {
  105. name: "customerInformation",
  106. components: {
  107. detailPage,
  108. reportDialog
  109. },
  110. data() {
  111. return {
  112. configuration: {
  113. multipleChoices: false,
  114. multiple: false,
  115. collapseTags: false,
  116. placeholder: "请点击右边按钮选择",
  117. dicData: [],
  118. },
  119. configurationWarehouse: {
  120. multipleChoices: false,
  121. multiple: false,
  122. collapseTags: false,
  123. placeholder: "请点击右边按钮选择",
  124. dicData: [],
  125. },
  126. form: {},
  127. search: {},
  128. loading: false,
  129. option: {},
  130. parentId: 0,
  131. dataList: [],
  132. page: {
  133. pageSize: 10,
  134. currentPage: 1,
  135. total: 0,
  136. pageSizes: [10,50,100,200,300]
  137. },
  138. // 非单个禁用
  139. single: true,
  140. // 非多个禁用
  141. multiple: true,
  142. selection: [],
  143. isShow: true,
  144. detailData: {},
  145. switchDialog: false, // 报表弹窗
  146. exportLoading:false,
  147. statementData: {},
  148. }
  149. },
  150. async created() {
  151. this.search.businessDate = defaultDate(1)
  152. this.option = option
  153. // this.option = await this.getColumnData(this.getColumnName(20), option);
  154. let i = 0;
  155. this.option.column.forEach(item => {
  156. if (item.search) i++
  157. })
  158. if (i % 3 !== 0){
  159. const num = 3 - Number(i % 3)
  160. this.option.searchMenuSpan = num * 8;
  161. this.option.searchMenuPosition = "right";
  162. }
  163. this.option.column.forEach(item => {
  164. if (item.pickerOptions) {
  165. item.pickerOptions = {
  166. shortcuts: [{
  167. text: '最近一周',
  168. onClick(picker) {
  169. const end = new Date();
  170. const start = new Date();
  171. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  172. picker.$emit('pick', [start, end]);
  173. }
  174. }, {
  175. text: '最近一个月',
  176. onClick(picker) {
  177. const end = new Date();
  178. const start = new Date();
  179. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  180. picker.$emit('pick', [start, end]);
  181. }
  182. }, {
  183. text: '最近三个月',
  184. onClick(picker) {
  185. const end = new Date();
  186. const start = new Date();
  187. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  188. picker.$emit('pick', [start, end]);
  189. }
  190. }]
  191. }
  192. }
  193. })
  194. },
  195. activated() {
  196. // this.isShow = true;
  197. setTimeout(() => {
  198. if (this.$route.query.form) {
  199. this.detailData = {
  200. form: this.$route.query.form,
  201. };
  202. this.$store.commit("IN_IN_DETAIL");
  203. this.isShow = false;
  204. }
  205. }, 100);
  206. },
  207. methods: {
  208. cellStyle() {
  209. return "padding:0;height:40px;";
  210. },
  211. searchCriteriaSwitch(type){
  212. if (type){
  213. this.option.height = this.option.height - 140
  214. }else {
  215. this.option.height = this.option.height + 140
  216. }
  217. this.$refs.crud.getTableHeight()
  218. },
  219. //删除列表后面的删除按钮触发触发(row, index, done)
  220. rowDel(row, index, done) {
  221. this.$confirm("确定将选择数据删除?", {
  222. confirmButtonText: "确定",
  223. cancelButtonText: "取消",
  224. type: "warning"
  225. }).then(() => {
  226. return deleteDetails(row.id);
  227. }).then(() => {
  228. this.$message({
  229. type: "success",
  230. message: "操作成功!"
  231. });
  232. this.page.currentPage = 1;
  233. this.onLoad(this.page, {parentId: 0});
  234. });
  235. },
  236. //修改时的修改按钮点击触发
  237. rowUpdate(row, index, done, loading) {
  238. typeSave(row).then(() => {
  239. this.$message({
  240. type: "success",
  241. message: "操作成功!"
  242. });
  243. // 数据回调进行刷新
  244. done(row);
  245. }, error => {
  246. window.console.log(error);
  247. loading();
  248. });
  249. },
  250. //新增修改时保存触发
  251. rowSave(row, done, loading) {
  252. typeSave(row).then(res => {
  253. console.log(res)
  254. done()
  255. })
  256. },
  257. //查询全部
  258. initData() {
  259. customerList().then(res => {
  260. const column = this.findObject(this.option.column, "parentId");
  261. column.dicData = res.data.data.records;
  262. });
  263. },
  264. //新增子项触发
  265. handleAdd(row) {
  266. this.parentId = row.id;
  267. const column = this.findObject(this.option.column, "parentId");
  268. column.value = row.id;
  269. column.addDisabled = true;
  270. this.$refs.crud.rowAdd();
  271. },
  272. //查看跳转页面
  273. beforeOpenPage(row, index) {
  274. const data = {
  275. moduleName: 'fh',
  276. tableName: 'business_delivery',
  277. billId: row.id,
  278. no: localStorage.getItem('browserID')
  279. }
  280. this.checkLock(data).then(res => {
  281. if (res.data.code == 200) {
  282. this.onLock(data).then(response => {
  283. })
  284. this.detailData = {
  285. seeDisabled: true,
  286. id: row.id,
  287. };
  288. this.isShow = false;
  289. this.$store.commit("IN_IN_DETAIL");
  290. }
  291. }).catch(err => {
  292. this.detailData = {
  293. id: row.id,
  294. seeDisabled: true,
  295. opDisabled: true
  296. };
  297. this.isShow = false;
  298. this.$store.commit("IN_IN_DETAIL");
  299. })
  300. },
  301. //新增跳转页面
  302. beforeOpen(row, index) {
  303. this.detailData = {
  304. id: row.id,
  305. };
  306. this.isShow = false;
  307. this.$store.commit("IN_IN_DETAIL");
  308. },
  309. editOpen(row, index) {
  310. this.detailData = {
  311. id: row.id,
  312. };
  313. this.isShow = false;
  314. this.$store.commit("IN_IN_DETAIL");
  315. },
  316. // 复制新单
  317. copyOrder() {
  318. const id = this.selection[0].id;
  319. this.detailData = {
  320. copyId: id,
  321. };
  322. this.isShow = false;
  323. this.$store.commit("IN_IN_DETAIL");
  324. },
  325. //点击新增时触发
  326. beforeClose(done) {
  327. this.parentId = "";
  328. const column = this.findObject(this.option.column, "parentId");
  329. column.value = "";
  330. column.addDisabled = false;
  331. done();
  332. },
  333. //点击搜索按钮触发
  334. searchChange(params, done) {
  335. if (params.businessDate) {
  336. params.businessStartDate = params.businessDate[0]+ " " + "00:00:00"
  337. params.businessEndDate = params.businessDate[1]+ " " + "23:59:59"
  338. }
  339. if (params.createTime) {
  340. params.createTimeStart = params.createTime[0]+ " " + "00:00:00"
  341. params.createTimeEnd = params.createTime[1]+ " " + "23:59:59"
  342. this.$delete(params,'createTime')
  343. }
  344. this.page.currentPage = 1;
  345. this.onLoad(this.page, params);
  346. done()
  347. },
  348. searchReset() {
  349. // this.configuration.dicData = []
  350. },
  351. selectionChange(list) {
  352. this.selection = list;
  353. this.single = list.length !== 1;
  354. },
  355. currentChange(currentPage) {
  356. this.page.currentPage = currentPage;
  357. },
  358. sizeChange(pageSize) {
  359. this.page.pageSize = pageSize;
  360. },
  361. refreshChange() {
  362. this.page.currentPage = 1;
  363. this.onLoad(this.page,this.search);
  364. },
  365. onLoad(page, params) {
  366. if (this.search.businessDate.length > 0) {
  367. params = {
  368. ...params,
  369. businessStartDate: this.search.businessDate[0]+ " " + "00:00:00",
  370. businessEndDate: this.search.businessDate[1]+ " " + "23:59:59",
  371. }
  372. this.$delete(params,'businessDate')
  373. }
  374. let data = this.gobackSearch(params)
  375. let queryParams = Object.assign({}, data, {
  376. size: page.pageSize,
  377. current: page.currentPage,
  378. billType:"FH"
  379. })
  380. this.loading = true;
  381. customerList(queryParams).then(res => {
  382. this.dataList = res.data.data.records
  383. this.page.total = res.data.data.total
  384. this.option.height = window.innerHeight - 240;
  385. }).finally(() => {
  386. this.loading = false;
  387. })
  388. },
  389. //树桩列点击展开触发
  390. treeLoad(tree, treeNode, resolve) {
  391. const parentId = tree.id;
  392. customerList({parentId: parentId}).then(res => {
  393. resolve(res.data.data.records);
  394. });
  395. },
  396. goBack() {
  397. this.detailData=this.$options.data().detailData
  398. if (this.$route.query.form) {
  399. this.$router.$avueRouter.closeTag();
  400. this.$router.push({
  401. path: "/businessManagement/deliveryNotice/index"
  402. });
  403. }
  404. this.isShow = true;
  405. this.$store.commit("IN_OUT_DETAIL");
  406. this.onLoad(this.page, this.search)
  407. },
  408. gobackSearch(params) {
  409. params = Object.assign({}, this.search)
  410. if (params.businessDate && params.businessDate != '') {
  411. params.businessStartDate = params.businessDate[0]+ " " + "00:00:00"
  412. params.businessEndDate = params.businessDate[1]+ " " + "23:59:59"
  413. this.$delete(params,'businessDate')
  414. }
  415. if (params.createTime && params.createTime != '') {
  416. params.createTimeStart = params.createTime[0]+ " " + "00:00:00"
  417. params.createTimeEnd = params.createTime[1]+ " " + "23:59:59"
  418. this.$delete(params,'createTime')
  419. }
  420. return params
  421. },
  422. //列保存触发
  423. async saveColumn() {
  424. /**
  425. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  426. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  427. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  428. */
  429. const inSave = await this.saveColumnData(
  430. this.getColumnName(20),
  431. this.option
  432. );
  433. if (inSave) {
  434. this.$message.success("保存成功");
  435. //关闭窗口
  436. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  437. }
  438. },
  439. async resetColumn() {
  440. this.option = option;
  441. const inSave = await this.delColumnData(
  442. this.getColumnName(20),
  443. option
  444. );
  445. if (inSave) {
  446. this.$message.success("重置成功");
  447. //关闭窗口
  448. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  449. }
  450. },
  451. statement() {
  452. this.statementData = {...this.search}
  453. if (this.statementData.createTime && this.statementData.createTime != '') {
  454. this.statementData.createTimeStart = this.statementData.createTime[0]+ " " + "00:00:00"
  455. this.statementData.createTimeEnd = this.statementData.createTime[1]+ " " + "23:59:59"
  456. } else {
  457. this.statementData.createTimeStart = ""
  458. this.statementData.createTimeEnd = ""
  459. }
  460. if (this.statementData.businessDate && this.statementData.businessDate != '') {
  461. this.statementData.businessStartDate = this.statementData.businessDate[0]+ " " + "00:00:00"
  462. this.statementData.businessEndDate = this.statementData.businessDate[1]+ " " + "23:59:59"
  463. } else {
  464. this.statementData.businessStartDate = ""
  465. this.statementData.businessEndDate = ""
  466. }
  467. this.$delete(this.statementData,'createTime')
  468. this.$delete(this.statementData,'businessDate')
  469. this.switchDialog = !this.switchDialog;
  470. },
  471. onClose(val) {
  472. this.switchDialog = val;
  473. },
  474. }
  475. }
  476. </script>
  477. <style scoped>
  478. </style>