independent.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. <template>
  2. <div style="height: 100%" class="flexStar">
  3. <div class="boxswai" style="width: 26%; padding-left: 0px">
  4. <div class="boxnei" style="display: flex; flex-direction: column">
  5. <h3>引用元素表</h3>
  6. <div style="overflow: auto; flex: 1">
  7. <avue-tree
  8. :option="treeOption"
  9. :data="treeData"
  10. @node-click="nodeClick"
  11. ></avue-tree>
  12. </div>
  13. </div>
  14. </div>
  15. <div
  16. class="boxswai"
  17. style="width: 74%; padding-left: 0px; padding-right: 0px"
  18. >
  19. <div class="boxnei">
  20. <div
  21. class="marleft10"
  22. style="height: 100%; display: flex; flex-direction: column"
  23. >
  24. <div class="martop20" v-if="true" style="flex: 1">
  25. <avue-crud
  26. :data="loadData"
  27. :option="loadOption"
  28. v-model="obj"
  29. ref="crud"
  30. @selection-change="selectionChange"
  31. >qingb
  32. <template slot="menuRight">
  33. <el-button
  34. type="primary"
  35. size="small"
  36. plain
  37. @click="quteEle"
  38. >引用元素表单库
  39. </el-button>
  40. <el-button
  41. size="small"
  42. type="danger"
  43. plain
  44. @click="handleDelete"
  45. >删除表单
  46. </el-button>
  47. </template>
  48. <template slot-scope="{type,size,row}" slot="menu">
  49. <el-button :size="size" :type="type" @click="Associationlist(row)">关联清表</el-button>
  50. <el-button :size="size" :type="type" @click="rightClick(
  51. row.pkeyId,
  52. row.excelId,
  53. row.id,
  54. row.initTableName
  55. )">编辑元素</el-button>
  56. <el-button :size="size" :type="type" @click="adjustExcel(row.pkeyId,row.excelId)">调整表单</el-button>
  57. <el-button :size="size" :type="type" @click="handleEditFormula(row)">编辑公式</el-button>
  58. </template>
  59. </avue-crud>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. <Qute ref="Qute"> </Qute>
  65. <Relation ref="Relation" :GLExcelFrom="GLExcelFrom"/>
  66. <!-- 编辑元素 -->
  67. <!-- 编辑元素 -->
  68. <el-dialog
  69. title=" "
  70. :visible.sync="editElementVisible"
  71. fullscreen
  72. append-to-body
  73. class="full-dialog"
  74. >
  75. <EditElement
  76. :pkeyId="editElementQuery.pkeyId"
  77. :excelId="editElementQuery.excelId"
  78. :id="editElementQuery.id"
  79. :initTableName="editElementQuery.initTableName"
  80. :pid="editElementQuery.pid"
  81. :wbsid="editElementQuery.wbsid"
  82. :nodeid="editElementQuery.nodeid"
  83. @hideDialog="editElementVisible = false"
  84. v-if="editElementVisible"
  85. ></EditElement>
  86. </el-dialog>
  87. <!-- 调整表单模板 -->
  88. <div v-if="excelHtml" class="excelHtml">
  89. <dynamicExcel
  90. @remove="removeExcel"
  91. v-if="excelHtml"
  92. :pkeyId="GLExcelFrom.id"
  93. />
  94. </div>
  95. <!-- 元素公式 -->
  96. <el-dialog
  97. title="元素公式"
  98. :visible.sync="editEleFormulaVisible"
  99. width="800px"
  100. append-to-body
  101. :close-on-click-modal="false"
  102. >
  103. <div class="flex mg-b-10">
  104. <el-input
  105. v-model="formulaInput"
  106. placeholder="请输入名称"
  107. size="samll"
  108. clearable
  109. @clear="searchFormulaName"
  110. ></el-input>
  111. <el-button type="info" class="mg-l-10" @click="searchFormulaName"
  112. >搜索</el-button
  113. >
  114. </div>
  115. <el-table
  116. :data="editEleListFilter"
  117. border
  118. style="width: 100%"
  119. height="400px"
  120. >
  121. <el-table-column align="center" prop="eName" label="字段信息">
  122. </el-table-column>
  123. <el-table-column align="center" label="操作" width="200">
  124. <template slot-scope="scope">
  125. <el-link
  126. :type="scope.row.isSaveFormula == 1 ? 'warning' : 'primary'"
  127. @click="toFormulaEdit(scope.row)"
  128. >公式配置</el-link
  129. >
  130. <!-- <el-link
  131. class="mg-l-10"
  132. type="danger"
  133. @click="delEleRowHandle(scope.$index,editEleListFilter)"
  134. >删除</el-link> -->
  135. </template>
  136. </el-table-column>
  137. </el-table>
  138. </el-dialog>
  139. <!-- 公式 -->
  140. <el-dialog
  141. title="元素公式"
  142. :visible.sync="formulaCompVisible"
  143. fullscreen
  144. append-to-body
  145. class="full-dialog"
  146. >
  147. <FormulaEdit
  148. :wbsid="id"
  149. :nodeid="curTreeData.id"
  150. :eleid="formulaCurRow.id"
  151. :projectid="projectid"
  152. @hideDialog="formulaCompVisible = false"
  153. v-if="formulaCompVisible"
  154. ></FormulaEdit>
  155. </el-dialog>
  156. </div>
  157. </template>
  158. <script>
  159. import {
  160. detailExcel,
  161. excelType,
  162. tabLazytree,
  163. wbstree,
  164. getWbsTypeList,
  165. } from "@/api/exctab/excelmodel";
  166. import {
  167. updateBatchNodeTableInfo,
  168. selectByNodeTable,
  169. selectFormElements,
  170. } from "@/api/manager/wbstree";
  171. import {
  172. getList,
  173. tabLazytreeAll,
  174. saveLinkTab,
  175. getExcelHtml,
  176. } from "@/api/exctab/excelmodel"
  177. import {
  178. getDetail,} from "@/api/manager/wbsprivate";
  179. import Qute from "./qutediaolog/qute.vue";//引入元素库
  180. import Relation from './qutediaolog/relation.vue'//关联清表
  181. import EditElement from "@/views/manager/projectinfo/editElement/editElement.vue";//编辑元素
  182. import dynamicExcel from "./treeTemplate/dynamicExcel.vue";
  183. import FormulaEdit from "@/views/formula/edit.vue";
  184. export default {
  185. components: { dynamicExcel, EditElement, Qute,Relation,FormulaEdit },
  186. computed:{
  187. ids () {
  188. let ids = [];
  189. this.selectionList.forEach(ele => {
  190. ids.push(ele.id);
  191. });
  192. return ids.join(",");
  193. }
  194. },
  195. data() {
  196. return {
  197. dialogVisible: false,
  198. obj: {},
  199. treeData: [
  200. {
  201. value: 0,
  202. label: "一级部门",
  203. children: [
  204. {
  205. value: 1,
  206. label: "一级部门1",
  207. },
  208. ],
  209. },
  210. ],
  211. treeOption: {
  212. defaultExpandAll: true,
  213. filter: false,
  214. addBtn: false,
  215. formOption: {
  216. labelWidth: 100,
  217. column: [
  218. {
  219. label: "自定义项",
  220. prop: "test",
  221. },
  222. ],
  223. },
  224. props: {
  225. labelText: "标题",
  226. label: "label",
  227. value: "value",
  228. children: "children",
  229. },
  230. },
  231. loadData: [],
  232. loadData1: [
  233. {
  234. tableName: "张三",
  235. formatTableType: "男",
  236. },
  237. ],
  238. loadData2: [
  239. {
  240. tableName: "李四2",
  241. formatTableType: "女",
  242. },
  243. ],
  244. loadOption: {
  245. height: "auto",
  246. calcHeight: 30,
  247. tip: false,
  248. searchShow: false,
  249. searchMenuSpan: 6,
  250. border: true,
  251. index: true,
  252. viewBtn: false,
  253. selection: true,
  254. editBtn: false,
  255. delBtn: false,
  256. addBtn: false,
  257. menu: true,
  258. menuWidth:300,
  259. dialogClickModal: false,
  260. column: [
  261. {
  262. label: "表单名称",
  263. prop: "tableName",
  264. editDisplay: false,
  265. addDisplay: false,
  266. },
  267. {
  268. label: "元素表类型",
  269. prop: "formatTableType",
  270. // search: true,
  271. rules: [
  272. {
  273. required: true,
  274. message: "请输入名称",
  275. trigger: "blur",
  276. },
  277. ],
  278. },
  279. {
  280. label: "元素总量",
  281. prop: "elementTotal",
  282. editDisplay: false,
  283. addDisplay: false,
  284. rules: [
  285. {
  286. message: "请输入表数量",
  287. trigger: "blur",
  288. },
  289. ],
  290. },
  291. {
  292. label: "所书方",
  293. prop: "formatOwner",
  294. editDisplay: false,
  295. addDisplay: false,
  296. rules: [
  297. {
  298. message: "请输入表数量",
  299. trigger: "blur",
  300. },
  301. ],
  302. },
  303. {
  304. label: "填报率",
  305. prop: "fillRate",
  306. editDisplay: false,
  307. addDisplay: false,
  308. rules: [
  309. {
  310. message: "请输入表数量",
  311. trigger: "blur",
  312. },
  313. ],
  314. },
  315. ],
  316. },
  317. selectionList:[],
  318. GLExcelFrom: {
  319. id: "",
  320. name: "",
  321. search: "", //搜素框舒服的值
  322. ids: "",
  323. excelId: "",
  324. initTableName: "",
  325. },
  326. //编辑元素弹窗
  327. editElementVisible: false, //编辑元素弹框
  328. editElementQuery: {
  329. pkeyId: "",
  330. excelId: "",
  331. id: "",
  332. initTableName: "",
  333. pid: "",
  334. wbsid: "",
  335. nodeid: "",
  336. }, //
  337. excelHtml:false,//调整表单
  338. curEleTable: {},//编辑元素公式
  339. editEleFormulaVisible: false,//元素公式
  340. formulaInput: "",
  341. editEleListFilter: [],
  342. editEleListAll: [],
  343. formulaCurRow: {}, //当前元素
  344. formulaCompVisible:false,
  345. //#region公式
  346. id: "",
  347. curTreeData: {},
  348. projectid:''
  349. };
  350. },
  351. created() {
  352. this.loadData = this.loadData1;
  353. },
  354. methods: {
  355. nodeClick(data) {
  356. if (data.value == 0) {
  357. this.loadData = this.loadData1;
  358. } else if (data.value == 1) {
  359. this.loadData = this.loadData2;
  360. }
  361. this.$message.success(JSON.stringify(data));
  362. },
  363. handleClose(done) {
  364. this.$confirm("确认关闭?")
  365. .then((_) => {
  366. done();
  367. })
  368. .catch((_) => {});
  369. },
  370. //引用元素表单库
  371. quteEle(){
  372. this.$refs.Qute.show()
  373. },
  374. handleDelete () {
  375. if (this.selectionList.length === 0) {
  376. this.$message.warning("请选择至少一条数据");
  377. return;
  378. }
  379. this.$confirm("确定将选择数据删除?", {
  380. confirmButtonText: "确定",
  381. cancelButtonText: "取消",
  382. type: "warning"
  383. })
  384. .then(() => {
  385. // return remove(this.ids);
  386. console.log(this.ids,'this.ids删除');
  387. })
  388. .then(() => {
  389. this.onLoad(this.page);
  390. this.$message({
  391. type: "success",
  392. message: "操作成功!"
  393. });
  394. this.$refs.crud.toggleSelection();
  395. });
  396. },
  397. selectionChange (list) {
  398. this.selectionList = list;
  399. },
  400. selectionClear () {
  401. this.selectionList = [];
  402. this.$refs.crud.toggleSelection();
  403. },
  404. //关联清表
  405. Associationlist(row) {
  406. console.log('关联清表');
  407. this.$refs.Relation.show()
  408. this.GLExcelFrom.name = row.modeId;
  409. this.GLExcelFrom.id = row.pkeyId;
  410. this.GLExcelFrom.excelId =row.excelId;
  411. this.GLExcelFrom.ids = row.id;
  412. this.GLExcelFrom.initTableName =row.initTableName;
  413. this.GLExcelFrom.excelId=row.excelId
  414. },
  415. //#region 编辑元素
  416. async rightClick(pkeyId, excelId, id, initTableName) {
  417. // await this.getExcelHtml2(pkeyId);
  418. // console.log('编辑元素');
  419. // this.editElementQuery.pkeyId = pkeyId;
  420. // this.editElementQuery.excelId = excelId;
  421. // this.editElementQuery.id = id;
  422. // this.editElementQuery.initTableName = initTableName;
  423. // this.editElementQuery.pid = this.$route.query.pid;
  424. // this.editElementQuery.wbsid = this.$route.query.wbsid;
  425. // this.editElementQuery.nodeid = this.curTreeData.id;
  426. this.editElementVisible = true;
  427. },
  428. async getExcelHtml2(pkeyId) {
  429. const { data: res } = await getExcelHtml({ pkeyId });
  430. console.log(res);
  431. if (res.code === 200) {
  432. localStorage.setItem("editElement", res.data);
  433. }
  434. },
  435. //#region 调整表单
  436. adjustExcel(pkeyId, excelId) {
  437. this.excelHtml=true
  438. // console.log('调整表单');
  439. // //调整表单
  440. // this.GLExcelFrom.id = pkeyId;
  441. // this.getExcelHtml(pkeyId);
  442. },
  443. handleEditFormula(row) {
  444. console.log('公式');
  445. this.curEleTable = row;
  446. selectFormElements(this.curEleTable.id).then((res) => {
  447. this.editEleListFilter = res.data.data;
  448. this.editEleListAll = [].concat(this.editEleListFilter);
  449. });
  450. this.editEleFormulaVisible = true;
  451. },
  452. //搜索 筛选
  453. searchFormulaName() {
  454. this.editEleListFilter = this.editEleListAll.filter((ele) => {
  455. return ele.eName.indexOf(this.formulaInput) > -1;
  456. });
  457. },
  458. async getExcelHtml(pkeyId) {
  459. const { data: res } = await getExcelHtml({ pkeyId });
  460. console.log(res);
  461. if (res.code === 200) {
  462. localStorage.setItem("excelHtml", res.data);
  463. this.adjustmentExcel = res.data;
  464. this.excelHtml = true;
  465. }
  466. },
  467. removeExcel() {
  468. this.excelHtml = false;
  469. },
  470. //跳转到公式配置页面
  471. toFormulaEdit(row) {
  472. // this.$router.push({
  473. // path: '/formula/edit',
  474. // query: {
  475. // wbsid: this.id,
  476. // eleid: row.id,
  477. // nodeid:this.curTreeData.id,
  478. // projectid:this.projectid
  479. // }
  480. // });
  481. this.formulaCurRow = row;
  482. this.formulaCompVisible = true;
  483. },
  484. // getNodeDetail(data, node) {
  485. // let parentName = "";
  486. // if (node.parent.data) {
  487. // parentName = node.parent.data.title;
  488. // }
  489. // this.curTreeData = data;
  490. // this.curTreeNode = node;
  491. // this.curTreeData.parentName = parentName;
  492. // getDetail(data.id, this.id, this.projectid).then((res) => {
  493. // res.data.data.parentName = parentName;
  494. // this.tableData = [res.data.data];
  495. // this.nodeDetail = Object.assign({}, res.data.data);
  496. // });
  497. // this.updateNodeTable();
  498. // //获取节点展开路径
  499. // this.getExpandedKeys(node);
  500. // },
  501. },
  502. mounted() {
  503. // this.heightss = this.$refs.rulesss.clientHeight
  504. },
  505. };
  506. </script>
  507. <style scoped lang="scss">
  508. //调整表单样式
  509. .excelHtml {
  510. position: absolute;
  511. z-index: 999999;
  512. top: 50px;
  513. left: 0px;
  514. width: 100%;
  515. height: 100%;
  516. }
  517. .marleft10 {
  518. margin-left: 10px;
  519. }
  520. /deep/.el-tree-node__expand-icon {
  521. font-size: 16px;
  522. }
  523. .colorblue {
  524. color: rgb(0, 82, 217);
  525. }
  526. .treecontent /deep/.el-scrollbar {
  527. height: 100%;
  528. }
  529. .el-scrollbar {
  530. height: 100%;
  531. }
  532. .rightHeader {
  533. display: flex;
  534. justify-content: flex-start;
  535. align-items: top;
  536. font-size: 14px;
  537. background-color: #fff;
  538. .excelname {
  539. box-sizing: border-box;
  540. min-width: 200px;
  541. height: 28px;
  542. border: 1px solid rgb(220, 220, 220);
  543. padding: 0 10px;
  544. border-radius: 3px;
  545. display: flex;
  546. justify-content: space-between;
  547. align-items: center;
  548. }
  549. }
  550. .dialogModel {
  551. .dialogBox {
  552. .middle {
  553. display: flex;
  554. .left {
  555. border: 1px solid rgb(220, 220, 220);
  556. border-radius: 3px;
  557. height: 500px;
  558. width: 49%;
  559. .select {
  560. box-sizing: border-box;
  561. display: flex;
  562. justify-content: center;
  563. padding: 5px 0;
  564. border-bottom: 1px solid #e0e0e0;
  565. }
  566. .leftscroll {
  567. height: 450px;
  568. overflow-y: scroll;
  569. }
  570. }
  571. .right {
  572. height: auto;
  573. height: 60px;
  574. max-height: 500px;
  575. margin-left: 2%;
  576. // height: 500px;
  577. border-radius: 3px;
  578. td {
  579. box-sizing: border-box;
  580. padding: 5px 10px;
  581. height: 30px;
  582. line-height: 30px;
  583. }
  584. }
  585. }
  586. }
  587. .btbox {
  588. margin-top: 20px;
  589. display: flex;
  590. justify-content: center;
  591. }
  592. }
  593. .rightBox {
  594. flex: 1;
  595. }
  596. .boxswai {
  597. height: 100%;
  598. box-sizing: border-box;
  599. padding-bottom: 10px;
  600. }
  601. </style>