get_task.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <template>
  2. <div>
  3. <div class="box boxMinHeight">
  4. <el-tabs v-model="active">
  5. <el-tab-pane label="待领取" name="unclaimed"></el-tab-pane>
  6. <el-tab-pane label="已领取" name="received"></el-tab-pane>
  7. </el-tabs>
  8. <div v-if="active === 'unclaimed'">
  9. <el-table :data="list" style="width: 100%" v-loading="loading" @row-click="openDetail">
  10. <el-table-column label="发布者" prop="owner_name">
  11. <template slot-scope="scope">
  12. <userImage class="fl" :id="scope.row.owner_id" :user_name="scope.row.owner_name" :img_url="scope.row.owner_img_url" width="50px" height="50px"></userImage>
  13. <span style="line-height: 50px; padding-left: 10px;">{{ scope.row.owner_name }}</span>
  14. </template>
  15. </el-table-column>
  16. <el-table-column label="任务内容" prop="task_name" show-overflow-tooltip></el-table-column>
  17. <el-table-column label="积分" prop="base_point" width="120">
  18. <template slot-scope="scope">
  19. <span v-if="scope.row.base_point>=0" class="red">+{{scope.row.base_point}} {{scope.row.pt_name}}</span>
  20. <span v-else class="green">{{scope.row.base_point}} {{scope.row.pt_name}}</span>
  21. </template>
  22. </el-table-column>
  23. <el-table-column label="截止时间" prop="expire_time" width="200"></el-table-column>
  24. <el-table-column label="操作" prop="owner_id" v-if="!$supremeAuthority('creator')" width="120">
  25. <template slot-scope="scope">
  26. <el-link v-if="scope.row.owner_id!=$userInfo().id && scope.row.reviewer_id != $userInfo().id" type="primary">领取任务</el-link>
  27. </template>
  28. </el-table-column>
  29. <template slot="empty">
  30. <NoData></NoData>
  31. </template>
  32. </el-table>
  33. </div>
  34. <div v-if="active === 'received'">
  35. <el-table :data="list" style="width: 100%" v-loading="loading" @row-click="openDetail">
  36. <el-table-column label="执行人" prop="receiver_id" width="250">
  37. <template slot-scope="scope">
  38. <userImage class="fl" :id="scope.row.receiver_id" :user_name="scope.row.receiver_name" :img_url="scope.row.receiver_img_url" width="50px" height="50px"></userImage>
  39. <span style="line-height: 50px; padding-left: 10px;">{{ scope.row.receiver_name }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="任务内容" prop="task_name" show-overflow-tooltip></el-table-column>
  43. <el-table-column label="积分" prop="base_point" width="120">
  44. <template slot-scope="scope">
  45. <span v-if="scope.row.base_point>=0" class="red">+{{scope.row.base_point}} {{scope.row.pt_name}}</span>
  46. <span v-else class="green">{{scope.row.base_point}} {{scope.row.pt_name}}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="截止时间" prop="expire_time" width="200"></el-table-column>
  50. <template slot="empty">
  51. <NoData></NoData>
  52. </template>
  53. </el-table>
  54. </div>
  55. <center style="padding: 20px 0;">
  56. <el-pagination
  57. background
  58. @size-change="handleSizeChange"
  59. @current-change="handleCurrentChange"
  60. :page-sizes="[10, 20, 50, 100]"
  61. layout="total, sizes, prev, pager, next"
  62. :current-page="formData.page"
  63. :page-size="formData.page_size"
  64. :total="total"
  65. ></el-pagination>
  66. </center>
  67. <el-drawer :custom-class="'drawer_details'" :visible.sync="detailShow" :with-header="false" size="500px">
  68. <div class="details_title">悬赏信息</div>
  69. <div class="details_content" v-loading="detail_loading">
  70. <!-- <div style="border-bottom:1px #f8f8f8 solid;padding-bottom: 10px;margin-bottom: 10px;" class="flex-box-ce">-->
  71. <!-- <userImage-->
  72. <!-- :user_name="active == 'unclaimed' ? detailInfo.owner_name : detailInfo.receiver_name"-->
  73. <!-- :id="active == 'unclaimed' ? detailInfo.owner_id : detailInfo.receiver_id"-->
  74. <!-- :img_url="active == 'unclaimed' ? detailInfo.owner_img_url : detailInfo.receiver_img_url"-->
  75. <!-- class="fl"-->
  76. <!-- width="50px"-->
  77. <!-- height="50px"-->
  78. <!-- fontSize="15"-->
  79. <!-- ></userImage>-->
  80. <!-- <div class="flex-1" style="padding-left: 10px;">-->
  81. <!-- <div class="flex-box-ce" style="margin-bottom: 4px;">-->
  82. <!-- <div class="flex-1" style="font-size: 16px;font-weight: 700;">-->
  83. <!-- {{ active == 'unclaimed' ? detailInfo.owner_name : detailInfo.receiver_name }}{{active == 'unclaimed' ? `悬赏的${$getTypsName(detailInfo.pt_id)}任务`:`领取的${$getTypsName(detailInfo.pt_id)}任务`}}-->
  84. <!-- </div>-->
  85. <!-- <div>-->
  86. <!-- <span class="color_red point" v-show="detailInfo.point_config.base_point >= 0">+{{ detailInfo.point_config.base_point }}</span>-->
  87. <!-- <span class="color_green point" v-show="detailInfo.point_config.base_point < 0">{{ detailInfo.point_config.base_point }}</span>-->
  88. <!-- </div>-->
  89. <!-- </div>-->
  90. <!-- <div class="orange">{{detailInfo.status_mark}}</div>-->
  91. <!-- </div>-->
  92. <!-- </div>-->
  93. <!-- <el-row v-if="detailInfo.task_name !== ''">-->
  94. <!-- <el-col :span="4">任务内容</el-col>-->
  95. <!-- <el-col :span="20">{{ detailInfo.task_name }}</el-col>-->
  96. <!-- </el-row>-->
  97. <!-- <el-row v-if="detailInfo.task_remark !== ''">-->
  98. <!-- <el-col :span="4">任务备注</el-col>-->
  99. <!-- <el-col :span="20">{{ detailInfo.task_remark }}</el-col>-->
  100. <!-- </el-row>-->
  101. <!-- <el-row v-if="detailInfo.type_mark !== ''">-->
  102. <!-- <el-col :span="4">任务类型</el-col>-->
  103. <!-- <el-col :span="20">{{ detailInfo.type_mark }}</el-col>-->
  104. <!-- </el-row>-->
  105. <!-- <el-row v-if="$getTypsName(detailInfo.pt_id) !== ''">-->
  106. <!-- <el-col :span="4">积分类型</el-col>-->
  107. <!-- <el-col :span="20">{{ $getTypsName(detailInfo.pt_id) }}</el-col>-->
  108. <!-- </el-row>-->
  109. <!-- <el-row v-if="detailInfo.create_time !== ''">-->
  110. <!-- <el-col :span="4">发布时间</el-col>-->
  111. <!-- <el-col :span="20">{{ detailInfo.create_time }}</el-col>-->
  112. <!-- </el-row>-->
  113. <!-- <el-row v-if="detailInfo.expire_time !== ''">-->
  114. <!-- <el-col :span="4">截止时间</el-col>-->
  115. <!-- <el-col :span="20">{{ detailInfo.expire_time }}</el-col>-->
  116. <!-- </el-row>-->
  117. <!-- <el-row v-if="detailInfo.reviewer_name">-->
  118. <!-- <el-col :span="4">审批人</el-col>-->
  119. <!-- <el-col :span="20">{{ detailInfo.reviewer_name }}</el-col>-->
  120. <!-- </el-row>-->
  121. <!-- <el-row v-if="detailInfo.owner_name">-->
  122. <!-- <el-col :span="4">发布人</el-col>-->
  123. <!-- <el-col :span="20">{{ detailInfo.owner_name }}</el-col>-->
  124. <!-- </el-row>-->
  125. <!-- <el-row v-if="detailInfo.task_file_list !== null && detailInfo.task_file_list.length !== 0">-->
  126. <!-- <el-col :span="4">图片附件</el-col>-->
  127. <!-- <el-col :span="20">-->
  128. <!-- <el-image-->
  129. <!-- v-for="(item,index) in detailInfo.task_file_list"-->
  130. <!-- :key="index"-->
  131. <!-- style="width: 100px; height: 100px; margin-right:10px"-->
  132. <!-- :src="item"-->
  133. <!-- :preview-src-list="detailInfo.task_file_list"></el-image>-->
  134. <!-- </el-col>-->
  135. <!-- </el-row>-->
  136. <el-card shadow="always">
  137. <template slot="header">
  138. <div class="flex-box-ce">
  139. <userImage
  140. :user_name="active == 'unclaimed' ? detailInfo.owner_name : detailInfo.receiver_name"
  141. :id="active == 'unclaimed' ? detailInfo.owner_id : detailInfo.receiver_id"
  142. :img_url="active == 'unclaimed' ? detailInfo.owner_img_url : detailInfo.receiver_img_url"
  143. class="fl"
  144. width="50px"
  145. height="50px"
  146. fontSize="15"
  147. />
  148. <div>
  149. {{detailInfo.owner_name}}
  150. {{ $getTypsName(detailInfo.pt_id) }}任务
  151. <el-tag>{{ detailInfo.point_config.base_point }}分</el-tag>
  152. <el-tag type="info">{{ detailInfo.receiver_name }}{{ detailInfo.status_mark }}</el-tag>
  153. </div>
  154. </div>
  155. </template>
  156. <el-descriptions
  157. title="任务信息"
  158. direction="vertical"
  159. :column="2"
  160. size="small"
  161. :label-style="{width:'80px',textAlign:'center'}"
  162. :content-style="{width:'80px',textAlign: 'center'}"
  163. border
  164. >
  165. <el-descriptions-item label="任务内容">{{detailInfo.task_name}}</el-descriptions-item>
  166. <el-descriptions-item
  167. v-if="detailInfo.receiver_id !== 0"
  168. :label="detailInfo.status == 3 ? '完成人' : '领取人'"
  169. >{{detailInfo.receiver_name}}
  170. </el-descriptions-item>
  171. <el-descriptions-item
  172. v-if="detailInfo.task_remark"
  173. label="任务备注"
  174. >{{detailInfo.task_remark}}
  175. </el-descriptions-item>
  176. <el-descriptions-item
  177. v-if="detailInfo.point_config"
  178. label="任务积分"
  179. >
  180. {{ detailInfo.point_config.base_point }}{{ $getTypsName(detailInfo.pt_id) }}
  181. </el-descriptions-item>
  182. <el-descriptions-item label="发布时间">{{detailInfo.create_time}}</el-descriptions-item>
  183. <el-descriptions-item label="截止时间">{{detailInfo.end_time}}</el-descriptions-item>
  184. <el-descriptions-item
  185. v-if="detailInfo.point_config && detailInfo.point_config.timeout_deduction_point"
  186. label="逾期扣分"
  187. >
  188. {{ detailInfo.point_config.timeout_deduction_point }}/天
  189. </el-descriptions-item>
  190. <el-descriptions-item
  191. v-if="detailInfo.point_config && detailInfo.point_config.ahead_award_point"
  192. label="提前奖分"
  193. >
  194. {{ detailInfo.point_config.ahead_award_point }}/天
  195. </el-descriptions-item>
  196. <el-descriptions-item
  197. v-if="detailInfo.department_info"
  198. label="可见范围"
  199. >
  200. <div class="content_text" v-if="detailInfo.department_info.length > 0">
  201. <span
  202. v-for="(item, index) in detailInfo.department_info"
  203. :key="index"
  204. >
  205. {{ item.name }}&nbsp;
  206. </span>
  207. </div>
  208. <div v-else >
  209. <el-tag>全公司可见</el-tag>
  210. </div>
  211. </el-descriptions-item>
  212. <el-descriptions-item
  213. v-if="detailInfo.reviewer_name"
  214. label="审批人"
  215. >
  216. {{detailInfo.reviewer_name}}
  217. </el-descriptions-item>
  218. <el-descriptions-item label="任务类型">{{ detailInfo.source_type_mark }}</el-descriptions-item>
  219. </el-descriptions>
  220. <el-descriptions
  221. v-if="detailInfo.item_info"
  222. style="margin-top: 20px"
  223. title="规则依据"
  224. direction="vertical"
  225. :column="2"
  226. size="small"
  227. :label-style="{width:'80px',textAlign:'center'}"
  228. :content-style="{width:'80px',textAlign: 'center'}"
  229. border
  230. >
  231. <el-descriptions-item label="规则">{{detailInfo.item_info.remark}}</el-descriptions-item>
  232. <el-descriptions-item label="积分">{{pointRemark}}</el-descriptions-item>
  233. <el-descriptions-item label="规则状态" v-if="detailInfo.item_info.has_delete">
  234. <el-tag type="warning">规则已删除</el-tag>
  235. </el-descriptions-item>
  236. <el-descriptions-item v-if="detailInfo.rule_info" label="分类">{{detailInfo.rule_info.name}}</el-descriptions-item>
  237. <el-descriptions-item v-if="detailInfo.rule_info && detailInfo.rule_info.has_delete" label="分类状态">
  238. <el-tag type="warning">分类已删除</el-tag>
  239. </el-descriptions-item>
  240. </el-descriptions>
  241. <el-descriptions
  242. v-else-if="detailInfo.rule_info"
  243. style="margin-top: 20px"
  244. title="规则分类"
  245. direction="vertical"
  246. :column="2"
  247. size="small"
  248. :label-style="{width:'80px',textAlign:'center'}"
  249. :content-style="{width:'80px',textAlign: 'center'}"
  250. border
  251. >
  252. <el-descriptions-item label="分类">{{detailInfo.rule_info.name}}</el-descriptions-item>
  253. <el-descriptions-item label="分类状态" v-if="detailInfo.rule_info.has_delete">
  254. <el-tag type="warning">分类已删除</el-tag>
  255. </el-descriptions-item>
  256. </el-descriptions>
  257. </el-card>
  258. </div>
  259. <div class="drawer-footer flex-box-end flex-v-ce" v-if="detailInfo.status == '1' && user_id != detailInfo.owner_id && detailInfo.reviewer_id != user_id">
  260. <el-button plain @click="detailShow = false">取消</el-button>
  261. <el-button type="primary" @click="collectTask" :loading="receiveLoad">领取任务</el-button>
  262. </div>
  263. </el-drawer>
  264. </div>
  265. </div>
  266. </template>
  267. <script>
  268. import Template from "../../../../examine/components/Template.vue";
  269. export default {
  270. name: 'get_task',
  271. components: {Template},
  272. data() {
  273. return {
  274. active: 'unclaimed',
  275. list: [],
  276. loading: false,
  277. receiveLoad: false,
  278. total: null,
  279. formData: {
  280. page: 1,
  281. page_size: 10
  282. },
  283. detailShow: false,
  284. detail_loading: false,
  285. detailInfo: {
  286. point_config: {},
  287. task_file_list: []
  288. },
  289. user_id: this.$store.getters.user_info.id
  290. };
  291. },
  292. computed:{
  293. pointRemark(){
  294. if (!(this.detailInfo && this.detailInfo.item_info)) return ''
  295. return this.detailInfo.item_info.range_type === 1 ? `${this.detailInfo.item_info.min_point} ${this.$getTypsName(this.detailInfo.item_info.pt_id)}` : `${this.detailInfo.item_info.min_point} -- ${this.detailInfo.item_info.max_point} ${this.$getTypsName(this.detailInfo.item_info.pt_id)}`
  296. }
  297. },
  298. mounted() {
  299. this.get_list();
  300. },
  301. watch: {
  302. active(val) {
  303. this.list = [];
  304. this.get_list();
  305. }
  306. },
  307. methods: {
  308. // 领取任务
  309. collectTask() {
  310. let self = this;
  311. self.receiveLoad = true;
  312. self
  313. .$axiosUser('POST', '/api/pro/integral/task', { task_id: this.detailInfo.id })
  314. .then(res => {
  315. if (res.data.code == 1) {
  316. self.$message.success('领取成功');
  317. self.list.forEach((element, index) => {
  318. if (element.id == self.detailInfo.id) {
  319. self.list.splice(index, 1);
  320. }
  321. });
  322. self.detailShow = false;
  323. } else {
  324. self.$message.error(res.data.msg);
  325. }
  326. })
  327. .finally(() => {
  328. self.receiveLoad = false;
  329. });
  330. },
  331. // 页面变更
  332. handleCurrentChange(val) {
  333. this.formData.page = val;
  334. this.get_list();
  335. },
  336. handleSizeChange(val) {
  337. this.formData.page_size = val;
  338. this.get_list();
  339. },
  340. // 打开详情弹窗
  341. openDetail(item) {
  342. this.detailShow = true;
  343. this.getDetailInfo(item);
  344. },
  345. // 获取详情信息
  346. getDetailInfo(item) {
  347. let self = this;
  348. self.detail_loading = true;
  349. let data = { task_id: item.id };
  350. self
  351. .$axiosUser('get', '/api/pro/integral/task', data)
  352. .then(res => {
  353. if (res.data.code == 1) {
  354. self.detailInfo = JSON.parse(JSON.stringify(res.data.data));
  355. } else {
  356. self.$message.error(res.data.data.msg);
  357. }
  358. })
  359. .finally(() => {
  360. self.detail_loading = false;
  361. });
  362. },
  363. // 获取列表信息
  364. get_list() {
  365. let self = this;
  366. self.loading = true;
  367. let data = JSON.parse(JSON.stringify(this.formData));
  368. if (self.active == 'unclaimed') {
  369. data.hall_type = 'waiting';
  370. } else {
  371. data.hall_type = 'catch';
  372. }
  373. self
  374. .$axiosUser('get', '/api/pro/integral/task/hall', data)
  375. .then(res => {
  376. if (res.data.code == 1) {
  377. self.list = res.data.data.list;
  378. self.total = res.data.data.total;
  379. } else {
  380. self.$message.error(res.data.data.msg);
  381. }
  382. })
  383. .finally(() => {
  384. self.loading = false;
  385. });
  386. },
  387. }
  388. };
  389. </script>
  390. <style scoped lang="scss">
  391. .drawer-footer {
  392. background-color: #fff;
  393. border-top: 1px solid #ebebeb;
  394. padding: 10px 20px;
  395. font-size: 14px;
  396. }
  397. .details_content {
  398. height: calc(100vh - 120px) !important;
  399. padding: 20px;
  400. overflow: auto;
  401. }
  402. .box {
  403. padding: 20px;
  404. background-color: #fff;
  405. }
  406. .color_red {
  407. color: #f56c6c;
  408. }
  409. .color_green {
  410. color: #67c23a;
  411. }
  412. .details_content {
  413. .row_title {
  414. position: relative;
  415. margin: 0 0 20px 0;
  416. padding-top: 12px;
  417. font-size: 16px;
  418. color: #303133;
  419. line-height: 22px;
  420. }
  421. .row_title:before {
  422. position: absolute;
  423. top: 0;
  424. content: ' ';
  425. width: 100%;
  426. border-top: 1px #f8f8f8 solid;
  427. }
  428. .el-row {
  429. margin-bottom: 10px;
  430. font-size: 14px;
  431. .el-col-4 {
  432. color: #606266;
  433. }
  434. }
  435. }
  436. /deep/ .el-table tr:hover {
  437. cursor: pointer;
  438. }
  439. </style>