archiveTime.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <template>
  2. <div style="height: 100%" class="flexStar">
  3. <div class="boxswai" style="width: 15%;">
  4. <div class="boxnei" style="display: flex; flex-direction: column">
  5. <el-menu :default-active="activeIndex" class="el-menu-vertical-demo" @select="selectMajorDataType">
  6. <el-menu-item :index="item.dictKey" v-for="(item, index) in majorDataTypeList">
  7. <i class="el-icon-s-opportunity"></i>
  8. <span>{{ item.dictValue }}</span>
  9. </el-menu-item>
  10. </el-menu>
  11. </div>
  12. </div>
  13. <div class="boxswai" style="width: 30%; padding-left: 0px">
  14. <div class="boxnei" style="display: flex; flex-direction: column">
  15. <h3>引用元素表</h3>
  16. <div style="overflow: auto; flex: 1;height:500px">
  17. <div class="flex">
  18. <el-input size="small" placeholder="请输入你想搜索的表单" clearable @clear="clearfiltertext"
  19. v-model="filterText">
  20. </el-input>
  21. <el-button size="small" class="mg-l-10" @click="treeFilter">搜索</el-button>
  22. </div>
  23. <el-tree style="display: inline-block;min-width: 100%;" class="filter-tree" :data="treeData"
  24. :default-expanded-keys="defaultExpanded" @node-click="getNodeDetail" :props="defaultProps"
  25. :expand-on-click-node="false" highlight-current node-key="id" ref="tree" lazy :load="treeLoadNode"
  26. v-show="!allTreeShow">
  27. </el-tree>
  28. <el-tree style="width: 100%" ref="treeall" v-loading="treeloading" :data="allTreeData"
  29. :props="defaultProps" @node-click="getNodeDetail" node-key="id" :expand-on-click-node="false"
  30. :filter-node-method="filterNode" v-show="allTreeShow">
  31. </el-tree>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="boxswai" style="width: 55%; padding-left: 0px; padding-right: 0px">
  36. <div class="boxnei">
  37. <div class="marleft10" style="height: 100%; display: flex; flex-direction: column">
  38. <div class="martop20" v-if="true" style="flex: 1">
  39. <div class="flex mg-b-10">
  40. <el-input
  41. v-model="formulaInput"
  42. placeholder="请输入名称"
  43. size="samll"
  44. clearable
  45. @clear="searchFormulaName">
  46. </el-input>
  47. <el-button type="info" class="mg-l-10" @click="searchFormulaName">搜索</el-button>
  48. </div>
  49. <el-table
  50. :data="editEleListFilter"
  51. border
  52. style="width: 100%"
  53. >
  54. <el-table-column align="center" prop="eName" label="字段信息">
  55. </el-table-column>
  56. <el-table-column align="center" label="操作" width="200">
  57. <template slot-scope="scope">
  58. <el-button
  59. v-if="!scope.row.isFile"
  60. type="primary"
  61. size="small"
  62. plain
  63. @click="setFiledate(scope.row)"
  64. >设置为文件日期
  65. </el-button>
  66. <el-button
  67. v-else
  68. type="danger"
  69. size="small"
  70. plain
  71. @click="quitFiledate(scope.row)"
  72. >取消
  73. </el-button>
  74. </template>
  75. </el-table-column>
  76. </el-table>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. import { dictionary } from "@/api/manager/archivetree";
  85. import {tabTypeLazyTree} from "@/api/manager/wbsprivate";
  86. import {getTableElments} from "@/api/manager/wbstree";
  87. export default {
  88. data() {
  89. return {
  90. majorDataTypeList: [], //内业资料类型
  91. activeIndex:'1',
  92. projectid: '',
  93. wbsid: '',
  94. treeData: [],
  95. allTreeData:[],
  96. filterText: '',
  97. defaultExpanded: '',
  98. allTreeShow: false,
  99. defaultProps: {
  100. children: "children",
  101. label: "title",
  102. isLeaf: function (data) {
  103. return !data.hasChildren;
  104. },
  105. },
  106. curData:{
  107. },
  108. majorDataType:{
  109. },
  110. formulaInput:'',//搜索元素字段
  111. editEleListFilter:[],
  112. editEleListAll:[]
  113. };
  114. },
  115. created() {
  116. this.projectid = this.$route.query.pid;
  117. this.wbsid = this.$route.query.wbsid;
  118. this.major_data_type()//内业资料类型
  119. },
  120. methods: {
  121. async major_data_type() {//内业资料类型
  122. const { data: res } = await dictionary({ code: 'major_data_type' })
  123. console.log(res);
  124. if (res.code == 200) {
  125. this.majorDataTypeList = res.data
  126. }
  127. },
  128. selectMajorDataType(item){
  129. console.log(item,'item');
  130. this.treeloading = true;
  131. this.allTreeShow = false;
  132. this.activeIndex=item
  133. let parentId=''
  134. if(this.curData.hasChildren){
  135. parentId=this.curData.id
  136. }else{
  137. // parentId=this.curData.parentId
  138. parentId=''
  139. }
  140. tabTypeLazyTree({parentId:parentId,projectId:this.projectid,pcurrent:1,size:1000,titleName:this.filterText,majorDataType:this.activeIndex}).then((res) => {
  141. this.treeloading = false;
  142. this.allTreeData = res.data.data.records;
  143. });
  144. },
  145. clearfiltertext() {
  146. this.allTreeShow = false;
  147. },
  148. getNodeDetail(data,node) {
  149. this.curData=data;
  150. console.log(data,'data');
  151. this.getTableElmentsData()
  152. },
  153. treeLoadNode(node, resolve) {
  154. let parentId = 12345678910;
  155. if (node.level != 0) {
  156. parentId = node.data.id;
  157. }
  158. // 开启 “加载中” 动画
  159. if (node.level == 0) this.loading = true
  160. tabTypeLazyTree({
  161. parentId, projectId: this.projectid, pcurrent: 1, size: 1000,majorDataType:this.activeIndex
  162. }).then(res => {
  163. // 请求接口,返回数据
  164. let data = res.data.data.records;
  165. this.loading = false
  166. resolve(data);
  167. })
  168. },
  169. filterNode(value, data) {
  170. if (!value) return true;
  171. return data.title.indexOf(value) !== -1;
  172. },
  173. //搜索树
  174. treeFilter() {
  175. console.log('搜索');
  176. if (this.filterText) {
  177. this.allTreeShow = true;
  178. this.allTreeData=[]
  179. if (!this.allTreeData.length) {
  180. this.treeloading = true;
  181. let parentId=''
  182. if(this.curData.hasChildren){
  183. parentId=this.curData.id
  184. }else{
  185. // parentId=this.curData.parentId
  186. parentId=''
  187. }
  188. console.log(parentId,'parentId');
  189. tabTypeLazyTree({parentId:parentId,projectId:this.projectid,pcurrent:1,size:1000,titleName:this.filterText,majorDataType:this.activeIndex}).then((res) => {
  190. this.treeloading = false;
  191. this.allTreeData = res.data.data.records;
  192. });
  193. this.$nextTick(() => {
  194. console.log("过滤");
  195. this.treeloading = false;
  196. this.$refs.treeall.filter(this.filterText);
  197. });
  198. } else {
  199. this.treeloading = false;
  200. this.$refs.treeall.filter(this.filterText);
  201. }
  202. } else {
  203. this.$message.warning('请先输入文字')
  204. this.allTreeShow = false;
  205. }
  206. },
  207. //搜索 筛选
  208. searchFormulaName() {
  209. this.editEleListFilter = this.editEleListAll.filter((ele) => {
  210. return ele.eName.indexOf(this.formulaInput) > -1;
  211. });
  212. },
  213. //获取元素列表
  214. getTableElmentsData(){
  215. getTableElments(this.curData.initTableId).then((res) => {
  216. this.editEleListFilter = res.data.data;
  217. this.editEleListAll = [].concat(this.editEleListFilter);
  218. });
  219. },
  220. //设置为文件日期
  221. setFiledate(row){
  222. if(!row.isFile){
  223. this.$set(row, "isFile", true);
  224. }
  225. },
  226. //取消设置
  227. quitFiledate(row){
  228. if(row.isFile){
  229. this.$set(row, "isFile", false);
  230. }
  231. }
  232. },
  233. mounted() {
  234. // this.heightss = this.$refs.rulesss.clientHeight
  235. },
  236. };
  237. </script>
  238. <style scoped lang="scss">
  239. //调整表单样式
  240. .excelHtml {
  241. position: absolute;
  242. z-index: 999999;
  243. top: 50px;
  244. left: 0px;
  245. width: 100%;
  246. height: 100%;
  247. }
  248. .marleft10 {
  249. margin-left: 10px;
  250. }
  251. /deep/.el-tree-node__expand-icon {
  252. font-size: 16px;
  253. }
  254. .colorblue {
  255. color: rgb(0, 82, 217);
  256. }
  257. .treecontent /deep/.el-scrollbar {
  258. height: 100%;
  259. }
  260. .el-scrollbar {
  261. height: 100%;
  262. }
  263. .rightHeader {
  264. display: flex;
  265. justify-content: flex-start;
  266. align-items: top;
  267. font-size: 14px;
  268. background-color: #fff;
  269. .excelname {
  270. box-sizing: border-box;
  271. min-width: 200px;
  272. height: 28px;
  273. border: 1px solid rgb(220, 220, 220);
  274. padding: 0 10px;
  275. border-radius: 3px;
  276. display: flex;
  277. justify-content: space-between;
  278. align-items: center;
  279. }
  280. }
  281. .dialogModel {
  282. .dialogBox {
  283. .middle {
  284. display: flex;
  285. .left {
  286. border: 1px solid rgb(220, 220, 220);
  287. border-radius: 3px;
  288. height: 500px;
  289. width: 49%;
  290. .select {
  291. box-sizing: border-box;
  292. display: flex;
  293. justify-content: center;
  294. padding: 5px 0;
  295. border-bottom: 1px solid #e0e0e0;
  296. }
  297. .leftscroll {
  298. height: 450px;
  299. overflow-y: scroll;
  300. }
  301. }
  302. .right {
  303. height: auto;
  304. height: 60px;
  305. max-height: 500px;
  306. margin-left: 2%;
  307. // height: 500px;
  308. border-radius: 3px;
  309. td {
  310. box-sizing: border-box;
  311. padding: 5px 10px;
  312. height: 30px;
  313. line-height: 30px;
  314. }
  315. }
  316. }
  317. }
  318. .btbox {
  319. margin-top: 20px;
  320. display: flex;
  321. justify-content: center;
  322. }
  323. }
  324. .rightBox {
  325. flex: 1;
  326. }
  327. .boxswai {
  328. height: 100%;
  329. box-sizing: border-box;
  330. padding-bottom: 10px;
  331. }
  332. /deep/.avue-crud__left {
  333. width: 65%;
  334. }
  335. /deep/.el-input-group__append {
  336. background-color: #ecf5ff;
  337. color: #409EFF;
  338. }
  339. /deep/.el-input-group__append:hover {
  340. background-color: #409EFF;
  341. color: white;
  342. }
  343. /deep/.el-input-group__prepend:hover {
  344. background-color: #409EFF;
  345. color: white;
  346. }
  347. /deep/.el-input-group__append:active {
  348. background-color: #9dc5ee;
  349. color: white;
  350. }
  351. /deep/.el-input-group__prepend:active {
  352. background-color: #9dc5ee;
  353. color: white;
  354. }
  355. </style>