index.vue 90 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <el-col :span="18" :class="{ edit: menudata }">
  5. <el-card
  6. v-show="tabIndex == '0'"
  7. shadow="always"
  8. :body-style="{ padding: '20px' }"
  9. >
  10. <template #header>
  11. <div>
  12. <span>基础信息</span>
  13. </div>
  14. </template>
  15. <el-select
  16. v-model="tableName"
  17. placeholder="请选择数据表"
  18. filterable
  19. @change="getList"
  20. class="mb10"
  21. >
  22. <el-option
  23. v-for="item in tableList"
  24. :key="item.tableName"
  25. :label="item.tableComment"
  26. :value="item.tableName"
  27. >
  28. <span style="float: left">{{ item.tableComment }}</span>
  29. <span style="float: right; color: #8492a6; font-size: 13px">{{
  30. item.tableName
  31. }}</span>
  32. </el-option>
  33. </el-select>
  34. <el-table
  35. :data="tableFieldList"
  36. border
  37. ref="dragTable"
  38. row-key="id"
  39. max-height="500px"
  40. >
  41. >
  42. <el-table-column
  43. type="index"
  44. label="序号"
  45. width="50"
  46. class-name="allowDrag"
  47. >
  48. </el-table-column>
  49. <el-table-column prop="fieldName" label="数据字段">
  50. </el-table-column>
  51. <el-table-column prop="fieldDescription" label="字段描述">
  52. <template slot-scope="scope">
  53. <input
  54. :class="{
  55. isNullDesc:
  56. scope.row.fieldDescription == '' &&
  57. scope.row.isShow &&
  58. isInputInvalid
  59. ? true
  60. : false,
  61. ipt: true,
  62. }"
  63. v-model="scope.row.fieldDescription"
  64. />
  65. </template>
  66. </el-table-column>
  67. <el-table-column prop="relationTable" label="关联表">
  68. <template slot-scope="scope">
  69. <el-select
  70. v-model="scope.row.relationTable"
  71. :disabled="
  72. !scope.row.relationTableList ||
  73. !scope.row.relationTableList.length
  74. "
  75. placeholder="请选择关联的表"
  76. clearable
  77. filterable
  78. @change="ralationTableChange(scope.row)"
  79. >
  80. <el-option
  81. v-for="item in scope.row.relationTableList"
  82. :key="item.tableName"
  83. :label="item.tableComment"
  84. :value="item.tableName"
  85. >
  86. <span style="float: left">{{ item.tableComment }}</span>
  87. <span
  88. style="float: right; color: #8492a6; font-size: 13px"
  89. >{{ item.tableName }}</span
  90. >
  91. </el-option>
  92. </el-select>
  93. </template>
  94. </el-table-column>
  95. <el-table-column prop="relationFieldName" label="关联条件字段">
  96. <template slot-scope="scope">
  97. <el-select
  98. v-model="scope.row.relationFieldName"
  99. @change="relationFieldChange(scope.row)"
  100. :disabled="!scope.row.disableRelaFieldName"
  101. placeholder="关联字段"
  102. filterable
  103. >
  104. <el-option
  105. v-for="item in scope.row.relaFieldNameList"
  106. :key="item.fieldName"
  107. :label="item.fieldDescription"
  108. :value="item.fieldName"
  109. >
  110. </el-option>
  111. </el-select>
  112. </template>
  113. </el-table-column>
  114. <el-table-column prop="relationType" label="关联方式">
  115. <template slot-scope="scope">
  116. <el-select
  117. v-model="scope.row.relationType"
  118. placeholder="请选择关联方式"
  119. :disabled="!scope.row.disableRelaType"
  120. @change="relationTypeChangeHandler(scope.row)"
  121. filterable
  122. >
  123. <el-option
  124. v-for="item in relaTypeList"
  125. :key="item.value"
  126. :label="item.label"
  127. :value="item.value"
  128. >
  129. </el-option>
  130. </el-select>
  131. </template>
  132. </el-table-column>
  133. <el-table-column prop="isShow" label="是否显示">
  134. <template slot-scope="scope">
  135. <el-switch v-model="scope.row.isShow"> </el-switch>
  136. </template>
  137. </el-table-column>
  138. <el-table-column prop="isShowRelaDialog" label="添加依赖关系">
  139. <template slot-scope="scope">
  140. <el-switch
  141. v-model="scope.row.isShowRelaDialog"
  142. @change="isShowRelaDialogHandler(scope.row)"
  143. >
  144. </el-switch>
  145. </template>
  146. </el-table-column>
  147. </el-table>
  148. </el-card>
  149. <SubList
  150. ref="subList"
  151. v-show="tabIndex == '1'"
  152. :tableListName="'tableList1'"
  153. :menudata="menudata"
  154. :tableList="tableList"
  155. :echoData="subEchoData.echoData"
  156. :btnGroupOptions="btnGroupOptions"
  157. @tableNameChange="subNameHandler"
  158. @fieldListChange="filedListHandler"
  159. />
  160. <SubList
  161. ref="StatusTable"
  162. v-show="tabIndex == '2'"
  163. :tableListName="'tableList2'"
  164. :menudata="menudata"
  165. :tableList="tableList"
  166. :echoData="countEchoData.echoData"
  167. :btnGroupOptions="btnGroupOptions"
  168. @tableNameChange="statusTableHandler"
  169. @fieldListChange="statusFieldListHandler"
  170. />
  171. </el-col>
  172. <el-col :span="6" :class="{ menudata: menudata }">
  173. <el-tabs v-model="activeName" @tab-click="tabhandleClick">
  174. <el-tab-pane label="基础信息" name="menuedit">
  175. <el-card shadow="always" :body-style="{ padding: '10px' }">
  176. <el-form
  177. ref="formData"
  178. :model="formData"
  179. label-width="100px"
  180. :rules="rules"
  181. >
  182. <el-form-item label="组名称" prop="groupName">
  183. <el-input v-model="formData.groupName"></el-input>
  184. </el-form-item>
  185. <el-form-item label="组描述" prop="groupDescription">
  186. <el-input v-model="formData.groupDescription"></el-input>
  187. </el-form-item>
  188. <el-form-item label="时间格式" prop="timeFormate">
  189. <el-select
  190. v-model="formData.timeFormate"
  191. placeholder="请选择时间格式"
  192. >
  193. <el-option
  194. v-for="val in dict.type.sys_time_format"
  195. :key="val.value"
  196. :label="val.label"
  197. :value="val.value"
  198. ></el-option>
  199. </el-select>
  200. </el-form-item>
  201. <el-form-item label="表格主键" prop="primaryKey">
  202. <el-select
  203. v-model="formData.primaryKey"
  204. placeholder="请选择表格主键"
  205. >
  206. <el-option
  207. v-for="val in primaryKeyList"
  208. :key="val.fieldName"
  209. :label="val.fieldDescription"
  210. :value="val.fieldName"
  211. >
  212. <span style="float: left">{{
  213. val.fieldDescription
  214. }}</span>
  215. <span
  216. style="float: right; color: #8492a6; font-size: 13px"
  217. >{{ val.fieldName }}</span
  218. >
  219. </el-option>
  220. </el-select>
  221. </el-form-item>
  222. <el-form-item label="操作列按钮" prop="btnGroupList">
  223. <el-select
  224. v-model="formData.btnGroupList"
  225. placeholder="请选择按钮组"
  226. clearable
  227. multiple
  228. >
  229. <el-option
  230. v-for="val in btnGroupOptions"
  231. :key="val.btnKey"
  232. :label="val.btnGroupName"
  233. :value="val.btnKey"
  234. ></el-option>
  235. </el-select>
  236. </el-form-item>
  237. <el-form-item label="排序依赖字段">
  238. <el-select
  239. v-model="formData.orderByColumn"
  240. placeholder="请选择排序依赖"
  241. >
  242. <el-option
  243. v-for="val in primaryKeyList"
  244. :key="val.fieldName"
  245. :label="val.fieldDescription"
  246. :value="val.fieldName"
  247. >
  248. <span style="float: left">{{
  249. val.fieldDescription
  250. }}</span>
  251. <span
  252. style="float: right; color: #8492a6; font-size: 13px"
  253. >{{ val.fieldName }}</span
  254. >
  255. </el-option>
  256. </el-select>
  257. </el-form-item>
  258. <el-form-item label="排序方式" v-show="formData.orderByColumn">
  259. <el-radio v-model="formData.isAsc" :label="false"
  260. >升序</el-radio
  261. >
  262. <el-radio v-model="formData.isAsc" :label="true"
  263. >降序</el-radio
  264. >
  265. </el-form-item>
  266. <!-- <el-form-item label="当前表字段">
  267. <el-select
  268. v-model="formData.relyFile"
  269. placeholder="请选择当前表字段"
  270. >
  271. <el-option
  272. v-for="item in orderByFieldList"
  273. :key="item.fieldName"
  274. :label="item.fieldDescription"
  275. :value="item.tableName + '.' + item.fieldName"
  276. >
  277. </el-option>
  278. </el-select>
  279. </el-form-item> -->
  280. <!-- <el-form-item label="依赖表格">
  281. <el-select
  282. v-model="formData.relytableName"
  283. placeholder="请选择依赖表"
  284. filterable
  285. @change="getrelyList"
  286. class="mb10"
  287. >
  288. <el-option
  289. v-for="item in dragTableList"
  290. :key="item.dtName"
  291. :label="item.dtName"
  292. :value="item.dtName"
  293. >
  294. <span style="float: left">{{ item.dtName }}</span>
  295. </el-option>
  296. </el-select>
  297. </el-form-item>
  298. <el-form-item label="依赖表格字段">
  299. <el-select
  300. v-model="formData.relaykey"
  301. placeholder="请选择依赖字段"
  302. >
  303. <el-option
  304. v-for="item in dragTableFilds"
  305. :key="item.keu"
  306. :label="item.val"
  307. :value="item.key"
  308. ></el-option>
  309. </el-select>
  310. </el-form-item> -->
  311. <!-- <el-form-item label="依赖表">
  312. <el-select
  313. v-model="formData.relytableName"
  314. placeholder="请选择依赖表"
  315. filterable
  316. @change="getrelalist"
  317. class="mb10"
  318. >
  319. <el-option
  320. v-for="item in tableList"
  321. :key="item.tableName"
  322. :label="item.tableComment"
  323. :value="item.tableName"
  324. >
  325. <span style="float: left">{{ item.tableComment }}</span>
  326. <span
  327. style="float: right; color: #8492a6; font-size: 13px"
  328. >{{ item.tableName }}</span
  329. >
  330. </el-option>
  331. </el-select>
  332. </el-form-item>
  333. <el-form-item label="依赖表字段">
  334. <el-select
  335. v-model="formData.relaykey"
  336. placeholder="请选择依赖字段"
  337. >
  338. <el-option
  339. v-for="val in relayTableList"
  340. :key="val.fieldName"
  341. :label="val.fieldDescription"
  342. :value="val.fieldName"
  343. >
  344. <span style="float: left">{{
  345. val.fieldDescription
  346. }}</span>
  347. <span
  348. style="float: right; color: #8492a6; font-size: 13px"
  349. >{{ val.fieldName }}</span
  350. >
  351. </el-option>
  352. </el-select>
  353. </el-form-item> -->
  354. <el-form-item>
  355. <el-button size="mini" @click="previewHandle">预览</el-button>
  356. <el-button size="mini" type="primary" @click="createHandle">{{
  357. tId ? "确认修改" : "确认创建"
  358. }}</el-button>
  359. </el-form-item>
  360. </el-form>
  361. </el-card>
  362. </el-tab-pane>
  363. <el-tab-pane label="关联子表" name="styleEdit">
  364. <el-card shadow="always" :body-style="{ padding: '10px' }">
  365. <relayTable
  366. ref="styleTableRef"
  367. :echoData="echoData"
  368. :btnGroupOptions="btnGroupOptions"
  369. :subFieldList="subFiledList"
  370. @subFormData="subFormDataHandler"
  371. :dragTableList="dragTableList"
  372. :tableList="tableList"
  373. />
  374. <el-button
  375. type="primary"
  376. class="inline-large-button addcount"
  377. icon="el-icon-plus"
  378. size="mini"
  379. @click="addDataDialog"
  380. >
  381. 添加数据字段
  382. </el-button>
  383. <el-table
  384. :data="dragTableStatisticList"
  385. border
  386. class="mb10"
  387. style="width: 100%"
  388. >
  389. <!-- <el-table-column prop="number" label="序号" width="50"> -->
  390. <!-- style="width: 100%"> -->
  391. <el-table-column
  392. type="index"
  393. label="序号"
  394. width="50"
  395. class-name="allowDrag"
  396. >
  397. </el-table-column>
  398. <el-table-column
  399. prop="statisticTitle"
  400. label="统计标题"
  401. width="83"
  402. >
  403. </el-table-column>
  404. <el-table-column
  405. prop="statisticField"
  406. label="统计数据"
  407. width="80"
  408. >
  409. </el-table-column>
  410. <el-table-column
  411. prop="statisticType"
  412. label="统计类型"
  413. width="50"
  414. >
  415. </el-table-column>
  416. <el-table-column
  417. label="操作"
  418. align="center"
  419. class-name="small-padding fixed-width"
  420. >
  421. <template slot-scope="scope">
  422. <el-dropdown>
  423. <el-button type="warning" plain size="small">
  424. 处理<i class="el-icon-arrow-down el-icon--right"></i>
  425. </el-button>
  426. <el-dropdown-menu slot="dropdown">
  427. <el-dropdown-item>
  428. <el-button
  429. size="mini"
  430. type="text"
  431. icon="el-icon-edit"
  432. @click="handleUpdateStat(scope.row)"
  433. >修改
  434. </el-button>
  435. </el-dropdown-item>
  436. <el-dropdown-item>
  437. <el-button
  438. size="mini"
  439. type="text"
  440. icon="el-icon-delete"
  441. @click="handleDeleteStat(scope.row)"
  442. >删除
  443. </el-button>
  444. </el-dropdown-item>
  445. </el-dropdown-menu>
  446. </el-dropdown>
  447. </template>
  448. </el-table-column>
  449. </el-table>
  450. </el-card>
  451. </el-tab-pane>
  452. <el-tab-pane label="数据统计" name="datacount">
  453. <el-card shadow="always" :body-style="{ padding: '10px' }">
  454. <el-form ref="countData" :model="countData" label-width="100px">
  455. <el-form-item label="按钮组" prop="btnGroupList">
  456. <el-select
  457. v-model="countData.btnGroupList"
  458. placeholder="请选择按钮组"
  459. clearable
  460. multiple
  461. >
  462. <el-option
  463. v-for="val in btnGroupOptions"
  464. :key="val.btnKey"
  465. :label="val.btnGroupName"
  466. :value="val.btnKey"
  467. ></el-option>
  468. </el-select>
  469. </el-form-item>
  470. <!-- <el-form-item label="状态展示标题" prop="title">
  471. <el-input
  472. @input="iptChange()"
  473. v-model="countData.title"
  474. placeholder="请输入展示标题"
  475. ></el-input>
  476. </el-form-item> -->
  477. <!-- <el-form-item label="选择数据表" prop="table">
  478. <el-select
  479. @input="iptChange()"
  480. v-model="countData.countName"
  481. placeholder="请选择数据表"
  482. filterable
  483. @change="getCountList"
  484. class="mb10"
  485. >
  486. <el-option
  487. v-for="item in countList"
  488. :key="item.tableName"
  489. :label="item.tableComment"
  490. :value="item.tableName"
  491. >
  492. <span style="float: left">{{ item.tableComment }}</span>
  493. <span
  494. style="float: right; color: #8492a6; font-size: 13px"
  495. >{{ item.tableName }}</span
  496. >
  497. </el-option>
  498. </el-select>
  499. </el-form-item> -->
  500. <el-form-item label="表格主键" prop="primaryKey">
  501. <el-select
  502. @input="iptChange()"
  503. v-model="countData.primaryKey"
  504. placeholder="请选择表格主键"
  505. >
  506. <el-option
  507. v-for="val in countPrimaryKeyList"
  508. :key="val.fieldName"
  509. :label="val.fieldDescription"
  510. :value="val.fieldName"
  511. >
  512. <span style="float: left">{{
  513. val.fieldDescription
  514. }}</span>
  515. <span
  516. style="float: right; color: #8492a6; font-size: 13px"
  517. >{{ val.fieldName }}</span
  518. >
  519. </el-option>
  520. </el-select>
  521. </el-form-item>
  522. <!-- <el-form-item label="统计字段">
  523. <el-select
  524. v-model="countData.countFile"
  525. placeholder="请选择统计字段"
  526. @input="iptChange()"
  527. >
  528. <el-option
  529. v-for="item in countByFieldList"
  530. :key="item.fieldName"
  531. :label="item.fieldDescription"
  532. :value="item.fieldName"
  533. >
  534. <span style="float: left">{{
  535. item.fieldDescription
  536. }}</span>
  537. <span
  538. style="float: right; color: #8492a6; font-size: 13px"
  539. >{{ item.fieldName }}</span
  540. >
  541. </el-option>
  542. </el-select>
  543. </el-form-item> -->
  544. </el-form>
  545. </el-card>
  546. </el-tab-pane>
  547. </el-tabs>
  548. </el-col>
  549. </el-row>
  550. <el-dialog title="效果预览" :visible.sync="isShowPreview" width="50%">
  551. <div class="cardBox">
  552. <el-card
  553. shadow="hover"
  554. :body-style="{ padding: '20px' }"
  555. class="card"
  556. v-for="(item, index) in deepragTableStatisticList"
  557. :key="index"
  558. >
  559. <el-tooltip
  560. class="item"
  561. effect="dark"
  562. :content="item.statisticTitle"
  563. placement="top-start"
  564. >
  565. <div class="title">
  566. {{
  567. item.statisticTitle
  568. ? item.statisticTitle
  569. : item.statisticDescription
  570. }}
  571. </div>
  572. </el-tooltip>
  573. <div class="type">
  574. <div class="count">统计结果</div>
  575. </div>
  576. </el-card>
  577. </div>
  578. <el-row :gutter="10" class="mb8">
  579. <el-col :span="18">
  580. <el-input placeholder="请输入" clearable />
  581. </el-col>
  582. <el-col :span="6" class="previewbtn">
  583. <el-button
  584. type="primary"
  585. icon="el-icon-search"
  586. size="small"
  587. @click="() => {}"
  588. >搜索</el-button
  589. >
  590. <el-button icon="el-icon-refresh" size="small" @click="() => {}"
  591. >重置</el-button
  592. >
  593. </el-col>
  594. </el-row>
  595. <el-row :gutter="10" class="mb8">
  596. <el-col :span="1.5">
  597. <el-button
  598. type="primary"
  599. plain
  600. icon="el-icon-plus"
  601. size="mini"
  602. @click="() => {}"
  603. >新增
  604. </el-button>
  605. </el-col>
  606. <el-col :span="1.5">
  607. <el-button
  608. type="success"
  609. plain
  610. icon="el-icon-edit"
  611. size="mini"
  612. :disabled="false"
  613. @click="() => {}"
  614. >修改
  615. </el-button>
  616. </el-col>
  617. <el-col :span="1.5">
  618. <el-button
  619. type="danger"
  620. plain
  621. icon="el-icon-delete"
  622. size="mini"
  623. :disabled="false"
  624. @click="() => {}"
  625. >删除
  626. </el-button>
  627. </el-col>
  628. <el-col :span="1.5">
  629. <el-button plain icon="el-icon-upload2" size="mini" @click="() => {}"
  630. >导入
  631. </el-button>
  632. </el-col>
  633. <el-col :span="1.5">
  634. <el-button
  635. type="warning"
  636. plain
  637. icon="el-icon-download"
  638. size="mini"
  639. @click="() => {}"
  640. >导出
  641. </el-button>
  642. </el-col>
  643. </el-row>
  644. <el-table :data="tableDataList" @selection-change="() => {}">
  645. <el-table-column
  646. type="selection"
  647. width="55"
  648. align="center"
  649. ></el-table-column>
  650. <el-table-column
  651. v-for="item in columns"
  652. :key="item.key + item.value"
  653. :label="item.value"
  654. align="center"
  655. :prop="toUpperCase(item.key)"
  656. />
  657. <el-table-column
  658. label="操作"
  659. align="center"
  660. class-name="small-padding fixed-width"
  661. >
  662. <template>
  663. <el-dropdown>
  664. <el-button type="warning" plain size="small">
  665. 处理<i class="el-icon-arrow-down el-icon--right"></i>
  666. </el-button>
  667. <el-dropdown-menu slot="dropdown">
  668. <el-dropdown-item
  669. ><el-button
  670. size="mini"
  671. type="text"
  672. icon="el-icon-edit"
  673. @click="() => {}"
  674. >修改</el-button
  675. ></el-dropdown-item
  676. >
  677. <el-dropdown-item
  678. ><el-button
  679. size="mini"
  680. type="text"
  681. icon="el-icon-delete"
  682. @click="() => {}"
  683. >删除</el-button
  684. >
  685. </el-dropdown-item>
  686. </el-dropdown-menu>
  687. </el-dropdown>
  688. </template>
  689. </el-table-column>
  690. </el-table>
  691. <pagination
  692. v-show="total > 0"
  693. :total="total"
  694. :page.sync="queryParams.pageNum"
  695. :limit.sync="queryParams.pageSize"
  696. @pagination="pageList"
  697. />
  698. <template #footer>
  699. <span>
  700. <el-button @click="isShowPreview = false">关闭</el-button>
  701. <el-button type="primary" @click="createHandle">{{
  702. tId ? "确认修改" : "确认关联"
  703. }}</el-button>
  704. </span>
  705. </template>
  706. </el-dialog>
  707. <!-- 添加数据统计对话框 -->
  708. <el-dialog :title="staictitle" :visible.sync="isShowAddData" width="30%">
  709. <el-form label-width="100px" :model="dataCountFormData">
  710. <el-form-item label="统计标题" prop="statisticTitle">
  711. <el-input v-model="dataCountFormData.statisticTitle"></el-input>
  712. </el-form-item>
  713. <el-form-item label="统计数据">
  714. <el-select
  715. v-model="dataCountFormData.statisticField"
  716. placeholder="请选择统计字段"
  717. >
  718. <el-option
  719. v-for="item in dataArr"
  720. :key="item.id"
  721. :label="item.fieldDescription"
  722. :value="item.tableName + '.' + item.fieldName"
  723. >
  724. <span style="float: left; margin-right: 5px"
  725. >{{ item.fieldDescription }}
  726. </span>
  727. <span style="float: right; color: #8492a6; font-size: 13px">{{
  728. item.fieldName
  729. }}</span>
  730. </el-option>
  731. </el-select>
  732. </el-form-item>
  733. <el-form-item label="统计类型">
  734. <el-select
  735. v-model="dataCountFormData.statisticType"
  736. placeholder="请选择统计类型"
  737. >
  738. <el-option
  739. v-for="item in dataType"
  740. :key="item.dictCode"
  741. :label="item.dictLabel"
  742. :value="item.dictValue"
  743. ></el-option>
  744. </el-select>
  745. </el-form-item>
  746. </el-form>
  747. <span slot="footer" class="dialog-footer">
  748. <el-button @click="closeAddDialog">取 消</el-button>
  749. <el-button
  750. v-if="staictitle == '修改统计数据字段'"
  751. type="primary"
  752. @click="upadtaData"
  753. >确 定</el-button
  754. >
  755. <el-button v-else type="primary" @click="addData">确 定</el-button>
  756. </span>
  757. </el-dialog>
  758. <!-- 添加依赖关系 -->
  759. <RelayDialog ref="relayRef" @saveRelayRes="saveRelayRes"></RelayDialog>
  760. </div>
  761. </template>
  762. <script>
  763. import { getTableInfo } from "@/api/system/table.js";
  764. import {
  765. dragTableInfo,
  766. addStatistic,
  767. updateStatistic,
  768. addGroupTableStatistic,
  769. updateGroupTableStatistic,
  770. } from "@/api/tablelist/commonTable";
  771. import { listTable } from "@/api/dragform/tableList";
  772. import {
  773. getFormName,
  774. getListName,
  775. dragTablePreview,
  776. } from "@/api/dragform/form.js";
  777. import { getTable } from "@/api/relateTable/index.js";
  778. import { addDialogGroup, undataDialogGroup } from "@/api/dialogMange/index.js";
  779. import { listType } from "@/api/system/dict/type.js";
  780. import { mapState } from "vuex";
  781. import Sortable from "sortablejs";
  782. import { v4 as uuidv4 } from "uuid";
  783. import { listBtn } from "@/api/system/btn";
  784. import relayTable from "./components/relayTable.vue";
  785. import SubList from "./relayTableMange/tablelist.vue";
  786. import RelayDialog from "./components/RelayDialog.vue";
  787. export default {
  788. name: "tableMange",
  789. dicts: ["sys_time_format", "table_statistic_type"],
  790. props: [],
  791. components: { relayTable, SubList, RelayDialog },
  792. data() {
  793. return {
  794. // 关联子表数据回显
  795. echoData: {},
  796. dragTableList: [],
  797. countdragTableList: [],
  798. dragTableFilds: {},
  799. // 统计子表
  800. countdragTableFilds: [],
  801. // 子表tablename
  802. subTableName: "",
  803. subFiledList: [],
  804. statusFieldList: [], //状态按钮 字段数据
  805. // 依赖表名称
  806. // relytableName: '',
  807. staictitle: this.$t('dialog.addStatisticField'),
  808. isInputInvalid: false,
  809. // 修改表格时的menuId
  810. menuId: "",
  811. // 修改表格的id
  812. tId: "",
  813. // 当前模板信息
  814. templateInfo: {},
  815. // 排序方式 默认降序
  816. sortState: true,
  817. // 列信息
  818. columns: {},
  819. // 查询条件
  820. queryFromWhere: {},
  821. // 当前table唯一标识
  822. sqlKey: "",
  823. // 动态数据sqlkey
  824. staticSqlKey: "",
  825. // 表格的高度
  826. tableKey: "",
  827. // tableHeight: document.documentElement.scrollHeight - 245 + "px",
  828. tableList: [], //所有表格列表
  829. tableFieldList: [], // 当前表格字段数据
  830. relayFieldList: [],
  831. tableName: "", // 当前表名称
  832. relationTableList: [], //关联表格列表
  833. relationFieldList: [], //关联字段列表
  834. relationTypeList: [], //关联方式列表
  835. total: 0, //表格数据总数
  836. relyOptions: [
  837. {
  838. value: "0",
  839. label: this.$t('dialog.customDependency'),
  840. },
  841. {
  842. value: "1",
  843. label: this.$t('dialog.dependOnOtherField'),
  844. }
  845. ],
  846. // 依赖值
  847. relayValue: "",
  848. // 依赖字段
  849. relyFileds: {},
  850. relaTypeList: [
  851. {
  852. label: this.$t('dialog.equalJoin'),
  853. value: "INNER JOIN",
  854. },
  855. {
  856. label: this.$t('dialog.leftJoin'),
  857. value: "LEFT JOIN",
  858. },
  859. {
  860. label: this.$t('dialog.rightJoin'),
  861. value: "RIGHT JOIN",
  862. }
  863. ],
  864. headerList: [
  865. {
  866. prop: "fieldName",
  867. label: "数据字段",
  868. },
  869. {
  870. prop: "fieldDescription",
  871. label: "字段描述",
  872. },
  873. {
  874. prop: "relationTable",
  875. label: "关联表",
  876. },
  877. {
  878. prop: "relationFieldName",
  879. label: "关联字段",
  880. },
  881. {
  882. prop: "relationType",
  883. label: "关联方式",
  884. },
  885. {
  886. prop: "isShow",
  887. label: "是否显示",
  888. },
  889. {
  890. prop: "isSearch",
  891. label: "是否包含查询",
  892. },
  893. {
  894. prop: "isExport",
  895. label: "是否导出",
  896. },
  897. {
  898. prop: "isCount",
  899. label: "是否统计",
  900. },
  901. ], //表头列表
  902. // 基础信息编辑
  903. formData: {
  904. groupName: "",
  905. groupDescription: "",
  906. routePath: undefined,
  907. isShowList: true,
  908. timeFormate: "",
  909. orderByColumn: "",
  910. isAsc: false,
  911. primaryKey: "",
  912. btnGroupList: [],
  913. },
  914. // 统计信息
  915. countData: {},
  916. rules: {
  917. groupName: [
  918. { required: true, message: "请输入组名称", trigger: "blur" },
  919. ],
  920. groupDescription: [
  921. { required: true, message: "请输入组描述", trigger: "blur" },
  922. ],
  923. timeFormate: [
  924. { required: true, message: "请选择时间格式", trigger: "change" },
  925. ],
  926. primaryKey: [
  927. { required: true, message: "请选择表格主键", trigger: "blur" },
  928. ],
  929. fieldDescription: [
  930. { required: true, message: "请输入字段描述", trigger: "blur" },
  931. ],
  932. },
  933. // tab切换
  934. tabIndex: "0",
  935. menus: [], //路由列表数据
  936. // 预览弹窗相关
  937. isShowPreview: false, //弹窗显示与隐藏
  938. queryParams: {
  939. pageNum: 1,
  940. pageSize: 10,
  941. orderByColumn: "",
  942. isAsc: false,
  943. basicMap: {
  944. sql: "",
  945. },
  946. },
  947. loading: false, //表格加载
  948. tableDataList: [], //数据
  949. // 基础信息数据回显
  950. editData: {},
  951. // 关联子表数据回显
  952. subEchoData: {},
  953. // 统计数据回显
  954. countEchoData: {},
  955. gruopKey: "",
  956. menuOrderNum: 0,
  957. // tab动态切换
  958. activeName: "menuedit",
  959. // 数据统计对象
  960. dataCountFormData: {},
  961. // 添加数据统计表格
  962. dragTableStatisticList: [],
  963. deepragTableStatisticList: [],
  964. tableSqlList: [],
  965. searchFieldList: [],
  966. // 是否切换到数据统计
  967. menudata: false,
  968. // 显示添加字段对话框dataArr
  969. isShowAddData: false,
  970. dataType: [],
  971. uuid: "",
  972. // 样式编辑tab数据
  973. // dragTableStyleList: [],
  974. //操作列按钮组数据
  975. btnGroupOptions: [],
  976. // 统计展示字段
  977. countFiledsList: [
  978. {
  979. label: "直接展示",
  980. value: "0",
  981. },
  982. {
  983. label: "字段关联展示",
  984. value: "1",
  985. },
  986. ],
  987. // 关联字段字典
  988. countDicts: [],
  989. // 子表表单数据
  990. subformData: {},
  991. // 数据统计
  992. countName: "",
  993. countFieldList: [],
  994. // 统计状态信息回显
  995. statusCount: [],
  996. // 回显数据单表列表
  997. lists: [],
  998. relayField: [],
  999. countrelayFieldList: [],
  1000. relaytableField: [],
  1001. // 依赖相关数据
  1002. row: null,
  1003. };
  1004. },
  1005. computed: {
  1006. // 数据字段
  1007. dataArr() {
  1008. // console.log(this.subFiledList);
  1009. return this.subFiledList?.filter((item) => item.isShow);
  1010. },
  1011. // 数据表
  1012. countList() {
  1013. return this.tableList;
  1014. },
  1015. // 统计数据依赖表
  1016. countRelayList() {
  1017. return this.tableList;
  1018. },
  1019. // 依赖表
  1020. relayList() {
  1021. return this.tableList;
  1022. },
  1023. infoTableList() {
  1024. return this.tableList;
  1025. },
  1026. // 数据统计字段表名中文
  1027. isShowTableName() {
  1028. let tableComment;
  1029. this.subFiledList.forEach((item) => {
  1030. if (item.tableName === this.subTableName) {
  1031. tableComment = item.tableComment;
  1032. }
  1033. });
  1034. // console.log(tableComment);
  1035. return tableComment;
  1036. },
  1037. ...mapState({
  1038. databaseName: (state) => state.user.dataSource.databaseName,
  1039. databaseType: (state) => state.user.dataSource.databaseType,
  1040. username: (state) => state.user.dataSource.username,
  1041. tenantId: (state) => state.user.tenant.tenantId,
  1042. }),
  1043. searchArr() {
  1044. if (!this.templateInfo?.where?.length) return [];
  1045. return this.templateInfo.where.map((item) => item.conditionName);
  1046. },
  1047. checkedWhere() {
  1048. if (!this.templateInfo?.where?.length) return [];
  1049. return this.templateInfo?.where.filter((item) => {
  1050. return this.checkedList.includes(item.conditionName);
  1051. });
  1052. },
  1053. // 当前表字段
  1054. orderByFieldList() {
  1055. // return this.tableFieldList.filter((item) => item.isShow);
  1056. return this.tableFieldList;
  1057. },
  1058. // 统计字段
  1059. countByFieldList() {
  1060. return this.countFieldList;
  1061. },
  1062. // 表格主键
  1063. primaryKeyList: {
  1064. get() {
  1065. return this.tableFieldList.filter((item) => !item.isChildren);
  1066. },
  1067. },
  1068. // 数据统计表格主键
  1069. countPrimaryKeyList() {
  1070. // console.log(this.countFieldList);
  1071. return this.countFieldList.filter((item) => !item.isChildren);
  1072. },
  1073. // 依赖表字段
  1074. relayTableList() {
  1075. return this.relaytableField.filter((item) => !item.isChildren);
  1076. },
  1077. relayKeyList() {
  1078. return this.relayFieldList.filter((item) => !item.isChildren);
  1079. },
  1080. // 数据统计依赖表字段
  1081. countRelayField() {
  1082. return this.countrelayFieldList.filter((item) => !item.isChildren);
  1083. },
  1084. },
  1085. watch: {
  1086. tableName: function (val) {
  1087. if (val) {
  1088. this.relationTableList = this.tableList
  1089. .filter((item) => item.tableName != val)
  1090. .map((item) => {
  1091. return {
  1092. tableName: item.tableName,
  1093. tableComment: item.tableComment,
  1094. };
  1095. });
  1096. } else {
  1097. this.relationTableList = [];
  1098. }
  1099. },
  1100. },
  1101. methods: {
  1102. // 数据统计tag选择数据表
  1103. getCountList() {
  1104. if (!this.countData.countName) return;
  1105. let data = {
  1106. databaseName: this.databaseName,
  1107. databaseType: this.databaseType,
  1108. tableName: this.countData.countName,
  1109. };
  1110. let tableComment = this.getTableCommont(
  1111. this.countData.countName,
  1112. this.tableList
  1113. );
  1114. // 获取当前表单结构信息
  1115. getListName(data).then((res) => {
  1116. // console.log(res);
  1117. this.countFieldList = res.map((item, index) => {
  1118. return {
  1119. id: this.countData.countName + "_" + item.fieldName,
  1120. fieldName: item.fieldName,
  1121. fieldDescription: item.fieldDescription,
  1122. relationTable: "",
  1123. relationFieldName: "",
  1124. relaFieldNameList: [],
  1125. disableRelaFieldName: false,
  1126. relationType: "",
  1127. relationShowField: [],
  1128. relationShowFiledList: [],
  1129. disableRelaType: false,
  1130. isShowRelaDialog: false, //关联关系弹窗
  1131. relaData: {}, //关联数据
  1132. isShow: false,
  1133. isSearch: false,
  1134. isExport: true,
  1135. relationTableList: this.relationTableList,
  1136. tableName: this.tableName,
  1137. tableComment,
  1138. relationFieldList: [],
  1139. };
  1140. });
  1141. });
  1142. },
  1143. // 数据统计依赖表
  1144. getCountrelayList() {
  1145. if (!this.countData.relytableName) return;
  1146. let data = {
  1147. databaseName: this.databaseName,
  1148. databaseType: this.databaseType,
  1149. tableName: this.countData.relytableName,
  1150. };
  1151. let tableComment = this.getTableCommont(
  1152. this.countData.relytableName,
  1153. this.tableList
  1154. );
  1155. // 获取当前表单结构信息
  1156. getListName(data).then((res) => {
  1157. // console.log(res);
  1158. this.countrelayFieldList = res.map((item, index) => {
  1159. return {
  1160. id: this.countData.countName + "_" + item.fieldName,
  1161. fieldName: item.fieldName,
  1162. fieldDescription: item.fieldDescription,
  1163. relationTable: "",
  1164. relationFieldName: "",
  1165. relaFieldNameList: [],
  1166. disableRelaFieldName: false,
  1167. relationType: "",
  1168. relationShowField: [],
  1169. relationShowFiledList: [],
  1170. isShowRelaDialog: false, //关联关系弹窗
  1171. relaData: {}, //关联数据
  1172. disableRelaType: false,
  1173. isShow: false,
  1174. isSearch: false,
  1175. isExport: true,
  1176. relationTableList: this.relationTableList,
  1177. tableName: this.countData.relytableName,
  1178. tableComment,
  1179. relationFieldList: [],
  1180. };
  1181. });
  1182. });
  1183. },
  1184. // 关联字典字段
  1185. async getDictType() {
  1186. let data = {
  1187. isEnablePaging: false,
  1188. };
  1189. let res = await listType(data);
  1190. // console.log('字典数据', res);
  1191. this.countDicts = res.rows;
  1192. },
  1193. // 关联子表名
  1194. subNameHandler(val) {
  1195. this.subTableName = val;
  1196. },
  1197. // 统计状态 表名
  1198. statusTableHandler(val) {
  1199. this.countData.countName = val;
  1200. },
  1201. // 关联子表字段
  1202. filedListHandler(list) {
  1203. this.subFiledList = list;
  1204. },
  1205. // 数据统计字段
  1206. statusFieldListHandler(list) {
  1207. this.statusFieldList = list;
  1208. this.countFieldList = list;
  1209. },
  1210. // 关联子表
  1211. subFormDataHandler(data) {
  1212. this.subformData = data;
  1213. },
  1214. /** 查询列表 */
  1215. getList(queryParams) {
  1216. if (!this.tableName) return;
  1217. let data = {
  1218. databaseName: this.databaseName,
  1219. databaseType: this.databaseType,
  1220. tableName: this.tableName,
  1221. };
  1222. let tableComment = this.getTableCommont(this.tableName, this.tableList);
  1223. // 获取当前表单结构信息
  1224. getListName(data).then((res) => {
  1225. // console.log(res);
  1226. this.tableFieldList = res.map((item, index) => {
  1227. return {
  1228. id: this.tableName + "_" + item.fieldName,
  1229. fieldName: item.fieldName,
  1230. fieldDescription: item.fieldDescription,
  1231. relationTable: "",
  1232. relationFieldName: "",
  1233. relaFieldNameList: [],
  1234. disableRelaFieldName: false,
  1235. relationType: "",
  1236. relationShowField: [],
  1237. relationShowFiledList: [],
  1238. disableRelaType: false,
  1239. isShow: false,
  1240. isShowRelaDialog: false, //关联关系弹窗
  1241. relaData: "", //关联数据
  1242. isSearch: false,
  1243. isExport: true,
  1244. relationTableList: this.relationTableList,
  1245. tableName: this.tableName,
  1246. tableComment,
  1247. relationFieldList: [],
  1248. };
  1249. });
  1250. // console.log(this.tableFieldList);
  1251. });
  1252. },
  1253. // 依赖表字段
  1254. getrelalist() {
  1255. if (!this.formData.relytableName) return;
  1256. let data = {
  1257. databaseName: this.databaseName,
  1258. databaseType: this.databaseType,
  1259. tableName: this.formData.relytableName,
  1260. };
  1261. let tableComment = this.getTableCommont(
  1262. this.formData.relytableName,
  1263. this.tableList
  1264. );
  1265. // 获取当前表单结构信息
  1266. getListName(data).then((res) => {
  1267. // console.log(res);
  1268. this.relaytableField = res.map((item, index) => {
  1269. return {
  1270. id: this.formData.relytableName + "_" + item.fieldName,
  1271. fieldName: item.fieldName,
  1272. fieldDescription: item.fieldDescription,
  1273. relationTable: "",
  1274. relationFieldName: "",
  1275. relaFieldNameList: [],
  1276. disableRelaFieldName: false,
  1277. relationType: "",
  1278. relationShowField: [],
  1279. relationShowFiledList: [],
  1280. disableRelaType: false,
  1281. isShow: false,
  1282. isShowRelaDialog: false, //关联关系弹窗
  1283. relaData: "", //关联数据
  1284. isSearch: false,
  1285. isExport: true,
  1286. relationTableList: this.relationTableList,
  1287. tableName: this.formData.relytableName,
  1288. tableComment,
  1289. relationFieldList: [],
  1290. };
  1291. });
  1292. // console.log(this.relayField);
  1293. });
  1294. },
  1295. // 依赖表格
  1296. getrelyList() {
  1297. // console.log(this.formData.relytableName);
  1298. this.dragTableList.forEach((item) => {
  1299. if (this.formData.relytableName == item.dtName) {
  1300. this.dragTableFilds = JSON.parse(item.dtColumnName);
  1301. }
  1302. });
  1303. this.dragTableFilds.forEach((item) => {
  1304. for (let val in item) {
  1305. item.key = val;
  1306. item.val = item[val];
  1307. }
  1308. });
  1309. },
  1310. // 依赖表格
  1311. getCountrelyList() {
  1312. if (this.countdragTableList) {
  1313. this.countdragTableList?.forEach((item) => {
  1314. // console.log(this.countData.relytableName);
  1315. if (this.countData.relytableName == item.dtName) {
  1316. this.countdragTableFilds = JSON.parse(item.dtColumnName);
  1317. }
  1318. });
  1319. this.countdragTableFilds?.forEach((item) => {
  1320. for (let val in item) {
  1321. item.key = val;
  1322. item.val = item[val];
  1323. }
  1324. });
  1325. }
  1326. },
  1327. // 依赖表格列表数据
  1328. getdragTable() {
  1329. let queryParams = {
  1330. isEnablePaging: false,
  1331. dtType: 0,
  1332. };
  1333. listTable(queryParams).then((res) => {
  1334. this.dragTableList = res.rows;
  1335. this.countdragTableList = res.rows;
  1336. });
  1337. },
  1338. // 关联表变化回调
  1339. async ralationTableChange(row) {
  1340. this.tableFieldList = this.tableFieldList.filter((item) => {
  1341. return !row.relationFieldList.some((val) => {
  1342. return val.id == item.id;
  1343. });
  1344. });
  1345. row.relationFieldName = "";
  1346. row.relationType = "";
  1347. row.disableRelaFieldName = false;
  1348. row.disableRelaType = false;
  1349. row.relationFieldList = [];
  1350. if (!row.relationTable) {
  1351. return;
  1352. }
  1353. // 获取关联表的字段
  1354. let data = {
  1355. databaseName: this.databaseName,
  1356. databaseType: this.databaseType,
  1357. tableName: row.relationTable,
  1358. };
  1359. let tableComment = this.getTableCommont(
  1360. row.relationTable,
  1361. this.tableList
  1362. );
  1363. let res = await getListName(data);
  1364. // 关联字段下拉列表数据
  1365. row.relaFieldNameList = res.map((item) => {
  1366. return {
  1367. fieldName: item.fieldName,
  1368. fieldDescription: item.fieldDescription,
  1369. };
  1370. });
  1371. let relationTableList = row.relationTableList.filter(
  1372. (item) => row.relationTable != item.tableName
  1373. );
  1374. row.relationFieldList = row.relaFieldNameList.map((item, index) => {
  1375. return {
  1376. id: row.relationTable + "_" + item.fieldName,
  1377. fieldName: item.fieldName,
  1378. fieldDescription: item.fieldDescription,
  1379. relationTable: "",
  1380. relationFieldName: "",
  1381. relaFieldNameList: [],
  1382. disableRelaFieldName: false,
  1383. relationType: "",
  1384. relationShowField: [],
  1385. relationShowFiledList: [],
  1386. disableRelaType: false,
  1387. isShowRelaDialog: false, //关联关系弹窗
  1388. relaData: "", //关联数据
  1389. isShow: false,
  1390. isSearch: false,
  1391. isExport: true,
  1392. relationTableList,
  1393. tableName: row.relationTable,
  1394. tableComment,
  1395. relationFieldList: [],
  1396. isChildren: true,
  1397. };
  1398. });
  1399. // this.tableFieldList = [...this.tableFieldList, ...row.relationFieldList];
  1400. row.disableRelaFieldName = true;
  1401. },
  1402. // 关联类型变化回调
  1403. relationTypeChangeHandler(row) {
  1404. let tempRelationFieldList = row.relationFieldList.filter((item) => {
  1405. return !this.tableFieldList.find((val) => val.id === item.id);
  1406. });
  1407. this.tableFieldList = [...this.tableFieldList, ...tempRelationFieldList];
  1408. },
  1409. // 关联字段回调
  1410. relationFieldChange(row) {
  1411. if (!row.relationFieldName) {
  1412. row.relationType = "";
  1413. row.disableRelaType = false;
  1414. row.relaFieldNameList = [];
  1415. return;
  1416. }
  1417. row.disableRelaType = true;
  1418. },
  1419. // 勾选框回调
  1420. handleSelectionChange(selection) {
  1421. this.ids = selection.map((item) => item.id);
  1422. // this.single = selection.length != 1;
  1423. this.multiple = !selection.length;
  1424. },
  1425. // 分页查询
  1426. pageList(row) {
  1427. this.$refs.mychild.pageList(
  1428. row == undefined
  1429. ? {
  1430. limit: this.queryParams.pageSize,
  1431. page: this.queryParams.pageNum,
  1432. }
  1433. : row
  1434. );
  1435. },
  1436. // 多选框改变回调
  1437. checkedChangeHandle(val) {},
  1438. // 获取所有表格
  1439. async getAllTable() {
  1440. let data = {
  1441. databaseName: this.databaseName,
  1442. databaseType: this.databaseType,
  1443. };
  1444. let res = await getFormName(data);
  1445. const baseTable = await this.getDicts("base_table");
  1446. this.tableList = res.data.filter((item) => {
  1447. return !baseTable.data.some(
  1448. (value) =>
  1449. value.dictValue.toLowerCase() == item.tableName.toLowerCase()
  1450. );
  1451. });
  1452. },
  1453. //处理表格行拖拽
  1454. initDragTable() {
  1455. const el = this.$refs.dragTable.$el.querySelectorAll(
  1456. ".el-table__body-wrapper > table > tbody"
  1457. )[0];
  1458. const sortable = Sortable.create(el, {
  1459. handle: ".allowDrag",
  1460. onEnd: (evt) => {
  1461. const targetRow = this.tableFieldList.splice(evt.oldIndex, 1)[0];
  1462. this.tableFieldList.splice(evt.newIndex, 0, targetRow);
  1463. for (let index in this.tableFieldList) {
  1464. this.tableFieldList[index].sort = parseInt(index) + 1;
  1465. }
  1466. },
  1467. });
  1468. },
  1469. // 校验字段合法性(递归版)
  1470. validateField(tableFieldList, validateParams) {
  1471. if (!tableFieldList.length) {
  1472. return;
  1473. }
  1474. for (let i = 0; i < tableFieldList.length; i++) {
  1475. let temp = tableFieldList[i];
  1476. if (!temp.fieldDescription?.trim() && temp.isShow) {
  1477. //描述字段不能为空
  1478. validateParams.isFieldDescrib = true;
  1479. }
  1480. if (
  1481. temp.relationTable &&
  1482. (!temp.relationFieldName || !temp.relationType)
  1483. ) {
  1484. // 关联条件不足
  1485. validateParams.isRelationFieldAll = true;
  1486. }
  1487. if (temp.relationFieldList.length) {
  1488. this.validateField(temp.relationFieldList, validateParams);
  1489. }
  1490. }
  1491. },
  1492. // 校验字段合法性(非递归版)
  1493. validateTableData(tableFieldList) {
  1494. if (!tableFieldList.length) {
  1495. return {
  1496. val: false,
  1497. meg: "字段个数不能为空",
  1498. };
  1499. }
  1500. for (let i = 0; i < tableFieldList.length; i++) {
  1501. let temp = tableFieldList[i];
  1502. if (!temp.fieldDescription?.trim() && temp.isShow) {
  1503. return {
  1504. val: false,
  1505. msg: "显示的字段,字段描述不能为空",
  1506. };
  1507. }
  1508. if (
  1509. temp.relationTable &&
  1510. (!temp.relationFieldName || !temp.relationType)
  1511. ) {
  1512. return {
  1513. val: false,
  1514. msg: "关联条件不足,请完善关联条件",
  1515. };
  1516. }
  1517. }
  1518. if (tableFieldList.filter((item) => item.isShow).length == 0) {
  1519. return {
  1520. val: false,
  1521. msg: "显示的字段数不能为空",
  1522. };
  1523. }
  1524. // if (
  1525. // tableFieldList.filter((item) => item.isExport && !item.isChildren)
  1526. // .length == 0
  1527. // ) {
  1528. // return {
  1529. // val: false,
  1530. // msg: "导出字段中至少应有一个主表字段",
  1531. // };
  1532. // }
  1533. // 导出的字段的描述不能重复
  1534. // let describeArr = tableFieldList
  1535. // .filter((item) => item.isExport)
  1536. // .map((item) => item.fieldDescription);
  1537. // let isRepeat = false;
  1538. // describeArr.map((item) => {
  1539. // if (describeArr.indexOf(item) != describeArr.lastIndexOf(item)) {
  1540. // isRepeat = true;
  1541. // }
  1542. // });
  1543. // if (isRepeat) {
  1544. // return {
  1545. // val: false,
  1546. // msg: "导出的字段描述不能重复",
  1547. // };
  1548. // }
  1549. return {
  1550. val: true,
  1551. msg: "",
  1552. };
  1553. },
  1554. // 递归拼接查询语句
  1555. getSQLString(
  1556. tableFieldList,
  1557. fieldArr,
  1558. tableArr,
  1559. sqlType = "mysql",
  1560. formData
  1561. ) {
  1562. let prefix = "{DBNAME}.";
  1563. let asOrSpace = sqlType == "oracle" ? " " : " AS ";
  1564. for (let i = 0; i < tableFieldList.length; i++) {
  1565. let temp = tableFieldList[i];
  1566. if (temp.isShow) {
  1567. let tempArr = prefix + temp.tableName + "." + temp.fieldName;
  1568. if (temp.isChildren) {
  1569. tempArr += asOrSpace + temp.tableName + "_" + temp.fieldName;
  1570. }
  1571. fieldArr.push(tempArr);
  1572. }
  1573. if (temp.relationTable && temp.relationFieldName && temp.relationType) {
  1574. let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
  1575. tableArr.push(
  1576. temp.relationType +
  1577. " " +
  1578. isNeedUsername +
  1579. prefix +
  1580. temp.relationTable +
  1581. asOrSpace +
  1582. temp.relationTable +
  1583. " ON " +
  1584. prefix +
  1585. temp.relationTable +
  1586. "." +
  1587. temp.relationFieldName +
  1588. " = " +
  1589. prefix +
  1590. temp.tableName +
  1591. "." +
  1592. temp.fieldName
  1593. );
  1594. }
  1595. }
  1596. // 如果主键不包含显示,则添加至sql语句中
  1597. let isNotInclude = formData.primaryKeyList.find(
  1598. (val) => !val.isShow && val.fieldName == formData.primaryKey
  1599. );
  1600. if (isNotInclude) {
  1601. fieldArr.push(
  1602. prefix + isNotInclude.tableName + "." + isNotInclude.fieldName
  1603. );
  1604. }
  1605. },
  1606. // 递归拼接查询语句
  1607. getSQLCountString(tableFieldList, fieldArr, tableArr, sqlType = "mysql") {
  1608. let prefix = "{DBNAME}.";
  1609. let asOrSpace = sqlType == "oracle" ? " " : " AS ";
  1610. for (let i = 0; i < tableFieldList.length; i++) {
  1611. let temp = tableFieldList[i];
  1612. if (temp.isShow) {
  1613. let tempArr = prefix + temp.tableName + "." + temp.fieldName;
  1614. if (temp.isChildren) {
  1615. tempArr += asOrSpace + temp.tableName + "_" + temp.fieldName;
  1616. }
  1617. fieldArr.push(tempArr);
  1618. }
  1619. if (temp.relationTable && temp.relationFieldName && temp.relationType) {
  1620. let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
  1621. tableArr.push(
  1622. temp.relationType +
  1623. " " +
  1624. isNeedUsername +
  1625. prefix +
  1626. temp.relationTable +
  1627. asOrSpace +
  1628. temp.relationTable +
  1629. " ON " +
  1630. prefix +
  1631. temp.relationTable +
  1632. "." +
  1633. temp.relationFieldName +
  1634. " = " +
  1635. prefix +
  1636. temp.tableName +
  1637. "." +
  1638. temp.fieldName
  1639. );
  1640. }
  1641. }
  1642. // 如果主键不包含显示,则添加至sql语句中
  1643. let isNotInclude = this.countPrimaryKeyList.find(
  1644. (val) => !val.isShow && val.fieldName == this.countData.primaryKey
  1645. );
  1646. if (isNotInclude) {
  1647. fieldArr.push(
  1648. prefix + isNotInclude.tableName + "." + isNotInclude.fieldName
  1649. );
  1650. }
  1651. },
  1652. // 拼接查询sql语句
  1653. getSQLStr() {
  1654. let prefix = "{DBNAME}.";
  1655. let sqlType = this.databaseType; //数据库类型
  1656. // let sqlType = "oracle";
  1657. let sql = "";
  1658. // mysql
  1659. sql += "SELECT ";
  1660. let fieldNameArr = [],
  1661. relaTypeArr = [];
  1662. this.getSQLString(
  1663. this.tableFieldList,
  1664. fieldNameArr,
  1665. relaTypeArr,
  1666. sqlType,
  1667. {
  1668. ...this.formData,
  1669. primaryKeyList: this.primaryKeyList,
  1670. }
  1671. );
  1672. let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
  1673. let asOrSpace = sqlType == "oracle" ? " " : " AS ";
  1674. sql +=
  1675. fieldNameArr.join(",") +
  1676. " FROM " +
  1677. isNeedUsername +
  1678. prefix +
  1679. this.tableName +
  1680. asOrSpace +
  1681. this.tableName;
  1682. if (relaTypeArr.length) {
  1683. sql += " " + relaTypeArr.join(" ");
  1684. }
  1685. return sql;
  1686. },
  1687. // 拼接查询sql语句
  1688. getSQLStr2() {
  1689. let prefix = "{DBNAME}.";
  1690. let sqlType = this.databaseType; //数据库类型
  1691. // let sqlType = "oracle";
  1692. let sql = "";
  1693. // mysql
  1694. sql += "SELECT ";
  1695. let fieldNameArr = [],
  1696. relaTypeArr = [];
  1697. console.log(this.subFiledList);
  1698. this.getSQLString(
  1699. this.subFiledList,
  1700. fieldNameArr,
  1701. relaTypeArr,
  1702. sqlType,
  1703. this.subformData
  1704. );
  1705. console.log(fieldNameArr);
  1706. let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
  1707. let asOrSpace = sqlType == "oracle" ? " " : " AS ";
  1708. sql +=
  1709. fieldNameArr.join(",") +
  1710. " FROM " +
  1711. isNeedUsername +
  1712. prefix +
  1713. this.subTableName +
  1714. asOrSpace +
  1715. this.subTableName;
  1716. if (relaTypeArr.length) {
  1717. sql += " " + relaTypeArr.join(" ");
  1718. }
  1719. return sql;
  1720. },
  1721. // 拼接数据统计查询sql
  1722. getSQLStr3(fieldList, tableName) {
  1723. let prefix = "{DBNAME}.";
  1724. let sqlType = this.databaseType; //数据库类型
  1725. // let sqlType = "oracle";
  1726. let sql = "";
  1727. // mysql
  1728. sql += "SELECT ";
  1729. let fieldNameArr = [],
  1730. relaTypeArr = [];
  1731. this.countData.primaryKeyList = fieldList.filter(
  1732. (item) => !item.isChildren
  1733. );
  1734. this.getSQLString(
  1735. fieldList,
  1736. fieldNameArr,
  1737. relaTypeArr,
  1738. sqlType,
  1739. this.countData
  1740. );
  1741. console.log(fieldNameArr);
  1742. let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
  1743. let asOrSpace = sqlType == "oracle" ? " " : " AS ";
  1744. sql +=
  1745. fieldNameArr.join(",") +
  1746. " FROM " +
  1747. isNeedUsername +
  1748. prefix +
  1749. tableName +
  1750. asOrSpace +
  1751. tableName;
  1752. if (relaTypeArr.length) {
  1753. sql += " " + relaTypeArr.join(" ");
  1754. }
  1755. return sql;
  1756. },
  1757. // 数据统计sql
  1758. countGetSQLStr(countByFieldList, tableName) {
  1759. let prefix = "{DBNAME}.";
  1760. let sqlType = this.databaseType; //数据库类型
  1761. // let sqlType = "oracle";
  1762. let sql = "";
  1763. // mysql
  1764. sql += "SELECT ";
  1765. let fieldNameArr = [],
  1766. relaTypeArr = [];
  1767. console.log(countByFieldList);
  1768. this.getSQLCountString(
  1769. countByFieldList,
  1770. fieldNameArr,
  1771. relaTypeArr,
  1772. sqlType
  1773. );
  1774. let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
  1775. let asOrSpace = sqlType == "oracle" ? " " : " AS ";
  1776. sql +=
  1777. fieldNameArr.join(",") +
  1778. " FROM " +
  1779. isNeedUsername +
  1780. prefix +
  1781. tableName +
  1782. asOrSpace +
  1783. tableName;
  1784. if (relaTypeArr.length) {
  1785. sql += " " + relaTypeArr.join(" ");
  1786. }
  1787. return sql;
  1788. },
  1789. // 统计信息
  1790. getStaticSQL(key) {
  1791. let prefix = "{DBNAME}.";
  1792. let sqlType = this.databaseType; //数据库类型
  1793. // let sqlType = "oracle";
  1794. let sql = "";
  1795. // mysql
  1796. sql += "SELECT ";
  1797. let fieldNameArr = [],
  1798. relaTypeArr = [];
  1799. this.getSQLString(this.subFiledList, fieldNameArr, relaTypeArr, sqlType, {
  1800. ...this.countData,
  1801. primaryKeyList: this.primaryKeyList,
  1802. });
  1803. let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
  1804. let asOrSpace = sqlType == "oracle" ? " " : " AS ";
  1805. sql +=
  1806. key +
  1807. " FROM " +
  1808. isNeedUsername +
  1809. prefix +
  1810. this.subTableName +
  1811. asOrSpace +
  1812. this.subTableName;
  1813. if (relaTypeArr.length) {
  1814. sql += " " + relaTypeArr.join(" ");
  1815. }
  1816. return sql;
  1817. },
  1818. // 统计状态
  1819. getstateSQL(formName, fieldName) {
  1820. let prefix = "{DBNAME}.";
  1821. let sqlType = this.databaseType; //数据库类型
  1822. // let sqlType = "oracle";
  1823. let sql = "";
  1824. // mysql
  1825. sql += "SELECT ";
  1826. let fieldNameArr = [],
  1827. relaTypeArr = [];
  1828. this.getSQLString(this.subFiledList, fieldNameArr, relaTypeArr, sqlType, {
  1829. ...this.formData,
  1830. primaryKeyList: this.primaryKeyList,
  1831. });
  1832. let isNeedUsername = sqlType == "oracle" ? this.username + "." : "";
  1833. let asOrSpace = sqlType == "oracle" ? " " : " AS ";
  1834. sql +=
  1835. fieldName +
  1836. " FROM " +
  1837. isNeedUsername +
  1838. prefix +
  1839. formName +
  1840. asOrSpace +
  1841. formName;
  1842. if (relaTypeArr.length) {
  1843. sql += " " + relaTypeArr.join(" ");
  1844. }
  1845. return sql;
  1846. },
  1847. // 处理列表信息
  1848. columnsHandler(columns) {
  1849. let resArr = [];
  1850. columns.forEach((item) => {
  1851. for (const key in item) {
  1852. let tempObj = {};
  1853. tempObj.key = key;
  1854. tempObj.value = item[key];
  1855. resArr.push(tempObj);
  1856. }
  1857. });
  1858. return resArr;
  1859. },
  1860. // 依赖关系改变回调
  1861. isShowRelaDialogHandler(row) {
  1862. let isShow = row.isShowRelaDialog;
  1863. if (isShow) {
  1864. console.log(isShow);
  1865. this.row = row;
  1866. this.$refs.relayRef.openHandlder();
  1867. } else {
  1868. this.row = null;
  1869. }
  1870. console.log(row);
  1871. },
  1872. // 保存依赖结果
  1873. saveRelayRes(res) {
  1874. if (res.flag) {
  1875. this.row.relaData = res.data;
  1876. } else {
  1877. this.row.isShowRelaDialog = false;
  1878. }
  1879. },
  1880. // 下划线命名转驼峰命名
  1881. toUpperCase(str) {
  1882. let nstr = str.replace(/(?:_)+([^_])/g, function ($0, $1) {
  1883. return $1.toUpperCase();
  1884. });
  1885. nstr = nstr.replace(nstr[0], nstr[0].toLowerCase());
  1886. return nstr;
  1887. },
  1888. // 递归获取列表信息
  1889. getCol(
  1890. tableFieldList,
  1891. columns,
  1892. searchFieldList = [],
  1893. tableExportField = {}
  1894. ) {
  1895. if (!tableFieldList.length) return;
  1896. for (let i = 0; i < tableFieldList.length; i++) {
  1897. let temp = tableFieldList[i];
  1898. let tempFieldName = "",
  1899. exportFieldName = "";
  1900. if (temp.isChildren) {
  1901. tempFieldName = temp.tableName + "_" + temp.fieldName;
  1902. exportFieldName = temp.tableName + "@" + temp.fieldName;
  1903. } else {
  1904. tempFieldName = temp.fieldName;
  1905. exportFieldName = temp.fieldName;
  1906. }
  1907. if (temp.isShow) {
  1908. let tempObj = {};
  1909. tempObj[tempFieldName] = temp.fieldDescription;
  1910. columns.push(tempObj);
  1911. }
  1912. if (temp.isSearch) {
  1913. searchFieldList.push(temp.tableName + "." + temp.fieldName);
  1914. }
  1915. if (temp.isExport) {
  1916. tableExportField[exportFieldName] = temp.fieldDescription;
  1917. }
  1918. }
  1919. },
  1920. // 预览结果回调
  1921. async previewHandle() {
  1922. this.$refs.formData.validate(async (valid) => {
  1923. // 至少包含一个查询项
  1924. if (valid) {
  1925. if (!this.tableName) {
  1926. this.$message.error("请选择数据表");
  1927. return;
  1928. }
  1929. // 检验表单合法性
  1930. let validRes = this.validateTableData(this.tableFieldList);
  1931. if (!validRes.val) {
  1932. this.$message.error(validRes.msg);
  1933. return;
  1934. }
  1935. // 拼接预览的sql查询语句
  1936. this.queryParams.basicMap.sql = this.getSQLStr();
  1937. // 获取表头信息
  1938. let tempColumns = [],
  1939. searchFieldList = [];
  1940. this.getCol(this.tableFieldList, tempColumns, searchFieldList);
  1941. if (!searchFieldList.length) {
  1942. this.$message.warning("请至少选择一个包含查询字段");
  1943. return false;
  1944. }
  1945. const dataType = await this.getDicts("table_statistic_type");
  1946. this.deepragTableStatisticList = JSON.parse(
  1947. JSON.stringify(this.dragTableStatisticList)
  1948. );
  1949. this.deepragTableStatisticList.forEach((item) => {
  1950. dataType.data.forEach((val) => {
  1951. if (val.dictValue == item.statisticType) {
  1952. item.statisticType = val.dictLabel;
  1953. }
  1954. });
  1955. });
  1956. this.columns = this.columnsHandler(tempColumns);
  1957. this.queryParams.isAsc = this.formData.isAsc;
  1958. // 发送请求获取预览数据
  1959. let res = await dragTablePreview(this.queryParams);
  1960. this.tableDataList = [];
  1961. res.rows.forEach((item) => {
  1962. this.tableDataList.push(item.resultMap);
  1963. });
  1964. this.total = res.total;
  1965. this.isShowPreview = true;
  1966. } else {
  1967. this.$message.warning("请完善表单");
  1968. return false;
  1969. }
  1970. });
  1971. },
  1972. // 获取依赖条件对象
  1973. getRelaObjAndSearchList(fieldList = []) {
  1974. console.log(fieldList);
  1975. let res = {
  1976. relaObj: {},
  1977. searchList: [],
  1978. };
  1979. fieldList.forEach((item) => {
  1980. if (item.isShowRelaDialog) {
  1981. // let { tableName as tName,fieldName} = item;
  1982. let { tableName, fieldName } = item.relaData;
  1983. res.relaObj[item.tableName + "." + item.fieldName] =
  1984. "#{" + tableName + "." + fieldName;
  1985. res.searchList.push(item.tableName + "." + item.fieldName);
  1986. }
  1987. });
  1988. return res;
  1989. },
  1990. // 创建回调
  1991. async createHandle() {
  1992. this.isInputInvalid = true;
  1993. this.$refs.formData.validate(async (valid) => {
  1994. if (valid) {
  1995. // 检验表单合法性
  1996. let validRes = this.validateTableData(this.tableFieldList);
  1997. if (!validRes.val) {
  1998. this.$message.error(validRes.msg);
  1999. return;
  2000. }
  2001. let relyName = "";
  2002. let subrelayName = "";
  2003. // 基础信息关联
  2004. let searchData = this.getRelaObjAndSearchList(this.tableFieldList);
  2005. let conditionDefault = searchData.relaObj;
  2006. // 基础信息tableKey
  2007. let table1tableKey = uuidv4();
  2008. // 处理基础信息列数据
  2009. let columns1 = [];
  2010. // 基础信息查询条件
  2011. let searchFieldList1 = searchData.searchList;
  2012. this.getCol(this.tableFieldList, columns1);
  2013. // 基础信息回显
  2014. let echoData = {
  2015. tableName: this.tableName,
  2016. tableFieldData: this.tableFieldList,
  2017. formData: this.formData,
  2018. };
  2019. // 处理基础信息依赖表
  2020. // this.dragTableList.forEach((item) => {
  2021. // if (item.dtName == this.formData.relytableName) {
  2022. // relyName = item.dtTableName;
  2023. // }
  2024. // });
  2025. // console.log(this.dragTableList);
  2026. // return;
  2027. // 基础信息判断表格依赖方式
  2028. // if (this.formData.relyOption === "0") {
  2029. // conditionDefault[this.formData.relyFile] = this.relayValue;
  2030. // } else {
  2031. // conditionDefault[this.formData.relyFile] =
  2032. // "#{" + relyName + "." + this.formData.relaykey;
  2033. // }
  2034. // 基础信息查询条件
  2035. // searchFieldList1.push(this.formData.relyFile);
  2036. // 基础信息请求数据接口
  2037. let tableList1 = {
  2038. tId: this.tId,
  2039. tableKey: table1tableKey, // 暂定
  2040. dtTableName: this.tableName,
  2041. primaryKey: this.formData.primaryKey,
  2042. orderByColumn: this.formData.orderByColumn,
  2043. sortOrder: this.formData.isAsc,
  2044. sqlKey: uuidv4(),
  2045. dtColumnName: columns1, //列字
  2046. timeFormat: this.formData.timeFormate,
  2047. searchFieldList: searchFieldList1, //搜索字段数组
  2048. tableSql: this.getSQLStr(), // 暂定
  2049. echoData: JSON.stringify(echoData),
  2050. conditionDefaultValueMap: conditionDefault,
  2051. };
  2052. console.log(tableList1.tableKey, this.formData.btnGroupList);
  2053. // 基础信息绑定按钮
  2054. tableList1.dragTableBtnRelevanceList = this.getBtnMapList(
  2055. tableList1.tableKey,
  2056. this.formData.btnGroupList
  2057. );
  2058. // 关联子表回显
  2059. let subTableData = this.$refs.subList.getTableInfo();
  2060. this.subFiledList = subTableData.fieldInfo;
  2061. let echoData2 = {
  2062. tableName: subTableData.tableName,
  2063. tableFieldData: subTableData.fieldInfo,
  2064. // tableName: this.subTableName,
  2065. // tableFieldData: this.subFiledList,
  2066. formData: this.subformData,
  2067. };
  2068. // 处理关联子表依赖表
  2069. this.dragTableList.forEach((item) => {
  2070. if (item.dtName == this.subformData.relytableName) {
  2071. subrelayName = item.dtTableName;
  2072. }
  2073. });
  2074. let tempSubData = this.getRelaObjAndSearchList(
  2075. subTableData.fieldInfo
  2076. );
  2077. let subCondition = tempSubData.relaObj;
  2078. // 判断表格依赖方式
  2079. // if (this.subformData.relyOption === "0") {
  2080. // subCondition[this.subformData.relyFile] =
  2081. // this.subformData.relayValue;
  2082. // } else {
  2083. // subCondition[this.subformData.relyFile] =
  2084. // "#{" + subrelayName + "." + this.subformData.relaykey;
  2085. // }
  2086. // 关联子表类信息
  2087. let columns2 = [],
  2088. searchFieldList2 = tempSubData.searchList;
  2089. this.getCol(this.subFiledList, columns2);
  2090. let table2tableKey = uuidv4();
  2091. // searchFieldList2.push(this.subformData.relyFile);
  2092. // 关联子表请求数据
  2093. let tableList2 = {
  2094. tId: this.tId,
  2095. tableKey: table2tableKey, // 暂定
  2096. dtTableName: subTableData.tableName,
  2097. primaryKey: this.subformData.primaryKey,
  2098. orderByColumn: this.subformData.orderByColumn,
  2099. sortOrder: this.subformData.isAsc,
  2100. statisticTitle: this.subformData.title,
  2101. sqlKey: uuidv4(),
  2102. dtColumnName: columns2, //列字
  2103. timeFormat: this.subformData.timeFormate,
  2104. searchFieldList: searchFieldList2, //搜索字段数组
  2105. tableSql: this.getSQLStr2(), // 暂定
  2106. echoData: JSON.stringify(echoData2),
  2107. conditionDefaultValueMap: subCondition,
  2108. };
  2109. console.log(2, tableList2.tableKey, this.subformData.btnGroupList);
  2110. tableList2.dragTableBtnRelevanceList = this.getBtnMapList(
  2111. tableList2.tableKey,
  2112. this.subformData.btnGroupList
  2113. );
  2114. // 统计信息
  2115. let countData = this.$refs.StatusTable?.getTableInfo();
  2116. let countEchoData = {
  2117. formData: this.countData,
  2118. // tableFieldData: this.countFieldList,
  2119. tableFieldData: countData.fieldInfo,
  2120. tableName: countData.tableName,
  2121. };
  2122. let conutrelayName = "";
  2123. // 处理关联子表依赖表
  2124. this.dragTableList.forEach((item) => {
  2125. if (item.dtName == this.countData.relytableName) {
  2126. conutrelayName = item.dtTableName;
  2127. }
  2128. });
  2129. let tempconut = this.getRelaObjAndSearchList(countData.fieldInfo);
  2130. let countFieldLists = tempconut.searchList;
  2131. // countFieldLists.push(this.countData.relyFile);
  2132. let countTableKey = uuidv4();
  2133. let conutCondition = tempconut.relaObj;
  2134. let countColumnName = [];
  2135. this.getCol(countData.fieldInfo, countColumnName);
  2136. // 数据统计表格参数
  2137. let countTableList = {
  2138. tId: this.tId,
  2139. tableKey: countTableKey, // 暂定
  2140. dtTableName: countData.tableName,
  2141. primaryKey: this.countData.primaryKey,
  2142. orderByColumn: "",
  2143. sortOrder: "",
  2144. sqlKey: uuidv4(),
  2145. dtColumnName: countColumnName, //列字
  2146. timeFormat: "",
  2147. searchFieldList: countFieldLists, //搜索字段数组
  2148. // tableSql: this.countGetSQLStr(
  2149. // countData.fieldInfo,
  2150. // countData.tableName
  2151. // ),
  2152. tableSql: this.getSQLStr3(countData.fieldInfo, countData.tableName),
  2153. echoData: JSON.stringify(countEchoData),
  2154. conditionDefaultValueMap: conutCondition,
  2155. };
  2156. // return;
  2157. console.log(3, countTableList.tableKey, this.countData.btnGroupList);
  2158. countTableList.dragTableBtnRelevanceList = this.getBtnMapList(
  2159. countTableList.tableKey,
  2160. this.countData.btnGroupList
  2161. );
  2162. let stateSqlkey = uuidv4();
  2163. let stateList = [
  2164. {
  2165. sqlKey: stateSqlkey,
  2166. statisticTitle: this.countData.title,
  2167. statisticField: this.countData.relaykey,
  2168. statisticType: "等值",
  2169. },
  2170. ];
  2171. let stateSql;
  2172. let stateSqlList = [];
  2173. let stateName = "";
  2174. // console.log(this.dragTableList)
  2175. // console.log(this.dragTableList);
  2176. // 统计状态信息
  2177. let search = [];
  2178. let conditionDefaultValueMap = {};
  2179. stateSqlList.push({
  2180. sqlKey: stateSqlkey,
  2181. tableSql: this.getCountSqlStr(
  2182. this.countGetSQLStr(countData.fieldInfo, countData.tableName),
  2183. countData.tableName
  2184. ),
  2185. });
  2186. this.dragTableList.forEach(async (item) => {
  2187. console.log(item.dtName, this.countData.relytableName);
  2188. if (item.dtName == this.countData.relytableName) {
  2189. // console.log(123);
  2190. const info = await dragTableInfo({
  2191. queryMap: { tableKey: item.tableKey },
  2192. });
  2193. // console.log('info', info);
  2194. let infoSql = info.data.resultMap.querySql.tableSql;
  2195. let state = this.getTableSql(infoSql, this.countData.relaykey);
  2196. // stateSql = state + ' where ' + item.dtTableName + '.' + item.primaryKey + ' = #{' + item.dtTableName + '.' + item.primaryKey
  2197. stateSql = state;
  2198. search.push(item.dtTableName + "." + item.primaryKey);
  2199. // console.log('sql', stateSql);
  2200. conditionDefaultValueMap[
  2201. item.dtTableName + "." + item.primaryKey
  2202. ] = " #{" + item.dtTableName + "." + item.primaryKey;
  2203. stateSqlList = [
  2204. {
  2205. sqlKey: stateSqlkey,
  2206. tableSql: stateSql,
  2207. },
  2208. ];
  2209. stateName = item.dtTableName;
  2210. }
  2211. });
  2212. // return;
  2213. // 统计信息
  2214. this.dragTableStatisticList.forEach((item) => {
  2215. if (this.tId == "") {
  2216. item.tableKey = tableList2.tableKey;
  2217. this.staticSqlKey = uuidv4();
  2218. item.sqlKey = this.staticSqlKey;
  2219. }
  2220. if (item.sqlKey) {
  2221. this.staticSqlKey = item.sqlKey;
  2222. } else {
  2223. this.staticSqlKey = uuidv4();
  2224. item.sqlKey = this.staticSqlKey;
  2225. }
  2226. let key =
  2227. item.statisticType +
  2228. "(" +
  2229. item.statisticField +
  2230. ")" +
  2231. " as result";
  2232. this.tableSqlList.push({
  2233. tableSql: this.getStaticSQL(key),
  2234. sqlKey: this.staticSqlKey,
  2235. });
  2236. // this.searchFieldList = searchFieldList;
  2237. });
  2238. let res;
  2239. let res1;
  2240. // 判断修改还是新增
  2241. if (this.tId) {
  2242. // console.log('修改');
  2243. // console.log(this.editData);
  2244. // 基础信息
  2245. tableList1.sqlKey = this.editData.sqlKey;
  2246. tableList1.tableKey = this.editData.tableKey;
  2247. tableList1.tId = this.lists[0].tId;
  2248. console.log(tableList1.dragTableBtnRelevanceList);
  2249. let btnTempList1 = tableList1.dragTableBtnRelevanceList.map(
  2250. (item) => item.btnKey
  2251. );
  2252. tableList1.dragTableBtnRelevanceList = this.getBtnMapList(
  2253. this.editData.tableKey,
  2254. btnTempList1
  2255. );
  2256. // 关联子表
  2257. tableList2.tableKey = this.subEchoData.tableKey;
  2258. tableList2.sqlKey = this.subEchoData.sqlKey;
  2259. tableList2.tId = this.lists[1].tId;
  2260. let btnTempList2 = tableList2.dragTableBtnRelevanceList.map(
  2261. (item) => item.btnKey
  2262. );
  2263. tableList2.dragTableBtnRelevanceList = this.getBtnMapList(
  2264. this.subEchoData.tableKey,
  2265. btnTempList2
  2266. );
  2267. // 数据统计
  2268. console.log(this.countEchoData);
  2269. countTableList.tableKey = this.countEchoData.tableKey;
  2270. countTableList.sqlKey = this.countEchoData.sqlKey;
  2271. let btnTempList3 = countTableList.dragTableBtnRelevanceList.map(
  2272. (item) => item.btnKey
  2273. );
  2274. countTableList.dragTableBtnRelevanceList = this.getBtnMapList(
  2275. this.countEchoData.tableKey,
  2276. btnTempList3
  2277. );
  2278. countTableList.tId = this.lists[2].tId;
  2279. let data = {
  2280. id: this.tId,
  2281. groupType: 1,
  2282. groupKey: this.groupKey,
  2283. groupName: this.formData.groupName,
  2284. groupDescription: this.formData.groupDescription,
  2285. groupTableInfo: [],
  2286. dragTables: [],
  2287. };
  2288. data.groupTableInfo.push(
  2289. {
  2290. tableKey: tableList1.tableKey,
  2291. sort: 0,
  2292. },
  2293. {
  2294. tableKey: tableList2.tableKey,
  2295. sort: 1,
  2296. },
  2297. {
  2298. tableKey: countTableList.tableKey,
  2299. sort: 2,
  2300. }
  2301. );
  2302. data.groupTableInfo = JSON.stringify(data.groupTableInfo);
  2303. data.dragTables.push(tableList1, tableList2, countTableList);
  2304. res = await undataDialogGroup(data);
  2305. this.dragTableStatisticList.forEach((item) => {
  2306. item.tableKey = this.subEchoData.tableKey;
  2307. });
  2308. console.log("回显", this.statusCount);
  2309. // stateList.forEach((item) => {
  2310. // item.id = this.statusCount.id;
  2311. // item.sqlKey = this.statusCount.sqlKey;
  2312. // item.tableKey = this.statusCount.tableKey;
  2313. // });
  2314. // stateSqlList.forEach((item) => {
  2315. // item.sqlKey = this.statusCount.sqlKey;
  2316. // });
  2317. // 修改统计数据
  2318. await updateGroupTableStatistic({
  2319. tableKey: this.subEchoData.tableKey,
  2320. dragTableStatisticList: this.dragTableStatisticList,
  2321. tableSqlList: this.tableSqlList,
  2322. searchFieldList: searchFieldList2,
  2323. conditionDefaultValueMap: subCondition,
  2324. dtTableName: subTableData.tableName,
  2325. });
  2326. // 修改统计状态
  2327. // await updateGroupTableStatistic({
  2328. // tableKey: this.countEchoData.tableKey,
  2329. // dragTableStatisticList: stateList,
  2330. // tableSqlList: stateSqlList,
  2331. // searchFieldList: countFieldLists,
  2332. // dtTableName: countData.tableName,
  2333. // conditionDefaultValueMap: conutCondition,
  2334. // });
  2335. } else {
  2336. // 统计信息
  2337. let graguuid = uuidv4();
  2338. let statusuuid = uuidv4();
  2339. let uuid = uuidv4();
  2340. this.dragTableStatisticList.forEach((item) => {
  2341. item.tableKey = tableList2.tableKey;
  2342. });
  2343. stateList.forEach((item) => {
  2344. item.tableKey = countTableList.tableKey;
  2345. });
  2346. // 新增操作
  2347. let groupKeyObj = { groupKey: uuid };
  2348. let data = {
  2349. groupType: 1,
  2350. groupKey: groupKeyObj.groupKey,
  2351. groupName: this.formData.groupName,
  2352. groupDescription: this.formData.groupDescription,
  2353. groupTableInfo: [],
  2354. dragTables: [],
  2355. templateType: "composeForm",
  2356. };
  2357. data.groupTableInfo.push(
  2358. {
  2359. tableKey: tableList1.tableKey,
  2360. sort: 0,
  2361. },
  2362. {
  2363. tableKey: tableList2.tableKey,
  2364. sort: 1,
  2365. },
  2366. {
  2367. tableKey: countTableList.tableKey,
  2368. sort: 2,
  2369. }
  2370. );
  2371. data.groupTableInfo = JSON.stringify(data.groupTableInfo);
  2372. data.dragTables.push(tableList1, tableList2, countTableList);
  2373. res = await addDialogGroup(data);
  2374. // 统计数据
  2375. await addGroupTableStatistic({
  2376. tableKey: tableList2.tableKey,
  2377. dragTableStatisticList: this.dragTableStatisticList,
  2378. tableSqlList: this.tableSqlList,
  2379. searchFieldList: searchFieldList2,
  2380. dtTableName: subTableData.tableName,
  2381. conditionDefaultValueMap: subCondition,
  2382. });
  2383. // console.log(stateList);
  2384. // 统计状态
  2385. // await addGroupTableStatistic({
  2386. // tableKey: countTableList.tableKey,
  2387. // dragTableStatisticList: stateList,
  2388. // tableSqlList: stateSqlList,
  2389. // searchFieldList: countFieldLists,
  2390. // dtTableName: countData.tableName,
  2391. // conditionDefaultValueMap: conutCondition,
  2392. // });
  2393. }
  2394. if (this.tId) {
  2395. if (res.code == 200) {
  2396. this.$message.success("修改成功");
  2397. } else {
  2398. this.$message.warning("修改失败");
  2399. }
  2400. this.$tab.closePage();
  2401. this.$router.push({
  2402. path: "/system/fromModel/index/tableDialog",
  2403. });
  2404. } else {
  2405. if (res.code == 200) {
  2406. this.$message.success("创建成功");
  2407. } else {
  2408. this.$message.warning("创建失败");
  2409. }
  2410. this.isShowPreview = false;
  2411. }
  2412. } else {
  2413. this.$message.warning("请完善表单");
  2414. return false;
  2415. }
  2416. });
  2417. },
  2418. // 获取数据统计的sql
  2419. getCountSqlStr(sql, tableName) {
  2420. let tempList = sql.split("FROM");
  2421. return (
  2422. "SELECT " +
  2423. tableName +
  2424. "." +
  2425. this.countData.countFile +
  2426. " as result " +
  2427. " FROM" +
  2428. tempList[1]
  2429. );
  2430. },
  2431. // 按钮
  2432. getBtnMapList(tableKey, btnGroupList) {
  2433. let res = btnGroupList.map((item) => {
  2434. return {
  2435. tableKey,
  2436. btnKey: item,
  2437. };
  2438. });
  2439. return res;
  2440. },
  2441. // 解决回显input不能输入问题
  2442. iptChange() {
  2443. this.$forceUpdate(); //强制刷新
  2444. },
  2445. // 处理统计sql语句
  2446. getTableSql(sql, key, tableName) {
  2447. // console.log(key);
  2448. let Sql;
  2449. let arrSql = sql.split("FROM");
  2450. // console.log(arrSql);
  2451. let fromFields = arrSql[1].split("AS");
  2452. let tableArr = [];
  2453. fromFields.forEach((item, index) => {
  2454. if (index !== 0) {
  2455. let arr = item.trim().split(" ");
  2456. tableArr.push(arr[0]);
  2457. }
  2458. });
  2459. tableArr.forEach((item, index) => {
  2460. if (key.includes(item)) {
  2461. // let keyfileld = keyarr[keyarr]
  2462. let str = key.substring(item.length + 1);
  2463. // Sql = 'SELECT ' + item +'.' + str + 'as result ' + ' FROM' + arrSql[1]
  2464. console.log("表名", this.countData.countName);
  2465. console.log("zidaun", this.countData.countFile);
  2466. Sql =
  2467. "SELECT " +
  2468. tableName +
  2469. "." +
  2470. this.countData.countFile +
  2471. " as result " +
  2472. " FROM" +
  2473. arrSql[1];
  2474. }
  2475. });
  2476. console.log("sql", Sql);
  2477. return Sql;
  2478. },
  2479. // 修改表格回显数据
  2480. async initTableData(tId) {
  2481. let res = await getTable({ id: tId });
  2482. // console.log(res);
  2483. if (res.code == 200) {
  2484. this.groupKey = res.data.groupKey;
  2485. this.lists = res.data.dragTables;
  2486. this.formData.groupName = res.data.groupName;
  2487. this.formData.groupDescription = res.data.groupDescription;
  2488. let groupInfo = JSON.parse(res.data.groupTableInfo);
  2489. this.lists.forEach(async (item) => {
  2490. if (item.tableKey == groupInfo[0].tableKey) {
  2491. this.editData = item;
  2492. // console.log('123',this.editData);
  2493. let echoData = JSON.parse(item.echoData);
  2494. this.tableName = echoData.tableName;
  2495. this.tableFieldList = echoData.tableFieldData;
  2496. let {
  2497. timeFormate,
  2498. orderByColumn,
  2499. isAsc,
  2500. primaryKey,
  2501. btnGroupList,
  2502. relyFile,
  2503. relytableName,
  2504. relaykey,
  2505. relyOption,
  2506. } = echoData.formData;
  2507. Object.assign(this.formData, {
  2508. timeFormate,
  2509. orderByColumn,
  2510. isAsc,
  2511. primaryKey,
  2512. btnGroupList,
  2513. relyFile,
  2514. relytableName,
  2515. relaykey,
  2516. relyOption,
  2517. });
  2518. } else if (item.tableKey == groupInfo[1].tableKey) {
  2519. let res = await getTableInfo(item.tId);
  2520. // console.log('tji', res);
  2521. this.subEchoData = item;
  2522. this.echoData = JSON.parse(item.echoData);
  2523. console.log(this.echoData);
  2524. this.subTableName = this.echoData.tableName;
  2525. this.subFiledList = this.echoData.tableFieldData;
  2526. this.dragTableStatisticList = res.data.dragTableStatisticList;
  2527. } else if (item.tableKey == groupInfo[2].tableKey) {
  2528. let res = await getTableInfo(item.tId);
  2529. console.log("统计", res.data);
  2530. this.statusCount = res.data.dragTableStatisticList[0];
  2531. console.log(this.statusCount);
  2532. // console.log('zhuangt', res);
  2533. let echoData = JSON.parse(item.echoData);
  2534. this.countFieldList = echoData.tableFieldData;
  2535. this.countData.title = this.statusCount?.statisticTitle;
  2536. // this.countData.relaykey = this.statusCount.statisticField
  2537. this.countEchoData = item;
  2538. console.log(JSON.parse(this.countEchoData.echoData));
  2539. // this.dragTableStatisticList = []
  2540. let {
  2541. relaykey,
  2542. btnGroupList,
  2543. countName,
  2544. primaryKey,
  2545. relyFile,
  2546. countFile,
  2547. relytableName,
  2548. } = echoData.formData;
  2549. Object.assign(this.countData, {
  2550. relaykey,
  2551. btnGroupList,
  2552. countName,
  2553. primaryKey,
  2554. relyFile,
  2555. countFile,
  2556. relytableName,
  2557. });
  2558. }
  2559. await this.getdragTable();
  2560. });
  2561. // this.getrelyList();
  2562. // this.getCountrelyList();
  2563. } else {
  2564. this.$message.error("数据回显失败");
  2565. }
  2566. },
  2567. // tab切换
  2568. tabhandleClick(tab, event) {
  2569. this.tabIndex = tab.index;
  2570. console.log(this.tabIndex);
  2571. if (this.tabIndex == "2") {
  2572. // this.getCountrelyList();
  2573. }
  2574. this.menudata = this.activeName != "menuedit" ? true : false;
  2575. },
  2576. // 添加数据字段对话框
  2577. async addDataDialog() {
  2578. this.staictitle = "添加统计数据字段";
  2579. this.isShowAddData = true;
  2580. this.dataType = await this.getDicts("table_statistic_type");
  2581. this.dataType = this.dataType.data;
  2582. // console.log(this.dataType)
  2583. },
  2584. async updataDialog() {
  2585. // console.log(this.dataType)
  2586. },
  2587. // 修改数据字段
  2588. upadtaData() {
  2589. this.dragTableStatisticList.forEach((item, index) => {
  2590. // console.log(this.dataCountFormData);
  2591. if (item.id !== undefined && item.id == this.dataCountFormData.id) {
  2592. this.dragTableStatisticList[index] = this.dataCountFormData;
  2593. } else if (item.xid == this.dataCountFormData.xid) {
  2594. this.dragTableStatisticList[index] = this.dataCountFormData;
  2595. }
  2596. });
  2597. this.isShowAddData = false;
  2598. // console.log(this.dragTableStatisticList)
  2599. this.dataCountFormData = {};
  2600. },
  2601. // 添加数据字段
  2602. addData() {
  2603. // console.log(this.dataCountFormData);
  2604. this.dataCountFormData.xid = Date.now();
  2605. this.dataCountFormData.tableKey = this.tableKey;
  2606. this.dragTableStatisticList.push(this.dataCountFormData);
  2607. this.isShowAddData = false;
  2608. this.dataCountFormData = {};
  2609. },
  2610. // 关闭添加数据字段
  2611. closeAddDialog() {
  2612. this.isShowAddData = false;
  2613. this.dataCountFormData = {};
  2614. },
  2615. // 修改统计信息
  2616. async handleUpdateStat(row) {
  2617. // console.log(row);
  2618. this.dataCountFormData = row;
  2619. this.dataCountFormData.xid = Date.now();
  2620. this.staictitle = "修改统计数据字段";
  2621. this.dataType = await this.getDicts("table_statistic_type");
  2622. this.dataType = this.dataType.data;
  2623. this.isShowAddData = true;
  2624. // console.log(this.dataCountFormData)
  2625. // console.log(this.dragTableStatisticList);
  2626. },
  2627. // 删除统计信息
  2628. handleDeleteStat(row) {
  2629. this.dragTableStatisticList.forEach((item, index) => {
  2630. if (item.id == row.id) {
  2631. this.dragTableStatisticList.splice(index, 1);
  2632. }
  2633. });
  2634. },
  2635. // 获取当前表描述
  2636. getTableCommont(tableName, tableList) {
  2637. return tableList.find((item) => item.tableName == tableName).tableComment;
  2638. },
  2639. // 获取按钮组数据
  2640. async getBtnList() {
  2641. let res = await listBtn({ isEnablePaging: false, btnParentId: 0 });
  2642. this.btnGroupOptions = res.rows.filter((item) => !item.whetherBind);
  2643. },
  2644. },
  2645. created() {},
  2646. async mounted() {
  2647. await this.getAllTable();
  2648. this.getdragTable();
  2649. this.initDragTable();
  2650. this.getBtnList();
  2651. this.getDictType();
  2652. // await this.getMenuList();
  2653. if (this.$route.query.tId) {
  2654. this.tId = this.$route.query.tId;
  2655. this.initTableData(this.tId);
  2656. }
  2657. },
  2658. };
  2659. </script>
  2660. <style scoped lang="scss">
  2661. .ipt {
  2662. height: 36px;
  2663. line-height: 36px;
  2664. font-size: 14px;
  2665. width: 100%;
  2666. outline: none;
  2667. text-align: center;
  2668. background-color: #fff;
  2669. border: 1px solid #dcdfe6;
  2670. color: #606266;
  2671. display: inline-block;
  2672. border-radius: 4px;
  2673. }
  2674. .isNullDesc {
  2675. border-color: #ff4949 !important;
  2676. }
  2677. .ipt:focus {
  2678. border-color: #1890ff;
  2679. }
  2680. ::v-deep .right_card {
  2681. min-height: 500px !important;
  2682. }
  2683. ::v-deep .vue-treeselect--has-value .vue-treeselect__input {
  2684. vertical-align: middle !important;
  2685. }
  2686. .menudata {
  2687. width: 30% !important;
  2688. }
  2689. .edit {
  2690. width: 70% !important;
  2691. }
  2692. .mb10 {
  2693. margin-top: 10px;
  2694. }
  2695. .cardBox {
  2696. display: flex;
  2697. align-content: space-between;
  2698. flex-wrap: wrap;
  2699. align-content: flex-start;
  2700. }
  2701. .card {
  2702. /* width:15%; */
  2703. height: 150px;
  2704. flex-basis: 15%;
  2705. margin-bottom: 10px;
  2706. margin-right: 15px;
  2707. min-width: 180px;
  2708. .title {
  2709. /* width:20%; */
  2710. font-size: 18px;
  2711. margin-bottom: 5px;
  2712. white-space: nowrap;
  2713. overflow: hidden;
  2714. text-overflow: ellipsis;
  2715. }
  2716. .description {
  2717. width: 70%;
  2718. font-size: 13px;
  2719. color: #9699a2;
  2720. overflow: hidden;
  2721. text-overflow: ellipsis;
  2722. display: -webkit-box;
  2723. -webkit-box-orient: vertical;
  2724. -webkit-line-clamp: 3;
  2725. word-break: break-all;
  2726. float: left;
  2727. }
  2728. .type {
  2729. float: right;
  2730. margin-top: 40px;
  2731. .statisticType {
  2732. font-size: 18px;
  2733. }
  2734. }
  2735. .count {
  2736. font-size: 25px;
  2737. }
  2738. }
  2739. .mb8 {
  2740. ::v-deep .el-col-18 {
  2741. width: 30% !important;
  2742. min-width: 220px !important;
  2743. }
  2744. ::v-deep .previewbtn {
  2745. min-width: 190px !important;
  2746. }
  2747. }
  2748. .addcount {
  2749. margin-bottom: 5px;
  2750. }
  2751. </style>