DocumentCenter.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <div>
  3. <el-row>
  4. <el-col :span="5">
  5. <el-scrollbar>
  6. <basic-container>
  7. <avue-tree :option="treeOption" :data="feesTypeData" @node-click="nodeClick">
  8. <template slot="addBtn">
  9. <el-tooltip class="item" effect="dark" content="新建分类" placement="top">
  10. <i class="el-icon-setting" style="font-size:18px;line-height: 30px;width: 20px;padding: 0 10px;"
  11. @click="corpTypeVisible = true"></i>
  12. </el-tooltip>
  13. </template>
  14. </avue-tree>
  15. </basic-container>
  16. </el-scrollbar>
  17. </el-col>
  18. <el-col :span="19">
  19. <basic-container>
  20. <avue-crud :option="documentOption" :table-loading="loading" :data="documentData" :page.sync="documentPage" :search.sync="documentSearch"
  21. id="out-table" :header-cell-class-name="headerClassName"
  22. :before-open="beforeOpen" v-model="form" ref="documentCrud" @search-change="searchChange"
  23. @search-reset="searchReset" @refresh-change="refreshChange" @on-load="reportslogListfun"
  24. @resetColumn="resetColumnTwo('documentCrud', 'documentOption', 'documentOptionBack', 312.1)"
  25. @saveColumn="saveColumnTwo('documentCrud', 'documentOption', 'documentOptionBack', 312.1)" >
  26. <template slot="menuLeft">
  27. <el-button type="primary" size="small" icon="el-icon-plus" @click="addbtnfun()">新增单证
  28. </el-button>
  29. </template>
  30. </avue-crud>
  31. </basic-container>
  32. </el-col>
  33. </el-row>
  34. <!--类别弹窗-->
  35. <el-dialog title="类别" :visible.sync="corpTypeVisible" append-to-body width="60%" :before-close="corpTypeClose">
  36. <div>
  37. <bbusinesstype></bbusinesstype>
  38. </div>
  39. <span slot="footer" class="dialog-footer">
  40. <el-button @click="corpTypeVisible = false">取 消</el-button>
  41. <el-button type="primary" @click="corpTypeVisible = false">确 定</el-button>
  42. </span>
  43. </el-dialog>
  44. <!--报表列表弹窗-->
  45. <el-dialog title="单证列表" :visible.sync="reportVisible" append-to-body width="70%" :before-close="corpTypeClose">
  46. <div>
  47. <reportforms-list ref="reportformsList" @reportRadio="reportRadio"></reportforms-list>
  48. </div>
  49. <span slot="footer" class="dialog-footer">
  50. <el-button @click="reportVisible = false">取 消</el-button>
  51. <el-button type="primary" @click="reportConfirm" >确 定</el-button>
  52. </span>
  53. </el-dialog>
  54. <!--添加编辑弹窗-->
  55. <el-dialog title="单证操作" :visible.sync="documentVisible" append-to-body width="60%" :before-close="corpTypeClose">
  56. <Dispatch-Notice v-if="reportForms.code == 'PCTZD'" :documentForm="documentForm"></Dispatch-Notice>
  57. <Purchase-Notice v-if="reportForms.code == 'RHTZ'" :documentForm="documentForm"></Purchase-Notice>
  58. <span v-else>啥也不是</span>
  59. <span slot="footer" class="dialog-footer">
  60. <el-button @click="documentVisible = false">取 消</el-button>
  61. <el-button type="primary" @click="documentSubmit">确 定</el-button>
  62. </span>
  63. </el-dialog>
  64. </div>
  65. </template>
  66. <script>
  67. import {reportslogList, reportslogSubmit} from "@/api/iosBasicData/bills";
  68. import {bbusinesstypeList} from "@/api/iosBasicData/bbusinesstype";
  69. import bbusinesstype from "@/views/iosBasicData/bbusinesstype/index.vue";
  70. import reportformsList from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsList.vue";
  71. import DispatchNotice from '@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsFrame/DispatchNotice.vue'
  72. import PurchaseNotice from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsFrame/PurchaseNotice.vue";
  73. export default {
  74. components: {reportformsList, bbusinesstype,DispatchNotice,PurchaseNotice},
  75. data(){
  76. return {
  77. reportVisible:false, // 报表列表数据
  78. documentVisible:false, // 单证添加编辑弹窗
  79. documentForm:{}, // 添加编辑弹窗的数据
  80. corpTypeVisible:false,
  81. // 左侧配置项
  82. treeOption: {
  83. nodeKey: "id",
  84. // lazy: true,
  85. addBtn: false,
  86. menu: false,
  87. size: "small",
  88. props: {
  89. labelText: "标题",
  90. label: "cnName",
  91. value: "value",
  92. children: "children"
  93. }
  94. },
  95. feesTypeData:[], // 左侧获取的数据
  96. documentOption:{},
  97. documentOptionBack: {
  98. dialogDrag: true,
  99. height: 'auto',
  100. calcHeight: 30,
  101. tip: false,
  102. searchShow: true,
  103. searchMenuSpan: 6,
  104. border: true,
  105. index: true,
  106. selection: true,
  107. dialogClickModal: false,
  108. menuWidth:260,
  109. addBtn:false,
  110. viewBtn: true,
  111. delBtn:false,
  112. editBtn:false,
  113. column: [
  114. {
  115. label: "报表编码",
  116. prop: "reportsCode",
  117. overHidden:true,
  118. },
  119. {
  120. label: "备注",
  121. prop: "remarks",
  122. overHidden:true,
  123. },
  124. ]
  125. },
  126. documentSearch:{},
  127. documentPage:{
  128. pageSize: 10,
  129. currentPage: 1,
  130. total: 0,
  131. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  132. },
  133. query: {},
  134. documentData:[],
  135. loading:false,
  136. businesstypeData:{}, // 左侧选择的数据
  137. reportForms:{}, // 报表列表选择的数据
  138. }
  139. },
  140. props:{
  141. assemblyForm:{
  142. type:Object,
  143. default:{}
  144. }
  145. },
  146. async created() {
  147. this.documentOption = await this.getColumnData(this.getColumnName(312.1), this.documentOptionBack);
  148. this.bbusinesstypeListfun()
  149. },
  150. methods:{
  151. // 新建单证按钮
  152. addbtnfun(){
  153. if(!this.businesstypeData.id){
  154. this.$message.warning("请先选择报表类型");
  155. return
  156. }
  157. // 打开报表选择框
  158. this.reportVisible = true
  159. let page = {
  160. pageSize: 10,
  161. currentPage: 1,
  162. total: 0
  163. }
  164. this.$nextTick(()=>{
  165. this.$refs.reportformsList.onLoad(page,{businessType:this.businesstypeData.code})
  166. })
  167. },
  168. // 报表弹窗的单选
  169. reportRadio(val){
  170. this.reportForms = val
  171. },
  172. // 报表弹窗的确认
  173. reportConfirm(){
  174. console.log(this.reportForms,180)
  175. if (!this.reportForms.id){
  176. this.$message.warning("请选择一条报表");
  177. return
  178. }
  179. this.documentVisible = true
  180. },
  181. // 单证弹窗的确认按钮
  182. documentSubmit(){
  183. // 打印时间
  184. // printTime
  185. let obj = {
  186. remarks:this.assemblyForm.remarks,
  187. businessType:this.assemblyForm.businessType,
  188. billId:this.assemblyForm.billId,
  189. billNo:this.assemblyForm.billNo,
  190. mblno:this.assemblyForm.mblno,
  191. hblno:this.assemblyForm.hblno,
  192. reportsCode:this.reportForms.code,
  193. groupCode:this.reportForms.groupCode,
  194. printContent:JSON.stringify(this.documentForm),
  195. }
  196. console.log(obj,204)
  197. return
  198. reportslogSubmit().then(res=>{
  199. console.log(res,151)
  200. })
  201. this.documentVisible = false
  202. },
  203. // 左侧筛选
  204. nodeClick(data) {
  205. this.businesstypeData = data
  206. },
  207. // 左侧数据获取
  208. bbusinesstypeListfun(){
  209. bbusinesstypeList(1,20).then(res=>{
  210. this.feesTypeData = res.data.data.records
  211. })
  212. },
  213. // 类别弹窗关闭
  214. corpTypeClose(done) {
  215. this.$confirm('确认关闭?')
  216. .then(_ => {
  217. done();
  218. })
  219. .catch(_ => { });
  220. },
  221. // 点击搜索触发
  222. searchChange(params, done){
  223. this.query = params;
  224. this.documentPage.currentPage = 1;
  225. this.reportslogListfun(this.documentPage, params);
  226. done();
  227. },
  228. // 清空搜索回调方法
  229. searchReset(){
  230. this.query = {};
  231. this.reportslogListfun(this.documentPage);
  232. },
  233. // 点击刷新按钮
  234. refreshChange(){
  235. this.reportslogListfun(this.documentPage, this.query);
  236. },
  237. // 打开前的回调
  238. beforeOpen(done, type) {
  239. // 编辑和查看
  240. if (["edit", "view"].includes(type)) {
  241. }
  242. },
  243. // 单证中心数据获取
  244. reportslogListfun(documentPage, params = {}){
  245. this.loading = true;
  246. reportslogList(documentPage.currentPage, documentPage.pageSize, Object.assign(params, this.query)).then(res=>{
  247. const data = res.data.data;
  248. this.documentPage.total = data.total;
  249. this.documentData = data.records;
  250. this.loading = false;
  251. })
  252. },
  253. //自定义列保存
  254. async saveColumnTwo(ref, option, optionBack, code) {
  255. /**
  256. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  257. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  258. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  259. */
  260. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  261. if (inSave) {
  262. this.$message.success("保存成功");
  263. //关闭窗口
  264. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  265. }
  266. },
  267. //自定义列重置
  268. async resetColumnTwo(ref, option, optionBack, code) {
  269. this[option] = this[optionBack];
  270. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  271. if (inSave) {
  272. this.$message.success("重置成功");
  273. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  274. }
  275. },
  276. // 更改表格颜色
  277. headerClassName(tab) {
  278. //颜色间隔
  279. let back = ""
  280. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  281. if (tab.columnIndex % 2 === 0) {
  282. back = "back-one"
  283. } else if (tab.columnIndex % 2 === 1) {
  284. back = "back-two"
  285. }
  286. }
  287. return back;
  288. },
  289. }
  290. }
  291. </script>
  292. <style scoped>
  293. ::v-deep#out-table .back-one {
  294. background: #ecf5ff !important;
  295. }
  296. ::v-deep#out-table .back-two {
  297. background: #ecf5ff !important;
  298. }
  299. </style>