integral_event.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981
  1. <template>
  2. <div>
  3. <div class="integral_event_box">
  4. <el-row :gutter="20" style="margin-bottom: 20px;">
  5. <el-col :span="3">
  6. <el-select v-model="newTaskFormType" style="width:110px;" filterable placeholder="请选择">
  7. <el-option v-for="item in pullrow" :key="item.id" :label="item.value" :value="item.id"></el-option>
  8. </el-select>
  9. </el-col>
  10. <el-col :span="6" class="display_flex" v-show="newTaskFormType==1">
  11. <el-cascader
  12. class="date-picker-width"
  13. v-model="rule"
  14. :options="rule_trees"
  15. :props="props"
  16. @change="rule_null"
  17. ref="rule"
  18. clearable
  19. filterable
  20. change-on-select
  21. placeholder="选择规则分类"
  22. ></el-cascader>
  23. </el-col>
  24. <el-col :span="6" class="display_flex" v-show="newTaskFormType==2">
  25. <el-cascader
  26. @change="ruleautomatic"
  27. class="date-picker-width"
  28. v-model="automaticIntegration"
  29. :options="rule_list"
  30. :props="props"
  31. ref="rule1"
  32. filterable
  33. change-on-select
  34. placeholder="选择自动积分"
  35. clearable></el-cascader>
  36. </el-col>
  37. <el-col :span="8" class="display_flex">
  38. <span class="label">积分分类</span>
  39. <el-select class="date-picker-width" v-model="formData.pt_id" clearable placeholder="请选择积分分类">
  40. <el-option v-for="item in point_types" :key="item.name" :label="item.name" :value="item.id"></el-option>
  41. </el-select>
  42. </el-col>
  43. <el-col :span="7" class="display_flex" style="position: relative;">
  44. <span class="label">部门</span>
  45. <deptData deptStyle="width:150px;left:50px;" v-if="toPdept && toPdept!=0" :refsName="$refs.dept" :toPdept="toPdept"></deptData>
  46. <el-cascader class="date-picker-width" v-model="dept_name" :options="dept_tree" :props="{ label: 'name', value: 'id'}" ref="dept" clearable filterable change-on-select placeholder="全公司">
  47. <template slot-scope="{ node, data }">
  48. <span>
  49. <WWOpenData type="departmentName" :openid="data.name"></WWOpenData>
  50. </span>
  51. <!-- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> -->
  52. </template>
  53. </el-cascader>
  54. </el-col>
  55. </el-row>
  56. <el-row :gutter="20" style="margin-bottom: 20px;">
  57. <el-col class="time_section display_flex" :span="10">
  58. <span class="label">时间</span>
  59. <el-date-picker
  60. v-model="time_slot"
  61. type="daterange"
  62. value-format="yyyy-MM-dd"
  63. range-separator="至"
  64. start-placeholder="开始日期"
  65. end-placeholder="结束日期"
  66. ></el-date-picker>
  67. </el-col>
  68. <el-col :span="6" class="display_flex">
  69. <el-input v-model="formData.keyword" placeholder="输入关键字查找" maxlength="100" @keyup.enter.native="keyWordSelect" class="persons_name">
  70. <el-button slot="append" icon="el-icon-search" @click="keyWordSelect"></el-button>
  71. </el-input>
  72. </el-col>
  73. <el-col :span="8" style="padding-left:15px;float:right;position: relative;">
  74. <div v-if="dropOuOfPers.currentLabel && dropOuOfPers.currentLabel != ''" class="dropOuOfPersName" @click="takePartIn">
  75. <WWOpenData type="userName" :openid="dropOuOfPers.currentLabel"></WWOpenData>
  76. </div>
  77. <el-select v-model="select_employee_id" ref="dropOuOfref" clearable placeholder="请选择人员">
  78. <el-option v-for="item in employee_map" :key="item.id" :label="item.name" :value="item.id">
  79. <span style="float: left"><WWOpenData type="userName" :openid="item.name"></WWOpenData></span>
  80. </el-option>
  81. </el-select>
  82. </el-col>
  83. </el-row>
  84. <el-row :gutter="20" style="margin-bottom: 20px;">
  85. <el-col :span="4">
  86. <!-- <el-button type="primary" @click="excelImportShow = true">导入数据</el-button> -->
  87. <el-button type="primary" @click="exportExcel" :disabled="deriveDis">导出当前数据</el-button>
  88. <!-- <a :href="aherfUrl" ref="aherfClick" v-if="aherfUrl != ''" v-trigger></a> -->
  89. <a :href="aherfUrl" ref="aherfClick"></a>
  90. </el-col>
  91. <el-col :span="17">
  92. <!-- <el-button type="primary" plain @click="swiperShowTrue">轮播排名</el-button> -->
  93. <el-button class="first-element-btn" v-if="noticeRole" :disabled='selectionID.length==0' @click="deleteInBatches" type="danger" >批量删除</el-button>
  94. </el-col>
  95. </el-row>
  96. <el-table :data="list" style="width: 100%" v-loading="loading" @row-click="open_detail" @selection-change="deleteEvents">
  97. <el-table-column
  98. v-if="noticeRole"
  99. type="selection"
  100. width="55">
  101. </el-table-column>
  102. <el-table-column prop="employee_name" label="姓名" align="left">
  103. <template slot-scope="scope">
  104. <userImage class="fl" :id="scope.row.employee_id" :user_name="scope.row.employee_name" :img_url="scope.row.employee_img_url" width="50px" height="50px"></userImage>
  105. <span style="margin-left: 10px; line-height: 50px;"><WWOpenData type="userName" :openid="scope.row.employee_name"></WWOpenData></span>
  106. </template>
  107. </el-table-column>
  108. <el-table-column prop="dept" label="部门" align="left" width="150px">
  109. <template slot-scope="scope">
  110. <span v-for="(item,index) in scope.row.dept" :key="index">
  111. <WWOpenData type="departmentName" :openid="item"></WWOpenData><span v-if="(scope.row.dept.length-index)>1">,</span>
  112. </span>
  113. </template>
  114. </el-table-column>
  115. <el-table-column prop="point_mark" label="积分" align="left" width="100px">
  116. <template slot-scope="scope">
  117. <span :class="scope.row.point < 0 ? 'color_green' : 'color_red'">{{ scope.row.point_mark }} {{ point_name(scope.row.pt_id) }}</span>
  118. </template>
  119. </el-table-column>
  120. <el-table-column prop="remark" show-overflow-tooltip label="事件" align="left"></el-table-column>
  121. <!-- <el-table-column prop="remark_data.rule" show-overflow-tooltip label="分类" align="left">
  122. </el-table-column> -->
  123. <el-table-column prop="source_type" label="来源" align="left" width="120px">
  124. <template slot-scope="scope">
  125. <span v-show="scope.row.source_type == 1">积分录入</span>
  126. <span v-show="scope.row.source_type == 2">任务</span>
  127. <span v-show="scope.row.source_type == 3">积分系统分配</span>
  128. <span v-show="scope.row.source_type == 4">考勤系统分配</span>
  129. <span v-show="scope.row.source_type == 5">积分申请</span>
  130. <span v-show="scope.row.source_type == 6">绩效任务包</span>
  131. <span v-show="scope.row.source_type > 6">其他</span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column prop="create_time" label="录入时间" align="left" width="110px">
  135. <template slot-scope="scope">
  136. {{ cuttString(scope.row.create_time) }}
  137. </template>
  138. </el-table-column>
  139. <template slot="empty">
  140. <noData></noData>
  141. </template>
  142. </el-table>
  143. <center class="pagination">
  144. <el-pagination
  145. background
  146. @size-change="handleSizeChange"
  147. @current-change="handleCurrentChange"
  148. :current-page="formData.page"
  149. :page-sizes="[10, 20, 50, 100]"
  150. layout="total, sizes, prev, pager, next"
  151. :page-size="pageLimit"
  152. :total="total"
  153. ></el-pagination>
  154. </center>
  155. </div>
  156. <el-drawer title="事件详情" :visible.sync="detail_popup" ref="drawer" :with-header="false" :width="'500px'" direction="rtl">
  157. <div class="drawer_title">事件详情</div>
  158. <div class="detail_popup" v-loading="detail_loading" v-if="detail_info !== null">
  159. <el-row style="padding-bottom:10px;border-bottom:1px #f8f8f8 solid;">
  160. <el-col :span="24">
  161. <userImage :user_name="detail_info.employee_name" :img_url="detail_info.img_url" class="fl" width="50px" height="50px" fontSize="15"></userImage>
  162. <span style="line-height:50px; margin-left:10px;margin-right:4px;"><WWOpenData type="userName" :openid="detail_info.employee_name"></WWOpenData></span>
  163. <span class="color_red point" v-show="detail_info.point >= 0">+{{ detail_info.point }} {{ point_name(detail_info.pt_id) }}</span>
  164. <span class="color_green point" v-show="detail_info.point < 0">{{ detail_info.point }} {{ point_name(detail_info.pt_id) }}</span>
  165. </el-col>
  166. </el-row>
  167. <el-row>
  168. <el-col :span="4">任务描述</el-col>
  169. <el-col :span="20" v-if="detail_info.remark">{{ detail_info.remark && (detail_info.remark.customize || detail_info.remark.rule) }}</el-col>
  170. </el-row>
  171. <el-row>
  172. <el-col :span="4">规则分类</el-col>
  173. <el-col :span="20">{{ detail_info.rule_list }}</el-col>
  174. </el-row>
  175. <el-row v-show="detail_info.rule_list">
  176. <el-col :span="4">事件时间</el-col>
  177. <el-col :span="20">{{ detail_info.date }}</el-col>
  178. </el-row>
  179. <el-row v-show="detail_info.source_type_mark">
  180. <el-col :span="4">来源类型</el-col>
  181. <el-col :span="20">{{ detail_info.source_type_mark }}</el-col>
  182. </el-row>
  183. <el-row v-show="!detail_info.rule_id">
  184. <el-col :span="4">记录人</el-col>
  185. <el-col :span="20"><WWOpenData type="userName" :openid="detail_info.employee_name"></WWOpenData></el-col>
  186. </el-row>
  187. <el-row v-show="detail_info.files !== null && detail_info.files.length > 0">
  188. <el-col :span="4">图片</el-col>
  189. <el-col :span="20">
  190. <el-image
  191. v-for="(item, index) in detail_info.files"
  192. :key="index"
  193. style="width: 100px; height: 100px;margin:1px"
  194. :src="item"
  195. :preview-src-list="detail_info.files"
  196. ></el-image>
  197. </el-col>
  198. </el-row>
  199. <div v-show="detail_info.rule_id">
  200. <p class="row_title">规则依据</p>
  201. <el-row>
  202. <el-col :span="4">规则分类</el-col>
  203. <el-col :span="19">{{ detail_info.rule_list }}</el-col>
  204. </el-row>
  205. <el-row v-show="detail_info.rule_item_id!=0">
  206. <el-col :span="4">积分规则</el-col>
  207. <el-col :span="19">{{ detail_info.remark.rule }}</el-col>
  208. </el-row>
  209. <el-row v-show="detail_info.rule_item.min_point>0">
  210. <el-col :span="5">积分</el-col>
  211. <el-col :span="19" v-show="detail_info.rule_item.min_point == detail_info.rule_item.max_point">{{ detail_info.rule_item.min_point }}</el-col>
  212. <el-col :span="19" v-show="detail_info.rule_item.min_point != detail_info.rule_item.max_point">
  213. {{ detail_info.rule_item.min_point }} ~ {{ detail_info.rule_item.max_point }}
  214. </el-col>
  215. </el-row>
  216. </div>
  217. <div v-show="detail_info.process !=undefined&&detail_info.process.length>0">
  218. <Steps :process="detail_info.process"></Steps>
  219. </div>
  220. <!-- <div v-show="detail_info.rule_id">
  221. <p class="row_title">
  222. 审批
  223. <span class="row_tips">多人审批时,以最后一人为准</span>
  224. </p>
  225. <div class="examine_steps">
  226. <el-steps direction="vertical" :space="50">
  227. <el-step v-for="(item, index) in detail_info.process" :key="index">
  228. <template slot="icon">
  229. <userImage width="36px" height="36px" :img_url="item.img_url" :user_name="item.name"></userImage>
  230. </template>
  231. <template slot="title">
  232. <div style="color: #303133;font-size:14px;margin-top:-2px;">
  233. <WWOpenData type="userName" :openid="item.name"></WWOpenData> {{ item.remark }}
  234. </div>
  235. </template>
  236. <template slot="description" style="">
  237. {{ item.time }}
  238. </template>
  239. </el-step>
  240. </el-steps>
  241. </div>
  242. </div> -->
  243. <div style="position: absolute; bottom: 20px; display: block; right: 20px;" v-show="deptManagerRouters">
  244. <el-button @click="close_integral_event">取消</el-button>
  245. <el-button type="danger" @click="del_integral_event(detail_info)">删除</el-button>
  246. </div>
  247. </div>
  248. </el-drawer>
  249. <!-- 导入数据 -->
  250. <el-dialog title="导入积分事件数据" width="600px" :visible.sync="excelImportShow" :close-on-click-modal="false" :before-close="close_import">
  251. <div style="padding:0 50px;">
  252. <div class="align-center" style="margin-bottom:20px;">
  253. <p>
  254. 1、下载积分事件模版,批量录入积分事件
  255. <el-button type="primary" @click="downloadTemplate" plain>下载模板</el-button>
  256. </p>
  257. <el-upload
  258. :limit="1"
  259. :headers="ATOKEN"
  260. ref="upload1"
  261. :action="integralUpload"
  262. :data="{ type: 'integral' }"
  263. :on-success="handlePictureCardPreview"
  264. :before-upload="beforeFilesUpload"
  265. >
  266. <p>
  267. 2、上传积分事件数据Excel表
  268. <el-button type="primary" plain>选择文件</el-button>
  269. </p>
  270. </el-upload>
  271. <p>3、选择文件后点击下方【上传】按钮</p>
  272. </div>
  273. <div class="align-center" style="margin-bottom:20px; float:left; margin-left:10px;"></div>
  274. <div class="align-center" style="margin-bottom:20px; float:left; margin-left:10px;"><!-- <el-button type="primary" @click="downloadSheet">Excel导出</el-button> --></div>
  275. <div style="clear:both;"></div>
  276. </div>
  277. <div slot="footer" class="dialog-footer">
  278. <el-button @click="close_import">取 消</el-button>
  279. <el-button type="primary" @click="uploadFile(1)" :loading="update_btn" plain>上传</el-button>
  280. </div>
  281. </el-dialog>
  282. <el-dialog title="导入结果" :visible.sync="importErrorInfoShow" width="30%">
  283. <div>
  284. <el-table :data="error_list" border stripe>
  285. <el-table-column prop="name" label="备注信息">
  286. <template slot-scope="scope">
  287. {{ scope.row }}
  288. </template>
  289. </el-table-column>
  290. </el-table>
  291. </div>
  292. <span slot="footer"><el-button type="primary" @click="importErrorInfoShow = false">确 定</el-button></span>
  293. </el-dialog>
  294. <el-dialog title="轮播排名" :visible.sync="swiperShow" width="500px">
  295. <div>
  296. <el-form :inline="true">
  297. <div style="color:rgb(122 202 126);font-size: 13px;padding:5px 0 20px 0">设置后,相关排名信息可在各类智能终端屏幕上的网页浏览器滚屏展示</div>
  298. <el-form-item label="展示标题">
  299. <el-input
  300. type="textarea"
  301. :autosize="{ minRows: 2, maxRows: 6 }"
  302. v-model="titleVals"
  303. placeholder="请输入标题"
  304. maxlength="20"
  305. show-word-limit
  306. style="width: 341px"
  307. ></el-input>
  308. </el-form-item>
  309. </el-form>
  310. <el-row>
  311. <el-col :span="4" style="line-height: 36px;">&nbsp;&nbsp;&nbsp;显示最新</el-col>
  312. <el-col :span="6">
  313. <el-select v-model="page_size" placeholder="请选择">
  314. <el-option v-for="item in swiperPageList" :key="item.value" :label="item.value" :value="item.value"></el-option>
  315. </el-select>
  316. </el-col>
  317. <el-col :span="6" style="line-height: 36px;">条积分事件来轮播</el-col>
  318. </el-row>
  319. </div>
  320. <span slot="footer">
  321. <el-button @click="swiperShow = false">取 消</el-button>
  322. <router-link :to="{ path: '/deptRankSwiper?' + '&page=1&page_size=' + this.page_size + '&types=1' }" target="_blank">
  323. <el-button type="primary" @click="swiperPage">开始轮播</el-button>
  324. </router-link>
  325. </span>
  326. </el-dialog>
  327. </div>
  328. </template>
  329. <script>
  330. import { getToken } from '@/utils/auth';
  331. import noData from '@/components/noData';
  332. import Steps from '@/components/Steps.vue';
  333. // import axios from "axios"
  334. export default {
  335. data() {
  336. return {
  337. automaticIntegration:[],
  338. newTaskFormType:1,
  339. pullrow: [{
  340. value: '规则分类',
  341. id: 1
  342. },
  343. {
  344. value: '自动积分',
  345. id: 2
  346. }
  347. ],
  348. rule_list:[],//自动积分分类列表
  349. noticeRole:this.$authoritys('creator') || this.$authoritys('admin') || this.$authoritys('point_manager'),
  350. select_employee_id: '',
  351. employee_map: JSON.parse(localStorage.getItem('SET_EMPLOYEE_MAP')),
  352. deptManagerRouters: !this.$authoritys('dept_manager') && !this.$authoritys('employee'),
  353. integralUpload: process.env.BASE_API + '/api/upload/excel',
  354. publicBASE_API: process.env.BASE_API,
  355. titleVals: '',
  356. titleVal: {
  357. titleVal1: '',
  358. titleVal2: '',
  359. titleVal3: ''
  360. },
  361. ATOKEN: { 'A-TOKEN': getToken() },
  362. loading: false,
  363. swiperShow: false,
  364. swiperPageList: [{ value: '10' }, { value: '30' }, { value: '50' }, { value: '100' }],
  365. page_size: 10,
  366. point_types: JSON.parse(localStorage.getItem('SET_POINT_TYPES')),
  367. dept_name: [],
  368. dept_tree: [],
  369. formData: {
  370. page: 1,
  371. page_size: 10
  372. },
  373. time_slot: null,
  374. rule_trees: [],
  375. props: { value: 'id', label: 'name', children: 'child' },
  376. rule: [],
  377. list: [],
  378. total: null,
  379. detail_info: null,
  380. detail_popup: false,
  381. detail_loading: false,
  382. pageLimit: 10,
  383. excelImportShow: false,
  384. update_btn: false,
  385. error_list: [],
  386. importErrorInfoShow: false,
  387. selectionID:[],//删除的事件ID
  388. toPdept:0,
  389. dropOuOfPers:[],
  390. deriveJobId: '',
  391. deriveJobIf: 0,
  392. deriveDis: false,
  393. aherfUrl: '',
  394. };
  395. },
  396. components: { noData, Steps},
  397. created() {},
  398. mounted() {
  399. if (localStorage.getItem('dept_tree')) {
  400. this.dept_tree = this.getTreeData(JSON.parse(localStorage.getItem('dept_tree')));
  401. }
  402. this.get_rule_trees();
  403. this.get_integral_list(this.formData);
  404. this.voluntarilyRule_trees()//自动积分列表
  405. },
  406. watch: {
  407. newTaskFormType(val){
  408. this.formData.rule_id = []
  409. // this.get_integral_list(this.formData);
  410. },
  411. 'formData.pt_id'(val, old_val) {
  412. this.formData.page = 1;
  413. !val ? delete this.formData.pt_id : '';
  414. this.get_integral_list(this.formData);
  415. },
  416. 'formData.page'(val, old_val) {
  417. this.get_integral_list(this.formData);
  418. },
  419. time_slot(val, old_val) {
  420. this.formData.page = 1;
  421. if (val !== null) {
  422. this.formData.start_day = val[0];
  423. this.formData.end_day = val[1];
  424. } else {
  425. delete this.formData.start_day;
  426. delete this.formData.end_day;
  427. }
  428. this.get_integral_list(this.formData);
  429. },
  430. dept_name(val, old_val) {
  431. this.toPdept = val[val.length-1]
  432. this.formData.page = 1;
  433. if (val.length != 0) {
  434. this.formData.dept_id = val[val.length - 1];
  435. } else {
  436. this.formData.dept_id = 0;
  437. }
  438. this.$nextTick(() => {
  439. this.$refs.dept.dropDownVisible = false;
  440. this.get_integral_list(this.formData);
  441. });
  442. },
  443. select_employee_id(val) {
  444. console.log(val)
  445. this.formData.employee_ids = val;
  446. this.get_integral_list(this.formData);
  447. this.$nextTick(()=>{
  448. console.log(this.$refs['dropOuOfref'].selected)
  449. this.dropOuOfPers = this.$refs['dropOuOfref'].selected
  450. })
  451. }
  452. },
  453. // directives: {
  454. // aderivecli:{
  455. // inserted(el,binging){
  456. // console.log(el)
  457. // // el.click()
  458. // }
  459. // }
  460. // },
  461. methods: {
  462. takePartIn(){
  463. this.$refs['dropOuOfref'].visible = true
  464. },
  465. ruleautomatic(){
  466. let list = this.automaticIntegration
  467. this.formData.rule_id = list[0]
  468. this.get_integral_list(this.formData);
  469. this.$refs.rule1.dropDownVisible = false;
  470. },
  471. voluntarilyRule_trees() {
  472. let self = this;
  473. self.$http('get',"/api/integral/rule/trees",{cycle_type: "2",},)
  474. .then((res) => {
  475. if (res.data.code == 1) {
  476. self.rule_list = this.getRuleTreeData(res.data.data.rule_tree);
  477. }
  478. })
  479. .finally(() => {
  480. });
  481. },
  482. //删除事件
  483. deleteEvents(selection){
  484. let listId = []
  485. selection.forEach(item=>{
  486. listId.push(item.id)
  487. })
  488. this.selectionID = listId
  489. },
  490. deleteInBatches(){
  491. if (this.selectionID.length < 1) {
  492. return false
  493. }
  494. this.$confirm('此操作将永久删除选中的积分事件, 确认要删除吗?', '批量删除事件', {
  495. confirmButtonText: '确定',
  496. cancelButtonText: '取消',
  497. type: 'warning'
  498. }).then(() => {
  499. this.loading = true
  500. this.$http('DELETE','/api/integral/statistics/integral/many',{event_ids:this.selectionID}).then((res)=>{
  501. if(res.data.code == 1){
  502. this.$message({
  503. message: res.data.msg,
  504. type: 'success'
  505. });
  506. if(this.selectionID.length == this.list.length){
  507. if(this.formData.page > 1){
  508. this.formData.page = this.formData.page-1;
  509. }
  510. }
  511. this.get_integral_list(this.formData)
  512. }else{
  513. this.$message.error(res.data.msg);
  514. };
  515. }).catch(()=>{
  516. this.loading = false
  517. }).finally(()=>{
  518. })
  519. }).catch(() => {
  520. })
  521. },
  522. //轮播
  523. swiperPage() {
  524. if (this.titleVals != '') {
  525. this.titleVal.titleVal1 = this.titleVals;
  526. localStorage.setItem('titleVal', JSON.stringify(this.titleVal));
  527. } else {
  528. this.titleVal.titleVal1 = '';
  529. localStorage.setItem('titleVal', JSON.stringify(this.titleVal));
  530. }
  531. },
  532. // 轮播弹窗
  533. swiperShowTrue() {
  534. if (localStorage.getItem('titleVal')) {
  535. this.titleVal = JSON.parse(localStorage.getItem('titleVal'));
  536. this.titleVals = this.titleVal.titleVal1;
  537. } else {
  538. this.titleVals = '';
  539. }
  540. this.swiperShow = true;
  541. },
  542. // keyword
  543. keyWordSelect() {
  544. this.formData.page = 1;
  545. this.get_integral_list(this.formData);
  546. },
  547. downloadTemplate() {
  548. window.open(this.publicBASE_API + '/api/download/integral/template');
  549. },
  550. // 文件上传
  551. close_import() {
  552. this.excelImportShow = false;
  553. },
  554. uploadFile() {
  555. // this.excelImportShow = false
  556. let params = {};
  557. params.file = this.file;
  558. this.update_btn = true;
  559. this.$http('post','/api/integral/import', params).then(res => {
  560. if (res.data.code == 1) {
  561. if (res.data.data.error.length == 0) {
  562. this.$message({ type: 'success', message: '导入成功' });
  563. this.excelImportShow = false;
  564. } else {
  565. this.$message({ type: 'error', message: '导入错误' });
  566. this.error_list = res.data.data.error;
  567. this.importErrorInfoShow = true;
  568. }
  569. } else {
  570. this.$message({ type: 'error', message: res.data.msg });
  571. }
  572. })
  573. .finally(() => {
  574. setTimeout(() => {
  575. this.update_btn = false;
  576. }, 3000);
  577. });
  578. },
  579. handlePictureCardPreview(response) {
  580. if (response.code == 1) {
  581. this.file = response.data;
  582. }
  583. },
  584. beforeFilesUpload(file) {
  585. const $ext_list = ['xlsx', 'xls'];
  586. let len = file.name.split('.').length - 1;
  587. const $ext_name = file.name.split('.')[len];
  588. if ($ext_list.indexOf($ext_name) != -1) {
  589. } else {
  590. this.$message.warning('文件格式上传错误,仅支持上传xlsx,xls)');
  591. return false;
  592. }
  593. },
  594. onFilePreView() {},
  595. downloadResult(){
  596. if(this.deriveJobIf < 5){
  597. this.$http('get','/api/download/result',{job_id: this.deriveJobId}).then((res)=>{
  598. if(res.data.code == 1){
  599. // window.open(res.data.data.url)
  600. // window.location.href = res.data.data.url
  601. this.aherfUrl = res.data.data.url
  602. this.deriveJobId = ''
  603. this.deriveDis = false
  604. this.$nextTick(()=>{
  605. this.$refs.aherfClick.click()
  606. // this.aderivecli()
  607. })
  608. }else{
  609. setTimeout(()=>{
  610. this.deriveJobIf++
  611. this.downloadResult()
  612. },3000)
  613. }
  614. })
  615. }else{
  616. this.deriveJobIf = 0
  617. this.deriveJobId = ''
  618. this.deriveDis = false
  619. this.aherfUrl = ''
  620. this.$message.warning('导出超时');
  621. }
  622. },
  623. exportExcel() {
  624. this.aherfUrl = ''
  625. this.$confirm('确认导出积分事件?', '导出', {
  626. confirmButtonText: '确定',
  627. cancelButtonText: '取消',
  628. type: 'warning'
  629. }).then(() => {
  630. this.deriveDis = true
  631. let params = {
  632. employee_id: this.$store.getters.user_info.id,
  633. page: this.formData.page,
  634. page_size: this.formData.page_size,
  635. }
  636. this.formData.rule_id ? params.rule_id = this.formData.rule_id : ''
  637. this.formData.pt_id ? params.pt_id = this.formData.pt_id : ''
  638. this.formData.employee_ids ? params.employee_ids = this.formData.employee_ids : ''
  639. this.formData.dept_id ? params.dept_ids = this.formData.dept_id : ''
  640. this.formData.start_day ? params.start_day = this.formData.start_day : ''
  641. this.formData.end_day ? params.end_day = this.formData.end_day : ''
  642. this.formData.keyword ? params.keyword = this.formData.keyword : ''
  643. this.$http('get','/api/download/integral',params).then((res)=>{
  644. if(res.data.code == 1){
  645. this.deriveJobId = res.data.data.job_id
  646. this.downloadResult()
  647. }else{
  648. this.deriveDis = false
  649. }
  650. })
  651. }).catch(() => {
  652. })
  653. return
  654. window.open('https://open.work.weixin.qq.com/wwopen/openData/getTranslateContactOpenData?dataid=_Q-jZZifks4nhgXAXmSGYJwMC40p3sGyeeKZV2I79e0')
  655. return
  656. let token = this.$getToken?this.$getToken:getToken()
  657. window.open(
  658. this.publicBASE_API +'/api/download/integral?employee_id=' +this.$store.getters.user_info.id +'&page=' + this.formData.page +'&page_size=' +this.formData.page_size +
  659. (this.formData.rule_id ? '&rule_id=' + this.formData.rule_id : '') +
  660. (this.formData.pt_id ? '&pt_id=' + this.formData.pt_id : '') +
  661. (this.formData.employee_ids ? '&employee_ids=' + this.formData.employee_ids : '') +
  662. (this.formData.dept_id ? '&dept_ids=' + this.formData.dept_id : '') +
  663. (this.formData.start_day ? '&start_day=' + this.formData.start_day : '') +
  664. (this.formData.end_day ? '&end_day=' + this.formData.end_day : '') +0
  665. (this.formData.keyword ? '&keyword=' + this.formData.keyword : '')+
  666. '&token='+token,
  667. '_blank'
  668. );
  669. // let params = {
  670. // employee_id:this.$store.getters.user_info.id,
  671. // page:this.formData.page,
  672. // page_size:this.formData.page_size,
  673. // rule_id:this.formData.rule_id ? this.formData.rule_id : null,
  674. // pt_id:this.formData.pt_id ? this.formData.pt_id : null,
  675. // employee_ids:this.formData.employee_ids ? this.formData.employee_ids : null,
  676. // dept_ids:this.formData.dept_id ? this.formData.dept_id : null,
  677. // start_day:this.formData.start_day ? this.formData.start_day : null,
  678. // end_day:this.formData.end_day ? this.formData.end_day : null,
  679. // keyword:this.formData.keyword ? this.formData.keyword : null,
  680. // }
  681. // this.$http('get',this.publicBASE_API +'/api/download/integral',params).then((res)=>{
  682. // console.log(res)
  683. // })
  684. // axios({
  685. // method: 'get',
  686. // url: this.publicBASE_API +'/api/download/integral',
  687. // responseType: 'blob',
  688. // params: params,
  689. // headers: {
  690. // }
  691. // }).then((res)=>{
  692. // console.log(res)
  693. // })
  694. },
  695. // openPostWindow(url, params) {
  696. // var newWin = window.open(),
  697. // formStr = '';
  698. // //设置样式为隐藏,打开新标签再跳转页面前,如果有可现实的表单选项,用户会看到表单内容数据
  699. // formStr = '<form style="visibility:hidden;" method="POST" action="' + url + '">' +
  700. // '<input type="hidden" name="params" value="' + params + '" />' +
  701. // '</form>';
  702. // newWin.document.body.innerHTML = formStr;
  703. // // newWin.document.write(formStr)
  704. // newWin.document.forms[0].submit();
  705. // return newWin;
  706. // },
  707. // end 文件上传
  708. handleSizeChange(val) {
  709. this.pageLimit = val;
  710. this.formData.page_size = this.pageLimit;
  711. this.get_integral_list(this.formData);
  712. },
  713. cuttString(data) {
  714. return data.substring(5);
  715. },
  716. // 递归判断列表,把最后的children设为undefined
  717. getTreeData(data) {
  718. for (var i = 0; i < data.length; i++) {
  719. if (data[i].children.length < 1) {
  720. // children若为空数组,则将children设为undefined
  721. data[i].children = undefined;
  722. } else {
  723. // children若不为空数组,则继续 递归调用 本方法
  724. this.getTreeData(data[i].children);
  725. }
  726. }
  727. return data;
  728. },
  729. // 规则递归 children
  730. getRuleTreeData(data) {
  731. for (var i = 0; i < data.length; i++) {
  732. if (data[i].child.length < 1) {
  733. // children若为空数组,则将children设为undefined
  734. data[i].child = undefined;
  735. } else {
  736. // children若不为空数组,则继续 递归调用 本方法
  737. this.getRuleTreeData(data[i].child);
  738. }
  739. }
  740. return data;
  741. },
  742. open_detail(item) {
  743. let self = this;
  744. self.detail_popup = true;
  745. let data = {
  746. event_id: item.id
  747. };
  748. self.detail_loading = true;
  749. self.$http('get','/api/integral/statistics/integral/info',data)
  750. .then(res => {
  751. if (res.data.code == 1) {
  752. self.detail_info = res.data.data;
  753. } else {
  754. self.$message.error(res.data.data.msg);
  755. }
  756. })
  757. .finally(() => {
  758. self.detail_loading = false;
  759. });
  760. },
  761. get_rule_trees() {
  762. let self = this;
  763. self.$http('get','/api/integral/rule/trees')
  764. .then(res => {
  765. if (res.data.code == 1) {
  766. let arr = res.data.data.rule_tree;
  767. self.rule_trees = self.getRuleTreeData(arr);
  768. } else {
  769. self.$message.error(res.data.data.msg);
  770. }
  771. })
  772. .finally(() => {});
  773. },
  774. get_integral_list(data) {
  775. let self = this;
  776. data.dept_ids = data.dept_id;
  777. self.loading = true;
  778. self.$http('get','/api/integral/statistics/integral',data)
  779. .then(res => {
  780. if (res.data.code == 1) {
  781. self.list = res.data.data.list;
  782. self.total = res.data.data.total;
  783. } else {
  784. self.$message.error(res.data.data.msg);
  785. }
  786. })
  787. .finally(() => {
  788. self.loading = false;
  789. });
  790. },
  791. handleCurrentChange(val) {
  792. this.formData.page = val;
  793. },
  794. rule_null(val) {
  795. if (val.length == 0) {
  796. this.formData.rule_id = 0;
  797. } else {
  798. this.formData.rule_id = this.rule[this.rule.length - 1];
  799. }
  800. this.$nextTick(() => {
  801. this.$refs.rule.dropDownVisible = false;
  802. this.get_integral_list(this.formData);
  803. });
  804. },
  805. del_integral_event(item) {
  806. let self = this;
  807. self.$confirm('删除事件的同时也会撤销积分,确定删除吗?', '提示', {
  808. confirmButtonText: '确定',
  809. cancelButtonText: '取消',
  810. type: 'warning'
  811. }).then(() => {
  812. self.$http('DELETE','/api/integral/statistics/integral',{ event_id: item.event_id }).then(res => {
  813. if (res.data.code == 1) {
  814. self.$message.success(res.data.msg);
  815. self.detail_popup = false;
  816. self.get_integral_list();
  817. } else {
  818. self.$message.error(res.data.msg);
  819. }
  820. }) .catch(e => {
  821. self.$message.error(e.data.msg);
  822. });
  823. });
  824. },
  825. close_integral_event() {
  826. this.detail_popup = false;
  827. },
  828. point_name(id) {
  829. return this.point_types.find(item => {
  830. if (item.id == id) {
  831. return item.name;
  832. }
  833. }).name;
  834. }
  835. }
  836. };
  837. </script>
  838. <style scoped lang="scss">
  839. header.el-drawer__header {
  840. font-size: 18px;
  841. font-family: MicrosoftYaHei;
  842. color: #303133;
  843. width: 500px;
  844. span {
  845. :focus {
  846. outline: 0;
  847. }
  848. }
  849. }
  850. .display_flex {
  851. display: flex;
  852. }
  853. .label {
  854. line-height: 36px;
  855. padding-right: 10px;
  856. }
  857. .time_section {
  858. .el-range-editor {
  859. width: 330px;
  860. }
  861. }
  862. .color_green {
  863. color: #67c23a;
  864. }
  865. .pagination {
  866. padding: 20px 0;
  867. }
  868. .detail_popup {
  869. padding: 20px;
  870. height: 100%;
  871. .row_title {
  872. position: relative;
  873. margin: 0 0 20px 0;
  874. padding-top: 12px;
  875. font-size: 16px;
  876. color: #303133;
  877. line-height: 22px;
  878. }
  879. .row_title:before {
  880. position: absolute;
  881. top: 0;
  882. content: ' ';
  883. width: 100%;
  884. border-top: 1px #f8f8f8 solid;
  885. }
  886. .el-row {
  887. margin-bottom: 10px;
  888. font-size: 14px;
  889. .el-col-4 {
  890. color: #606266;
  891. }
  892. }
  893. }
  894. .color_red {
  895. color: #f56c6c;
  896. }
  897. .color_green {
  898. color: #67c23a;
  899. }
  900. span.point {
  901. font-size: 16px;
  902. }
  903. .drawer_title {
  904. font-size: 18px;
  905. padding: 20px;
  906. border-bottom: 1px #efefef solid;
  907. }
  908. .row_tips {
  909. display: block;
  910. color: #909399;
  911. font-size: 12px;
  912. margin-top: 0px;
  913. }
  914. .el-range-editor--medium .el-range-separator {
  915. width: 25px;
  916. }
  917. .integral_event_box {
  918. background-color: #ffffff;
  919. padding: 20px;
  920. min-height: calc(100vh - 160px);
  921. }
  922. .examine_steps /deep/.el-step.is-vertical .el-step__title {
  923. padding-bottom: 0;
  924. }
  925. /deep/ .el-dialog__body{
  926. padding:0px 20px 30px;
  927. }
  928. .dropOuOfPersName {
  929. position: absolute;
  930. top: 0;
  931. right: 0;
  932. left: 0;
  933. bottom: 0;
  934. z-index: 9;
  935. margin: 1px 0 0 16px;
  936. padding-left: 14px;
  937. background-color: #ffffff;
  938. color: #1d1d1d;
  939. width: 170px;
  940. overflow: hidden;
  941. cursor: pointer;
  942. height:34px;
  943. line-height:34px;
  944. border-radius: 5px;
  945. }
  946. </style>