index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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 1://项目开卷审核任务
  292. this.handleProject(row, str)
  293. break;
  294. case 4://侵权分析及FTO协同任务
  295. this.teamworkTask(row, str ? 2 : 1)
  296. break;
  297. case 5://专利挖掘任务审核任务
  298. case 7://专利挖掘文件审核任务
  299. this.fileExamine(row)
  300. break;
  301. case 6://专利挖掘文件分配任务
  302. this.$refs.handleTask2Dialog.open(row, !str)
  303. break;
  304. default:
  305. break;
  306. }
  307. },
  308. // 处理项目开卷审核任务
  309. handleProject(row, str) {
  310. if (row.projectType == 2) {//报告项目开卷审核
  311. this.getPatentNoMessage(row, str ? 1 : 2)
  312. } else {//专利挖掘开卷审核
  313. this.getPatentMining(row, str ? 1 : 2)
  314. }
  315. },
  316. getPatentNoMessage(row, str) {
  317. this.$refs.lookReport.open(row,str)
  318. },
  319. //协同任务(侵权分析及FTO)
  320. teamworkTask(row, val) {
  321. let router = this.$router.resolve({
  322. path: '/tortTeamWork',
  323. query: {
  324. taskId: row.id,
  325. projectId: row.projectId,
  326. isResult: val
  327. }
  328. })
  329. window.open(router.href, '_blank')
  330. },
  331. //文件及任务审核任务(专利挖掘)
  332. fileExamine(row) {
  333. row.disabled = str == '查看' ? true : false
  334. let router = this.$router.resolve({
  335. path: '/handleExamine',
  336. query: {
  337. row: JSON.stringify(row)
  338. }
  339. })
  340. window.open(router.href, '_blank')
  341. },
  342. // 获取挖掘项目
  343. getPatentMining(row, val) {
  344. let params = {
  345. current: 1,
  346. size: 10,
  347. searchQuery: `id=${row.projectId}`,//检索条件
  348. }
  349. this.$api.queryPatentDigProject(params).then(res => {
  350. if (res.code == 200) {
  351. this.$refs.handleTask1Dialog.open(res.data.data[0], row, val)
  352. }
  353. })
  354. },
  355. // 左侧搜索
  356. search(val) {
  357. let params = {}
  358. val.forEach(item => {
  359. if (item.type == 3) {
  360. params[item.value] = item.searchValue.map(itemValue => {
  361. return itemValue.value
  362. })
  363. } else {
  364. params[item.value] = item.searchValue.label
  365. }
  366. })
  367. // 返回字符串
  368. this.searchOption = params
  369. // 调用查询接口
  370. this.queryParams.current = 1
  371. this.getList()
  372. },
  373. //排序
  374. sortChange({ column, prop, order }) {
  375. //如需要多个字段排序,则不需要清空
  376. var params = {
  377. sort: this.sort,
  378. column,
  379. prop,
  380. order,
  381. }
  382. this.sort = this.$commonJS.getSortData(params)
  383. this.queryParams.current = 1
  384. this.getList()
  385. },
  386. //获取table栏位及分组字段、检索字段
  387. async getColumn() {
  388. let params = [this.searchType[this.type]]
  389. await this.$api.getParamsCommon(params).then(res => {
  390. if (res.code == 200) {
  391. let conditionDTOList = JSON.parse(JSON.stringify(res.data[0].conditionDTOList))
  392. // 搜索字段
  393. this.searchFiled = this.$commonJS.getField(conditionDTOList, (u) => u.ifSearch == true, {
  394. label: 'name',
  395. value: 'value',
  396. type: 'type',
  397. })
  398. var obj = this.searchFiled.find(item => { return item.label == '任务状态' })
  399. if (obj) {
  400. obj.options = []
  401. for (let key in this.taskStatus) {
  402. obj.options.push({
  403. label: this.taskStatus[key],
  404. value: key
  405. })
  406. }
  407. }
  408. var obj2 = this.searchFiled.find(item => { return item.label == '任务类型' })
  409. if (obj) {
  410. obj2.options = []
  411. for (let key in this.taskType) {
  412. obj2.options.push({
  413. label: this.taskType[key],
  414. value: key
  415. })
  416. }
  417. }
  418. var obj3 = this.searchFiled.find(item => { return item.label == '所属流程' })
  419. obj3.options = this.pathOptions
  420. }
  421. })
  422. },
  423. },
  424. }
  425. </script>
  426. <style lang="scss" scoped></style>