index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. <template>
  2. <div class="height_100">
  3. <el-container v-if="showView">
  4. <el-header>
  5. <div id="step1">
  6. <mySearch style="width:500px" :SearchFields="searchFiled" @search="search" :searchValue="searchOption">
  7. </mySearch>
  8. </div>
  9. <div style="display:flex;">
  10. <div id="step2" v-if="[2].indexOf(isOperate) == -1" class="margin-right_10">
  11. <span>分组查询:</span>
  12. <el-select v-model="groupingValue" size="small" @change="changeGrouping" clearable style="width: 120px">
  13. <el-option v-for="item in groupingOption" :key="item.value" :label="item.name" :value="item.value">
  14. </el-option>
  15. </el-select>
  16. </div>
  17. <el-button-group id="step3" style="display:flex;justify-content:flex-start" v-if="[2].indexOf(isOperate) == -1">
  18. <el-button v-for="item in viewTypes" :key="item.component" size="small"
  19. :type="viewType == item.component ? 'primary' : ''" @click="onChange(item.component)">{{ item.name
  20. }}</el-button>
  21. </el-button-group>
  22. <div id="step4" class="margin-left_10">
  23. <el-dropdown size="small" v-if="$permission('/pcs/report/add')">
  24. <el-button type="primary" size="small">
  25. 创建报告<i class="el-icon-arrow-down el-icon--right"></i>
  26. </el-button>
  27. <el-dropdown-menu slot="dropdown" style="margin-top:0px" v-if="dictMessage.REPORT_TYPE">
  28. <!-- 遍历按钮 -->
  29. <el-dropdown-item
  30. v-for="item in dictMessage.REPORT_TYPE.filter(item => !['6'].includes(item.dictChildValue))"
  31. :key="item.dictChildLabel" @click.native="handleAnalyse(item.dictChildValue)"
  32. v-if="$permission('/pcs/report/add/' + item.permission)">{{ item.dictChildLabel }}</el-dropdown-item>
  33. </el-dropdown-menu>
  34. </el-dropdown>
  35. <el-button type="primary" class="margin-left_10" size="small" @click="showField">显示栏位管理</el-button>
  36. </div>
  37. </div>
  38. </el-header>
  39. <el-main id="patent-list-container" class="main" v-loading="loading">
  40. <component :is="viewType" v-bind="$attrs" v-on="$listeners" :isOperate="isOperate" :tableData="dataList"
  41. :state="state" :queryParams="queryParams" @option="handleOption" @on-sort="handleSort" :groupBy="groupingValue"
  42. :groupingOption="groupingOption" :commonData="commonData" :searchOption="searchOption" :column="columnList"
  43. @getRow="checkDetails" @params="getParams"></component>
  44. </el-main>
  45. <el-footer class="pagination" v-if="viewType != 'visual'">
  46. <el-pagination background layout="total,sizes, prev, pager, next, jumper" :current-page.sync="queryParams.current"
  47. :page-sizes="pageSize" :page-size.sync="queryParams.size" @current-change="handleCurrentChange"
  48. :handleMessage="handleMessage" @size-change="handleSizeChange" :total="total">
  49. </el-pagination>
  50. </el-footer>
  51. </el-container>
  52. <CreateReport ref="ReportForm" @getList="isGetList"></CreateReport>
  53. <fields ref="field" type="reportProject" @getFieldList="getFieldList"></fields>
  54. </div>
  55. </template>
  56. <script>
  57. import Table from './view/table.vue'
  58. import Card from './view/card.vue'
  59. import visual from './view/visual.vue'
  60. import mergeTable from './view/mergeTable.vue'
  61. import CreateReport from './dialog/addAndEditReport.vue'
  62. import fields from '@/views/components/dialog/fields.vue';
  63. export default {
  64. components: {
  65. Table,
  66. Card,
  67. visual,
  68. CreateReport,
  69. mergeTable,
  70. fields,
  71. },
  72. props: {
  73. isOperate: '',
  74. matterId:{},
  75. scenarioId:{}
  76. },
  77. data() {
  78. return {
  79. //视图类型
  80. viewTypes: [
  81. {
  82. name: '可视化',
  83. component: 'visual'
  84. },
  85. {
  86. name: '列表',
  87. component: 'Table'
  88. },
  89. {
  90. name: '卡片',
  91. component: 'Card'
  92. },
  93. ],
  94. //当前视图类型
  95. viewType: 'Table',
  96. //检索字段
  97. searchFiled: [],
  98. //检索条件
  99. searchOption: {
  100. name: localStorage.searchContent,
  101. scenarioNames:this.scenarioId,
  102. matterNames:this.matterId
  103. },
  104. //分组的值
  105. groupingValue: '',
  106. //分组
  107. groupingOption: [],
  108. //分页信息
  109. queryParams: {
  110. current: 1,
  111. size: 10,
  112. },
  113. //总数
  114. total: 0,
  115. //分页数量
  116. pageSize: [10, "全部"],
  117. //排序字段
  118. sort: [
  119. {
  120. "orderBy": "createTime",
  121. "orderType": 1
  122. }
  123. ],
  124. //加载
  125. loading: false,
  126. //报告数据集合
  127. dataList: [],
  128. // 报告分组数据集合
  129. commonData: [],
  130. // 栏位信息数组
  131. columnList: [],
  132. // 子组件新增、编辑报告成功发送的字符串
  133. handleMessage: '',
  134. showView:false,
  135. };
  136. },
  137. watch: {},
  138. computed: {
  139. dictMessage() {
  140. var a = this.$store.state.dictMessage.dictMessage
  141. if (a.REPORT_TYPE) {
  142. a.REPORT_TYPE.forEach(item => {
  143. if (['0', '1', '2'].includes(item.dictChildValue)) {
  144. item.permission = 'invalid'
  145. } else if (item.dictChildValue == 3) {
  146. item.permission = 'FTO'
  147. } else if (item.dictChildValue == 4) {
  148. item.permission = 'tort'
  149. } else if (item.dictChildValue == 5) {
  150. item.permission = 'avoidDesign'
  151. } else if (item.dictChildValue == 7) {
  152. item.permission = 'reInvalid'
  153. }
  154. })
  155. }
  156. if (a.REPORT_TYPE) {
  157. // 报告类型
  158. this.searchFiled[1].options = a.REPORT_TYPE.map(item => {
  159. return {
  160. value: item.dictChildValue,
  161. label: item.dictChildLabel
  162. }
  163. })
  164. // 报告状态
  165. this.searchFiled[2].options = a.REPORT_STATE.map(item => {
  166. return {
  167. value: item.dictChildValue,
  168. label: item.dictChildLabel
  169. }
  170. })
  171. }
  172. return a
  173. },
  174. state() {
  175. var a = this.$store.state.dictMessage.dictMessage.REPORT_STATE
  176. var b = {}
  177. if (a) {
  178. a.forEach(item => {
  179. b[item.dictChildValue] = item.dictChildLabel
  180. });
  181. return b
  182. }
  183. return []
  184. },
  185. scene(){
  186. var a = this.$store.state.dictMessage.scenario.map(item=>{
  187. return {
  188. label:item.name,
  189. value:item.id
  190. }
  191. })
  192. var obj = this.searchFiled.find(item=>{return item.label == '应用场景'})
  193. if(obj){
  194. obj.options = a
  195. }
  196. return this.$store.state.dictMessage.scenario
  197. },
  198. matter() {
  199. var a = this.$store.state.dictMessage.matter.map(item => {
  200. return {
  201. label: item.name,
  202. value: item.id
  203. }
  204. })
  205. var obj = this.searchFiled.find(item => { return item.label == '调查类型' })
  206. if (obj) {
  207. obj.options = a
  208. }
  209. return this.$store.state.dictMessage.matter || []
  210. }
  211. },
  212. created() { },
  213. async mounted() {
  214. // 获取table栏位
  215. this.columnList = await this.$commonJS.getCustomField('reportProject')
  216. // 获取搜索/分组
  217. await this.getColumn()
  218. //获取报告清单
  219. this.getList()
  220. this.showViews()
  221. },
  222. methods: {
  223. //显示视图?
  224. showViews() {
  225. this.showView = false
  226. this.$nextTick(() => {
  227. this.showView = true
  228. })
  229. },
  230. // 显示栏位管理组件返回数据
  231. getFieldList(val) {
  232. this.columnList = val
  233. },
  234. // 显示栏位管理
  235. showField() {
  236. this.$refs.field.open(this.columnList)
  237. },
  238. //获取table栏位及分组字段、检索字段
  239. async getColumn() {
  240. let params = ['reportProject']
  241. await this.$api.getParamsCommon(params).then(res => {
  242. if (res.code == 200) {
  243. let conditionDTOList = JSON.parse(JSON.stringify(res.data[0].conditionDTOList))
  244. // 分组字段
  245. this.groupingOption = this.$commonJS.getField(conditionDTOList, (u) => u.ifGroup == true, {
  246. name: 'name',
  247. value: 'value',
  248. })
  249. // 搜索字段
  250. this.searchFiled = this.$commonJS.getField(conditionDTOList, (u) => u.ifSearch == true, {
  251. label: 'name',
  252. value: 'value',
  253. type: 'type',
  254. })
  255. //先获取报告类型,报告状态,相关事件,再为报告类型,报告状态,相关事件添加选项
  256. let arr = ['报告类型', '报告状态', '核心结论']
  257. arr.forEach(item => {
  258. let obj = this.searchFiled.find(item2 => {
  259. return item2.label == item
  260. })
  261. if (obj) {
  262. this.handleSearchArray(obj)
  263. }
  264. })
  265. //为应用场景添加选项
  266. var obj = this.searchFiled.find(item=>{return item.label == '应用场景'})
  267. if(obj){
  268. obj.options = this.scene.map(item=>{
  269. return {
  270. label:item.name,
  271. value:item.id
  272. }
  273. })
  274. }
  275. var obj = this.searchFiled.find(item=>{return item.label == '调查类型'})
  276. if(obj){
  277. obj.options = this.matter.map(item=>{
  278. return {
  279. label:item.name,
  280. value:item.id
  281. }
  282. })
  283. }
  284. }
  285. })
  286. this.showView = false
  287. this.$nextTick(() => {
  288. this.showView = true
  289. })
  290. },
  291. // 处理检索字段为array类型的问题
  292. handleSearchArray(obj) {
  293. switch (obj.label) {
  294. case '报告类型':
  295. let dict = this.dictMessage.REPORT_TYPE.filter(item => !['6'].includes(item.dictChildValue))
  296. obj.options = dict.map(item => {
  297. return {
  298. label: item.dictChildLabel,
  299. value: item.dictChildValue,
  300. }
  301. })
  302. break;
  303. case '报告状态':
  304. obj.options = [
  305. { value: 0, label: '开卷审核' },
  306. { value: 1, label: '创建中' },
  307. { value: 2, label: '处理中' },
  308. { value: 3, label: '完成' },
  309. { value: 4, label: '取消开卷' },
  310. { value: 5, label: '补资料中' },
  311. ]
  312. break;
  313. case '核心结论':
  314. this.$api.queryCrons().then(res => {
  315. if (res.code == 200) {
  316. obj.options = res.data.data
  317. }
  318. })
  319. break;
  320. default:
  321. break;
  322. }
  323. },
  324. //接收检索条件
  325. search(val) {
  326. let params = {}
  327. val.forEach(item => {
  328. if (item.type == 3) {
  329. params[item.value] = item.searchValue.map(itemValue => {
  330. return itemValue.value
  331. })
  332. } else {
  333. params[item.value] = item.searchValue.label
  334. }
  335. })
  336. // 返回字符串
  337. this.searchOption = params
  338. // 调用查询接口
  339. this.queryParams.current = 1
  340. this.getList()
  341. },
  342. //获取报告列表
  343. getList() {
  344. let params = {
  345. ...this.queryParams,//分页信息
  346. searchQuery: this.$commonJS.objectToString(this.searchOption),//检索条件
  347. orderDTOList: this.sort,//排序信息
  348. }
  349. this.loading = true
  350. this.$api.queryReportProject(params).then(res => {
  351. if (res.code == 200) {
  352. this.dataList = res.data.data
  353. this.total = res.data.total
  354. this.loading = false
  355. }
  356. }).catch(error => {
  357. this.dataList = []
  358. this.total = 0
  359. this.loading = false
  360. this.$message.error(error.message)
  361. })
  362. },
  363. // 获取分组数据
  364. getGrouping() {
  365. let params = {
  366. ...this.queryParams,//分页信息
  367. searchQuery: this.$commonJS.objectToString(this.searchOption),//检索条件
  368. orderDTOList: this.sort,//排序
  369. groupBy: this.groupingValue,//分组信息
  370. }
  371. this.$api.groupReportProject(params).then(res => {
  372. if (res.code == 200) {
  373. this.commonData = res.data.data.values
  374. this.total = res.total
  375. }
  376. }).catch(error => {
  377. this.commonData = []
  378. this.total = 0
  379. this.$message.error(error.message)
  380. })
  381. },
  382. //排序
  383. handleSort({ column, prop, order }) {
  384. //如需要多个字段排序,则不需要清空
  385. var params = {
  386. sort:this.sort,
  387. column,
  388. prop,
  389. order,
  390. }
  391. this.sort = this.$commonJS.getSortData(params)
  392. this.queryParams.current = 1
  393. this.isGrouping()
  394. },
  395. //分页
  396. handleCurrentChange(val) {
  397. this.queryParams.current = val;
  398. this.isGrouping()
  399. },
  400. //切换页大小
  401. handleSizeChange(val) {
  402. this.queryParams.size = val
  403. this.isGrouping()
  404. // this.getList()
  405. },
  406. //切换视图
  407. onChange(type) {
  408. this.viewType = type
  409. if (type == 'visual') {
  410. this.$nextTick(() => {
  411. this.reportVisual()
  412. })
  413. return false
  414. }
  415. this.queryParams.size = this.viewType === 'Table' ? 10 : 12
  416. this.groupingValue = ''
  417. this.queryParams.current = 1
  418. this.getList()
  419. },
  420. //展示报告可视化
  421. reportVisual() {
  422. this.$api.reportVisual(this.queryParams).then(response => {
  423. if (response.code == 200) {
  424. this.$refs.reportVisual.open(response.data)
  425. }
  426. })
  427. },
  428. //切换分组值
  429. changeGrouping(val) {
  430. if (val != '') {
  431. this.viewType = 'mergeTable'
  432. } else {
  433. this.viewType = 'Table'
  434. }
  435. this.queryParams.current = 1
  436. this.groupingValue = val
  437. this.isGrouping()
  438. },
  439. // 区分是否为分组
  440. isGrouping() {
  441. if (this.groupingValue != '') {//分组
  442. this.getGrouping()
  443. } else {//不分组
  444. this.getList()
  445. }
  446. },
  447. //打开创建报告弹窗
  448. handleAnalyse(id) {
  449. var form = {
  450. reportType: id,
  451. scenarioList: []
  452. }
  453. this.$refs.ReportForm.open(form)
  454. },
  455. //操作列
  456. handleOption({ option, row, isLast }) {
  457. this.$s.setSession('params', row)
  458. switch (option) {
  459. case '0'://分享
  460. this.share(row)
  461. break
  462. case '1'://导出报告
  463. this.exportReport(row)
  464. break
  465. case '2'://报告文档
  466. this.handleFile(row)
  467. break
  468. case '5'://拆分特征
  469. this.handleDetails(row)
  470. break
  471. case '3'://自定义字段
  472. this.handleFields(row)
  473. break
  474. case '4'://任务分配
  475. this.handleTask(row)
  476. break
  477. case '6'://导入专利
  478. this.handleImportPatent(row)
  479. break
  480. case '7'://删除
  481. this.handleDelete(row, isLast)
  482. break;
  483. case '8'://侵权分析技术特征对比
  484. this.$s.setSession('reportMessage1', row)
  485. var routerReport3 = this.$router.resolve({
  486. path: "/tortIndex",
  487. query: {
  488. id: row.id,
  489. patentNo: row.signPatentNo,
  490. personId: row.personId,
  491. type: 8
  492. }
  493. })
  494. window.open(routerReport3.href, '_blank');
  495. break
  496. case '9'://回避设计
  497. this.handleDetails(row)
  498. break;
  499. case '10'://添加对比文件
  500. this.addPatentList(row)
  501. break
  502. case '11'://完成报告
  503. this.completeReport(row)
  504. break
  505. case '12'://追踪报告
  506. this.trackReport(row)
  507. break
  508. case '13'://添加无效理由和证据
  509. this.toInvalidIndex(row)
  510. break;
  511. case '14'://导入无效证据
  512. this.toInvalidResponset(row)
  513. break;
  514. case 'e'://编辑
  515. this.handleEdit(row)
  516. break
  517. }
  518. },
  519. // 删除
  520. handleDelete(row, isLast) {
  521. this.handleDeletes([row.id], isLast)
  522. },
  523. // 批量删除报告
  524. handleDeletes(ids, isLast) {
  525. this.$confirm('此操作将永久删除该报告, 是否继续?', '提示', {
  526. confirmButtonText: '确定',
  527. cancelButtonText: '取消',
  528. type: 'warning'
  529. }).then(() => {
  530. this.$api.deleteReportProject(ids).then(res => {
  531. if (res.code == 200) {
  532. if (isLast) {
  533. this.isGrouping()
  534. } else {
  535. this.getList()
  536. }
  537. this.handleMessage = '删除成功'
  538. this.clearMessage()
  539. this.$message.success('删除报告成功')
  540. }
  541. }).catch(err => {
  542. this.$message.error(err.message)
  543. })
  544. }).catch(() => {
  545. this.$message.info("已取消删除")
  546. });
  547. },
  548. //编辑报告
  549. handleEdit(row) {
  550. this.$refs.ReportForm.open(row)
  551. },
  552. //查看详情(修改)
  553. checkDetails(row) {
  554. row.dictMessage = this.dictMessage
  555. row.showMenu = true
  556. this.$s.setSession('row', row)
  557. this.$s.setSession('params', row)
  558. switch (row.type) {
  559. case 0://无效分析
  560. case 1://稳定性分析
  561. case 2://第三方意见
  562. var router = this.$router.resolve({
  563. name: 'rDetails',
  564. })
  565. window.open(router.href, '_blank');
  566. break;
  567. case 3://FTO
  568. case 4://侵权
  569. var router = this.$router.resolve({
  570. name: 'FTOrDetails',
  571. })
  572. window.open(router.href, '_blank');
  573. break;
  574. case 5://回避
  575. var router = this.$router.resolve({
  576. name: 'avoidAside',
  577. })
  578. window.open(router.href, '_blank');
  579. break;
  580. case 6://图表
  581. break;
  582. case 7://无效应对
  583. var router = this.$router.resolve({
  584. name: 'InvalidResponse',
  585. })
  586. window.open(router.href, '_blank');
  587. break;
  588. }
  589. },
  590. //接收可视化的参数
  591. getParams(params) {
  592. if (params.conclusionType == '-1') {
  593. this.searchOption.statuses = ['0', '1', '2', '4', '5']
  594. this.searchOption.types = [params.type]
  595. } else {
  596. this.searchOption.cronIds = [params.conclusionType]
  597. }
  598. var a = JSON.parse(JSON.stringify(this.searchOption))
  599. this.searchOption = a
  600. this.viewType = 'Table'
  601. this.queryParams.current = 1
  602. this.getList()
  603. },
  604. //创建报告子组件返回值
  605. isGetList(val) {
  606. this.handleMessage = val
  607. this.queryParams.current = 1
  608. this.isGrouping()
  609. this.clearMessage()
  610. },
  611. //清空信息
  612. clearMessage() {
  613. this.$nextTick(() => {
  614. this.handleMessage = ''
  615. })
  616. },
  617. },
  618. };
  619. </script>
  620. <style lang="scss" scoped></style>