data-market.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293
  1. <template>
  2. <div :class="[$style.wrapHeight, $style.dataclass]">
  3. <div :class="$style.rowHeight">
  4. <div :class="$style.leftcard">
  5. <div :class="$style.leftcardspace">
  6. <audit-class-tree
  7. ref="auditMaintainCatalogTree"
  8. show-line
  9. top-node-text="数据分类维护"
  10. :is-select-dep="true"
  11. :draggable="false"
  12. :auto-expand-parent="showAllTreeNode"
  13. :cate="true"
  14. :tree-data="treeData.financeCategoryTree"
  15. @treeSelect="treeSelect1"
  16. @onChangeSearch="onChangeSearch1"
  17. >领域分类
  18. </audit-class-tree>
  19. </div>
  20. <div :class="$style.leftcardspace">
  21. <div :class="$style.leftcardspacetree">
  22. <audit-class-tree
  23. ref="auditMaintainCatalogTree"
  24. show-line
  25. top-node-text="数据分类维护"
  26. :is-select-dep="true"
  27. :draggable="false"
  28. :cate="true"
  29. :tree-data="treeData.spaceCategoryTree"
  30. @treeSelect="treeSelect"
  31. @onChangeSearch="onChangeSearch"
  32. >我的空间
  33. </audit-class-tree>
  34. </div>
  35. <div :class="$style.leftcardspaceedit">
  36. <a-button type="primary" @click="showisShowSpace">分类管理</a-button>
  37. <a-button type="primary" @click="uploadClick">文件上传</a-button>
  38. </div>
  39. </div>
  40. </div>
  41. <div :class="$style.rightcard">
  42. <a-card style="min-height: 100% ;">
  43. <template v-if="clickType === 'space'">
  44. <SdDataTableEx
  45. :key="key"
  46. ref="dataTableSpace"
  47. :projectlist="true"
  48. data-url="api/xcoa-mobile/v1/file-upload/list"
  49. :editnode="editnode"
  50. form-id="iamUploadFile"
  51. page-id="audit/maintain/iamUploadFile"
  52. :columns="columns"
  53. :actions="actions"
  54. :disable-export-table="true"
  55. :filter-expressions="expressions"
  56. @searchbtnClick="searchbtnClick"
  57. >
  58. <template slot="categoryName" slot-scope="text, record">
  59. <a
  60. v-if="record.editAndDeleteAuth !== 0"
  61. @click="
  62. () => {
  63. $refs.dataTable.showDetailModal(record.id, 'audit/maintain/iamDataCategory')
  64. }
  65. "
  66. >{{ text }}</a
  67. >
  68. <span v-else>{{ text }}</span>
  69. </template>
  70. <!-- 详情表单 -->
  71. </SdDataTableEx>
  72. </template>
  73. <template v-if="clickType === 'finance'">
  74. <div :class="$style.tableHeader">
  75. <!-- <a-form-model layout="inline">
  76. <a-form-model-item label="组织名称:">
  77. <a-input v-model="searchFinaceForm.name"></a-input>
  78. </a-form-model-item>
  79. <a-form-model-item label="日期:">
  80. <a-range-picker @change="onChangeFinace" />
  81. </a-form-model-item>
  82. <a-form-model-item> </a-form-model-item>
  83. </a-form-model>
  84. <a-button type="primary" @click="searchFinace">搜索</a-button> -->
  85. <a-button :disabled="!isExport" type="primary" @click="exportData">数据导出</a-button>
  86. <!-- <a-button>自助建模</a-button> -->
  87. </div>
  88. <!-- <a-table
  89. :class="$style.dataTable"
  90. :scroll="{ x: '100%' }"
  91. :columns="fileViewColumns"
  92. :pagination="{
  93. position: 'bottom',
  94. }"
  95. :data-source="fileViewData"
  96. ></a-table> -->
  97. <sd-table
  98. :columns="fileViewColumns"
  99. :data-source="fileViewData"
  100. :scroll="{ x: '100%' }"
  101. :pagination="{
  102. position: 'bottom',
  103. }"
  104. ></sd-table>
  105. </template>
  106. <template v-if="clickType === 'caiwu'">
  107. <a-form-model layout="inline">
  108. <a-form-model-item label="公司选择:">
  109. <a-cascader
  110. allow-clear
  111. change-on-select
  112. :show-search="true"
  113. :options="groupList"
  114. :field-names="{ label: 'name', value: 'code', children: 'children' }"
  115. placeholder="请选择分类"
  116. @change="handleChange1"
  117. />
  118. </a-form-model-item>
  119. <a-form-model-item label="报表类型:">
  120. <a-cascader
  121. v-model="cascaderReportType"
  122. allow-clear
  123. change-on-select
  124. :options="reportTypeList"
  125. :field-names="{ label: 'name', value: 'code', children: 'children' }"
  126. placeholder="请选择报表类型"
  127. @change="handleChangeReportType"
  128. />
  129. <!-- <a-select
  130. v-model="expressions1[0].stringValue"
  131. allow-clear
  132. :class="$style.caiwuWidth"
  133. placeholder="请输入模型名称"
  134. >
  135. <a-select-option v-for="item in reportTypeList" :key="item" :value="item">{{
  136. item
  137. }}</a-select-option>
  138. </a-select> -->
  139. </a-form-model-item>
  140. <a-form-model-item label="日期:">
  141. <!-- <a-month-picker v-model="expressions1[1].stringValue" :format="'YYYYMM'" /> -->
  142. <a-month-picker
  143. v-if="isPickerType"
  144. v-model="value"
  145. placeholder="请选择日期"
  146. @change="onChangeMonth"
  147. />
  148. <a-date-picker
  149. v-else
  150. v-model="value"
  151. mode="year"
  152. :open="open"
  153. format="YYYY"
  154. placeholder="请选择日期"
  155. @openChange="openChange"
  156. @panelChange="panelChange"
  157. @change="onChangeYear"
  158. />
  159. </a-form-model-item>
  160. <a-form-model-item>
  161. <a-button type="primary" @click="search">搜索</a-button>
  162. </a-form-model-item>
  163. </a-form-model>
  164. <SdDataTableEx
  165. :key="key"
  166. ref="dataTable"
  167. :projectlist="true"
  168. data-url="api/xcoa-mobile/v1/document-record/page"
  169. :editnode="editnode"
  170. :columns="columns1"
  171. :actions="actions"
  172. :disable-export-table="true"
  173. :filter-expressions="expressions1"
  174. form-id="iamUploadFile"
  175. page-id="audit/maintain/iamUploadFile"
  176. @searchbtnClick="searchbtnClick"
  177. >
  178. </SdDataTableEx>
  179. </template>
  180. </a-card>
  181. <a-modal v-model="isShowSpace" title="分类管理" width="40%" @ok="handleOk">
  182. <a-form-model :model="spaceForm" v-bind="formItemLayout">
  183. <a-form-model-item label="分类名称">
  184. <a-input v-model="spaceForm.name" allow-clear />
  185. </a-form-model-item>
  186. <a-form-model-item label="分类选择">
  187. <a-cascader
  188. v-model="spaceForm.ids"
  189. change-on-select
  190. :options="treeData.spaceCategoryTree"
  191. :field-names="{ label: 'name', value: 'id', children: 'children' }"
  192. placeholder="请选择分类"
  193. />
  194. </a-form-model-item>
  195. <a-form-model-item label="分类排序">
  196. <a-input-number v-model="spaceForm.sort" allow-clear />
  197. </a-form-model-item>
  198. <a-form-model-item label="分类备注">
  199. <a-textarea v-model="spaceForm.description" allow-clear />
  200. </a-form-model-item>
  201. </a-form-model>
  202. </a-modal>
  203. <a-modal v-model="isShowFile" title="文件上传" width="40%" @ok="handleUpload">
  204. <a-form-model
  205. ref="ruleForm"
  206. :model="fileForm"
  207. v-bind="formItemLayout"
  208. :rules="fileFormRules"
  209. >
  210. <a-form-model-item label="文件名称" prop="classifyName">
  211. <a-input v-model="fileForm.classifyName" allow-clear />
  212. </a-form-model-item>
  213. <a-form-model-item label="分类选择" prop="classifyId">
  214. <a-cascader
  215. v-model="fileForm.classifyId"
  216. allow-clear
  217. change-on-select
  218. :options="treeData.spaceCategoryTree"
  219. :field-names="{ label: 'name', value: 'id', children: 'children' }"
  220. placeholder="请选择分类"
  221. />
  222. </a-form-model-item>
  223. <a-form-model-item label="文件上传">
  224. <a-button v-if="fileName === ''" @click="isShowFileUpload = !isShowFileUpload"
  225. >点击选择文件</a-button
  226. >
  227. <a-tag v-else color="blue" closable @close="clearInfo">
  228. {{ fileName }}
  229. </a-tag>
  230. </a-form-model-item>
  231. <a-form-model-item label="文件备注">
  232. <a-textarea v-model="fileForm.description" allow-clear />
  233. </a-form-model-item>
  234. </a-form-model>
  235. </a-modal>
  236. <a-modal
  237. v-model="isShowFileUpload"
  238. title="文件上传"
  239. width="60%"
  240. @ok="handleUploadOk"
  241. @cancel="unUpload"
  242. >
  243. <a-form-model
  244. ref="fileFormRef"
  245. :model="fileForm"
  246. v-bind="formItemLayout"
  247. :rules="fileRules"
  248. >
  249. <a-form-model-item label="文件上传">
  250. <a-upload-dragger
  251. name="file"
  252. :multiple="false"
  253. :remove="handleRemove"
  254. :before-upload="beforeUpload"
  255. :file-list="defaultFileList"
  256. accept=".xls,.xlsx"
  257. >
  258. <p class="ant-upload-drag-icon">
  259. <a-icon type="inbox" />
  260. </p>
  261. <p class="ant-upload-text">
  262. 点击或拖拽上传文件<br />
  263. 支持 xls/xlsl/csv 文件格式文件,默认选择第一个sheet
  264. </p>
  265. </a-upload-dragger>
  266. </a-form-model-item>
  267. <a-form-model-item label="物理表名" prop="physicalTableName">
  268. <a-input v-model="fileForm.physicalTableName" allow-clear />
  269. </a-form-model-item>
  270. <a-form-model-item label="备注表名">
  271. <a-input v-model="fileForm.noteTableName" allow-clear />
  272. </a-form-model-item>
  273. <a-form-model-item label="字段配置">
  274. <a-table
  275. :key="indexKey"
  276. :columns="fileColumns"
  277. :data-source="fileData"
  278. bordered
  279. :pagination="false"
  280. :row-key="
  281. (record, index) => {
  282. return index
  283. }
  284. "
  285. >
  286. <a-input
  287. slot="comment"
  288. slot-scope="record, text, index"
  289. :value="record"
  290. @change="(e) => handleChange(e.target.value, 'comment', index)"
  291. />
  292. <a-input
  293. slot="columnName"
  294. slot-scope="record, text, index"
  295. :value="record"
  296. @change="(e) => handleChange(e.target.value, 'columnName', index)"
  297. />
  298. <a-select
  299. slot="columnType"
  300. slot-scope="record, text, index"
  301. :default-value="record"
  302. @change="(e) => handleChange(e, 'columnType', index)"
  303. >
  304. <a-select-option value="INT"> 整数</a-select-option>
  305. <a-select-option value="BIGINT"> 长整数</a-select-option>
  306. <a-select-option value="DECIMAL"> 小数</a-select-option>
  307. <a-select-option value="STRING"> 字符串</a-select-option>
  308. <a-select-option value="TEXT"> 长字符串</a-select-option>
  309. <a-select-option value="TIMESTAMP"> 日期</a-select-option>
  310. </a-select>
  311. <a-input
  312. slot="dataLength"
  313. slot-scope="record, text, index"
  314. :value="record"
  315. @change="(e) => handleChange(e.target.value, 'dataLength', index)"
  316. />
  317. <a-input
  318. v-if="text.columnType === 'DECIMAL'"
  319. slot="pointNum"
  320. slot-scope="record, text, index"
  321. :value="record"
  322. @change="(e) => handleChange(e.target.value, 'pointNum', index)"
  323. />
  324. </a-table>
  325. </a-form-model-item>
  326. </a-form-model>
  327. </a-modal>
  328. <a-modal v-model="isShowFileView" title="文件查看" width="60%" @ok="isShowFileView = false">
  329. <a-table :columns="fileViewColumns" :data-source="fileViewData"></a-table>
  330. </a-modal>
  331. </div>
  332. </div>
  333. </div>
  334. </template>
  335. <script>
  336. import axios from '@/common/services/axios-instance'
  337. import { message } from 'ant-design-vue'
  338. import auditClassTree from './audit-class-tree.vue'
  339. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  340. import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
  341. import SdDataTableEx from '@/common/components/sd-data-table-ex.vue'
  342. import dataService from './data-market'
  343. import { generateTree, getTreeIds } from '@product/iam/audit/dataMarket/util'
  344. import moment from 'moment'
  345. import { getUserInfo } from '@/common/store-mixin'
  346. import sdTable from '@/common/components/sd-table.vue'
  347. import appConfig from '@custom/app-config'
  348. export default {
  349. name: 'DataMarket',
  350. metaInfo: {
  351. title: '数据集市',
  352. },
  353. components: {
  354. SdDataTableEx,
  355. auditClassTree,
  356. sdTable,
  357. },
  358. mixins: [auditAdvancedQueryMixins, auditAdvancedGroupMixins],
  359. data() {
  360. return {
  361. // 点击类型
  362. clickType: '',
  363. editnode: true,
  364. key: 0,
  365. indexKey: 0,
  366. searchform: 'searchform',
  367. formData: {
  368. categoryName: '',
  369. categoryId: '',
  370. },
  371. auditOrgId: null,
  372. parentId: 0,
  373. parentCategoryId: '000000',
  374. level: 1,
  375. isEnd: null,
  376. columns: [
  377. {
  378. title: '序号',
  379. dataIndex: 'id',
  380. },
  381. {
  382. title: '文件名称',
  383. dataIndex: 'classifyName',
  384. },
  385. // physicalTableName
  386. {
  387. title: '物理表名',
  388. dataIndex: 'physicalTableName',
  389. },
  390. {
  391. title: '备注',
  392. dataIndex: 'description',
  393. },
  394. {
  395. title: '操作',
  396. dataIndex: 'opt',
  397. align: 'center',
  398. customRender: (text, record, index) => {
  399. return (
  400. <span>
  401. <a
  402. vOn:click={() => {
  403. this.exidInfo(record)
  404. }}
  405. >
  406. 编辑
  407. </a>{' '}
  408. <a
  409. vOn:click={() => {
  410. this.handleView(record.id)
  411. this.isShowFileView = !this.isShowFileView
  412. }}
  413. >
  414. 查看
  415. </a>
  416. </span>
  417. )
  418. },
  419. },
  420. ],
  421. actions: [
  422. // {
  423. // label: '新建',
  424. // permission: null,
  425. // // id: 'new',
  426. // type: TableActionTypes.primary,
  427. // callback: this.create,
  428. // },
  429. // {
  430. // label: '数据授权',
  431. // id: 'auditWarrant',
  432. // permission: null,
  433. // callback: this.Matterssq,
  434. // },
  435. // {
  436. // label: '删除',
  437. // // id: 'delete',
  438. // permission: null,
  439. // callback: this.deleteRows,
  440. // },
  441. ],
  442. expressions: [
  443. {
  444. dataType: 'long',
  445. name: 'classifyId',
  446. op: 'eq',
  447. longValue: -1,
  448. },
  449. ],
  450. columns1: [
  451. {
  452. title: '序号',
  453. dataIndex: 'id',
  454. width: '80px',
  455. },
  456. {
  457. title: '报表类型',
  458. dataIndex: 'reportName',
  459. width: '200px',
  460. },
  461. {
  462. title: '公司名称',
  463. dataIndex: 'orgName',
  464. width: '400px',
  465. },
  466. {
  467. title: '日期',
  468. dataIndex: 'reportDate',
  469. },
  470. {
  471. title: '操作',
  472. dataIndex: 'opt',
  473. align: 'center',
  474. customRender: (text, record, index) => {
  475. return (
  476. <span>
  477. <a
  478. vOn:click={() => {
  479. this.caiwuView(record)
  480. }}
  481. >
  482. 查看
  483. </a>
  484. </span>
  485. )
  486. },
  487. },
  488. ],
  489. // {
  490. // title: '报表类型',
  491. // dataIndex: 'reportName',
  492. // },
  493. // {
  494. // title: '公司名称',
  495. // dataIndex: 'orgName',
  496. // },
  497. // {
  498. // title: '月份信息',
  499. // dataIndex: 'reportDate',
  500. // },
  501. isPickerType: true,
  502. expressions1: [
  503. {
  504. dataType: 'str',
  505. op: 'in',
  506. name: 'reportName',
  507. stringValue: '',
  508. },
  509. { dataType: 'str', op: 'eq', name: 'reportDate', stringValue: '' },
  510. {
  511. dataType: 'str',
  512. op: 'eq',
  513. name: 'orgCode',
  514. stringValue: '',
  515. },
  516. ],
  517. isroot: true,
  518. className: '',
  519. // 财务报表开始
  520. isShowFinance: false,
  521. financeForm: {
  522. // 分类名称
  523. name: '',
  524. // 分类id
  525. ids: [],
  526. // 排序
  527. sort: 0,
  528. // 备注
  529. description: '',
  530. },
  531. groupList: [],
  532. allGroupList: [],
  533. reportTypeList: [],
  534. // 我的空间操作开始
  535. isShowSpace: false,
  536. spaceForm: {
  537. // 分类名称
  538. name: '',
  539. // 分类id
  540. ids: [],
  541. // 排序
  542. sort: 0,
  543. // 备注
  544. description: '',
  545. },
  546. treeData: {
  547. // 财务报表分类树
  548. financeCategoryTree: [],
  549. // 空间分类树
  550. spaceCategoryTree: [],
  551. },
  552. // 文件上传操作开始
  553. isShowFile: false,
  554. isShowFileUpload: false,
  555. isShowFileView: false,
  556. fileForm: {
  557. // 文件名称
  558. classifyName: '',
  559. // 分类
  560. classifyId: [],
  561. // 文件
  562. filePath: '',
  563. // 物理表名
  564. physicalTableName: '',
  565. noteTableName: '',
  566. // 备注
  567. description: '',
  568. },
  569. fileFormRules: {
  570. classifyName: [{ required: true, message: '请输入文件名称', trigger: 'blur' }],
  571. classifyId: [{ required: true, message: '请选择分类', trigger: 'change' }],
  572. filePath: [{ required: true, message: '请选择文件', trigger: 'change' }],
  573. physicalTableName: [{ required: true, message: '请输入物理表名', trigger: 'blur' }],
  574. noteTableName: [{ required: true, message: '请输入备注表名', trigger: 'blur' }],
  575. },
  576. fileRules: {
  577. physicalTableName: [
  578. { required: true, message: '请输入物理表名', trigger: 'blur' },
  579. { pattern: /^[a-zA-Z0-9_]+$/, message: '只能输入字母、数字、下划线' },
  580. // 必须以dws_dsjsj_开头
  581. { pattern: /^dws_dsjsj_/, message: '必须以dws_dsjsj_开头', trigger: 'change' },
  582. ],
  583. },
  584. fileData: [],
  585. fileColumns: [
  586. {
  587. title: '原始字段',
  588. dataIndex: 'comment',
  589. scopedSlots: { customRender: 'comment' },
  590. },
  591. {
  592. title: '物理字段',
  593. dataIndex: 'columnName',
  594. scopedSlots: { customRender: 'columnName' },
  595. },
  596. {
  597. title: '数据类型',
  598. dataIndex: 'columnType',
  599. width: 150,
  600. scopedSlots: { customRender: 'columnType' },
  601. },
  602. {
  603. title: '字段长度',
  604. dataIndex: 'dataLength',
  605. scopedSlots: { customRender: 'dataLength' },
  606. },
  607. {
  608. title: '小数位',
  609. dataIndex: 'pointNum',
  610. scopedSlots: { customRender: 'pointNum' },
  611. },
  612. ],
  613. fileViewColumns: [],
  614. fileViewData: [],
  615. searchFinaceForm: {
  616. name: '',
  617. start: '',
  618. end: '',
  619. },
  620. // 我的空间操作结束
  621. fileName: '',
  622. defaultFileList: [],
  623. isExport: false,
  624. onEditId: null,
  625. cascaderReportType: null,
  626. open: false,
  627. value: '',
  628. financeCategoryTree: [],
  629. showAllTreeNode: false,
  630. }
  631. },
  632. computed: {
  633. formItemLayout() {
  634. return {
  635. layout: 'horizontal',
  636. labelCol: { span: 4 },
  637. wrapperCol: { span: 18 },
  638. }
  639. },
  640. },
  641. mounted() {
  642. this.spaceInit()
  643. const roles = this.$store.state.sd.common.userInfo.default.roles
  644. this.isExport = roles.map((val) => val.code).includes('G-1_DATE_ EXPORT')
  645. },
  646. methods: {
  647. unUpload() {
  648. this.fileName = ''
  649. for (const key in this.fileForm) {
  650. this.fileForm[key] = ''
  651. if (key === 'classifyId') {
  652. this.fileForm[key] = []
  653. }
  654. }
  655. },
  656. openChange(status) {
  657. if (status) {
  658. this.open = true
  659. } else {
  660. this.open = false
  661. }
  662. },
  663. panelChange(e) {
  664. this.value = e
  665. if (!e) {
  666. this.expressions1[1].stringValue = ''
  667. return
  668. }
  669. this.expressions1[1].stringValue = e.format('YYYY') || ''
  670. this.open = false
  671. },
  672. showisShowSpace() {
  673. if (this.spaceForm.id === 0) {
  674. return message.error('默认分类不可修改')
  675. }
  676. this.isShowSpace = !this.isShowSpace
  677. },
  678. clearInfo() {
  679. this.fileName = ''
  680. this.defaultFileList = []
  681. this.fileData = []
  682. for (const key in this.fileForm) {
  683. this.fileForm[key] = ''
  684. if (key === 'classifyId') {
  685. this.fileForm[key] = []
  686. }
  687. }
  688. },
  689. uploadClick() {
  690. this.isShowFile = !this.isShowFile
  691. for (const key in this.fileForm) {
  692. this.fileForm[key] = ''
  693. if (key === 'classifyId') {
  694. this.fileForm[key] = []
  695. }
  696. }
  697. this.fileName = ''
  698. },
  699. exidInfo(item) {
  700. this.onEditId = item.id
  701. this.isShowFile = !this.isShowFile
  702. this.fileName = item.noteTableName
  703. for (const key in this.fileForm) {
  704. this.fileForm[key] = item[key]
  705. if (key === 'classifyId') {
  706. this.fileForm[key] = getTreeIds(this.treeData.spaceCategoryTree, item[key])
  707. }
  708. }
  709. },
  710. spaceInit() {
  711. const params = {
  712. columns: '',
  713. maxResults: 9999,
  714. startPosition: 0,
  715. expressions: [],
  716. buttonExpressions: [],
  717. }
  718. dataService.iamDataCubeQueryList(params).then((res) => {
  719. res.data.data.forEach((item) => {
  720. item.name = item.dataCubeBean.categoryName
  721. item.children = item?.serverBeanList.map((v) => {
  722. v.name = v.tableNameCN
  723. v.props = {
  724. isroot: false,
  725. }
  726. return v
  727. })
  728. item.isLeaf = false
  729. if (item.dataCubeBean.classifyType === '1') {
  730. item.slots = {
  731. icon: 'folder-open',
  732. }
  733. } else {
  734. item.slots = {
  735. icon: 'file-done',
  736. }
  737. }
  738. item.props = {
  739. isroot: true,
  740. }
  741. })
  742. this.financeCategoryTree = JSON.parse(JSON.stringify(res.data.data))
  743. this.treeData.financeCategoryTree = generateTree(
  744. res.data.data,
  745. 'id',
  746. 'parentId',
  747. 'children'
  748. )
  749. })
  750. dataService.findMySpaceCategoryTree().then((res) => {
  751. const parentNode = [
  752. {
  753. id: 0,
  754. name: '默认分类',
  755. children: generateTree(res.data, 'id', 'parentId', 'children'),
  756. },
  757. ]
  758. this.spaceCategoryTree = JSON.parse(JSON.stringify(res.data))
  759. this.treeData.spaceCategoryTree = parentNode
  760. })
  761. },
  762. onChangeSearch(value) {
  763. if (!value) {
  764. this.spaceInit()
  765. return
  766. }
  767. const list = this.spaceCategoryTree.filter((item) => {
  768. return item.name.includes(value)
  769. })
  770. this.treeData.spaceCategoryTree = generateTree(list, 'id', 'parentId', 'children')
  771. },
  772. onChangeSearch1(value) {
  773. if (!value) {
  774. this.showAllTreeNode = false
  775. this.spaceInit()
  776. }
  777. // let list = this.financeCategoryTree.filter((item) => {
  778. // return (
  779. // item.name.includes(value) ||
  780. // item.serverBeanList.some((v) => v.tableNameCN.includes(value))
  781. // )
  782. // })
  783. // // serverBeanList 里过滤没有数据的值
  784. // list = list.map((item) => {
  785. // item.children = item.children.filter((v) => v.name.includes(value))
  786. // return item
  787. // })
  788. // this.treeData.financeCategoryTree = generateTree(list, 'id', 'parentId', 'children')
  789. // 展开所有节点
  790. },
  791. treeSelect(selectedKeys, info) {
  792. this.clickType = 'space'
  793. if (!info.selected) {
  794. this.spaceForm = {
  795. name: '',
  796. ids: [],
  797. sort: 0,
  798. description: '',
  799. }
  800. return
  801. }
  802. const { dataRef } = info.node
  803. this.dataRef = dataRef
  804. this.expressions = [
  805. {
  806. dataType: 'long',
  807. name: 'classifyId',
  808. op: 'eq',
  809. longValue: dataRef.id,
  810. },
  811. ]
  812. this.spaceForm.name = dataRef.name
  813. this.spaceForm.id = dataRef.id
  814. this.spaceForm.parentId = dataRef.parentId
  815. this.spaceForm.ids = getTreeIds(this.treeData.spaceCategoryTree, dataRef.id)
  816. this.spaceForm.sort = dataRef.sort
  817. this.spaceForm.description = dataRef.description
  818. },
  819. handleChangeReportType(value) {
  820. if (value.length === 0) {
  821. this.expressions1[0].stringValue = ''
  822. this.cascaderReportType = null
  823. }
  824. if (value.length === 1) {
  825. // // 如果是月报则把月报下全部报表名用,分割
  826. if (value[0] === '月报') {
  827. this.expressions1[0].stringValue = this.reportTypeList[0].children
  828. .map((item) => `'${item.code}'`)
  829. .join(',')
  830. } else {
  831. this.expressions1[0].stringValue = this.reportTypeList[1].children
  832. .map((item) => `'${item.code}'`)
  833. .join(',')
  834. }
  835. }
  836. if (value.length === 2) {
  837. this.expressions1[0].stringValue = `'${value[1]}'`
  838. const flag = value[0] === '月报'
  839. if (this.isPickerType !== flag) {
  840. this.value = null
  841. this.expressions1[1].stringValue = ''
  842. }
  843. this.isPickerType = value[0] === '月报'
  844. }
  845. },
  846. treeSelect1(e, { node }) {
  847. this.clickType = 'finance'
  848. const { dataRef } = node
  849. this.dataRef = dataRef
  850. dataRef.classifyType = dataRef?.dataCubeBean ? +dataRef?.dataCubeBean?.classifyType : 1
  851. if (dataRef.classifyType === 2) {
  852. dataService.userGrouplist().then((res) => {
  853. this.groupList = generateTree(res.data, 'id', 'parentId', 'children')
  854. })
  855. dataService.financeClassifyList().then((res) => {
  856. this.reportTypeList = [
  857. {
  858. name: '月报',
  859. code: '月报',
  860. children: res.data.annualReport.map((item) => {
  861. return {
  862. name: item,
  863. code: item,
  864. }
  865. }),
  866. },
  867. {
  868. // 决算 finalAccount
  869. name: '决算',
  870. code: '决算',
  871. children: res.data.finalAccount.map((item) => {
  872. return {
  873. name: item,
  874. code: item,
  875. }
  876. }),
  877. },
  878. ]
  879. })
  880. this.clickType = 'caiwu'
  881. } else {
  882. if (!dataRef.props.isroot) {
  883. dataService.findDataList(dataRef.id).then((res) => {
  884. // todo 生成测试数据
  885. // for (let i = 0; i < 100; i++) {
  886. // res.data.push({
  887. // 数据抽取时间戳: '2023-10-09 09:47:55',
  888. // 是否签订: '1',
  889. // 来源系统名称: '数字法治系统',
  890. // 来源系统组织机构名称: '戴德新',
  891. // 来源系统组织机构编码: '戴德新',
  892. // 法定代表人或委托人: '',
  893. // 流程状态: '',
  894. // 相对方名称: '石家庄瑞能电力器材有限公司',
  895. // 相对方编码: '',
  896. // 签字人身份: '1',
  897. // 签约代表名称: '戴德新',
  898. // 签订时间: '2020-01-08 10:18:54',
  899. // })
  900. // }
  901. this.fileViewColumns = Object.keys(res.data[0]).map((item) => {
  902. // 检测item长度 每个字符设置16px宽度
  903. const width = item.length * 27
  904. return {
  905. title: item,
  906. dataIndex: item,
  907. width: width + 'px',
  908. ellipsis: true,
  909. }
  910. })
  911. this.fileViewData = res.data
  912. })
  913. } else {
  914. this.clickType = ''
  915. }
  916. }
  917. },
  918. searchFinace() {},
  919. // 时间过滤
  920. onChangeFinace(val) {
  921. if (val.length === 0) {
  922. this.searchFinaceForm.start = ''
  923. this.searchFinaceForm.end = ''
  924. } else {
  925. this.searchFinaceForm.start = moment(val[0]).format('YYYYMMDD')
  926. this.searchFinaceForm.end = moment(val[1]).format('YYYYMMDD')
  927. }
  928. },
  929. handleOk() {
  930. const parentId = this.spaceForm.ids[this.spaceForm.ids.length - 1] || 0
  931. if (parentId !== this.spaceForm.id) {
  932. this.spaceForm.parentId = parentId
  933. }
  934. if (this.spaceForm.parentId === undefined) {
  935. this.spaceForm.parentId = 0
  936. }
  937. // 如果id==0 说明是新增 则删除id
  938. if (this.spaceForm.id === 0) {
  939. delete this.spaceForm.id
  940. }
  941. this.spaceForm.creatorAccount = getUserInfo().account
  942. // console.log(this.spaceForm)
  943. dataService.saveMySpaceCategory(this.spaceForm).then((res) => {
  944. if (res.data) {
  945. message.success('保存成功')
  946. this.isShowSpace = false
  947. this.spaceInit()
  948. this.spaceForm = {
  949. // 分类名称
  950. name: '',
  951. // 分类id
  952. ids: [],
  953. // 排序
  954. sort: 0,
  955. // 备注
  956. description: '',
  957. }
  958. } else {
  959. message.error('保存失败')
  960. }
  961. })
  962. },
  963. // 文件上传
  964. handleRemove(file) {
  965. this.fileForm.filePath = null
  966. this.fileName = ''
  967. return true
  968. },
  969. beforeUpload(file) {
  970. this.fileName = file.name
  971. // 正在上传
  972. this.fileForm.filePath = file
  973. const formData = new FormData()
  974. formData.append('file', file)
  975. dataService.previewExcel(formData).then((res) => {
  976. // 随机生成表名
  977. this.fileForm.physicalTableName = 'dws_dsjsj_'
  978. this.fileForm.noteTableName = file.name.split('.')[0]
  979. this.fileData = res.data
  980. })
  981. return false
  982. },
  983. handleUploadOk() {
  984. this.$refs.fileFormRef.validate((valid) => {
  985. if (valid) {
  986. this.isShowFileUpload = false
  987. }
  988. })
  989. },
  990. handleChange(val, name, index) {
  991. if (name === 'dataLength') {
  992. if (this.fileData[index].columnType === 'INT') {
  993. if (val > 30) {
  994. message.error('最大长度为30')
  995. this.fileData[index].dataLength = 30
  996. return false
  997. }
  998. }
  999. if (this.fileData[index].columnType === 'STRING') {
  1000. if (val > 1000) {
  1001. message.error('字符串类型长度不能超过1000,请改为长字符串')
  1002. this.fileData[index].dataLength = 1000
  1003. return false
  1004. }
  1005. }
  1006. }
  1007. if (name === 'pointNum') {
  1008. if (val > 10) {
  1009. message.error('最大长度为20')
  1010. this.fileData[index].pointNum = 20
  1011. return false
  1012. }
  1013. }
  1014. if (name === 'columnType') {
  1015. if (val === 'INT') {
  1016. this.fileData[index].dataLength = 30
  1017. } else if (val === 'STRING') {
  1018. this.fileData[index].dataLength = 1000
  1019. } else if (val === 'TEXT') {
  1020. this.fileData[index].dataLength = 3000
  1021. } else if (val === 'DECIMAL') {
  1022. this.fileData[index].dataLength = 30
  1023. } else if (val === 'BIGINT') {
  1024. this.fileData[index].dataLength = 30
  1025. }
  1026. }
  1027. this.fileData.forEach((item) => {
  1028. if (item.columnIndex === index) {
  1029. item[name] = val
  1030. }
  1031. })
  1032. },
  1033. handleUpload() {
  1034. // 正在上传
  1035. const formData = {
  1036. eventId: 'save',
  1037. inputs: [
  1038. {
  1039. name: 'id',
  1040. value: this.onEditId,
  1041. },
  1042. {
  1043. name: 'classifyId',
  1044. value: this.fileForm.classifyId[this.fileForm.classifyId.length - 1] || 0,
  1045. },
  1046. {
  1047. name: 'classifyName',
  1048. value: this.fileForm.classifyName,
  1049. },
  1050. {
  1051. name: 'filePath',
  1052. value: '',
  1053. },
  1054. {
  1055. name: 'physicalTableName',
  1056. value: this.fileForm.physicalTableName,
  1057. },
  1058. {
  1059. name: 'noteTableName',
  1060. value: this.fileForm.noteTableName,
  1061. },
  1062. {
  1063. name: 'description',
  1064. value: this.fileForm.description,
  1065. },
  1066. ],
  1067. pageFlowId: '08ecc6f9-ed1d-4559-98ea-76a0e9661d6a',
  1068. pagePath: 'audit/datacube/iamUploadFile',
  1069. }
  1070. this.loading = true
  1071. this.$refs.ruleForm.validate((valid) => {
  1072. if (valid) {
  1073. const formTable = new FormData()
  1074. formTable.append('file', this.fileForm.filePath)
  1075. formTable.append(
  1076. 'tableInfoJson',
  1077. JSON.stringify({
  1078. tableName: this.fileForm.physicalTableName,
  1079. tableComment: this.fileForm.noteTableName,
  1080. fileStructures: this.fileData,
  1081. })
  1082. )
  1083. dataService.createTable(formTable).then((res) => {
  1084. if (res.data) {
  1085. message.success('创建成功')
  1086. this.isShowFile = false
  1087. dataService.saveMySpaceFile(formData).then((res) => {
  1088. if (res.data) {
  1089. message.success('保存成功')
  1090. // this.spaceInit()
  1091. this.$refs.dataTableSpace.refresh()
  1092. this.onEditId = null
  1093. this.clearInfo()
  1094. } else {
  1095. message.error('保存失败')
  1096. }
  1097. })
  1098. } else {
  1099. message.error('创建失败')
  1100. this.clearInfo()
  1101. }
  1102. })
  1103. } else {
  1104. return false
  1105. }
  1106. })
  1107. },
  1108. // 查看文件内容
  1109. handleView(id) {
  1110. dataService.queryData(id).then((res) => {
  1111. const data = res.data
  1112. this.fileViewColumns = Object.keys(data[0]).map((item) => {
  1113. return {
  1114. title: item,
  1115. dataIndex: item,
  1116. }
  1117. })
  1118. this.fileViewData = data
  1119. })
  1120. },
  1121. exportData(e) {
  1122. dataService.exportData(this.dataRef.id).then((res) => {
  1123. // 导出excel
  1124. const data = res.data
  1125. const fileName = this.dataRef.name
  1126. const blob = new Blob([data])
  1127. const link = document.createElement('a')
  1128. link.href = window.URL.createObjectURL(blob)
  1129. link.download = fileName + '.xlsx'
  1130. link.click()
  1131. URL.revokeObjectURL(link.href)
  1132. document.body.removeChild(link)
  1133. })
  1134. },
  1135. handleChange1(e) {
  1136. // 如果长度大于1
  1137. if (e.length >= 1) {
  1138. this.expressions1[2].stringValue = e[e.length - 1]
  1139. } else {
  1140. this.expressions1[2].stringValue = ''
  1141. }
  1142. // 报表
  1143. // this.expressions1[0].stringValue = e[e.length - 1] || ''
  1144. },
  1145. onChangeYear(e) {
  1146. // 年份信息
  1147. if (!e) {
  1148. this.expressions1[1].stringValue = ''
  1149. return
  1150. }
  1151. this.expressions1[1].stringValue = e.format('YYYY') || ''
  1152. },
  1153. onChangeMonth(e) {
  1154. // 月份信息
  1155. if (!e) {
  1156. this.expressions1[1].stringValue = ''
  1157. return
  1158. }
  1159. this.expressions1[1].stringValue = e.format('YYYYMM') || ''
  1160. },
  1161. search() {
  1162. this.expressions1 = [...this.expressions1]
  1163. },
  1164. caiwuView(e) {
  1165. // window.open(`https://10.104.32.31:9999/prview.html?fileId=${e.esUuid}`)
  1166. // 生产环境
  1167. const token = this.$store.state.sd.login.tokens.access_token
  1168. const baseUrl = appConfig.searchBaseUrl
  1169. window.open(
  1170. `${baseUrl}prview.html?fileId=${e.esUuid}&baseUrl=${baseUrl}esapi/wps/preview/url&token=${token}`
  1171. )
  1172. },
  1173. },
  1174. }
  1175. </script>
  1176. <style module lang="scss">
  1177. @use '@/common/design' as *;
  1178. .wrap-height {
  1179. position: relative;
  1180. height: 100%;
  1181. .row-height {
  1182. display: flex;
  1183. flex: auto;
  1184. gap: 10px;
  1185. height: 100%;
  1186. .leftcard {
  1187. display: flex;
  1188. flex-direction: column;
  1189. gap: 10px;
  1190. width: 20%;
  1191. height: 100%;
  1192. background: $body-background;
  1193. }
  1194. .leftcardspace {
  1195. position: relative;
  1196. height: calc(50% - 20px);
  1197. overflow-x: hidden;
  1198. overflow-y: auto;
  1199. border: 1px dotted $border-color-base;
  1200. .title {
  1201. padding: 5px;
  1202. text-align: center;
  1203. }
  1204. }
  1205. .leftcardspacetree {
  1206. height: calc(100% - 0px);
  1207. overflow-x: hidden;
  1208. overflow-y: auto;
  1209. }
  1210. .leftcardspaceedit {
  1211. position: absolute;
  1212. bottom: 0;
  1213. display: flex;
  1214. gap: 40px;
  1215. align-items: center;
  1216. justify-content: center;
  1217. width: 100%;
  1218. .ant-btn {
  1219. width: 100px;
  1220. }
  1221. }
  1222. .rightcard {
  1223. flex: 1;
  1224. width: calc(100% - 20%);
  1225. height: 100%;
  1226. }
  1227. }
  1228. }
  1229. :deep(.sd-body .ant-card-body) {
  1230. height: 100%;
  1231. padding: 2px !important;
  1232. }
  1233. .ant-upload-text {
  1234. font-size: 12px;
  1235. }
  1236. .dataclass {
  1237. :global(.projectlist .ant-table-empty .ant-table-body) {
  1238. overflow-x: hidden !important;
  1239. }
  1240. :global(span > .ant-btn:nth-child(2)) {
  1241. color: #fff;
  1242. background-color: #1890ff;
  1243. border-color: #1890ff;
  1244. }
  1245. // :global(.ant-table-placeholder) {
  1246. // width: auto;
  1247. // }
  1248. }
  1249. .dataTable {
  1250. width: 100%;
  1251. height: calc(100% - 150px);
  1252. }
  1253. .tableHeader {
  1254. display: flex;
  1255. gap: 10px;
  1256. justify-content: flex-end;
  1257. margin-bottom: 10px;
  1258. }
  1259. .caiwu-width {
  1260. width: 200px !important;
  1261. }
  1262. </style>