diff --git "a/data/javascript/data.json" "b/data/javascript/data.json" new file mode 100644--- /dev/null +++ "b/data/javascript/data.json" @@ -0,0 +1,100 @@ +{"size":7721,"ext":"js","lang":"JavaScript","max_stars_count":14.0,"content":"\/**\n * @since 2019-10-10\n * @author WT \n * @copyright Copyright (c) 2019, Hand\n *\/\nimport React from 'react';\nimport { Button, Col, DataSet, Form, Row, Table } from 'choerodon-ui\/pro';\nimport { Bind } from 'lodash-decorators';\n\nimport { Content, Header } from 'components\/Page';\n\nimport intl from 'utils\/intl';\nimport { TagRender } from 'utils\/renderer';\nimport { HZERO_IMP } from 'utils\/config';\nimport notification from 'utils\/notification';\nimport { openTab } from 'utils\/menuTab';\nimport formatterCollections from 'utils\/intl\/formatterCollections';\nimport { filterNullValueObject, getCurrentOrganizationId } from 'utils\/utils';\n\nimport queryString from 'querystring';\n\n@formatterCollections({ code: ['himp.commentImport', 'himp.importHistory'] })\nexport default class ImportHistory extends React.Component {\n tableDS = new DataSet({\n autoQuery: false,\n dataKey: 'content',\n selection: false,\n queryFields: [\n {\n name: 'templateCode',\n type: 'object',\n label: intl.get('himp.importHistory.view.title.importPlatform').d('\u5bfc\u5165\u6a21\u677f'),\n lovCode: 'HIMP.TEMPLATE',\n lovPara: { tenantId: getCurrentOrganizationId() },\n required: true,\n noCache: true,\n },\n {\n name: 'creationDateFrom',\n type: 'dateTime',\n label: intl.get('himp.importHistory.view.title.createIncidentFrom').d('\u521b\u5efa\u65f6\u95f4\u4ece'),\n },\n {\n name: 'creationDateTo',\n type: 'dateTime',\n label: intl.get('himp.importHistory.view.title.createIncidentTo').d('\u521b\u5efa\u65f6\u95f4\u81f3'),\n },\n ],\n fields: [\n {\n name: 'batch',\n type: 'string',\n label: intl.get('himp.importHistory.view.title.importBatch').d('\u5bfc\u5165\u6279\u6b21\u53f7'),\n },\n {\n name: 'dataCount',\n type: 'string',\n label: intl.get('himp.importHistory.view.title.totalData').d('\u6570\u636e\u603b\u91cf'),\n },\n {\n name: 'status',\n type: 'string',\n label: intl.get('himp.importHistory.view.title.status').d('\u72b6\u6001'),\n },\n {\n name: 'createdUserName',\n type: 'string',\n label: intl.get('himp.importHistory.view.title.createUser').d('\u521b\u5efa\u4eba'),\n },\n {\n name: 'creationDate',\n type: 'string',\n label: intl.get('himp.importHistory.view.title.createTime').d('\u521b\u5efa\u65f6\u95f4'),\n },\n ],\n transport: {\n read: (config) => {\n const { creationDateFrom = '', creationDateTo = '' } = config.data;\n const { templateCode = {}, prefixPatch = '', templateType = '' } = config.data.templateCode\n ? config.data.templateCode\n : {};\n const data = filterNullValueObject({ templateCode, creationDateFrom, creationDateTo });\n const params = { ...config.params };\n const url =\n templateType === 'C'\n ? `${prefixPatch}\/v1\/${getCurrentOrganizationId()}\/import\/manager`\n : `${HZERO_IMP}\/v1\/${getCurrentOrganizationId()}\/import\/manager`;\n return {\n data,\n params,\n url,\n method: 'GET',\n };\n },\n },\n });\n\n constructor(props) {\n super(props);\n this.state = {\n id: null,\n flag: true,\n prefixPatch: '',\n };\n }\n\n componentDidMount() {\n this.tableDS.queryDataSet.addEventListener('update', this.templateCodeQuery);\n }\n\n componentWillUnmount() {\n this.tableDS.queryDataSet.removeEventListener('update', this.templateCodeQuery);\n }\n\n @Bind()\n templateCodeQuery() {\n const { flag } = this.state;\n if (\n this.tableDS.queryDataSet.current &&\n this.tableDS.queryDataSet.current.get('templateCode')\n ) {\n const { id, prefixPatch } = this.tableDS.queryDataSet.current.get('templateCode');\n this.setState({ prefixPatch });\n if (id !== this.state.id || flag) {\n this.tableDS.query();\n this.setState({ id, flag: false });\n }\n }\n }\n\n \/**\n * \u5386\u53f2\u8bb0\u5f55\u8be6\u60c5\u9875\n * @param {*} record\n *\/\n @Bind()\n openDetailPage(record) {\n \/\/ \u8df3\u8f6c\u5230\u5f53\u524d\u884c\u8be6\u60c5\u9875\n const {\n data: { importId = '', templateCode = '', batch = '' },\n } = record;\n const { prefixPatch = '' } = this.state;\n openTab({\n key: `\/himp\/history\/detail\/${importId}\/${templateCode}\/${batch}`,\n title: 'hzero.common.title.historyDetail',\n closable: true,\n search: queryString.stringify({\n action: intl.get('hzero.common.title.historyDetail').d('\u5386\u53f2\u8be6\u60c5'),\n prefixPatch,\n }),\n });\n }\n\n @Bind()\n clearContent() {\n this.tableDS.queryDataSet.current.set({ creationDateFrom: null, creationDateTo: null });\n }\n\n get columns() {\n return [\n { name: 'batch' },\n { name: 'dataCount' },\n {\n name: 'status',\n renderer: (records) => {\n const statusList = [\n { status: 'UPLOADING', color: 'blue' \/* , text: 'Excel\u5bfc\u5165' *\/ },\n { status: 'UPLOADED', color: 'green' \/* , text: '\u9a8c\u8bc1\u6210\u529f' *\/ },\n { status: 'CHECKING', color: 'blue' \/* , text: '\u9a8c\u8bc1\u5931\u8d25' *\/ },\n { status: 'CHECKED', color: 'green' \/* , text: '\u5bfc\u5165\u6210\u529f' *\/ },\n { status: 'IMPORTING', color: 'blue' \/* , text: '\u5bfc\u5165\u5931\u8d25' *\/ },\n { status: 'IMPORTED', color: 'green' \/* , text: '\u6570\u636e\u5f02\u5e38' *\/ },\n ];\n const tagItem = statusList.find((t) => t.status === records.value) || {};\n return TagRender(records.value, [\n {\n status: records.value,\n text: records.record.data.statusMeaning,\n color: tagItem.color,\n },\n ]);\n },\n },\n { name: 'createdUserName' },\n { name: 'creationDate' },\n {\n header: intl.get('hzero.common.table.column.option').d('\u64cd\u4f5c'),\n width: 200,\n renderer: this.commands,\n lock: 'right',\n align: 'center',\n },\n ];\n }\n\n @Bind\n commands({ record }) {\n return (\n
\n \n \n \n this.openDetailPage(record)}>\n {intl.get('himp.commentImport.view.button.detail').d('\u8be6\u60c5')}\n <\/a>\n <\/span>\n <\/Col>\n <\/Row>\n <\/div>\n );\n }\n\n renderBar = ({ queryFields, buttons, queryFieldsLimit, dataSet, queryDataSet }) => {\n if (queryDataSet) {\n return (\n
\n {queryFields}\n
\n