element.vue 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476
  1. <template>
  2. <div
  3. style="height:100%;"
  4. class="flexStar"
  5. >
  6. <div
  7. class="boxswai"
  8. style="width:26%;padding-left:0px;"
  9. >
  10. <div class="boxnei" style="display: flex;flex-direction: column;">
  11. <div style="overflow: auto;flex:1">
  12. <avue-tree
  13. :option="treeOption"
  14. :data="treeData"
  15. @node-click="nodeClick"
  16. ref="avueTree"
  17. style="display: inline-block;min-width: 100%;">
  18. <span
  19. class="custom-tree-node"
  20. slot-scope="{ data ,node }"
  21. @mouseover.stop="mouseOver(data)"
  22. @mouseleave.stop="mouseLeave(data)"
  23. style="box-sizing: border-box;padding-right:70px!important;;"
  24. >
  25. <div style="width:100%;">
  26. <span style="text-overflow: ellipsis;"> {{ data.title }} </span>
  27. <!-- <span> {{ node}} </span> -->
  28. <!-- 添加 -->
  29. <span>
  30. <!-- 调整排序 -->
  31. <el-link :underline="false">
  32. <i
  33. class="el-icon-sort"
  34. @click.stop="sortpai(data, node)"
  35. v-if="node.level == 2"
  36. title="调整排序"
  37. ></i>
  38. </el-link>
  39. </span>
  40. </div>
  41. </span>
  42. </avue-tree>
  43. </div>
  44. </div>
  45. </div>
  46. <div
  47. class="boxswai"
  48. style="width:74%;padding-left:0px;padding-right:0px;"
  49. >
  50. <div class="boxnei">
  51. <div
  52. class="marleft10"
  53. style="height:100%;
  54. display: flex;flex-direction: column;"
  55. >
  56. <!-- 上传、删除、下载操作栏 -->
  57. <div
  58. class="rightHeader"
  59. v-show="from.checkd"
  60. >
  61. </div>
  62. <el-empty
  63. style="height:80%;"
  64. v-show="false"
  65. description="该目录为根目录没有EXCEL文件"
  66. ></el-empty>
  67. <div
  68. class="martop20"
  69. v-if="true"
  70. style="flex:1;"
  71. >
  72. <avue-crud
  73. ref="crud"
  74. :data="loadData"
  75. :option="loadOption"
  76. v-model="obj"
  77. :page.sync="page"
  78. @on-load="onLoad"
  79. @selection-change="selectionChange"
  80. :table-loading="tabloading"
  81. @current-change="currentChange"
  82. @size-change="sizeChange"
  83. @refresh-change="refreshChange"
  84. >
  85. <template slot="menuRight">
  86. <el-button
  87. type="danger"
  88. size="small"
  89. icon="el-icon-delete"
  90. plain
  91. @click="handleDelete">删除元素表
  92. </el-button>
  93. <el-button
  94. size="small"
  95. type="primary"
  96. plain
  97. @click="editele"
  98. >编辑表单
  99. </el-button>
  100. </template>
  101. <template slot="menuLeft" slot-scope="{size}">
  102. <el-input placeholder="请输入你想搜索的表单名称" v-model="input3" :size="size" @clear="clearinput" clearable>
  103. <i class="el-icon-search" slot="append" @click="searchChange" style=" cursor:pointer;font-size: 16px;"></i>
  104. </el-input>
  105. </template>
  106. <template slot-scope="{type,size,row}" slot="menu">
  107. <el-button :size="size" :type="type" @click="distribution(row)">分配节点</el-button>
  108. <el-button :size="size" :type="type" @click="handleEditFormula(row)">公式配置</el-button>
  109. <el-button :size="size" :type="type" @click="editElement(row)">编辑元素</el-button>
  110. </template>
  111. </avue-crud>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <!-- 编辑元素表单信息 -->
  117. <el-dialog
  118. title="编辑元素表单信息"
  119. :visible.sync="editElementFormTag"
  120. width="60%"
  121. :modal-append-to-body="false"
  122. >
  123. <div>
  124. <el-table
  125. :data="formDatass"
  126. border
  127. style="width: 100%"
  128. >
  129. <el-table-column
  130. prop="tableName"
  131. label="表名"
  132. >
  133. <template slot-scope="scope">
  134. <el-input
  135. v-model="scope.row.tableName"
  136. placeholder="请输入表名称"
  137. ></el-input>
  138. </template>
  139. </el-table-column>
  140. <el-table-column
  141. prop="tableType"
  142. label="表类型"
  143. >
  144. <template slot-scope="scope">
  145. <el-select
  146. v-model="scope.row.tableType"
  147. placeholder="请选择"
  148. >
  149. <el-option
  150. v-for="(item,key) in tableTypelist"
  151. :key="key"
  152. :label="item.dictValue"
  153. :value="item.dictKey"
  154. >
  155. </el-option>
  156. </el-select>
  157. </template>
  158. </el-table-column>
  159. <el-table-column
  160. prop="tableOwner"
  161. label="所属方"
  162. >
  163. <template slot-scope="scope">
  164. <el-select
  165. v-model="scope.row.tableOwner"
  166. placeholder="请选择"
  167. >
  168. <el-option
  169. v-for="(item,key) in ownerTypeList"
  170. :key="key"
  171. :label="item.dictValue"
  172. :value="item.dictKey"
  173. >
  174. </el-option>
  175. </el-select>
  176. </template>
  177. </el-table-column>
  178. <el-table-column
  179. prop="fillRate"
  180. label="填报率"
  181. >
  182. <template slot-scope="scope">
  183. <el-input
  184. v-model="scope.row.fillRate"
  185. placeholder="请输入填报率"
  186. ></el-input>
  187. </template>
  188. </el-table-column>
  189. </el-table>
  190. </div>
  191. <span
  192. slot="footer"
  193. class="dialog-footer"
  194. >
  195. <el-button @click="editElementFormTag = false">取 消</el-button>
  196. <el-button
  197. type="primary"
  198. @click="editeditElementFormMF()"
  199. >确 定</el-button>
  200. </span>
  201. </el-dialog>
  202. <!-- 公式配置 -->
  203. <el-dialog
  204. title="元素公式"
  205. :visible.sync="editEleFormulaVisible"
  206. width="800px"
  207. append-to-body
  208. :close-on-click-modal="false"
  209. >
  210. <div class="flex mg-b-10">
  211. <el-input
  212. v-model="formulaInput"
  213. placeholder="请输入名称"
  214. size="samll" clearable @clear="searchFormulaName"
  215. ></el-input>
  216. <el-button type="info" class="mg-l-10" @click="searchFormulaName">搜索</el-button>
  217. </div>
  218. <el-table
  219. :data="editEleListFilter"
  220. border
  221. style="width: 100%"
  222. height="400px"
  223. >
  224. <el-table-column align="center" prop="eName" label="字段信息">
  225. </el-table-column>
  226. <el-table-column align="center" label="操作" width="200">
  227. <template slot-scope="scope">
  228. <el-link
  229. :type="scope.row.globalFormula == 1 ? 'warning' : 'primary'"
  230. @click="toFormulaEdit(scope.row,1)"
  231. >全局公式</el-link
  232. >
  233. <!-- <el-link
  234. class="mg-l-10"
  235. :type="scope.row.isSaveFormula == 1 ? 'warning' : 'primary'"
  236. @click="toFormulaEdit(scope.row,10)"
  237. >节点公式</el-link
  238. > -->
  239. <!-- <el-link
  240. class="mg-l-10"
  241. type="danger"
  242. @click="delEleRowHandle(scope.$index,editEleListFilter)"
  243. >删除</el-link> -->
  244. </template>
  245. </el-table-column>
  246. </el-table>
  247. </el-dialog>
  248. <!-- 公式 -->
  249. <el-dialog
  250. title="元素公式"
  251. :visible.sync="formulaCompVisible"
  252. fullscreen
  253. append-to-body
  254. class="full-dialog"
  255. >
  256. <FormulaEdit
  257. :wbsid="id"
  258. :nodeid="curTreeData.id"
  259. :eleid="formulaCurRow.id"
  260. :projectid="projectid"
  261. @hideDialog="formulaCompVisible = false"
  262. v-if="formulaCompVisible"
  263. ></FormulaEdit>
  264. </el-dialog>
  265. <!-- 关联公共WBS模板 -->
  266. <PublicWbs ref="PublicWbs" :from="from"/>
  267. <!-- 编辑元素 -->
  268. <el-dialog
  269. :title="(curEleTable.title?curEleTable.title:'')+' 元素编辑'"
  270. :visible.sync="editEleVisible"
  271. width="80%"
  272. append-to-body
  273. :close-on-click-modal="false"
  274. >
  275. <p class="font-c-warning">编辑元素信息(请谨慎操作)</p>
  276. <el-table
  277. :data="editEleList"
  278. border
  279. style="width: 100%"
  280. height="400px"
  281. v-loading="editEleloading"
  282. >
  283. <el-table-column
  284. align="center"
  285. type="index"
  286. width="50"
  287. ></el-table-column>
  288. <el-table-column
  289. align="center"
  290. prop="eName"
  291. label="元素名称"
  292. >
  293. <template slot="header">
  294. <i class="required"></i>
  295. <span>元素名称</span>
  296. </template>
  297. <template slot-scope="scope">
  298. <el-input
  299. v-model="scope.row.eName"
  300. size="small"
  301. placeholder="请输入内容"
  302. ></el-input>
  303. </template>
  304. </el-table-column>
  305. <el-table-column
  306. align="center"
  307. prop="eType"
  308. label="数据类型"
  309. width="120"
  310. >
  311. <template slot="header">
  312. <i class="required"></i>
  313. <span>数据类型</span>
  314. </template>
  315. <template slot-scope="scope">
  316. <el-select
  317. v-model="scope.row.eType"
  318. @change="setDefaultLength(scope.row)"
  319. size="small"
  320. placeholder="请选择"
  321. >
  322. <el-option
  323. v-for="item in dataTypeList"
  324. :key="item.id"
  325. :label="item.dictValue"
  326. :value="item.dictKey"
  327. ></el-option>
  328. </el-select>
  329. </template>
  330. </el-table-column>
  331. <el-table-column
  332. align="center"
  333. prop="eLength"
  334. label="长度"
  335. width="120"
  336. >
  337. <template slot="header">
  338. <i class="required"></i>
  339. <span>长度</span>
  340. </template>
  341. <template slot-scope="scope">
  342. <el-input
  343. v-model="scope.row.eLength"
  344. size="small"
  345. placeholder="请输入内容"
  346. ></el-input>
  347. </template>
  348. </el-table-column>
  349. <el-table-column
  350. align="center"
  351. prop="eAllowDeviation"
  352. label="允许偏差值"
  353. >
  354. <template slot-scope="scope">
  355. <div class="flex">
  356. <el-select
  357. v-model="scope.row.allow"
  358. size="small"
  359. placeholder="请选择"
  360. style="width:120px"
  361. >
  362. <el-option
  363. :key="1"
  364. label="-"
  365. value="-"
  366. ></el-option>
  367. <el-option
  368. :key="2"
  369. label=">"
  370. value=">"
  371. ></el-option>
  372. <el-option
  373. :key="3"
  374. label="<"
  375. value="<"
  376. ></el-option>
  377. <el-option
  378. :key="4"
  379. label="≥"
  380. value="≥"
  381. ></el-option>
  382. <el-option
  383. :key="5"
  384. label="≤"
  385. value="≤"
  386. ></el-option>
  387. <el-option
  388. :key="6"
  389. label="±"
  390. value="±"
  391. ></el-option>
  392. <el-option
  393. :key="7"
  394. label="【】"
  395. value="【】"
  396. ></el-option>
  397. </el-select>
  398. <el-input
  399. v-model="scope.row.deviation"
  400. size="small"
  401. placeholder="请输入内容"
  402. ></el-input>
  403. </div>
  404. </template>
  405. </el-table-column>
  406. <el-table-column
  407. align="center"
  408. prop="eInspectionMethod"
  409. label="检查方法和频率"
  410. >
  411. <template slot-scope="scope">
  412. <el-input
  413. v-model="scope.row.eInspectionMethod"
  414. size="small"
  415. placeholder="请输入内容"
  416. ></el-input>
  417. </template>
  418. </el-table-column>
  419. <el-table-column
  420. align="center"
  421. label="操作"
  422. width="120"
  423. >
  424. <template slot="header">
  425. <el-button
  426. @click="addEleRow(editEleList)"
  427. type="text"
  428. icon="el-icon-circle-plus-outline"
  429. class="text-icon"
  430. ></el-button>
  431. </template>
  432. <template slot-scope="scope">
  433. <el-button
  434. v-if="scope.row.id"
  435. icon="el-icon-remove-outline"
  436. type="text"
  437. @click="delEleRowHandle(scope.$index,editEleList)"
  438. class="text-icon text-icon-danger"
  439. ></el-button>
  440. <div
  441. class="flex"
  442. v-else
  443. >
  444. <el-button
  445. @click="saveNewEle(scope.row)"
  446. type="mini"
  447. >保存</el-button>
  448. <el-button
  449. icon="el-icon-remove-outline"
  450. type="text"
  451. @click="delEleRowHandle(scope.$index,editEleList)"
  452. class="text-icon text-icon-danger"
  453. ></el-button>
  454. </div>
  455. </template>
  456. </el-table-column>
  457. </el-table>
  458. <span
  459. slot="footer"
  460. class="dialog-footer"
  461. >
  462. <el-button @click="editEleVisible = false">取 消</el-button>
  463. <el-button
  464. type="primary"
  465. @click="saveEles"
  466. >确 定</el-button>
  467. </span>
  468. </el-dialog>
  469. <!-- 私有wbs树排序弹框 -->
  470. <el-dialog
  471. title="调整排序"
  472. :visible.sync="sortTag"
  473. width="50%"
  474. append-to-body
  475. >
  476. <ManualSorting v-if="sortTag2" @bianhua="bianhua()" :sort="sort" />
  477. <span slot="footer" class="dialog-footer">
  478. <el-button @click="(sortTag = false), (sortTag2 = false)"
  479. >取 消</el-button
  480. >
  481. <el-button type="primary" @click="editSort()">确 定</el-button>
  482. </span>
  483. </el-dialog>
  484. </div>
  485. </template>
  486. <script>
  487. import { excelType} from '@/api/exctab/excelmodel';
  488. import {
  489. updateBatchNodeTableInfoElement,
  490. selectByNodeTable,
  491. selectFormElements,
  492. selectPrivateFormElements
  493. } from "@/api/manager/wbstree";
  494. import {tabTypeLazyTreeAll,delTabInfoAll} from "@/api/manager/wbsprivate";
  495. import {saveElement, remove as removeElement, updateBatchElements, getTemplate,importWbsElement} from "@/api/manager/wbsformelement";
  496. import FormulaEdit from "@/views/formula/edit.vue";
  497. import PublicWbs from './PublicWbs.vue'
  498. import { searchNodeTables, } from "@/api/exctab/excelmodel";
  499. import {wbsInfotabSort} from "@/api/manager/wbsinfo";
  500. import { getDictionary } from "@/api/system/dict";
  501. import ManualSorting from '@/components/WbsTree/ManualSorting'
  502. export default {
  503. components:{
  504. FormulaEdit,
  505. PublicWbs,
  506. ManualSorting
  507. },
  508. data () {
  509. return {
  510. input3:'',
  511. editElementFormTag:false,//编辑元素
  512. tabloading:false,
  513. formDatass: [],
  514. selectionList:[],
  515. tableTypelist:[],
  516. ownerTypeList:[],
  517. dataTypeList:[],
  518. //数据类型的默认长度
  519. dataTypeDefaultMap: {
  520. 1: 250,//字符串
  521. 2: 50,//整数
  522. 3: 50,//小数
  523. 4: 50,//日期
  524. 5: 50,//数值
  525. 6: 50,//签名
  526. 7: 100,//文件
  527. },
  528. page: {
  529. size: 10,
  530. current: 1,
  531. total: 2
  532. },
  533. loadOption: {
  534. height: 'auto',
  535. calcHeight: 30,
  536. tip: false,
  537. searchShow:false,
  538. searchMenuSpan: 6,
  539. border: true,
  540. index: true,
  541. viewBtn: false,
  542. selection: true,
  543. editBtn:false,
  544. delBtn:false,
  545. addBtn:false,
  546. menu:true,
  547. dialogClickModal: false,
  548. column: [
  549. {
  550. label: "元素表名称",
  551. prop: "title",
  552. editDisplay: false,
  553. addDisplay: false,
  554. },
  555. {
  556. label: "元素表类型",
  557. prop: "tabType",
  558. // search: true,
  559. rules: [
  560. {
  561. required: true,
  562. message: "请输入名称",
  563. trigger: "blur",
  564. },
  565. ],
  566. },
  567. {
  568. label: "元素总量",
  569. prop: "elementTotal",
  570. editDisplay: false,
  571. addDisplay: false,
  572. rules: [
  573. {
  574. message: "请输入表数量",
  575. trigger: "blur",
  576. },
  577. ],
  578. },
  579. {
  580. label: "所属方",
  581. prop: "tabOwner",
  582. editDisplay: false,
  583. addDisplay: false,
  584. rules: [
  585. {
  586. message: "请输入表数量",
  587. trigger: "blur",
  588. },
  589. ],
  590. },
  591. {
  592. label: "填报率",
  593. prop: "fillRate",
  594. editDisplay: false,
  595. addDisplay: false,
  596. rules: [
  597. {
  598. message: "请输入表数量",
  599. trigger: "blur",
  600. },
  601. ],
  602. },
  603. ],
  604. },
  605. formelemtfoelemtformrm: {},
  606. elementloading: false,
  607. elemtData:[
  608. {
  609. tableName:'张三',
  610. sex:'男',
  611. id:1
  612. }, {
  613. tableName:'李四',
  614. sex:'女',
  615. id:2
  616. }
  617. ],
  618. curEleTable:{},
  619. eleReg: /(-|>|<|≥|≤|±|【】)?([^≥≤±【】]*)/,
  620. editEleList:[],
  621. editEleListAll:[],
  622. editEleFormulaVisible:false,
  623. editEleListFilter:[],
  624. excelId:'',
  625. treeNode: {},
  626. //#region 鼠标
  627. leftTRee: '',//左侧树ID
  628. threessW: 400,
  629. //#endregion
  630. heightss: '',//
  631. data: [],//清表模板
  632. filterText:"",//搜索关键字
  633. treeloading:false,
  634. defaultProps: {
  635. children: "children",
  636. isLeaf: function (data) {
  637. return !data.hasChildren || (data.isExistForm == 1);
  638. },
  639. },
  640. wbsdata: [],//wbs模板
  641. //#region 右侧数据
  642. from:{
  643. checkd:false
  644. },
  645. rules: {
  646. nodeName: [
  647. { required: true, message: '请输入清表名称', trigger: 'blur' },
  648. ],
  649. tabType: [
  650. { required: true, message: '请选择清表类型', trigger: 'blur' },
  651. ],
  652. },
  653. wbsform: {
  654. id: '',
  655. wbsType: '',
  656. wbsName: '',
  657. },//wbs树选中的值
  658. tableData: [],//右侧表数据
  659. wbsmiddle: false,//选择wbs模板那块是否有
  660. tableList: [],//进行处理的wbs关联表
  661. exceltypeData: [],//清表类型枚举
  662. wbsmodel: [],//wbs模板名称枚举
  663. //#endregion
  664. saveExcelLoad:false,
  665. filterText1: "",
  666. addTableData:[],
  667. //编辑元素
  668. editEleVisible:false,
  669. editEleloading:false,
  670. formulaInput:"",//公式配置
  671. formulaCompVisible: false, //公式弹框
  672. formulaCurRow: {}, //当前元素
  673. id:'',
  674. curTreeData:{},
  675. loadData:[],
  676. treeOption:{
  677. defaultExpandedKeys:[],
  678. currentNode:{},
  679. filter:false,
  680. addBtn:false,
  681. props:{
  682. labelText:'标题',
  683. label:'title',
  684. value:'id',
  685. children:'children'
  686. },
  687. lazy: true,
  688. treeLoad: function (node, resolve) {
  689. const parentId = (node.level === 0) ? 12345678910 : node.data.id;
  690. tabTypeLazyTreeAll({parentId,current:1,size:1000}).then(res => {
  691. resolve(res.data.data.records.map(item => {
  692. return {
  693. ...item,
  694. leaf: !item.hasChildren
  695. }
  696. }))
  697. });
  698. },
  699. },
  700. treeData:'',
  701. projectid:"",
  702. curNode:{},
  703. defaultExpandKey:[],//默认展开的节点
  704. sortTag: false,
  705. sortTag2: false,
  706. sort:[]
  707. }
  708. },
  709. computed:{
  710. ids () {
  711. let ids = [];
  712. this.selectionList.forEach(ele => {
  713. ids.push(ele.id);
  714. });
  715. return ids.join(",");
  716. }
  717. },
  718. methods: {
  719. //#region 树形控件外层左侧事件
  720. mouseLeave (data) {
  721. if (data.moreShow) {
  722. this.$set(data, 'moreShow', false)
  723. }
  724. },
  725. mouseOver (data) {
  726. if (!data.moreShow) {
  727. this.$set(data, 'moreShow', true)
  728. }
  729. },
  730. async sortpai(data,node) {
  731. console.log(data,node);
  732. this.curNode=node;
  733. this.curTreeData=data;
  734. await this.findWbsTreePrivateSameLevel(node,data)
  735. this.sortTag = true;
  736. this.sortTag2 = true;
  737. },
  738. editSort() {
  739. this.wbsInfotabSort();
  740. },
  741. bianhua() {
  742. this.sortTag2 = false;
  743. this.$nextTick(() => {
  744. this.sortTag2 = true;
  745. });
  746. },
  747. async wbsInfotabSort() {
  748. //元素库、独立库节点排序
  749. var newArr=this.sort.map((v)=>{return v.id})
  750. newArr=newArr.join(',')
  751. const { data: res } = await wbsInfotabSort(newArr);
  752. console.log(res);
  753. if (res.code == 200) {
  754. this.sortTag = false;
  755. this.sortTag2 = false;
  756. this.refreshTreeData();
  757. }
  758. },
  759. async findWbsTreePrivateSameLevel(node,data) {
  760. const { data: res } =await tabTypeLazyTreeAll({parentId:node.data.parentId,current:1,size:1000});
  761. if (res.code == 200) {
  762. console.log(res.data,'res1111111');
  763. let tabArr=res.data.records
  764. tabArr.forEach((item)=>{
  765. item.tableName=item.title
  766. })
  767. console.log(tabArr,'tabArr');
  768. this.sort =tabArr
  769. }
  770. },
  771. addEleRow (list) {
  772. list.push({});
  773. },
  774. delEleRow (index, list) {
  775. list.splice(index, 1);
  776. },
  777. delEleRowHandle (index, list) {
  778. let row = list[index];
  779. if (row.id) {
  780. //有id需要请求删除
  781. this.$confirm('是否确认删除?', '删除元素', {
  782. distinguishCancelAndClose: true,
  783. confirmButtonText: '删除',
  784. cancelButtonText: '取消'
  785. }).then(() => {
  786. removeElement(row.id, this.curEleTable.initTableName, row.ekey).then(() => {
  787. list.splice(index, 1);
  788. })
  789. this.curEleTable.elementTotal --;
  790. })
  791. } else {
  792. list.splice(index, 1);
  793. }
  794. },
  795. formatTableType(cellValue) {
  796. for (let i = 0; i < this.tableTypelist.length; i++) {
  797. if (this.tableTypelist[i].dictValue == cellValue) {
  798. return this.tableTypelist[i].dictKey;
  799. }
  800. }
  801. return cellValue;
  802. //console.log(cellValue)
  803. },
  804. formatOwner( cellValue) {
  805. for (let i = 0; i < this.ownerTypeList.length; i++) {
  806. if (this.ownerTypeList[i].dictValue == cellValue) {
  807. return this.ownerTypeList[i].dictKey;
  808. }
  809. }
  810. return cellValue;
  811. //console.log(cellValue)
  812. },
  813. currentChange (currentPage) {
  814. this.page.current = currentPage;
  815. },
  816. sizeChange (pageSize) {
  817. this.page.size = pageSize;
  818. },
  819. selectionChange (list) {
  820. this.selectionList = list;
  821. },
  822. selectionClear () {
  823. this.selectionList = [];
  824. this.$refs.crud.toggleSelection();
  825. },
  826. async tabTypeLazyTreeAll ( parentId,current,size,titleName) {//清表树
  827. console.log(parentId);
  828. const { data: res } = await tabTypeLazyTreeAll({parentId,current,size,titleName} )
  829. if (res.code === 200) {
  830. return res.data
  831. }
  832. },
  833. nodeClick(data,node){
  834. console.log(data,node,'treedata');
  835. this.curNode=node
  836. this.curTreeData=data
  837. this.treeId=data.id
  838. this.page.current=1;
  839. this.page.currentPage=1
  840. if(data.hasChildren){
  841. this.onLoad(this.page)
  842. }
  843. if(data.hasChildren===false&&node.level==2){
  844. this.tabloading=true;
  845. let arr=[]
  846. arr.push(data)
  847. this.loadData=arr
  848. this.page.total=1
  849. setTimeout(() => {
  850. this.tabloading=false
  851. }, 1000);
  852. }else{
  853. this.loadData=[]
  854. this.page.total=0
  855. }
  856. },
  857. refreshChange () {
  858. this.searchChange();
  859. },
  860. onLoad(page, params = {}){
  861. if(this.treeId){
  862. this.tabloading=true;
  863. this.tabTypeLazyTreeAll(this.treeId, page.currentPage,page.pageSize).then((res)=>{
  864. this.loadData=res.records
  865. this.page.total=res.total
  866. this.tabloading=false
  867. })
  868. }
  869. },
  870. //编辑后刷新
  871. onLoad1(){
  872. if(this.curNode.level===1&&this.curNode.data.hasChildren){
  873. this.tabloading=true;
  874. this.tabTypeLazyTreeAll(this.treeId, this.page.current,this.page.size,this.input3).then((res)=>{
  875. this.loadData=res.records
  876. this.page.total=res.total
  877. this.tabloading=false
  878. })
  879. }else{
  880. this.tabTypeLazyTreeAll(this.curNode.data.parentId,this.page.current,1000,this.input3).then((res)=>{
  881. let faArr=res.records;
  882. this.loadData=faArr.filter((item)=>{
  883. if(item.id===this.treeId){
  884. return item
  885. }
  886. })
  887. })
  888. }
  889. },
  890. //搜索
  891. searchChange(){
  892. if(this.treeId){
  893. if(this.curTreeData.hasChildren){
  894. this.tabloading=true;
  895. this.tabTypeLazyTreeAll(this.curTreeData.id, this.page.current,this.page.size,this.input3).then((res)=>{
  896. this.loadData=res.records
  897. this.page.total=res.total
  898. this.tabloading=false;
  899. })
  900. }
  901. if(this.curTreeData.hasChildren===false&&this.curNode.level==2){
  902. this.tabloading=true;
  903. let arr=[]
  904. arr.push(this.curTreeData)
  905. this.loadData=arr
  906. this.page.total=1;
  907. setTimeout(() => {
  908. this.tabloading=false
  909. }, 1000);
  910. }else{
  911. this.tabloading=true;
  912. this.loadData=[]
  913. this.page.total=0
  914. setTimeout(() => {
  915. this.tabloading=false
  916. }, 1000);
  917. }
  918. }else{
  919. this.$message.warning("请选选择左侧节点");
  920. }
  921. },
  922. clearinput(){
  923. this.searchChange()
  924. },
  925. resetChange(item){
  926. console.log(item);
  927. this.tabTypeLazyTreeAll(this.treeId, this.page.current,this.page.size).then((res)=>{
  928. this.loadData=res.records
  929. this.page.total=res.total
  930. })
  931. },
  932. handleDelete () {
  933. if (this.selectionList.length === 0) {
  934. this.$message.warning("请选择至少一条数据");
  935. return;
  936. }
  937. this.$confirm("确定将选择数据删除?", {
  938. confirmButtonText: "确定",
  939. cancelButtonText: "取消",
  940. type: "warning"
  941. })
  942. .then(() => {
  943. return delTabInfoAll(this.ids);
  944. })
  945. .then(() => {
  946. this.onLoad(this.page);//刷新表格数据
  947. //刷新左边树形数据
  948. this.refreshTreeData()
  949. this.$message({
  950. type: "success",
  951. message: "操作成功!"
  952. });
  953. this.$refs.crud.toggleSelection();
  954. });
  955. },
  956. // //刷新左边树形数据
  957. // refreshTreeData(){
  958. // const parentId =12345678910
  959. // tabTypeLazyTreeAll({parentId,current:1,siez:1000}).then(res => {
  960. // this.treeData=res.data.data.records;
  961. // this.$nextTick(()=>{
  962. // //树默认展开
  963. // if(this.curNode.level===1){
  964. // this.treeOption.defaultExpandedKeys.push(this.curNode.data.id);
  965. // this.$refs.avueTree.setCurrentKey(this.curNode.data.id)
  966. // }else{
  967. // this.treeOption.defaultExpandedKeys.push(this.curNode.data.parentId);
  968. // // 设置选中的节点
  969. // this.treeOption.currentNode =this.curNode.data.id
  970. // this.$refs.avueTree.setCurrentKey(this.curNode.data.id)
  971. // }
  972. // })
  973. // });
  974. // },
  975. //刷新左边树形数据
  976. refreshTreeData(){
  977. if(this.curNode.level===1){
  978. const parentId =12345678910
  979. tabTypeLazyTreeAll({parentId,current:1,size:1000}).then(res => {
  980. this.data=res.data.data.records;
  981. this.$nextTick(()=>{
  982. this.defaultExpandKey.push(this.curNode.data.id);
  983. this.$refs.avueTree.setCurrentKey(this.curNode.data.id);
  984. })
  985. });
  986. }else{
  987. this.updateTreeNewNode()
  988. }
  989. },
  990. //编辑元素表单信息
  991. updateTreeNewNode() {
  992. tabTypeLazyTreeAll(
  993. {parentId:this.curTreeData.parentId,current:1,size:1000}
  994. ).then((res) => {
  995. this.$refs.avueTree.updateKeyChildren(
  996. this.curTreeData.parentId,
  997. res.data.data.records
  998. );
  999. this.$refs.avueTree.setCurrentKey(this.curNode.data.id);
  1000. });
  1001. },
  1002. editElement (row) {
  1003. console.log(row,'row');
  1004. this.curEleTable = row;
  1005. this.editEleloading=true
  1006. selectPrivateFormElements(this.curEleTable.id).then((res) => {
  1007. this.editEleloading=false
  1008. res.data.data.forEach((element) => {
  1009. this.eleReg.exec(element.eAllowDeviation);
  1010. //console.log(RegExp.$1)
  1011. //console.log(RegExp.$2)
  1012. element.allow = RegExp.$1 ? RegExp.$1 : '';
  1013. element.deviation = RegExp.$2 ? RegExp.$2 : '';
  1014. })
  1015. this.editEleList = res.data.data;
  1016. })
  1017. this.editEleVisible = true;
  1018. },
  1019. //修改数据类型,给个默认值
  1020. setDefatableTypeultLength (row) {
  1021. this.$set(row, 'eLength', this.dataTypeDefaultMap[row.eType]);
  1022. },
  1023. //分配节点
  1024. distribution(row){
  1025. console.log(row);
  1026. this.from.id=row.id;
  1027. this.from.title=row.title;
  1028. this.from.tableType=row.tabType
  1029. this.from.tableType=this.formatTableType(this.from.tableType);
  1030. this.from.tableOwner=row.tabOwner
  1031. this.from.tableOwner=this.formatOwner(this.from.tableOwner);
  1032. this.$refs.PublicWbs.show();
  1033. },
  1034. saveNewEle (row) {
  1035. if (!row.eName) {
  1036. this.$message({
  1037. type: "warning",
  1038. message: "请填写元素名称"
  1039. });
  1040. return;
  1041. }
  1042. if (!row.eType) {
  1043. this.$message({
  1044. type: "warning",
  1045. message: "请选择数据类型"
  1046. });
  1047. return;
  1048. }
  1049. row.eAllowDeviation = (row.allow ? row.allow : '') + (row.deviation ? row.deviation : '');
  1050. row.fId = this.curEleTable.id;
  1051. row.initTableName = this.curEleTable.initTableName;
  1052. if (!row.eLength) {
  1053. this.$message({
  1054. type: "warning",
  1055. message: "请填写长度"
  1056. });
  1057. return;
  1058. }
  1059. saveElement(row).then((res) => {
  1060. if (res.data.data) {
  1061. this.$set(row, 'id', res.data.data.id);
  1062. this.$set(row, 'ekey', res.data.data.ekey);
  1063. this.$message({
  1064. type: "success",
  1065. message: "保存成功!"
  1066. });
  1067. }
  1068. })
  1069. },
  1070. saveEles () {
  1071. for (let i = 0; i < this.editEleList.length; i++) {
  1072. if (!this.editEleList[i].id) {
  1073. this.$message({
  1074. type: "warning",
  1075. message: "请先将新增的元素点击保存"
  1076. });
  1077. return;
  1078. }
  1079. if (!this.editEleList[i].eName) {
  1080. this.$message({
  1081. type: "warning",
  1082. message: "请填写第" + (i + 1) + "条元素名称"
  1083. });
  1084. return;
  1085. }
  1086. if (!this.editEleList[i].eType) {
  1087. this.$message({
  1088. type: "warning",
  1089. message: "请选择第" + (i + 1) + "条数据类型"
  1090. });
  1091. return;
  1092. }
  1093. if ( !this.editEleList[i].eLength) {
  1094. this.$message({
  1095. type: "warning",
  1096. message: "请填写第" + (i + 1) + "条长度"
  1097. });
  1098. return;
  1099. }
  1100. }
  1101. if (this.editEleList.length > 0) {
  1102. this.editEleList.forEach((element) => {
  1103. element.eAllowDeviation = (element.allow ? element.allow : '') + (element.deviation ? element.deviation : '');
  1104. // if (element.eType == 4) {
  1105. // this.$set(element, 'eLength', 0);
  1106. // //element.eLength = 0;
  1107. // }
  1108. })
  1109. console.log(this.editEleList,'this.editEleList');
  1110. updateBatchElements(this.editEleList, this.curEleTable.initTableName).then(() => {
  1111. this.editEleVisible = false;
  1112. this.onLoad1(this.page);
  1113. this.$message({
  1114. type: "success",
  1115. message: "保存成功!"
  1116. });
  1117. })
  1118. } else {
  1119. this.editEleVisible = false;
  1120. this.onLoad1(this.page);
  1121. this.$message({
  1122. type: "success",
  1123. message: "保存成功!"
  1124. });
  1125. }
  1126. },
  1127. handleEditFormula ( row) {
  1128. console.log(row,'row');
  1129. this.curEleTable = row;
  1130. selectPrivateFormElements(this.curEleTable.id).then((res) => {
  1131. this.editEleListFilter = res.data.data;
  1132. this.editEleListAll = [].concat(this.editEleListFilter);
  1133. })
  1134. this.editEleFormulaVisible = true;
  1135. },
  1136. //搜索 筛选
  1137. searchFormulaName(){
  1138. this.editEleListFilter = this.editEleListAll.filter((ele)=>{
  1139. return ele.eName.indexOf(this.formulaInput) > -1;
  1140. })
  1141. },
  1142. //跳转到公式配置页面
  1143. toFormulaEdit(row,type) {
  1144. this.formulaCurRow = row;
  1145. this.formulaCurRow.globaltype = type;
  1146. this.formulaCompVisible = true;
  1147. },
  1148. editele(){
  1149. console.log('编辑元素表单信息');
  1150. if (this.selectionList.length === 0) {
  1151. this.$message.warning("请选择至少一条数据");
  1152. return;
  1153. }
  1154. if (this.elemtData.length) {
  1155. let da = []
  1156. this.formDatass = [...this.selectionList];
  1157. console.log(this.formDatass,'his.formDatass111');
  1158. this.formDatass.forEach(val => {
  1159. da.push({
  1160. tableType: val.tabType,
  1161. tableOwner: val.tabOwner,
  1162. id: val.id,
  1163. tableName: val.title,
  1164. fillRate: val.fillRate,
  1165. })
  1166. })
  1167. this.formDatass = da
  1168. console.log(this.formDatass,'this.formDatass');
  1169. let fa=[]
  1170. this.formDatass.forEach(val=>{
  1171. let newarr= this.tableTypelist.filter(e => e.dictValue===val.tableType);
  1172. let newarr1= this.ownerTypeList.filter(e => e.dictValue===val.tableOwner);
  1173. fa.push({
  1174. tableType: newarr[0].dictKey,
  1175. tableOwner: newarr1[0].dictKey,
  1176. id: val.id,
  1177. tableName: val.tableName,
  1178. fillRate: val.fillRate,
  1179. })
  1180. })
  1181. this.formDatass=fa
  1182. this.editElementFormTag = true;
  1183. }
  1184. },
  1185. getOwnerTypelist() {
  1186. if (this.ownerTypeList.length > 1) {
  1187. return;
  1188. }
  1189. getDictionary({
  1190. code: "owner_type",
  1191. }).then((res) => {
  1192. res.data.data.forEach((element) => {
  1193. element.dictKey = Number(element.dictKey);
  1194. });
  1195. this.ownerTypeList = res.data.data;
  1196. });
  1197. },
  1198. getDataTypelist() {
  1199. if (this.dataTypeList.length > 1) {
  1200. return;
  1201. }
  1202. getDictionary({
  1203. code: "data_type",
  1204. }).then((res) => {
  1205. res.data.data.forEach((element) => {
  1206. element.dictKey = Number(element.dictKey);
  1207. });
  1208. this.dataTypeList = res.data.data;
  1209. });
  1210. },
  1211. getTableTypelist() {
  1212. if (this.tableTypelist.length > 1) {
  1213. return;
  1214. }
  1215. getDictionary({
  1216. code: "table_type",
  1217. }).then((res) => {
  1218. res.data.data.forEach((element) => {
  1219. element.dictKey = Number(element.dictKey);
  1220. });
  1221. this.tableTypelist = res.data.data;
  1222. });
  1223. },
  1224. editeditElementFormMF () {//保存按钮
  1225. let da = []
  1226. let tag = true
  1227. console.log(this.tableTypelist,'tableTypelist');
  1228. this.formDatass.forEach(val => {
  1229. if (!val.tableName || !val.tableType || !val.tableOwner) {
  1230. tag = false
  1231. return
  1232. } else {
  1233. da.push({
  1234. id: val.id,
  1235. nodeName: val.tableName,
  1236. tableType: val.tableType,
  1237. tableOwner:val.tableOwner,
  1238. fillRate: val.fillRate,
  1239. Type:10
  1240. })
  1241. }
  1242. })
  1243. if (tag) {
  1244. this.updateBatchNodeTableInfoElement(da)
  1245. } else {
  1246. this.$message({
  1247. type: 'success',
  1248. message: '请填写完整元素表单的所有信息!',
  1249. })
  1250. }
  1251. },
  1252. async updateBatchNodeTableInfoElement (da) {//共有编辑元素
  1253. console.log(da,'编辑表单');
  1254. const { data: res } = await updateBatchNodeTableInfoElement(da)
  1255. if (res.code == 200) {
  1256. this.$message.success('操作成功');
  1257. this.editElementFormTag = false
  1258. this.onLoad1(this.page);
  1259. }
  1260. },
  1261. async excelType () {//清表类型
  1262. const { data: res } = await excelType({ code: 'sys_excltab_type' })
  1263. console.log(res);
  1264. if (res.code === 200) {
  1265. res.data.forEach(element => {
  1266. element.dictKey = Number(element.dictKey)
  1267. });
  1268. this.exceltypeData = res.data
  1269. }
  1270. },
  1271. //查看节点下已关联的元素表信息
  1272. searchNodeTables(id) {
  1273. searchNodeTables(id, this.from.id).then((res) => {
  1274. if (res.data.data.length > 0) {
  1275. res.data.data.forEach((val) => {
  1276. if (val.isLinkTable == 2) {
  1277. val.checknd = true;
  1278. } else {
  1279. val.checknd = false;
  1280. }
  1281. val.loading = false;
  1282. });
  1283. this.addTableData = res.data.data;
  1284. } else {
  1285. this.addTableData = [];
  1286. }
  1287. });
  1288. },
  1289. },
  1290. created () {
  1291. this.getTableTypelist();
  1292. this.getOwnerTypelist();
  1293. this.getDataTypelist();
  1294. },
  1295. mounted () {
  1296. // this.heightss = this.$refs.rulesss.clientHeight
  1297. }
  1298. }
  1299. </script>
  1300. <style scoped lang="scss">
  1301. .marleft10 {
  1302. margin-left: 10px;
  1303. }
  1304. /deep/.el-tree-node__expand-icon {
  1305. font-size: 16px;
  1306. }
  1307. .colorblue {
  1308. color: rgb(0, 82, 217);
  1309. }
  1310. .treecontent /deep/.el-scrollbar {
  1311. height: 100%;
  1312. }
  1313. .el-scrollbar {
  1314. height: 100%;
  1315. }
  1316. .rightHeader {
  1317. display: flex;
  1318. justify-content: flex-start;
  1319. align-items: top;
  1320. font-size: 14px;
  1321. background-color: #fff;
  1322. .excelname {
  1323. box-sizing: border-box;
  1324. min-width: 200px;
  1325. height: 28px;
  1326. border: 1px solid rgb(220, 220, 220);
  1327. padding: 0 10px;
  1328. border-radius: 3px;
  1329. display: flex;
  1330. justify-content: space-between;
  1331. align-items: center;
  1332. }
  1333. }
  1334. .dialogModel {
  1335. .dialogBox {
  1336. .middle {
  1337. display: flex;
  1338. .left {
  1339. border: 1px solid rgb(220, 220, 220);
  1340. border-radius: 3px;
  1341. height: 500px;
  1342. width: 49%;
  1343. .select {
  1344. box-sizing: border-box;
  1345. display: flex;
  1346. justify-content: center;
  1347. padding: 5px 0;
  1348. border-bottom: 1px solid #e0e0e0;
  1349. }
  1350. .leftscroll {
  1351. height: 450px;
  1352. overflow-y: scroll;
  1353. }
  1354. }
  1355. .right {
  1356. height: auto;
  1357. height: 60px;
  1358. max-height: 500px;
  1359. margin-left: 2%;
  1360. // height: 500px;
  1361. border-radius: 3px;
  1362. td {
  1363. box-sizing: border-box;
  1364. padding: 5px 10px;
  1365. height: 30px;
  1366. line-height: 30px;
  1367. }
  1368. }
  1369. }
  1370. }
  1371. .btbox {
  1372. margin-top: 20px;
  1373. display: flex;
  1374. justify-content: center;
  1375. }
  1376. }
  1377. .rightBox {
  1378. flex: 1;
  1379. }
  1380. .boxswai{
  1381. height: 100%;
  1382. box-sizing: border-box;
  1383. padding-bottom: 10px;
  1384. }
  1385. /deep/.avue-crud__left{
  1386. width: 65% !important;
  1387. }
  1388. /deep/.el-input-group__append{
  1389. background-color: #ecf5ff;
  1390. color: #409EFF;
  1391. }
  1392. /deep/.el-input-group__append:hover{
  1393. background-color: #409EFF;
  1394. color: white;
  1395. }
  1396. /deep/.el-input-group__prepend:hover{
  1397. background-color: #409EFF;
  1398. color: white;
  1399. }
  1400. /deep/.el-input-group__append:active{
  1401. background-color: #9dc5ee;
  1402. color: white;
  1403. }
  1404. /deep/.el-input-group__prepend:active{
  1405. background-color: #9dc5ee;
  1406. color: white;
  1407. }
  1408. </style>