archiveTime.vue 13 KB

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