data-market.vue 39 KB

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