list.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <basic-container>
  3. <avue-crud
  4. ref="crud"
  5. :data="data"
  6. :option="optionTable"
  7. :page.sync="page"
  8. :search.sync="search"
  9. :table-loading="loading"
  10. @row-del="rowDel"
  11. @row-update="rowUpdate"
  12. @row-save="rowSave"
  13. @search-change="searchChange"
  14. @refresh-change="refreshChange"
  15. @on-load="getList"
  16. @saveColumn="saveColumn"
  17. >
  18. <template slot="corpIdSearch">
  19. <select-component
  20. v-model="search.corpId"
  21. :configuration="configuration"
  22. ></select-component>
  23. </template>
  24. <template slot="menuLeft">
  25. <el-button type="primary"
  26. size="small"
  27. icon="el-icon-plus"
  28. @click="addMainItems">新 单
  29. </el-button>
  30. <el-button size="small"
  31. type="info"
  32. @click.stop="openReport()"
  33. >导出报表
  34. </el-button>
  35. </template>
  36. <template slot-scope="scope" slot="menu">
  37. <el-button
  38. type="text"
  39. icon="el-icon-edit"
  40. size="small"
  41. @click.stop="editOpen(scope.row, scope.index)"
  42. >编辑
  43. </el-button>
  44. <el-button
  45. type="text"
  46. icon="el-icon-delete"
  47. size="small"
  48. :disabled="!scope.row.allowDelete"
  49. @click.stop="rowDel(scope.row, scope.index)"
  50. >删除
  51. </el-button>
  52. </template>
  53. <report-dialog
  54. :switchDialog="switchDialog"
  55. @onClose="onClose()"
  56. ></report-dialog>
  57. </avue-crud>
  58. </basic-container>
  59. </template>
  60. <script>
  61. import option from "./configuration/mainList.json";
  62. import { getList,deleteMain } from "@/api/workManagement/mainProject";
  63. import reportDialog from "@/components/report-dialog/main";
  64. export default {
  65. data() {
  66. return {
  67. switchDialog:false,
  68. loading: false,
  69. data: [],
  70. search:{},
  71. configuration:{
  72. multipleChoices:false,
  73. multiple:false,
  74. disabled:false,
  75. searchShow:true,
  76. collapseTags:false,
  77. clearable:true,
  78. placeholder:'请点击右边按钮选择',
  79. dicData:[]
  80. },
  81. optionTable: option,
  82. page: {
  83. currentPage: 1,
  84. total: 0,
  85. pageSize: 10
  86. }
  87. };
  88. },
  89. created() {
  90. },
  91. mounted() {
  92. option.height = window.innerHeight - 380 ;
  93. },
  94. components: {
  95. reportDialog
  96. },
  97. methods: {
  98. //打印
  99. openReport() {
  100. this.switchDialog =! this.switchDialog;
  101. },
  102. //关闭打印
  103. onClose(val) {
  104. this.switchDialog = val;
  105. },
  106. //flag:0 判断是主营项目还是结算
  107. getList(page,params = {}) {
  108. params.flag = 0;
  109. this.loading = true;
  110. if(params){
  111. if (params.createTime != undefined) { //发货
  112. params.createStartDate = params.createTime[0]+ " " + "00:00:00";
  113. params.createEndDate = params.createTime[1] + " " + "23:59:59";
  114. this.$delete(params,'createTime')
  115. }
  116. }
  117. getList(page.currentPage, page.pageSize,params).then(res =>{
  118. this.data = res.data.data.records
  119. this.page.total = res.data.data.total
  120. this.loading = false
  121. })
  122. },
  123. //新单打开
  124. addMainItems(){
  125. this.$router.push({
  126. path: "/mainItems_detailsPage",
  127. query: {id: ''},
  128. });
  129. },
  130. //编辑打开
  131. editOpen(row, index){
  132. console.log(row)
  133. this.$router.push({
  134. path: "/mainItems_detailsPage",
  135. query: {id:row.id},
  136. });
  137. },
  138. searchChange(params, done) {
  139. this.getList(this.page, params);
  140. done();
  141. },
  142. refreshChange(params,done) {
  143. this.getList(this.page,params);
  144. done();
  145. },
  146. //删除列表后面的删除按钮触发触发(row, index, done)
  147. rowDel(row, index, done) {
  148. if(row.allowDelete){
  149. this.$confirm("确定将选择数据删除?", {
  150. confirmButtonText: "确定",
  151. cancelButtonText: "取消",
  152. type: "warning"
  153. }).then(() => {
  154. deleteMain(row.id).then(res =>{
  155. this.$message({
  156. type: "success",
  157. message: "操作成功!"
  158. });
  159. })
  160. // 数据回调进行刷新
  161. this.getList(this.page);
  162. });
  163. }else{
  164. this.$message({
  165. type: "warning",
  166. message: "当前项目存在已请核任务 不能删除!"
  167. });
  168. }
  169. },
  170. //修改时的修改按钮点击触发
  171. rowUpdate(row, index, done, loading) {
  172. setTimeout(() => {
  173. this.$message.success("修改成功");
  174. loading();
  175. done();
  176. }, 1000);
  177. },
  178. //新增修改时保存触发
  179. rowSave(row, done, loading) {
  180. setTimeout(() => {
  181. this.$message.success("保存成功");
  182. loading();
  183. done();
  184. }, 1000);
  185. },
  186. saveColumn(row, column) {
  187. console.log(row, column);
  188. },
  189. //打开详情页
  190. beforeOpenPage(row, index) {
  191. this.$router.push({
  192. path: "/mainItems_detailsPage",
  193. query: { id: JSON.stringify(row.prop1) }
  194. });
  195. }
  196. }
  197. };
  198. </script>
  199. <style></style>