archiveTime.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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 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} 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. tabTypeLazyTree({parentId:parentId,projectId:this.projectid,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. tabTypeLazyTree({
  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. tabTypeLazyTree({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. if(row.isBussTime!==2){
  229. this.$set(row, "isBussTime", 2);
  230. }
  231. let colId=row.id
  232. let colKey=row.tableElementKey
  233. let tableId=this.curData.initTableId
  234. const { data: res } = await saveTabusstime(colId,colKey,tableId)
  235. console.log(res);
  236. if (res.code == 200) {
  237. this.$message.success(res.msg)
  238. }
  239. },
  240. //取消设置
  241. async quitFiledate(row){
  242. let ids=row.tableElementKey
  243. const { data: res } = await removeTabusstime(ids)
  244. console.log(res);
  245. if (res.code == 200) {
  246. this.$message.success(res.msg)
  247. }
  248. if(row.isBussTime==2){
  249. this.$set(row, "isBussTime", 1);
  250. }
  251. }
  252. },
  253. mounted() {
  254. // this.heightss = this.$refs.rulesss.clientHeight
  255. },
  256. };
  257. </script>
  258. <style scoped lang="scss">
  259. //调整表单样式
  260. .excelHtml {
  261. position: absolute;
  262. z-index: 999999;
  263. top: 50px;
  264. left: 0px;
  265. width: 100%;
  266. height: 100%;
  267. }
  268. .marleft10 {
  269. margin-left: 10px;
  270. }
  271. /deep/.el-tree-node__expand-icon {
  272. font-size: 16px;
  273. }
  274. .colorblue {
  275. color: rgb(0, 82, 217);
  276. }
  277. .treecontent /deep/.el-scrollbar {
  278. height: 100%;
  279. }
  280. .el-scrollbar {
  281. height: 100%;
  282. }
  283. .rightHeader {
  284. display: flex;
  285. justify-content: flex-start;
  286. align-items: top;
  287. font-size: 14px;
  288. background-color: #fff;
  289. .excelname {
  290. box-sizing: border-box;
  291. min-width: 200px;
  292. height: 28px;
  293. border: 1px solid rgb(220, 220, 220);
  294. padding: 0 10px;
  295. border-radius: 3px;
  296. display: flex;
  297. justify-content: space-between;
  298. align-items: center;
  299. }
  300. }
  301. .dialogModel {
  302. .dialogBox {
  303. .middle {
  304. display: flex;
  305. .left {
  306. border: 1px solid rgb(220, 220, 220);
  307. border-radius: 3px;
  308. height: 500px;
  309. width: 49%;
  310. .select {
  311. box-sizing: border-box;
  312. display: flex;
  313. justify-content: center;
  314. padding: 5px 0;
  315. border-bottom: 1px solid #e0e0e0;
  316. }
  317. .leftscroll {
  318. height: 450px;
  319. overflow-y: scroll;
  320. }
  321. }
  322. .right {
  323. height: auto;
  324. height: 60px;
  325. max-height: 500px;
  326. margin-left: 2%;
  327. // height: 500px;
  328. border-radius: 3px;
  329. td {
  330. box-sizing: border-box;
  331. padding: 5px 10px;
  332. height: 30px;
  333. line-height: 30px;
  334. }
  335. }
  336. }
  337. }
  338. .btbox {
  339. margin-top: 20px;
  340. display: flex;
  341. justify-content: center;
  342. }
  343. }
  344. .rightBox {
  345. flex: 1;
  346. }
  347. .boxswai {
  348. height: 100%;
  349. box-sizing: border-box;
  350. padding-bottom: 10px;
  351. }
  352. /deep/.avue-crud__left {
  353. width: 65%;
  354. }
  355. /deep/.el-input-group__append {
  356. background-color: #ecf5ff;
  357. color: #409EFF;
  358. }
  359. /deep/.el-input-group__append:hover {
  360. background-color: #409EFF;
  361. color: white;
  362. }
  363. /deep/.el-input-group__prepend:hover {
  364. background-color: #409EFF;
  365. color: white;
  366. }
  367. /deep/.el-input-group__append:active {
  368. background-color: #9dc5ee;
  369. color: white;
  370. }
  371. /deep/.el-input-group__prepend:active {
  372. background-color: #9dc5ee;
  373. color: white;
  374. }
  375. </style>