integral_event_two.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900
  1. <template>
  2. <div>
  3. <div class="all padding-20">
  4. <header class="flex-box-ce" style="padding-bottom: 20px;">
  5. <div style="padding-right: 20px;" class="fh" @click="$router.go(-1)">返回</div>
  6. <div>{{parameter.name}}的奖扣执行明细</div>
  7. </header>
  8. <el-form ref="form" :inline="true" label-width="80px">
  9. <el-form-item label="事件来源">
  10. <el-select class="date-picker-width" size="medium" v-model="formData.source_type" clearable placeholder="全部">
  11. <el-option v-for="item in source_type" :key="item.id" :label="item.name" :value="item.id"></el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item>
  15. <div class="flex-box-ce">
  16. <el-select size="medium" v-model="select_employee_id" filterable clearable placeholder="请输入或选择人员" style="width: 250px;margin-right: 10px;">
  17. <el-option v-for="item in employee_map" :key="item.id" :label="item.name" :value="item.id"></el-option>
  18. </el-select>
  19. <el-input size="medium" v-model="formData.keyword" placeholder="输入关键字查找" max="200" @keyup.enter.native="keyWordSelect">
  20. <el-button size="medium" slot="append" icon="el-icon-search" @click="keyWordSelect"></el-button>
  21. </el-input>
  22. </div>
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button type="primary" size="medium" @click="exportExcel" plain>导出全部事件</el-button>
  26. <!-- <el-button class="first-element-btn" size="medium" v-if="employeeOrdept" :disabled="deleteDisabled" @click="deleteInBatches" type="danger">批量删除</el-button> -->
  27. </el-form-item>
  28. <el-alert v-if="str" :title="'此列表受【数据查看权限】控制,当前权限:'+str" type="info"></el-alert>
  29. </el-form>
  30. <!-- 表格 -->
  31. <div>
  32. <el-table :data="list" style="width: 100%;cursor: pointer;" v-loading="loading" @row-click="open_detail" @selection-change="deleteEvents">
  33. <el-table-column v-if="employeeOrdept" type="selection" width="55"></el-table-column>
  34. <el-table-column prop="employee_name" label="姓名" align="left" min-width="125px">
  35. <template slot-scope="scope">
  36. <div class="flex-box">
  37. <userImage :user_name="scope.row.employee_name" :img_url="scope.row.employee_img_url" width="50px" height="50px"></userImage>
  38. <span style="line-height: 50px; padding-left: 10px;">{{ scope.row.employee_name }}</span>
  39. </div>
  40. </template>
  41. </el-table-column>
  42. <el-table-column prop="dept" show-overflow-tooltip label="部门" align="left" min-width="120px"></el-table-column>
  43. <el-table-column prop="point" label="积分" align="left" min-width="120px">
  44. <template slot-scope="scope">
  45. <span :class="scope.row.point < 0 ? 'green' : 'red'">{{ scope.row.point }} {{ point_name(scope.row.pt_id) }}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column prop="remark" label="事件内容" align="left" min-width="280px">
  49. <template slot-scope="scope">
  50. <el-tooltip class="item" effect="dark" placement="top">
  51. <div slot="content" style="width: 400px;">{{ scope.row.remark }}</div>
  52. <div class="remark">{{ scope.row.remark }}</div>
  53. </el-tooltip>
  54. </template>
  55. </el-table-column>
  56. <el-table-column prop="rule_name" show-overflow-tooltip label="规则分类" align="left" min-width="140px"></el-table-column>
  57. <el-table-column prop="create_time" label="事件发生时间" align="left" min-width="140px">
  58. <template slot-scope="scope">
  59. {{ scope.row.event_time }}
  60. </template>
  61. </el-table-column>
  62. <el-table-column prop="source_type" label="来源" align="left" min-width="140px">
  63. <template slot-scope="scope">
  64. <span v-show="scope.row.source_type == 1">
  65. 积分奖扣
  66. <span v-if="scope.row.recorder_name">({{ scope.row.recorder_name }})</span>
  67. </span>
  68. <span v-show="scope.row.source_type == 2">任务</span>
  69. <span v-show="scope.row.source_type == 3">积分系统分配</span>
  70. <span v-show="scope.row.source_type == 4">考勤系统分配</span>
  71. <span v-show="scope.row.source_type == 5">
  72. 积分申请
  73. <span v-if="scope.row.applyor_name">({{ scope.row.applyor_name }})</span>
  74. </span>
  75. <span v-show="scope.row.source_type == 6">绩效任务包</span>
  76. <span v-show="scope.row.source_type == 8">积分导入</span>
  77. <span v-show="scope.row.source_type == 9">A分转B分</span>
  78. <span v-show="scope.row.source_type == 10">钉钉汇报(日志)奖扣分</span>
  79. <span v-show="scope.row.source_type > 10">其他</span>
  80. </template>
  81. </el-table-column>
  82. <el-table-column prop="update_time" label="录入时间" align="left" width="140px">
  83. <template slot-scope="scope">
  84. <!-- {{ cuttString(scope.row.create_time) }} -->
  85. {{ scope.row.update_time }}
  86. </template>
  87. </el-table-column>
  88. <template slot="empty">
  89. <noData></noData>
  90. </template>
  91. </el-table>
  92. <center class="pagination">
  93. <el-pagination
  94. background
  95. @size-change="handleSizeChange"
  96. @current-change="handleCurrentChange"
  97. :current-page="formData.page"
  98. :page-sizes="[10, 20, 50, 100]"
  99. layout="total, sizes, prev, pager, next"
  100. :page-size="pageLimit"
  101. :total="total"
  102. ></el-pagination>
  103. </center>
  104. </div>
  105. </div>
  106. <el-drawer title="事件详情" :visible.sync="detail_popup" ref="drawer" :with-header="false" :width="'500px'" direction="rtl">
  107. <div class="drawer_title">事件详情</div>
  108. <div class="detail_popup" v-loading="detail_loading" v-if="detail_info !== null">
  109. <el-row style="padding-bottom:10px;border-bottom:1px #f8f8f8 solid;">
  110. <div class="flex-box flex-v-ce">
  111. <userImage :user_name="detail_info.employee_name" width="50px" height="50px" fontSize="1"></userImage>
  112. <span style="font-size: 18px;line-height:50px; margin-left:10px;margin-right:4px;">{{ detail_info.employee_name }}</span>
  113. <span class="red point" v-show="detail_info.point >= 0">+{{ detail_info.point }} {{ point_name(detail_info.pt_id) }}</span>
  114. <span class="green point" v-show="detail_info.point < 0">{{ detail_info.point }} {{ point_name(detail_info.pt_id) }}</span>
  115. </div>
  116. </el-row>
  117. <el-row v-show="detail_info.rule_list">
  118. <el-col :span="6">任务描述</el-col>
  119. <el-col :span="18" v-if="detail_info.remark">{{ detail_info.remark && (detail_info.remark.customize || detail_info.remark.rule) }}</el-col>
  120. </el-row>
  121. <el-row v-show="detail_info.files && detail_info.files.length > 0">
  122. <el-col :span="18" :offset="6">
  123. <el-image
  124. v-for="(itme, index) in detail_info.files"
  125. :key="index"
  126. style="width: 80px; height: 80px;margin: 0 5px;"
  127. :src="itme"
  128. :preview-src-list="detail_info.files"
  129. ></el-image>
  130. </el-col>
  131. </el-row>
  132. <el-row v-show="detail_info.rule_list">
  133. <el-col :span="6">规则分类</el-col>
  134. <el-col :span="18">{{ detail_info.rule_list }}</el-col>
  135. </el-row>
  136. <el-row v-show="detail_info.source_type_mark">
  137. <el-col :span="6">来源类型</el-col>
  138. <el-col :span="18">{{ detail_info.source_type_mark }}</el-col>
  139. </el-row>
  140. <el-row v-show="detail_info.recorder_name">
  141. <el-col :span="6">记录人</el-col>
  142. <el-col :span="18">{{ detail_info.recorder_name }}</el-col>
  143. </el-row>
  144. <el-row v-show="detail_info.date">
  145. <el-col :span="6">事件时间</el-col>
  146. <el-col :span="18">{{ detail_info.date }}</el-col>
  147. </el-row>
  148. <el-row v-show="detail_info.complete_task.time">
  149. <el-col :span="6">完成时间</el-col>
  150. <el-col :span="18">{{ detail_info.complete_task.time }}</el-col>
  151. </el-row>
  152. <el-row v-show="detail_info.complete_task.remark">
  153. <el-col :span="6">完成备注</el-col>
  154. <el-col :span="18">{{ detail_info.complete_task.remark }}</el-col>
  155. </el-row>
  156. <el-row v-show="detail_info.complete_task && detail_info.complete_task.files && detail_info.complete_task.files.length > 0">
  157. <el-col :span="18" :offset="6">
  158. <el-image
  159. v-for="(itme, index) in detail_info.complete_task.files"
  160. :key="index"
  161. style="width: 80px; height: 80px;margin: 0 5px;"
  162. :src="itme"
  163. :preview-src-list="detail_info.complete_task.files"
  164. ></el-image>
  165. </el-col>
  166. </el-row>
  167. <div v-show="detail_info.rule_id">
  168. <p class="row_title">规则依据</p>
  169. <el-row>
  170. <el-col :span="6">规则分类</el-col>
  171. <el-col :span="18">{{ detail_info.rule_list }}</el-col>
  172. </el-row>
  173. <el-row v-show="detail_info.remark.rule">
  174. <el-col :span="6">积分规则</el-col>
  175. <el-col :span="18">{{ detail_info.remark.rule }}</el-col>
  176. </el-row>
  177. <el-row>
  178. <el-col :span="6">积分</el-col>
  179. <el-col :span="18" v-show="detail_info.rule_item.min_point == detail_info.rule_item.max_point">{{ detail_info.rule_item.min_point }}</el-col>
  180. <el-col :span="18" v-show="detail_info.rule_item.min_point != detail_info.rule_item.max_point">
  181. {{ detail_info.rule_item.min_point }} ~ {{ detail_info.rule_item.max_point }}
  182. </el-col>
  183. </el-row>
  184. </div>
  185. <div v-show="detail_info.process"><Steps :process="detail_info.process"></Steps></div>
  186. <div v-show="detail_info.dc_remark.flow"><Review :process="detail_info.dc_remark.flow" :status="detail_info.dc_status"></Review></div>
  187. <div style="text-align: center;margin-top: 30px;" v-if="detail_info.source_type == 10 && see_log">
  188. <el-button type="primary" size="medium" @click="showLog = true">
  189. 查看日志详情内容
  190. <span style=";padding-left:5px;">»</span>
  191. </el-button>
  192. </div>
  193. </div>
  194. <div v-if="!this.$authoritys('employee') && !this.$authoritys('dept_manager')" style="position: absolute; bottom: 20px; display: block; right: 20px;">
  195. <el-button @click="close_integral_event">取消</el-button>
  196. <el-button type="danger" @click="del_integral_event(detail_info)">删除</el-button>
  197. </div>
  198. </el-drawer>
  199. <el-dialog title="查看日志详情" width="600px" :visible.sync="showLog">
  200. <div class="title">{{ ding_report.creator_name }}的{{ ding_report.template_name }}</div>
  201. <div v-if="ding_report.contents.length > 0">
  202. <div class="contents" v-for="(item, index) in ding_report.contents" :key="index">
  203. <div class="key">{{ item.key }}</div>
  204. <div class="value fontColorF">
  205. <span v-if="item.value">{{ item.value }}</span>
  206. <span v-else>未填写</span>
  207. </div>
  208. </div>
  209. </div>
  210. <div v-if="ding_report.images.length > 0">
  211. <div class="key" style="margin-bottom: 20px;">图片</div>
  212. <div class="flex-box flex-d-wrap">
  213. <el-image
  214. v-for="(item, index) in ding_report.images"
  215. :key="index"
  216. style="width: 100px; height: 100px;margin-right:8px"
  217. :src="item"
  218. :preview-src-list="ding_report.images"
  219. ></el-image>
  220. </div>
  221. </div>
  222. </el-dialog>
  223. <el-dialog title="导入错误信息" :visible.sync="importErrorInfoShow" width="30%">
  224. <div>
  225. <el-table :data="error_list" border stripe>
  226. <el-table-column prop="name" label="错误信息">
  227. <template slot-scope="scope">
  228. {{ scope.row }}
  229. </template>
  230. </el-table-column>
  231. </el-table>
  232. </div>
  233. <span slot="footer"><el-button type="primary" size="medium" @click="importErrorInfoShow = false">确 定</el-button></span>
  234. </el-dialog>
  235. <el-dialog title="轮播事件" :visible.sync="swiperShow" width="500px">
  236. <div>
  237. <el-row>
  238. <el-col :span="5" style="line-height: 36px;">仅展示最新的</el-col>
  239. <el-col :span="6">
  240. <el-select v-model="page_size" placeholder="请选择">
  241. <el-option v-for="item in swiperPageList" :key="item.value" :label="item.value" :value="item.value"></el-option>
  242. </el-select>
  243. </el-col>
  244. <el-col :span="6" style="line-height: 36px;">条积分事件来轮播</el-col>
  245. </el-row>
  246. </div>
  247. <span slot="footer">
  248. <el-button size="medium" @click="swiperShow = false" style="margin-right: 10px;">取 消</el-button>
  249. <router-link :to="{ path: '/deptRankSwiper?' + '&page=1&page_size=' + this.page_size + '&type=1' }" target="_blank">
  250. <el-button size="medium" type="primary">开始轮播</el-button>
  251. </router-link>
  252. </span>
  253. </el-dialog>
  254. <toLead :visible.sync="toleadShw" :nowIndex.sync="nowIndex" :tolead="toleadResult" @confirm="tealConfirm" :export_type="'integral_event'" :dstyle="'height:130px;'">
  255. <template slot="1">
  256. <div v-if="nowIndex == 1">
  257. <div class="flex-box flex-v-ce margin-bottom">
  258. <div style="margin-right: 10px;">1、下载积分事件模版,批量录入积分事件</div>
  259. <el-button size="medium" type="primary" @click="downloadTemplate" plain>下载模板</el-button>
  260. </div>
  261. <div class="margin-bottom">
  262. <el-upload
  263. :limit="1"
  264. :headers="ATOKEN"
  265. ref="upload"
  266. :action="action"
  267. :on-remove="handleRemove"
  268. :on-success="handlePictureCardPrediv"
  269. :file-list="fileList"
  270. :before-upload="beforeFilesUpload"
  271. :on-progress="handleOnthecross"
  272. >
  273. <p>
  274. 2、上传积分事件数据Excel表
  275. <el-button style="margin-left: 10px;" size="medium" type="primary" plain>选择文件</el-button>
  276. </p>
  277. </el-upload>
  278. </div>
  279. </div>
  280. </template>
  281. </toLead>
  282. </div>
  283. </template>
  284. <script>
  285. import Steps from '@/components/Steps';
  286. import Review from '@/components/Review';
  287. import toLead from '@/components/toLead';
  288. export default {
  289. data() {
  290. return {
  291. parameter:{},
  292. deleteDisabled: true,
  293. action: process.env.VUE_APP_BASE_API + 'api/integral/import',
  294. ATOKEN: { 'A-TOKEN': this.$getToken(), Accept: 'application/vnd.test.v2+json' },
  295. loading: false,
  296. swiperShow: false,
  297. swiperPageList: [{ value: '10' }, { value: '30' }, { value: '50' }],
  298. page_size: 10,
  299. point_types: this.$getTyps(),
  300. dept_name: [],
  301. dept_tree: [],
  302. formData: {
  303. page: 1,
  304. page_size: 10,
  305. month:'',
  306. pt_id:3,
  307. dc_status:JSON.stringify([1]),
  308. order_key:'update_time'
  309. },
  310. time_slot: null,
  311. rule_trees: [],
  312. props: { checkStrictly: true, value: 'id', label: 'name', children: 'child' },
  313. rule: [],
  314. list: [],
  315. total: null,
  316. detail_info: null,
  317. detail_popup: false,
  318. detail_loading: false,
  319. pageLimit: 10,
  320. excelImportShow: false,
  321. update_btn: false,
  322. error_list: [],
  323. importErrorInfoShow: false,
  324. fileList: [],
  325. employeeOrdept: !this.$authoritys('employee') && !this.$authoritys('dept_manager'),
  326. select_employee_id: '',
  327. employee_map: [],
  328. selectionID: [], //删除的事件ID
  329. // 查看日志
  330. showLog: false,
  331. see_log: 1,
  332. ding_report: {
  333. contents: [],
  334. images: []
  335. },
  336. //导入相关
  337. toleadShw: false,
  338. nowIndex: 1,
  339. toleadResult: {},
  340. deriveNum: 0,
  341. str:'',
  342. source_type: [
  343. { id: 0, name: '全部' },
  344. { id: 1, name: '积分奖扣' },
  345. { id: 2, name: '任务' },
  346. { id: 3, name: '积分系统分配' },
  347. { id: 4, name: '考勤系统分配' },
  348. { id: 5, name: '积分申请' },
  349. // {id: 6,name: '绩效任务包'},
  350. { id: 8, name: '积分导入' },
  351. { id: 9, name: 'A分转B分' },
  352. { id: 10, name: '钉钉汇报(日志)奖扣分' }
  353. ]
  354. };
  355. },
  356. components: { Steps, toLead,Review },
  357. created() {
  358. this.parameter=JSON.parse(this.$route.query.data);
  359. this.formData.month=this.parameter.date;
  360. this.formData.recorder_id=this.parameter.id;
  361. this.getEmployee();
  362. this.getDataAccess();
  363. document.getElementById('main').scrollTop = 0;
  364. },
  365. mounted() {
  366. this.deriveRestrict();
  367. this.getDepartment();
  368. this.get_rule_trees();
  369. this.get_integral_list(this.formData);
  370. this.see_log = this.$store.state.config.see_log;
  371. this.point_types = this.getTypes();
  372. },
  373. watch: {
  374. toleadShw(val) {
  375. if (val) this.nowIndex = 1;
  376. },
  377. selectionID() {
  378. if (this.selectionID.length == 0) {
  379. this.deleteDisabled = true;
  380. } else {
  381. this.deleteDisabled = false;
  382. }
  383. },
  384. 'formData.pt_id'(val, old_val) {
  385. this.formData.page = 1;
  386. !val ? delete this.formData.pt_id : '';
  387. this.get_integral_list(this.formData);
  388. },
  389. 'formData.source_type'(val) {
  390. this.formData.page = 1;
  391. val == 0 ? delete this.formData.source_type : '';
  392. this.get_integral_list(this.formData);
  393. },
  394. 'formData.page'(val, old_val) {
  395. this.get_integral_list(this.formData);
  396. },
  397. select_employee_id(val) {
  398. this.formData.page = 1;
  399. this.formData.employee_ids = val;
  400. this.get_integral_list(this.formData);
  401. },
  402. time_slot(val, old_val) {
  403. this.formData.page = 1;
  404. if (val !== null) {
  405. this.formData.start_day = val[0];
  406. this.formData.end_day = val[1];
  407. } else {
  408. delete this.formData.start_day;
  409. delete this.formData.end_day;
  410. }
  411. this.get_integral_list(this.formData);
  412. },
  413. dept_name(val, old_val) {
  414. this.formData.page = 1;
  415. if (val.length !== 0) {
  416. this.formData.dept_ids = val[val.length - 1];
  417. } else {
  418. this.formData.dept_ids = 0;
  419. }
  420. this.$nextTick(() => {
  421. this.$refs.dept.dropDownVisible = false;
  422. this.get_integral_list(this.formData);
  423. });
  424. }
  425. },
  426. methods: {
  427. // 获取数据范围权限
  428. getDataAccess(id) {
  429. this.$axios('get', '/api/integral/statistics/range_level').then(res => {
  430. let resData = res.data.data;
  431. if(resData==1){
  432. this.str='仅查看自己的数据'
  433. }else if(resData==2){
  434. this.str='查看自己以及管理范围内用户的数据'
  435. }else if(resData==3){
  436. this.str='查看全员数据'
  437. }
  438. })
  439. },
  440. //获取员工列表
  441. getEmployee() {
  442. this.$axios('get', '/api/employee/index', { dept_id: 0, keywords: '', page: 1, page_size: 3000, is_official: 1 }).then(res => {
  443. let list = res.data.data.list;
  444. this.employee_map = list;
  445. });
  446. },
  447. deriveRestrict() {
  448. this.deriveNum = 0;
  449. this.$axios('GET', '/api/site/info').then(res => {
  450. if (res.data.code == 1) {
  451. this.deriveNum = Number(res.data.data.export_max_num);
  452. }
  453. });
  454. },
  455. getTypes() {
  456. var arr = this.$getTyps();
  457. return arr.filter(function(item) {
  458. return item.code != 'JX';
  459. });
  460. },
  461. handleRemove(file, fileList) {
  462. // if (fileList !== null && fileList.length != 0) {
  463. // this.import_btn_show = true;
  464. // } else {
  465. // this.import_btn_show = false;
  466. // }
  467. },
  468. // 导入相关
  469. close_import() {
  470. this.excelImportShow = false;
  471. this.$refs.upload.clearFiles();
  472. },
  473. // keyword
  474. keyWordSelect() {
  475. this.formData.page = 1;
  476. this.get_integral_list(this.formData);
  477. },
  478. downloadTemplate() {
  479. window.open(process.env.VUE_APP_BASE_API + 'api/download/integral/template');
  480. },
  481. uploadFile() {
  482. let params = {};
  483. params.file = this.file;
  484. this.update_btn = true;
  485. this.$axios('post', '/api/integral/import', params, 'v2')
  486. .then(res => {
  487. if (res.data.code == 1) {
  488. if (res.data.data.error.length == 0) {
  489. this.$message({ type: 'success', message: '导入成功' });
  490. this.excelImportShow = false;
  491. } else {
  492. this.$message({ type: 'error', message: '导入错误' });
  493. this.error_list = res.data.data.error;
  494. this.importErrorInfoShow = true;
  495. }
  496. } else {
  497. this.$message({ type: 'error', message: res.data.msg });
  498. }
  499. })
  500. .finally(() => {
  501. setTimeout(() => {
  502. this.update_btn = false;
  503. }, 3000);
  504. });
  505. },
  506. tealConfirm() {
  507. this.keyWordSelect();
  508. },
  509. handleOnthecross(event, file, fileList) {
  510. this.nowIndex = 2;
  511. },
  512. handlePictureCardPrediv(response) {
  513. if (response.code == 1) {
  514. response.data.id = 1;
  515. } else {
  516. response.data.id = 0;
  517. response.data.name = response.msg;
  518. }
  519. this.toleadResult = response.data;
  520. this.nowIndex = 3;
  521. return;
  522. // this.nowIndex = 3
  523. if (response.code == 1) {
  524. if (response.data.error.length > 0) {
  525. var htmls = response.data.error;
  526. var str = "<div class='red'></div>";
  527. htmls.forEach(item => {
  528. str += `<div>${item}</div>`;
  529. });
  530. // this.close_import();
  531. this.$notify.error({
  532. title: '导入错误',
  533. dangerouslyUseHTMLString: true,
  534. message: str,
  535. duration: 0,
  536. offset: 50,
  537. customClass: 'notifyBox'
  538. });
  539. } else {
  540. this.file = response.data;
  541. this.$message.success({ message: response.msg });
  542. this.keyWordSelect();
  543. this.close_import();
  544. }
  545. } else {
  546. this.$message.error({ message: response.msg });
  547. }
  548. },
  549. beforeFilesUpload(file) {
  550. const $ext_list = ['xlsx', 'xls'];
  551. let len = file.name.split('.').length - 1;
  552. const $ext_name = file.name.split('.')[len];
  553. if ($ext_list.indexOf($ext_name) != -1) {
  554. } else {
  555. this.toleadResult.id = 0;
  556. this.toleadResult.name = '文件格式上传错误,仅支持上传xlsx,xls)';
  557. this.nowIndex = 3;
  558. // this.$message.warning('文件格式上传错误,仅支持上传xlsx,xls)');
  559. return false;
  560. }
  561. },
  562. exportExcel() {
  563. if (this.deriveNum > 0 && this.total >= this.deriveNum) {
  564. this.$message.warning('当前数据已超出' + this.deriveNum + '条,请拆分时间段分批导出');
  565. return;
  566. }
  567. window.open(
  568. process.env.VUE_APP_BASE_API +
  569. 'api/download/integral?employee_id=' +this.$getUserData().id +
  570. '&page=' +this.formData.page +'&page_size=' +this.formData.page_size +'&pt_id=3'+'&dc_status=[1]'+
  571. '&recorder_id=' +this.parameter.id +'&month=' +this.parameter.date +'&order_key=update_time'+
  572. (this.formData.source_type ? '&source_type=' + this.formData.source_type : '') +
  573. (this.formData.keyword ? '&keyword=' + this.formData.keyword : ''),
  574. '_blank'
  575. );
  576. },
  577. // end 文件上传
  578. handleSizeChange(val) {
  579. this.pageLimit = val;
  580. this.formData.page_size = this.pageLimit;
  581. this.get_integral_list(this.formData);
  582. },
  583. cuttString(data) {
  584. return data.substring(5);
  585. },
  586. deleteInBatches() {
  587. if (this.selectionID.length < 1) {
  588. return false;
  589. }
  590. this.$confirm('此操作将永久删除选中的积分事件, 确认要删除吗?', '批量删除事件', {
  591. confirmButtonText: '确定',
  592. cancelButtonText: '取消',
  593. type: 'warning'
  594. })
  595. .then(() => {
  596. this.loading = true;
  597. this.$axios('POST', '/api/integral/statistics/integral/many', { event_ids: this.selectionID })
  598. .then(res => {
  599. if (res.data.code == 1) {
  600. this.$message({
  601. message: res.data.msg,
  602. type: 'success'
  603. });
  604. if (this.selectionID.length == this.list.length) {
  605. if (this.formData.page > 1) {
  606. this.formData.page = this.formData.page - 1;
  607. }
  608. }
  609. this.get_integral_list(this.formData);
  610. } else {
  611. this.$message.error(res.data.msg);
  612. }
  613. })
  614. .finally(() => {
  615. this.loading = false;
  616. });
  617. })
  618. .catch(() => {});
  619. },
  620. deleteEvents(selection) {
  621. let listId = [];
  622. selection.forEach(item => {
  623. listId.push(item.id);
  624. });
  625. this.selectionID = listId;
  626. },
  627. open_detail(item) {
  628. this.detail_popup = true;
  629. let data = {
  630. event_id: item.id
  631. };
  632. this.detail_loading = true;
  633. this.$axios('get', '/api/integral/statistics/integral/info', data)
  634. .then(res => {
  635. if (res.data.code == 1) {
  636. this.detail_info = res.data.data;
  637. var ding_report = res.data.data.remark.ding_report;
  638. if (Object.keys(ding_report).length != 0) {
  639. this.ding_report = res.data.data.remark.ding_report;
  640. }
  641. } else {
  642. this.$message.error(res.data.data.msg);
  643. }
  644. })
  645. .finally(() => {
  646. this.detail_loading = false;
  647. });
  648. },
  649. //获取部门
  650. getDepartment() {
  651. this.$axios('get', '/api/department/tree').then(res => {
  652. this.dept_tree = this.getTreeData(res.data.data.list);
  653. });
  654. },
  655. //获取规则
  656. get_rule_trees() {
  657. this.$axios('get', '/api/integral/rule/trees').then(res => {
  658. this.rule_trees = this.getRuleTreeData(res.data.data.rule_tree);
  659. });
  660. },
  661. get_integral_list(data) {
  662. this.loading = true;
  663. this.$axios('get', '/api/integral/statistics/integral', data)
  664. .then(res => {
  665. if (res.data.code == 1) {
  666. this.list = res.data.data.list;
  667. this.total = res.data.data.total;
  668. } else {
  669. this.$message.error(res.data.data.msg);
  670. }
  671. })
  672. .finally(() => {
  673. this.loading = false;
  674. });
  675. },
  676. handleCurrentChange(val) {
  677. this.formData.page = val;
  678. },
  679. rule_null(val) {
  680. if (val.length == 0) {
  681. this.formData.rule_id = 0;
  682. } else {
  683. this.formData.rule_id = this.rule[this.rule.length - 1];
  684. }
  685. this.$nextTick(() => {
  686. this.$refs.rule.dropDownVisible = false;
  687. this.get_integral_list(this.formData);
  688. });
  689. },
  690. del_integral_event(item) {
  691. this.$confirm('删除事件的同时也会撤销积分,确定删除吗?', '提示', {
  692. confirmButtonText: '确定',
  693. cancelButtonText: '取消',
  694. type: 'warning'
  695. }).then(() => {
  696. this.$axios('post', '/api/integral/statistics/integral/destroy', { event_id: item.event_id }).then(res => {
  697. if (res.data.code == 1) {
  698. this.$message.success(res.data.msg);
  699. this.detail_popup = false;
  700. this.get_integral_list(this.formData);
  701. } else {
  702. this.$message.error(res.data.msg);
  703. }
  704. });
  705. });
  706. },
  707. close_integral_event() {
  708. this.detail_popup = false;
  709. },
  710. point_name(id) {
  711. return this.point_types.find(item => {
  712. if (item.id == id) {
  713. return item.name;
  714. }
  715. }).name;
  716. },
  717. // 递归判断列表,把最后的children设为undefined
  718. getTreeData(data) {
  719. for (var i = 0; i < data.length; i++) {
  720. if (data[i]._child.length < 1) {
  721. // children若为空数组,则将children设为undefined
  722. data[i]._child = undefined;
  723. } else {
  724. // children若不为空数组,则继续 递归调用 本方法
  725. this.getTreeData(data[i]._child);
  726. }
  727. }
  728. return data;
  729. },
  730. // 规则递归 children
  731. getRuleTreeData(data) {
  732. for (var i = 0; i < data.length; i++) {
  733. if (data[i].child.length < 1) {
  734. // children若为空数组,则将children设为undefined
  735. data[i].child = undefined;
  736. } else {
  737. // children若不为空数组,则继续 递归调用 本方法
  738. this.getRuleTreeData(data[i].child);
  739. }
  740. }
  741. return data;
  742. }
  743. }
  744. };
  745. </script>
  746. <style scoped lang="scss">
  747. .fh{
  748. position: relative;
  749. cursor: pointer;
  750. padding-right: 40px !important;
  751. }
  752. .fh:hover{
  753. color: #26a2ff;
  754. }
  755. .fh::after{
  756. width: 2px;
  757. background-color: #ccc;
  758. height: 30px;
  759. content: " ";
  760. position: absolute;
  761. right: 20px;
  762. top: -5px;
  763. }
  764. .remark {
  765. display: -webkit-box;
  766. -webkit-box-orient: vertical;
  767. -webkit-line-clamp: 2;
  768. overflow: hidden;
  769. }
  770. .title {
  771. text-align: center;
  772. font-weight: 700;
  773. max-width: 70%;
  774. margin: 20px auto;
  775. margin-top: 0;
  776. font-size: 18px;
  777. }
  778. .key {
  779. font-weight: 700;
  780. font-size: 16px;
  781. }
  782. .value {
  783. font-size: 14px;
  784. margin: 10px 0;
  785. margin-bottom: 20px;
  786. }
  787. .imgs {
  788. width: 80px;
  789. height: 80px;
  790. margin-right: 5px;
  791. margin-bottom: 5px;
  792. }
  793. header.el-drawer__header {
  794. font-size: 18px;
  795. font-family: MicrosoftYaHei;
  796. color: #303133;
  797. width: 500px;
  798. span {
  799. :focus {
  800. outline: 0;
  801. }
  802. }
  803. }
  804. .display_flex {
  805. display: flex;
  806. }
  807. .label {
  808. line-height: 36px;
  809. padding-right: 10px;
  810. }
  811. .time_section {
  812. .el-range-editor {
  813. width: 330px;
  814. }
  815. }
  816. .pagination {
  817. padding: 20px 0;
  818. }
  819. .detail_popup {
  820. padding: 20px;
  821. height: calc(100vh - 140px);
  822. overflow: auto;
  823. padding-bottom: 100px;
  824. .row_title {
  825. position: relative;
  826. margin: 0 0 20px 0;
  827. padding-top: 12px;
  828. font-size: 16px;
  829. color: #303133;
  830. line-height: 22px;
  831. }
  832. .row_title:before {
  833. position: absolute;
  834. top: 0;
  835. content: ' ';
  836. width: 100%;
  837. border-top: 1px #f8f8f8 solid;
  838. }
  839. .el-row {
  840. margin-bottom: 10px;
  841. font-size: 14px;
  842. .el-col-4 {
  843. color: #606266;
  844. }
  845. }
  846. }
  847. span.point {
  848. font-size: 16px;
  849. }
  850. .drawer_title {
  851. font-size: 18px;
  852. padding: 20px;
  853. border-bottom: 1px #efefef solid;
  854. }
  855. .row_tips {
  856. display: block;
  857. color: #909399;
  858. font-size: 12px;
  859. margin-top: 0px;
  860. }
  861. .el-range-editor--medium .el-range-separator {
  862. width: 25px;
  863. }
  864. .integral_event_box {
  865. background-color: #ffffff;
  866. padding: 20px;
  867. min-height: calc(100vh - 160px);
  868. }
  869. .examine_steps ::v-deep .el-step.is-vertical .el-step__title {
  870. padding-bottom: 0;
  871. }
  872. .diy-tip1 {
  873. margin-bottom: 10px !important;
  874. background: #f0f9eb !important;
  875. color: #67c23a !important;
  876. border: 1px solid #67c23a !important;
  877. padding: 9px !important;
  878. min-width: 800px;
  879. border-radius: 4px;
  880. }
  881. </style>