qute.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <el-dialog
  3. title="引用元素表"
  4. :visible.sync="dialogVisible"
  5. width="70%"
  6. append-to-body
  7. destroy-on-close
  8. custom-class="flow-design-dialog"
  9. >
  10. <el-container>
  11. <el-aside width="200px">
  12. <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick" ></avue-tree>
  13. </el-aside>
  14. <el-main>
  15. <avue-crud
  16. :data="loadData"
  17. :option="loadOption"
  18. v-model="obj"
  19. :page.sync="page"
  20. @on-load="onLoad"
  21. @search-change="searchChange"
  22. @search-reset="resetChange"
  23. @selection-change="selectionChange"
  24. ref="crud"
  25. ></avue-crud>
  26. </el-main>
  27. </el-container>
  28. <span slot="footer" class="dialog-footer">
  29. <el-button @click="dialogVisible = false">取 消</el-button>
  30. <el-button type="primary" @click="submitQute">确 定</el-button>
  31. </span>
  32. </el-dialog>
  33. </template>
  34. <script>
  35. import {tabTypeLazyTreeAll,projecttabInfo} from "@/api/manager/wbsprivate";
  36. export default {
  37. data() {
  38. return {
  39. dialogVisible:false,
  40. obj: {},
  41. treeData:[],
  42. treeOption:{
  43. defaultExpandAll:true,
  44. filter:false,
  45. addBtn:false,
  46. props:{
  47. labelText:'标题',
  48. label:'title',
  49. value:'id',
  50. children:'children'
  51. }
  52. },
  53. selectionList:[],
  54. loadData:[],
  55. loadOption: {
  56. height: 'auto',
  57. calcHeight: 30,
  58. tip: false,
  59. searchShow:true,
  60. searchMenuSpan: 6,
  61. border: true,
  62. index: true,
  63. viewBtn: false,
  64. selection: true,
  65. editBtn:false,
  66. delBtn:false,
  67. addBtn:false,
  68. menu:false,
  69. dialogClickModal: false,
  70. column: [
  71. {
  72. label: "元素表名称",
  73. prop: "title",
  74. search: true,
  75. editDisplay: false,
  76. addDisplay: false,
  77. searchPlaceholder:'请输入元素表名称',
  78. searchSpan:18,
  79. searchLabelWidth:100,
  80. },
  81. {
  82. label: "元素表类型",
  83. prop: "tabType",
  84. // search: true,
  85. rules: [
  86. {
  87. required: true,
  88. message: "请输入名称",
  89. trigger: "blur",
  90. },
  91. ],
  92. },
  93. {
  94. label: "元素总量",
  95. prop: "elementTotal",
  96. editDisplay: false,
  97. addDisplay: false,
  98. rules: [
  99. {
  100. message: "请输入表数量",
  101. trigger: "blur",
  102. },
  103. ],
  104. },
  105. {
  106. label: "所书方",
  107. prop: "tabOwner",
  108. editDisplay: false,
  109. addDisplay: false,
  110. rules: [
  111. {
  112. message: "请输入表数量",
  113. trigger: "blur",
  114. },
  115. ],
  116. },
  117. {
  118. label: "填报率",
  119. prop: "fillRate",
  120. editDisplay: false,
  121. addDisplay: false,
  122. rules: [
  123. {
  124. message: "请输入表数量",
  125. trigger: "blur",
  126. },
  127. ],
  128. },
  129. ],
  130. },
  131. page:{
  132. current:1,
  133. size:10,
  134. total:10
  135. },
  136. treeId:''
  137. }
  138. },
  139. props:{
  140. projectid:String
  141. },
  142. computed:{
  143. ids () {
  144. let ids = [];
  145. this.selectionList.forEach(ele => {
  146. ids.push(ele.id);
  147. });
  148. return ids.join(",");
  149. }
  150. },
  151. created(){
  152. // this.loadData=this.loadData1;
  153. },
  154. methods: {
  155. onLoad(page){
  156. console.log(page,'page');
  157. if(this.treeId){
  158. this.tabTypeLazyTreeAll(this.treeId, page.currentPage,page.pageSize).then((res)=>{
  159. this.loadData=res.records
  160. this.page.total=res.total
  161. })
  162. }
  163. },
  164. selectionChange (list) {
  165. this.selectionList = list;
  166. },
  167. selectionClear () {
  168. this.selectionList = [];
  169. this.$refs.crud.toggleSelection();
  170. },
  171. //搜索
  172. searchChange(params,done){
  173. if(this.treeId){
  174. this.tabTypeLazyTreeAll(this.treeId, this.page.current,this.page.size,params.title).then((res)=>{
  175. this.loadData=res.records
  176. this.page.total=res.total
  177. done()
  178. })
  179. }
  180. },
  181. resetChange(item){
  182. console.log(item);
  183. this.tabTypeLazyTreeAll(this.treeId, this.page.current,this.page.size).then((res)=>{
  184. this.loadData=res.records
  185. this.page.total=res.total
  186. })
  187. },
  188. async tabTypeLazyTreeAll ( parentId,current,size,titleName) {//清表树
  189. console.log(parentId);
  190. const { data: res } = await tabTypeLazyTreeAll({parentId,current,size,titleName} )
  191. console.log(res,'tabTypeLazyTreeAll');
  192. if (res.code === 200) {
  193. return res.data
  194. }
  195. },
  196. nodeClick(data){
  197. console.log(data,'treedata');
  198. this.treeId=data.id
  199. this.tabTypeLazyTreeAll(data.id, this.page.current,this.page.size).then((res)=>{
  200. this.loadData=res.records
  201. this.page.total=res.total
  202. })
  203. },
  204. handleClose(done) {
  205. this.$confirm('确认关闭?')
  206. .then(_ => {
  207. done();
  208. })
  209. .catch(_ => {});
  210. },
  211. show(){
  212. this.dialogVisible=true;
  213. let id=12345678910
  214. this.tabTypeLazyTreeAll(id).then((res)=>{
  215. this.treeData=res.records;
  216. })
  217. },
  218. submitQute(){
  219. console.log('确定');
  220. console.log(this.ids,'ids');
  221. projecttabInfo({primaryKeyIds:this.ids,projectId:this.projectid}).then((res)=>{
  222. console.log(res,'res');
  223. if(res.data.code===200){
  224. this.$message({
  225. type: "success",
  226. message: "操作成功!"
  227. });
  228. this.$refs.crud.toggleSelection();
  229. }
  230. })
  231. }
  232. },
  233. }
  234. </script>
  235. <style>
  236. </style>