index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <div class="height_100">
  3. <el-container>
  4. <el-header style="display: flex;justify-content: space-between;align-items: center;">
  5. <div>
  6. <mySearch :SearchFields="searchFiled" @search="search" :searchValue="searchOption"></mySearch>
  7. </div>
  8. <div>
  9. <el-button v-if="!show" class="margin-right_10" type="primary" size="small" @click="createTask">创建任务</el-button>
  10. </div>
  11. </el-header>
  12. <el-main class="height_100">
  13. <el-table :data="tableData" height="calc(100% - 1px)" style="width: 100%;" border
  14. header-row-class-name="custom-table-header" @sort-change="sortChange">
  15. <el-table-column label="#" align="center" width="80px">
  16. <template slot-scope="scope">
  17. <div>
  18. {{ (queryParams.current - 1) * queryParams.size + scope.$index + 1 }}
  19. </div>
  20. </template>
  21. </el-table-column>
  22. <el-table-column v-for="item in columnList" :key="item.value" :prop="item.value"
  23. :render-header="$commonJS.renderHeaderMethods" :label="item.name" sortable="custom" align="center">
  24. <template slot-scope="scope">
  25. <div v-if="['name'].includes(item.value)">
  26. <el-link @click="handleItem(scope.row, item.value)">
  27. <span v-html="$commonJS.getColumnData(scope.row, item)"></span>
  28. </el-link>
  29. </div>
  30. <div v-else-if="['type'].includes(item.value)"
  31. v-html="$commonJS.getColumnData(scope.row, item, null, { data: taskType })"></div>
  32. <div v-else-if="['status'].includes(item.value)"
  33. v-html="$commonJS.getColumnData(scope.row, item, null, { data: taskStatus })"></div>
  34. <div v-else v-html="$commonJS.getColumnData(scope.row, item)"></div>
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="操作" align="center" width="180px">
  38. <template slot-scope="scope">
  39. <div>
  40. <el-dropdown split-button type="primary" size="small" @command="handleCommand($event, scope.row)"
  41. @click="handleTask(scope.row)">
  42. <span v-if="scope.row.status != 2 || scope.row.handlerName != userinfo.name">查 看</span>
  43. <span v-else>处 理</span>
  44. <el-dropdown-menu slot="dropdown" style="text-align: center;">
  45. <el-dropdown-item command="1" v-if="[6].includes(scope.row.type)">查看审核记录</el-dropdown-item>
  46. <el-dropdown-item command="4"
  47. v-if="scope.row.status != 3 && (scope.row.createName == userinfo.name && [1, 5, 6, 7].includes(scope.row.type))">编
  48. 辑</el-dropdown-item>
  49. <el-dropdown-item command="3" v-if="[4, 6].includes(scope.row.type) && scope.row.status == 2">完
  50. 成</el-dropdown-item>
  51. <el-dropdown-item command="5"
  52. v-if="[4].includes(scope.row.type) && scope.row.status == 2 && scope.row.createName == userinfo.name">确认协同结果</el-dropdown-item>
  53. <el-dropdown-item command="2"
  54. v-if="scope.row.createName == userinfo.name || (scope.row.type == 5 && !scope.row.handlerName.includes('@'))"
  55. divided style="color: red;">取 消</el-dropdown-item>
  56. </el-dropdown-menu>
  57. </el-dropdown>
  58. </div>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. </el-main>
  63. <el-footer class="pagination">
  64. <el-pagination background layout="total, prev, pager, next, jumper" :current-page.sync="queryParams.current"
  65. :page-size.sync="queryParams.size" @current-change="handleCurrentChange" :total="queryParams.total">
  66. </el-pagination>
  67. </el-footer>
  68. </el-container>
  69. <auditRecords ref="auditRecords"></auditRecords>
  70. <createTask ref="createTaskDialog" :id="id" :processId="processId" @isCreate="isCreate"></createTask>
  71. <handleTask1 ref="handleTask1Dialog" @isSuccess="isSuccess"></handleTask1>
  72. <handleTask2 ref="handleTask2Dialog" @isSuccess="isSuccess"></handleTask2>
  73. <lookReport ref="lookReport" @isSuccess="isSuccess"></lookReport>
  74. </div>
  75. </template>
  76. <script>
  77. import { mapGetters } from 'vuex'
  78. import { column, optionsData } from '@/views/patentMining/components/mixins/index2'
  79. import { taskPatentMining } from './mixins/task'
  80. import auditRecords from '@/views/patentMining/components/dialog/auditRecords.vue'
  81. import createTask from '@/views/patentMining/components/dialog/createTask.vue'
  82. import handleTask1 from '@/views/patentMining/components/dialog/handleTask1.vue'
  83. import handleTask2 from '@/views/patentMining/components/dialog/handleTask2.vue'
  84. import lookReport from '@/views/report/components/dialog/lookReport.vue'
  85. export default {
  86. mixins: [column, optionsData, taskPatentMining],
  87. // type区分是从哪里进入
  88. props: {
  89. type: {
  90. default: 1
  91. },
  92. projectId: '',
  93. processId: '',
  94. show: {
  95. type: Boolean,
  96. default: false
  97. },
  98. },
  99. components: {
  100. auditRecords,
  101. createTask,
  102. handleTask1,
  103. handleTask2,
  104. lookReport,
  105. },
  106. data() {
  107. return {
  108. // table数据
  109. tableData: [],
  110. // 分页及总数信息
  111. queryParams: {
  112. current: 1,
  113. size: 10,
  114. total: 0,
  115. },
  116. searchFiled2: {
  117. projectId: this.projectId,
  118. processId: this.processId
  119. },
  120. // 检索字段
  121. searchFiled: [],
  122. // 检索字符串
  123. searchOption: {},
  124. //排序字段
  125. sort: [{ "orderBy": "createTime", "orderType": 1 }],
  126. // 检索字段标识
  127. searchType: {
  128. 1: 'projectTask',//专利挖掘任务清单检索字段
  129. },
  130. // 任务类型
  131. taskType: {
  132. 0: '标引任务',
  133. 1: '项目开卷审核任务',
  134. 2: '检索条件任务',
  135. 3: '对比任务',
  136. 4: '协同任务',
  137. 5: '任务审核任务',
  138. 6: '文件分配任务',
  139. 7: '文件审核任务',
  140. },
  141. // 任务状态
  142. taskStatus: {
  143. 1: '审核中',
  144. 2: '处理中',
  145. 3: '已完成',
  146. 4: '缺少资料',
  147. 5: '取消',
  148. },
  149. }
  150. },
  151. watch: {
  152. processId(val) {
  153. if (val) {
  154. this.searchFiled2.processId = val
  155. this.tableData = []
  156. this.getList()
  157. }
  158. }
  159. },
  160. computed: {
  161. ...mapGetters(['webSocket', 'userinfo']),
  162. },
  163. async mounted() {
  164. // 获取table栏位
  165. this.columnList = await this.$commonJS.getCustomField('projectTask')
  166. // 获取栏位
  167. await this.getColumn()
  168. // 获取数据
  169. this.getList()
  170. },
  171. methods: {
  172. // 创建分配任务成功
  173. isCreate(val) {
  174. if (val) {
  175. this.getList()
  176. }
  177. },
  178. // 分配任务审核任务新增成功
  179. isSuccess(val) {
  180. if (val) {
  181. this.getList()
  182. }
  183. },
  184. // 请求数据
  185. getList() {
  186. let searchOption = {
  187. ...this.searchFiled2,//固有检索字段
  188. ...this.searchOption
  189. }
  190. let params = {
  191. ...this.queryParams,//分页信息
  192. searchQuery: this.$commonJS.objectToString(searchOption),//检索条件
  193. orderDTOList: this.sort,//排序信息
  194. }
  195. this.$api.queryProjectTask(params).then(response => {
  196. if (response.code == 200) {
  197. this.tableData = response.data.data
  198. this.queryParams.current = response.data.current
  199. this.queryParams.size = response.data.size
  200. this.queryParams.total = response.data.total
  201. }
  202. }).catch(error => {
  203. // this.tableData = []
  204. this.queryParams.total = 0
  205. })
  206. },
  207. // 分页
  208. handleCurrentChange(val) {
  209. this.queryParams.current = val
  210. this.getList()
  211. },
  212. // 操作栏下拉菜单按钮
  213. handleCommand(ev, row) {
  214. switch (ev) {
  215. case '1'://查看审核记录
  216. this.$refs.auditRecords.open(row)
  217. break;
  218. case '2'://取消任务//发起人和审核人可以取消任务,外部人员不能取消任务
  219. this.finishClose(row, 1)
  220. break;
  221. case '3'://完成任务
  222. this.finishClose(row, 0)
  223. break;
  224. case '4'://编辑任务
  225. this.handleEdit(row)
  226. break;
  227. case '5'://确认协同结果
  228. this.handleConfirm(row)
  229. break;
  230. default:
  231. break;
  232. }
  233. },
  234. // 确认协同结果
  235. handleConfirm(row) {
  236. let router = this.$router.resolve({
  237. path: '/tortTeamWork',
  238. query: {
  239. taskId: row.id,
  240. projectId: row.projectId,
  241. isResult: 3
  242. }
  243. })
  244. window.open(router.href, '_blank')
  245. },
  246. // 编辑任务
  247. handleEdit(row) {
  248. this.$refs.createTaskDialog.open(row)
  249. },
  250. // 取消/完成任务//0完成1取消2缺少资料
  251. finishClose(row, status) {
  252. // this.finishCloses([row.id], status)
  253. this.finishCloses(row.id, status)
  254. },
  255. finishCloses(id, status) {
  256. let params = {
  257. taskId: id,
  258. type: status
  259. }
  260. var str = ''
  261. if (status == 0) {
  262. str = '此操作会将任务置为完成,操作不可逆, 是否继续?'
  263. } else if (status == 1) {
  264. str = '此操作会将任务置为取消,操作不可逆, 是否继续?'
  265. }
  266. this.$confirm(str, '提示', {
  267. confirmButtonText: '确定',
  268. cancelButtonText: '取消',
  269. type: 'warning'
  270. }).then(() => {
  271. this.$api.updateTaskStatus(params).then(response => {
  272. if (response.code == 200) {
  273. if (status == 0) {
  274. this.$message.success('完成任务成功')
  275. } else if (status == 1) {
  276. this.$message.success('取消任务成功')
  277. }
  278. this.queryParams.current = 1
  279. this.getList()
  280. }
  281. })
  282. }).catch(() => {
  283. this.$message.info('操作已取消')
  284. });
  285. },
  286. //处理任务
  287. handleTask(row) {
  288. // 状态不是处理中或者创建人和处理人不相同是查看{true:查看,false:处理}
  289. var str = (row.status != 2 || row.handlerName != this.userinfo.name)
  290. switch (row.type) {//projectType项目类型(1专题库 2报告 3专利挖掘项目)
  291. case 0://报告标引任务
  292. this.handleAllocation(row)
  293. break;
  294. case 1://项目开卷审核任务
  295. this.handleProject(row, str)
  296. break;
  297. case 3://报告对比任务
  298. // this.handleAllocation(row)
  299. break;
  300. case 4://侵权分析及FTO协同任务
  301. this.teamworkTask(row, str ? 2 : 1)
  302. break;
  303. case 5://专利挖掘任务审核任务
  304. case 7://专利挖掘文件审核任务
  305. this.fileExamine(row)
  306. break;
  307. case 6://专利挖掘文件分配任务
  308. this.$refs.handleTask2Dialog.open(row, !str)
  309. break;
  310. default:
  311. break;
  312. }
  313. },
  314. //报告分配(标引)任务
  315. handleAllocation(row, str) {
  316. let router = this.$router.resolve({
  317. path: '/reportPatentList',
  318. query: {
  319. taskId: row.id,
  320. projectId: row.projectId,
  321. }
  322. })
  323. window.open(router.href, '_blank')
  324. },
  325. // 处理项目开卷审核任务
  326. handleProject(row, str) {
  327. if (row.projectType == 2) {//报告项目开卷审核
  328. this.getPatentNoMessage(row, str ? 1 : 2)
  329. } else {//专利挖掘开卷审核
  330. this.getPatentMining(row, str ? 1 : 2)
  331. }
  332. },
  333. getPatentNoMessage(row, str) {
  334. this.$refs.lookReport.open(row, str)
  335. },
  336. //协同任务(侵权分析及FTO)
  337. teamworkTask(row, val) {
  338. let router = this.$router.resolve({
  339. path: '/tortTeamWork',
  340. query: {
  341. taskId: row.id,
  342. projectId: row.projectId,
  343. isResult: val
  344. }
  345. })
  346. window.open(router.href, '_blank')
  347. },
  348. //文件及任务审核任务(专利挖掘)
  349. fileExamine(row) {
  350. row.disabled = str == '查看' ? true : false
  351. let router = this.$router.resolve({
  352. path: '/handleExamine',
  353. query: {
  354. row: JSON.stringify(row)
  355. }
  356. })
  357. window.open(router.href, '_blank')
  358. },
  359. // 获取挖掘项目
  360. getPatentMining(row, val) {
  361. let params = {
  362. current: 1,
  363. size: 10,
  364. searchQuery: `id=${row.projectId}`,//检索条件
  365. }
  366. this.$api.queryPatentDigProject(params).then(res => {
  367. if (res.code == 200) {
  368. this.$refs.handleTask1Dialog.open(res.data.data[0], row, val)
  369. }
  370. })
  371. },
  372. // 左侧搜索
  373. search(val) {
  374. let params = {}
  375. val.forEach(item => {
  376. if (item.type == 3) {
  377. params[item.value] = item.searchValue.map(itemValue => {
  378. return itemValue.value
  379. })
  380. } else {
  381. params[item.value] = item.searchValue.label
  382. }
  383. })
  384. // 返回字符串
  385. this.searchOption = params
  386. // 调用查询接口
  387. this.queryParams.current = 1
  388. this.getList()
  389. },
  390. //排序
  391. sortChange({ column, prop, order }) {
  392. //如需要多个字段排序,则不需要清空
  393. var params = {
  394. sort: this.sort,
  395. column,
  396. prop,
  397. order,
  398. }
  399. this.sort = this.$commonJS.getSortData(params)
  400. this.queryParams.current = 1
  401. this.getList()
  402. },
  403. //获取table栏位及分组字段、检索字段
  404. async getColumn() {
  405. let params = [this.searchType[this.type]]
  406. await this.$api.getParamsCommon(params).then(res => {
  407. if (res.code == 200) {
  408. let conditionDTOList = JSON.parse(JSON.stringify(res.data[0].conditionDTOList))
  409. // 搜索字段
  410. this.searchFiled = this.$commonJS.getField(conditionDTOList, (u) => u.ifSearch == true, {
  411. label: 'name',
  412. value: 'value',
  413. type: 'type',
  414. })
  415. var obj = this.searchFiled.find(item => { return item.label == '任务状态' })
  416. if (obj) {
  417. obj.options = []
  418. for (let key in this.taskStatus) {
  419. obj.options.push({
  420. label: this.taskStatus[key],
  421. value: key
  422. })
  423. }
  424. }
  425. var obj2 = this.searchFiled.find(item => { return item.label == '任务类型' })
  426. if (obj) {
  427. obj2.options = []
  428. for (let key in this.taskType) {
  429. obj2.options.push({
  430. label: this.taskType[key],
  431. value: key
  432. })
  433. }
  434. }
  435. var obj3 = this.searchFiled.find(item => { return item.label == '所属流程' })
  436. obj3.options = this.pathOptions
  437. }
  438. })
  439. },
  440. },
  441. }
  442. </script>
  443. <style lang="scss" scoped></style>