resultValueEntryMb.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175
  1. <template>
  2. <div style="height:calc(100% - 1.92rem);">
  3. <div style="width:100%; height: 100%;">
  4. <header>
  5. <van-tabs v-model="active" swipeable>
  6. <van-tab v-for="(item, index) in minFormactive" :title="item.name + '(' + item.age + ')'"
  7. :key="index"></van-tab>
  8. </van-tabs>
  9. </header>
  10. <div class="batch-operate">
  11. <van-checkbox v-model="isAllChecked" shape="square" icon-size="18px" @change="toggleAllCheck"
  12. style="margin: 0 0.24rem;"></van-checkbox>
  13. <button class="footcolButno" @click="openBatchOperation(1)"
  14. style="width: 2rem; height: 0.5rem; font-size: 0.28rem; margin-right: 0.24rem;"
  15. :class="!(selectList && selectList.length) > 0 ? 'disabled' : ''">结果值</button>
  16. <button class="footcolButno" @click="openBatchOperation(2)"
  17. style="width: 2rem; height: 0.5rem; font-size: 0.28rem; margin-right: 0.24rem;"
  18. :class="!(selectList && selectList.length) > 0 ? 'disabled' : ''">图片</button>
  19. <!-- <div style="color: #FF9600;">支持批量录入结果值和图片</div> -->
  20. <span @click.stop="openText2()"><van-icon name="question" class="fontColorC" /></span>
  21. </div>
  22. <div style="width:100%; height:calc(100% - 1.8rem);display: flex; flex-direction: column;">
  23. <scroller :isNeed="isNeed" ref="work_bench_scroller" class="all">
  24. <div style="padding-bottom:2.65rem;" v-if="rvenotList.length > 0">
  25. <div v-for="(item, index) in rvenotList" :key="index"
  26. style="margin:.2rem 0;padding:0.24rem;background-color:#fff;">
  27. <div class="flex-box-ce" style="border-bottom: 1px dashed #f3f3f3; padding-bottom: .25rem;">
  28. <van-checkbox v-model="item.isChecked" shape="square" style="margin-right: 0.24rem;" icon-size="18px"
  29. @change="updateAllCheckStatus"></van-checkbox>
  30. <userImage class="about-me__avatar" :id="item.employee_id" :user_name="item.employee_name"
  31. fontSize=".28" width="0.6rem" height="0.6rem"></userImage>
  32. <div style="font-size:.3rem; padding: 0rem 0px 0px 0.18rem; box-sizing: border-box;">
  33. {{ item.employee_name }}
  34. </div>
  35. <div class="font-flex-word fontColorC flex-1" style="padding-right: 0.2rem;">
  36. <span v-for="(depts, keys) in item.dept_list" :key="keys"
  37. style="font-size:.25rem;padding: 0rem 0px 0px 0.15rem;display: inline-block;">
  38. {{ depts.dept_name }}
  39. <span v-if="item.dept_list.length - keys > 1">,</span>
  40. </span>
  41. </div>
  42. <template v-if="active == 1">
  43. <div style="font-size:.3rem" class="fontColorC" v-if="!item.isUpdate" @click="openText(item)">
  44. <van-icon name="info-o" />不可调整
  45. </div>
  46. </template>
  47. </div>
  48. <div>
  49. <div style="font-size:.32rem;margin: 0.2rem 0;">{{ item.index_name }}</div>
  50. <div class="flex-box" style="margin-bottom: 0.14rem;" v-for="(arr, att) in item.dil" :key="att"
  51. v-if="arr.prop">
  52. <div style="color:#929292;font-size:.27rem; width: 1.6rem;">{{ arr.lab }}:</div>
  53. <div class="flex-1" style="font-size:.28rem;">{{ arr.prop }}</div>
  54. </div>
  55. <div style="border:1px solid #e4e4e4;margin: .2rem 0 0 0;" v-if="active == 0">
  56. <div class="flex-box-ce"
  57. style="justify-content: space-between; padding: 0 0.32rem 0 0; box-sizing: border-box;"
  58. v-if="item.index_type==1">
  59. <van-field v-model="item.result_cache" placeholder="请输入结果值" style="width: 5rem;" />
  60. <div class="fontColorC">{{item.unit}}</div>
  61. </div>
  62. <van-cell>
  63. <Uploader v-model="item.result_file.imgs" :max-count="3" :beforeRead="beforeRead"
  64. :accept="accept" />
  65. </van-cell>
  66. <van-cell v-if="item.result_file.append.length>0">
  67. <template>
  68. <div style="font-size: 0.24rem;" class="orange">文件仅支持在PC上‘上传’、‘删除’</div>
  69. <div class="blue" style="padding-top: 5px;font-size: 0.28rem;"
  70. v-for="(e,index2) in item.result_file.append" :key="index2" @click="downWgt(e.url,e.name)">
  71. {{e.name}}
  72. </div>
  73. </template>
  74. </van-cell>
  75. </div>
  76. <template v-else>
  77. <div style="border:1px solid #e4e4e4;margin: .2rem 0 0 0;" v-if="item.isUpdate">
  78. <div class="flex-box-ce"
  79. style="justify-content: space-between; padding: 0 0.32rem 0 0; box-sizing: border-box;"
  80. v-if="item.index_type==1">
  81. <van-field v-model="item.result_cache" placeholder="请输入结果值" style="width: 5rem;" />
  82. <div class="fontColorC">{{item.unit}}</div>
  83. </div>
  84. <van-cell>
  85. <Uploader v-model="item.result_file.imgs" :max-count="3" :beforeRead="beforeRead"
  86. :accept="accept" />
  87. </van-cell>
  88. <van-cell v-if="item.result_file.append.length>0">
  89. <template>
  90. <div style="font-size: 0.24rem;" class="orange">文件仅支持在PC上‘上传’、‘删除’</div>
  91. <div class="blue" style="padding-top: 5px;font-size: 0.28rem;"
  92. v-for="(e,index2) in item.result_file.append" :key="index2" @click="downWgt(e.url,e.name)">
  93. {{e.name}}
  94. </div>
  95. </template>
  96. </van-cell>
  97. </div>
  98. <div v-else>
  99. <span style="color:#929292;font-size:.27rem;width: 1.4rem;display: inline-block;">结果值:</span>
  100. <span style="font-size:.28rem;position: relative;left: -4px;" class="orange"
  101. v-if="item.index_type==1">{{ item.result_cache }} {{ item.unit }}</span>
  102. <template v-if="item.result_file.images">
  103. <div class="flex-box-ce" style="margin: 10px 0;" v-if="item.result_file.images.length>0">
  104. <van-image @click="openImg(item.result_file.images,index2)"
  105. v-for="(e,index2) in item.result_file.images" :key="index2"
  106. style="border-radius: 3px;margin-right: 10px;" width="100" height="100" :src="e.url" />
  107. </div>
  108. </template>
  109. <template v-if="item.result_file.append.length>0">
  110. <div style="font-size: 0.24rem;" class="orange">文件仅支持在PC上‘上传’、‘删除’</div>
  111. <div class="blue" style="padding-top: 5px;font-size: 0.28rem;"
  112. v-for="(e,index2) in item.result_file.append" :key="index2" @click="downWgt(e.url,e.name)">
  113. {{e.name}}
  114. </div>
  115. </template>
  116. </div>
  117. </template>
  118. </div>
  119. </div>
  120. </div>
  121. <van-empty description="暂无结果值录入" v-else />
  122. </scroller>
  123. <footer v-if="active == 0 && rvenotList.length > 0 && selectList && selectList.length > 0" v-isKeyboard>
  124. <van-row class="footfoot">
  125. <van-col span="14" class="footcol" @click="save(1)">
  126. <div style="width:1rem;margin: auto;">
  127. <icon name="save" style="width: 0.5rem;height: 0.5rem;"></icon>
  128. <div style="font-size: .24rem;color:#8a8a8a;">暂存</div>
  129. </div>
  130. </van-col>
  131. <van-col span="10" class="footBut">
  132. <button class="footcolButno" @click="rveno">取消</button>
  133. <button class="footcolButok" @click="save(0)">提交</button>
  134. </van-col>
  135. </van-row>
  136. </footer>
  137. <footer v-if="active == 1 && rvenotList.length > 0 && returnIsShow && selectList && selectList.length > 0"
  138. v-isKeyboard>
  139. <van-row class="footfoot">
  140. <van-col span="14" class="footcol"></van-col>
  141. <van-col span="10" class="footBut">
  142. <button class="footcolButno" @click="rveno">取消</button>
  143. <button class="footcolButok" @click="save(3)">提交</button>
  144. </van-col>
  145. </van-row>
  146. </footer>
  147. </div>
  148. </div>
  149. <van-popup v-model="isFilterShow" position="bottom" :style="popStyle">
  150. <div class="popup-title">
  151. {{ title }}
  152. </div>
  153. <div class="filter-options-box">
  154. <scroller style="height: 5rem; border-top: 0.01rem solid #f5f7fa;">
  155. <div class="dropdown-item-title" style="margin-top: 10px;">选择人员</div>
  156. <div class="dropdown-item-content-list">
  157. <div class="dropdown-item-content" v-for="(item, index) in user_list" :key="index"
  158. @click="chooseOptions(item, 'user_name')" :class="selectOptions.includes(item) ? 'active' : ''">
  159. {{ item }}
  160. </div>
  161. </div>
  162. <div class="dropdown-item-title">指标名称</div>
  163. <div class="dropdown-item-content-list">
  164. <div class="dropdown-item-content" v-for="(item, index) in index_name_list" :key="index"
  165. @click="chooseOptions(item, 'index_name')" :class="selectOptions.includes(item) ? 'active' : ''">
  166. {{ item }}
  167. </div>
  168. </div>
  169. <div class="dropdown-item-title">考核标准</div>
  170. <div class="dropdown-item-content-list">
  171. <div class="dropdown-item-content" v-for="(item, index) in index_standard_list" :key="index"
  172. style="flex: 0 0 100%; margin-right: 0;" @click="chooseOptions(item, 'index_standard')"
  173. :class="selectOptions.includes(item) ? 'active' : ''" s>
  174. {{ item }}
  175. </div>
  176. </div>
  177. <div class="dropdown-item-title">目标值</div>
  178. <div class="dropdown-item-content-list">
  179. <template v-if="target_list && target_list.length > 0">
  180. <div class="dropdown-item-content" v-for="(item, index) in target_list" :key="index"
  181. @click="chooseOptions(item, 'target')" :class="select_target_list.includes(item) ? 'active' : ''">
  182. {{ item }}
  183. </div>
  184. </template>
  185. </div>
  186. <div class="dropdown-item-title">权重%</div>
  187. <div class="dropdown-item-content-list">
  188. <template v-if="index_weight_list && index_weight_list.length > 0">
  189. <div class="dropdown-item-content" v-for="(item, index) in index_weight_list" :key="index"
  190. @click="chooseOptions(item, 'weight')" :class="select_index_weight_list.includes(item) ? 'active' : ''">
  191. {{ item }}
  192. </div>
  193. </template>
  194. </div>
  195. <div style="height: 1.2rem;"></div>
  196. </scroller>
  197. <div class="btn-container">
  198. <button class="footcolButno" style="width: 96%; height: 0.8rem;" @click="clearFilters()">重置</button>
  199. </div>
  200. </div>
  201. </van-popup>
  202. <van-popup v-model:show="isResult" round>
  203. <div style="width: 7rem;padding: 0.24rem;box-sizing: border-box;">
  204. <div style="font-size: 0.28rem;margin-bottom: 0.24rem;">提交结果</div>
  205. <van-progress :percentage="percentage" stroke-width="8" />
  206. <div style="margin-top: 16px;border: 1px solid #f1f1f1;max-height: 500px;overflow-y: auto;" class="scroll-bar">
  207. <div class="flex-box-ce results" style="font-weight: 600;">
  208. <div style="border-right: 1px solid #f1f1f1;width: 40px;">序号</div>
  209. <div class="flex-1" style="border-right: 1px solid #f1f1f1;">姓名</div>
  210. <div class="flex-2" style="border-right: 1px solid #f1f1f1;">指标名称</div>
  211. <div class="flex-2">提交结果</div>
  212. </div>
  213. <div class="flex-box-ce results" v-for="(item, index) in results" :key="index">
  214. <div style="border-right: 1px solid #f1f1f1;width: 40px;">{{ results.length - index }}</div>
  215. <div class="flex-1" style="border-right: 1px solid #f1f1f1;">{{ item.info.employee_name }}</div>
  216. <div class="flex-2" style="border-right: 1px solid #f1f1f1;">{{ item.info.index_name }}</div>
  217. <div class="flex-2 red" v-if="item.msg">{{item.msg}}</div>
  218. <div class="flex-2 green" v-else>提交成功</div>
  219. </div>
  220. </div>
  221. <span slot="footer">
  222. <div class="flex-box-end" style="margin-top: 12px;">
  223. <van-button type="primary" @click="closeIsResult" size="small">确 定</van-button>
  224. </div>
  225. </span>
  226. </div>
  227. </van-popup>
  228. <van-popup v-model:show="isBatchOperation" round>
  229. <div style="width: 7rem; padding: 0.24rem; box-sizing: border-box;">
  230. <div>
  231. <div style="font-weight: 600; text-align: center;">
  232. 批量录入数据
  233. </div>
  234. <div style="color: #FF9600; padding: 0.24rem 0.32rem; box-sizing: border-box;">选择的数据将会录入同一结果值和图片</div>
  235. <div class="flex-box-ce" v-if="showType == 1">
  236. <van-field label="结果值" v-model="batch_result_cache" placeholder="请输入结果值" border />
  237. <!-- <div style="padding-right: 0.32rem;" class="fontColorC">{{item.unit}}</div> -->
  238. </div>
  239. <div style="padding: 0.24rem 0.32rem; box-sizing: border-box;" v-if="showType == 2">
  240. <div style="color: #646566; margin-bottom: 0.24rem;">请上传图片</div>
  241. <Uploader v-model="batch_result_imgs" :max-count="3" :beforeRead="beforeRead" :accept="accept" />
  242. </div>
  243. </div>
  244. <span slot="footer">
  245. <div class="flex-box-end" style="margin-top: 12px;">
  246. <button class="footcolButno" @click="cancelBatchOperation()" style="height: 0.6rem;">取消</button>
  247. <button class="footcolButok" @click="confirmBatchOperation()" style="height: 0.6rem;">确定</button>
  248. </div>
  249. </span>
  250. </div>
  251. </van-popup>
  252. </div>
  253. </template>
  254. <script>
  255. import Vue from 'vue';
  256. import VanSkeleton from '@/performance/components/public/VanSkeleton';
  257. import EmployeeSelector from '@/components/EmployeeSelector';
  258. import Uploader from '@/components/OssUploader';
  259. import DeptSelectorDropdown from '@/components/DeptSelectorDropdown'
  260. import {
  261. Tab,
  262. Tabs,
  263. ImagePreview,
  264. Popup,
  265. Progress,
  266. DropdownMenu,
  267. DropdownItem,
  268. Icon
  269. } from 'vant';
  270. Vue.use(Tab).use(Tabs).use(ImagePreview).use(Popup).use(Progress).use(DropdownMenu).use(DropdownItem).use(Icon);
  271. export default {
  272. props: {
  273. peIds: {
  274. type: String,
  275. default: ''
  276. },
  277. isUpdate: {
  278. type: Boolean,
  279. default: false
  280. },
  281. },
  282. data() {
  283. return {
  284. popStyle: {
  285. width: '100%',
  286. height: '9rem',
  287. padding: '10px',
  288. boxSizing: 'border-box',
  289. borderRadius: '10px',
  290. position: 'relation'
  291. },
  292. showType: 1,
  293. isFilterShow: false,
  294. title: '未录入',
  295. isAllChecked: false,
  296. batch_result_cache: "",
  297. batch_result_imgs: [],
  298. isBatchOperation: false,
  299. isNeed: !this.$getCache('isAndroid'),
  300. skeletonLoad: true, // 骨架屏
  301. rvenotList: [],
  302. minFormactive: [{
  303. name: '未录入',
  304. age: 0
  305. }, {
  306. name: '已录入',
  307. age: 0
  308. }],
  309. active: 0,
  310. noStatusListAll: [],
  311. noStatusListDx: [],
  312. noStatusList: [], // 未录入指标
  313. statusList: [], // 已录入指标
  314. bootBool: false, // 防止多次请求
  315. isIos: this.$getCache('iPhone'),
  316. user_list: [],
  317. index_name_list: [],
  318. index_standard_list: [],
  319. target_list: [],
  320. index_weight_list: [],
  321. select_user_name_list: [],
  322. select_index_name_list: [], // 筛选指标名称列表
  323. select_index_standard_list: [], // 筛选指标标准列表
  324. select_target_list: [], // 筛选指标名称列表
  325. select_index_weight_list: [], // 筛选指标名称列表
  326. // 上传图标与附件
  327. img_fileList: [], // 图片附件
  328. images: [],
  329. accept: 'image/jpeg,image/png,image/jpg',
  330. // 长连接结果
  331. results: [], //提交的返回结果集合
  332. isResult: false,
  333. percentage: 0,
  334. resultList: [], //要发送数据的集合
  335. resultIndex: 0,
  336. userName: '全部人员',
  337. selectUser: false,
  338. employee_list: [],
  339. selected_data: {
  340. dept: [],
  341. employee: []
  342. }, //传入已选部门
  343. paiXu: false,
  344. selectOptions: []
  345. };
  346. },
  347. components: {
  348. VanSkeleton,
  349. Uploader,
  350. EmployeeSelector
  351. },
  352. computed: {
  353. returnIsShow() {
  354. let is = false
  355. this.statusList.forEach(item => {
  356. if (item.isUpdate) {
  357. is = true;
  358. }
  359. })
  360. return is
  361. },
  362. selectList() {
  363. return this.rvenotList.filter(item => item.isChecked)
  364. }
  365. },
  366. watch: {
  367. paiXu(val) {
  368. if (val) {
  369. this.rvenotList = JSON.parse(JSON.stringify(this.noStatusListDx));
  370. } else {
  371. this.rvenotList = JSON.parse(JSON.stringify(this.noStatusList));
  372. }
  373. },
  374. isResult(val) {
  375. if (!val) {
  376. this.results = []; //提交的返回结果集合
  377. this.isResult = false;
  378. this.percentage = 0;
  379. this.resultList = []; //要发送数据的集合
  380. this.resultIndex = 0;
  381. this.getPackageDtail();
  382. }
  383. },
  384. active(val) {
  385. if (val == 0) this.title = '未录入'
  386. else this.title = '已录入'
  387. this.clearFilters();
  388. this.initFilterData();
  389. },
  390. selectOptions(val) {
  391. if (this.active == 0) this.rvenotList = this.filterFn(this.noStatusList);
  392. else this.rvenotList = this.filterFn(this.statusList);
  393. },
  394. peIds() {
  395. this.getPackageDtail();
  396. }
  397. },
  398. methods: {
  399. openFilterBox(type) {
  400. if (type == 1) this.active = 0
  401. else this.active = 1
  402. this.isFilterShow = true;
  403. },
  404. clearFilters() {
  405. this.selectOptions = [];
  406. this.select_user_name_list = [];
  407. this.select_index_name_list = [];
  408. this.select_index_standard_list = [];
  409. this.select_target_list = [];
  410. this.select_index_weight_list = [];
  411. if (this.active == 0) this.rvenotList = this.noStatusList;
  412. else this.rvenotList = this.statusList;
  413. },
  414. filterFn(data) {
  415. let result = [];
  416. let flag0 = 0
  417. let flag1 = 0
  418. let flag2 = 0
  419. let flag3 = 0
  420. let flag4 = 0
  421. // 筛选条件对象
  422. let filterCriteria = {
  423. // employee_name: [],
  424. // index_name: [],
  425. // index_standard: [],
  426. // target: [],
  427. // index_weight: []
  428. };
  429. // 按照用户名称过滤数据
  430. if (this.select_user_name_list && this.select_user_name_list.length > 0) {
  431. flag0 = true;
  432. filterCriteria.employee_name = this.select_user_name_list
  433. }
  434. // 按照指标名称过滤数据
  435. if (this.select_index_name_list && this.select_index_name_list.length > 0) {
  436. flag1 = true;
  437. filterCriteria.index_name = this.select_index_name_list
  438. }
  439. // 按照指标标准过滤数据
  440. if (this.select_index_standard_list && this.select_index_standard_list.length > 0) {
  441. flag2 = true;
  442. filterCriteria.index_standard = this.select_index_standard_list
  443. }
  444. // 按照目标值过滤数据
  445. if (this.select_target_list && this.select_target_list.length > 0) {
  446. flag3 = true;
  447. filterCriteria.target = this.select_target_list
  448. }
  449. // 按照权重过滤数据
  450. if (this.select_index_weight_list && this.select_index_weight_list.length > 0) {
  451. flag4 = true;
  452. filterCriteria.index_weight = this.select_index_weight_list
  453. }
  454. if(!flag0 && !flag1 && !flag2 && !flag3 && !flag4) result = data
  455. // 根据条件对象筛选数组
  456. result = data.filter(user => {
  457. return Object.keys(filterCriteria).every(key => {
  458. if (Array.isArray(filterCriteria[key])) {
  459. // 如果条件值是数组,则检查属性值是否包含在数组中
  460. return filterCriteria[key] && filterCriteria[key].includes(user[key]);
  461. }
  462. });
  463. });
  464. return result
  465. },
  466. chooseOptions(item, type) {
  467. // 所有的过滤条件
  468. if (!this.selectOptions.includes(item)) this.selectOptions.push(item);
  469. else {
  470. let select_option_index = 0
  471. this.selectOptions.forEach((select, index) => {
  472. if (select == item) {
  473. select_option_index = index
  474. }
  475. })
  476. this.selectOptions.splice(select_option_index, 1)
  477. }
  478. // 用户名称
  479. if (type == 'user_name') {
  480. if (!this.select_user_name_list.includes(item)) this.select_user_name_list.push(item);
  481. else {
  482. let select_index = 0
  483. this.select_user_name_list.forEach((select, index) => {
  484. if (select == item) {
  485. select_index = index
  486. }
  487. })
  488. this.select_user_name_list.splice(select_index, 1)
  489. }
  490. }
  491. // 指标名称
  492. if (type == 'index_name') {
  493. if (!this.select_index_name_list.includes(item)) this.select_index_name_list.push(item);
  494. else {
  495. let select_index = 0
  496. this.select_index_name_list.forEach((select, index) => {
  497. if (select == item) {
  498. select_index = index
  499. }
  500. })
  501. this.select_index_name_list.splice(select_index, 1)
  502. }
  503. }
  504. // 考核标准
  505. if (type == 'index_standard') {
  506. if (!this.select_index_standard_list.includes(item)) this.select_index_standard_list.push(item);
  507. else {
  508. let select_index = 0
  509. this.select_index_standard_list.forEach((select, index) => {
  510. if (select == item) {
  511. select_index = index
  512. }
  513. })
  514. this.select_index_standard_list.splice(select_index, 1)
  515. }
  516. }
  517. // 目标值
  518. if (type == 'target') {
  519. if (!this.select_target_list.includes(item)) this.select_target_list.push(item);
  520. else {
  521. let select_index = 0
  522. this.select_target_list.forEach((select, index) => {
  523. if (select == item) {
  524. select_index = index
  525. }
  526. })
  527. this.select_target_list.splice(select_index, 1)
  528. }
  529. }
  530. // 权重
  531. if (type == 'weight') {
  532. if (!this.select_index_weight_list.includes(item)) this.select_index_weight_list.push(item);
  533. else {
  534. let select_index = 0
  535. this.select_index_weight_list.forEach((select, index) => {
  536. if (select == item) {
  537. select_index = index
  538. }
  539. })
  540. this.select_index_weight_list.splice(select_index, 1)
  541. }
  542. }
  543. },
  544. toggleAllCheck() {
  545. this.rvenotList.forEach(item => {
  546. item.isChecked = this.isAllChecked;
  547. });
  548. },
  549. updateAllCheckStatus() {
  550. this.isAllChecked = this.rvenotList.every(item => item.isChecked);
  551. },
  552. cancelBatchOperation() {
  553. this.isBatchOperation = false
  554. },
  555. confirmBatchOperation() {
  556. if (this.batch_result_imgs && this.batch_result_imgs.length > 0) {
  557. this.rvenotList.forEach(item => {
  558. if (item.isChecked) {
  559. item.result_file.imgs = this.batch_result_imgs
  560. }
  561. })
  562. }
  563. if (this.batch_result_cache !== '' && this.batch_result_cache !== null) {
  564. this.rvenotList.forEach(item => {
  565. if (item.isChecked) {
  566. if (item.index_type == 1) item.result_cache = this.batch_result_cache
  567. }
  568. })
  569. }
  570. this.isBatchOperation = false
  571. },
  572. openBatchOperation(type) {
  573. if (this.selectList && this.selectList.length > 0) {
  574. this.showType = type
  575. this.isBatchOperation = true
  576. }
  577. },
  578. closeIsResult() {
  579. this.isResult = false;
  580. this.batch_result_cache = "";
  581. this.batch_result_imgs = [];
  582. this.selectOptions = [];
  583. this.select_user_name_list = [];
  584. this.select_index_name_list = [];
  585. this.select_index_standard_list = [];
  586. this.select_target_list = [];
  587. this.select_index_weight_list = [];
  588. },
  589. openText2(index) {
  590. this.$dialog.alert({
  591. message: '支持多条件筛选,批量录入结果值及图片',
  592. }).then(() => {});
  593. },
  594. openText(item) {
  595. let message = `${item.employee_name}的考核指标已评分,不可调整结果值;如需调整,请联系绩效管理员`;
  596. this.$dialog.alert({
  597. message: message,
  598. }).then(() => {});
  599. },
  600. confirmCreator(data) {
  601. let userName = '';
  602. this.userName = "全部人员"
  603. this.employee_list = [];
  604. if (data.employee !== null && data.employee.length != 0) {
  605. data.employee.forEach(item => {
  606. this.employee_list.push(item.id);
  607. userName += (item.name + ',')
  608. })
  609. this.userName = userName;
  610. }
  611. this.selected_data = data;
  612. this.selectUser = false;
  613. this.getPackageDtail();
  614. },
  615. downWgt(url, name) {
  616. let self = this
  617. if (!window.plus) {
  618. window.open(url, '_blank');
  619. return false
  620. }
  621. plus.downloader.createDownload(encodeURI(url), {
  622. filename: '_doc/update/'
  623. },
  624. function(d, status) {
  625. if (status == 200) {
  626. plus.runtime.openFile(d.filename, {}, (err) => {
  627. // console.log(JSON.stringify(err))
  628. });
  629. } else {
  630. self.$toast.clear()
  631. Notify({
  632. type: 'danger',
  633. message: '下载失败,请稍后重试',
  634. duration: 1000
  635. })
  636. }
  637. }
  638. ).start()
  639. },
  640. openImg(imgs, index) {
  641. let imgArr = imgs.map(item => {
  642. return item.url
  643. })
  644. ImagePreview({
  645. images: imgArr,
  646. startPosition: index,
  647. });
  648. },
  649. // 返回布尔值
  650. beforeRead(file) {
  651. const isJPG = /^image\/(jpeg|png|jpg)$/.test(file.type);
  652. // const isLt2M = file.size / 1024 / 1024 < 2;
  653. if (!isJPG) {
  654. this.$toast('上传图片只能是 jpeg|png|jpg 格式!');
  655. }
  656. // if (!isLt2M) {
  657. // this.$toast('上传图片大小不能超过 2MB!');
  658. // }
  659. return isJPG;
  660. },
  661. // 返回上一页
  662. routerBak() {
  663. this.$route_back();
  664. },
  665. rveno() {
  666. // 取消
  667. this.$route_back();
  668. },
  669. // 提交
  670. save(num) {
  671. let isLr = false;
  672. let parameterArr = [];
  673. let isPost = true;
  674. let str = '';
  675. this.selectList.some(item => {
  676. let images = []; //图片
  677. let result_info = [];
  678. if (item.result_file.imgs) {
  679. item.result_file.imgs.forEach(imgItem => {
  680. let name = imgItem.split('/');
  681. let obj = {
  682. name: name[name.length - 1],
  683. url: imgItem,
  684. }
  685. images.push(obj)
  686. })
  687. }
  688. item.result_file.images = images;
  689. result_info.push({
  690. dimension_key: item.dimension_id, //维度索引
  691. index_key: item.index_key, //指标索引
  692. index_id: item.index_id, //指标ID
  693. result_file: item.result_file
  694. });
  695. if (item.index_type == 1) {
  696. result_info[0].result = item.result_cache
  697. }
  698. let data = {
  699. id: item.pe_id, //个人考核包ID
  700. cache: num == 1 ? 1 : 0, // 是否暂存 1 是 0 否(提交)
  701. info: item,
  702. result_info: JSON.stringify(result_info),
  703. sub: num == 3 ? 0 : 1
  704. };
  705. if (num == 3) {
  706. if (item.isUpdate) {
  707. if (item.index_type == 1) {
  708. if (!item.result_cache) {
  709. isPost = false;
  710. str = item.index_name + ': 请输入结果值'
  711. return true
  712. }
  713. parameterArr.push(data);
  714. } else {
  715. if (item.result_file.append.length == 0 && item.result_file.images.length == 0) {
  716. isPost = false;
  717. str = item.index_name + ': 至少添加一份附件'
  718. return true
  719. }
  720. parameterArr.push(data);
  721. }
  722. }
  723. } else {
  724. if (item.index_type == 1 && item.result_cache !== null && item.result_cache !== '') {
  725. parameterArr.push(data);
  726. }
  727. if (item.index_type != 1 && (item.result_file.append.length > 0 || item.result_file.images.length >
  728. 0)) {
  729. parameterArr.push(data);
  730. }
  731. }
  732. });
  733. if (num == 3) {
  734. if (!isPost) {
  735. this.$toast(str);
  736. return false;
  737. }
  738. } else {
  739. if (parameterArr.length == 0) {
  740. this.$toast.fail('至少输入一项结果值或非量化指标添加一份附件');
  741. return false;
  742. }
  743. }
  744. this.webSocket(parameterArr);
  745. },
  746. webSocket(data) {
  747. this.resultList = data;
  748. this.resultIndex = 0;
  749. this.percentage = 0;
  750. this.results = [];
  751. this.isResult = true;
  752. this.opneWebSocket();
  753. },
  754. opneWebSocket() {
  755. let wsData = this.resultList;
  756. if (wsData[this.resultIndex]) {
  757. this.$axiosUser('post', '/api/pro/per/package/record_result', wsData[this.resultIndex]).then(res => {
  758. this.onmessageWS(wsData[this.resultIndex], true);
  759. }).catch(e => {
  760. let data = wsData[this.resultIndex];
  761. data.msg = e.data.msg;
  762. this.onmessageWS(data, false);
  763. });
  764. }
  765. },
  766. onmessageWS(data, isJx) {
  767. this.results.unshift(data);
  768. this.resultIndex++;
  769. if (!isJx) {
  770. return false
  771. }
  772. this.opneWebSocket();
  773. // 进度条
  774. let lng = this.resultList.length;
  775. this.percentage += Math.floor(100 / lng);
  776. if (lng == this.results.length) {
  777. this.percentage = 100;
  778. }
  779. },
  780. getPackageDtail() {
  781. this.$axiosUser('get', '/api/pro/per/package/result_job_list', {
  782. pe_ids: this.peIds,
  783. page: 1,
  784. page_size: 2000,
  785. employee_ids: JSON.stringify(this.employee_list)
  786. }).then(res => {
  787. let list = res.data.data.list;
  788. let pe_flows = res.data.data.pe_flows;
  789. let statusList = []; // 已录入指标
  790. let noStatusList = []; // 未录入指标
  791. list.forEach(item => {
  792. let imgs = [];
  793. if (item.result_file) {
  794. item.result_file.images.forEach(img => {
  795. imgs.push(img.url);
  796. })
  797. item.result_file.imgs = imgs;
  798. }
  799. item.isChecked = false;
  800. item.dept_list = this.$getEmployeeMapItem(item.employee_id).employee_detail.dept_list;
  801. let target = item.target ? item.target + ' ' + item.unit : null;
  802. item.dil = [{
  803. lab: '考核标准',
  804. prop: item.index_standard ? item.index_standard : null
  805. },
  806. {
  807. lab: '权重%',
  808. prop: item.index_weight ? item.index_weight : null
  809. },
  810. {
  811. lab: '备注',
  812. prop: item.index_remark ? item.index_remark : null
  813. },
  814. {
  815. lab: '目标值',
  816. prop: target
  817. },
  818. ];
  819. if (item.index_result_status == 1) {
  820. noStatusList.push(item);
  821. }
  822. if (item.index_result_status == 2) {
  823. item.isUpdate = true;
  824. pe_flows.forEach(e => {
  825. if (e.pe_id == item.pe_id) {
  826. item.isUpdate = this.returnIs(e.flow);
  827. }
  828. })
  829. statusList.push(item);
  830. }
  831. });
  832. this.statusList = statusList;
  833. this.noStatusList = noStatusList;
  834. if (this.active == 0) {
  835. this.rvenotList = JSON.parse(JSON.stringify(noStatusList));
  836. } else if (this.active == 1) {
  837. this.rvenotList = this.statusList;
  838. }
  839. let obj = {},
  840. arr = [];
  841. noStatusList.forEach(item => {
  842. if (obj[item.index_name]) {
  843. obj[item.index_name].push(item)
  844. } else {
  845. obj[item.index_name] = [item]
  846. }
  847. })
  848. for (let key in obj) {
  849. arr.push(obj[key]);
  850. }
  851. arr.sort(function(a, b) {
  852. return b.length - a.length
  853. });
  854. let noStatusListDx = [];
  855. arr.forEach(item => {
  856. noStatusListDx.push(...item);
  857. })
  858. this.noStatusListDx = noStatusListDx
  859. this.title1 = '未录入' + '(' + noStatusList.length + ')'
  860. this.title2 = '已录入' + '(' + statusList.length + ')'
  861. this.minFormactive[0].age = noStatusList.length; // 未
  862. this.minFormactive[1].age = statusList.length; // 已
  863. if (this.isUpdate) {
  864. this.active = 1
  865. }
  866. this.initFilterData();
  867. })
  868. .finally(() => {
  869. this.skeletonLoad = false;
  870. });
  871. },
  872. uniqueArray(arr) {
  873. return [...new Set(arr.map(item => JSON.stringify(item)))].map(item => JSON.parse(item));
  874. },
  875. initFilterData() {
  876. if(this.rvenotList && this.rvenotList.length > 0) {
  877. this.user_list = [];
  878. this.index_name_list = [];
  879. this.index_standard_list = [];
  880. this.target_list = [];
  881. this.index_weight_list = [];
  882. this.rvenotList.forEach(item => {
  883. this.user_list.push(item.employee_name);
  884. this.index_name_list.push(item.index_name);
  885. this.index_standard_list.push(item.index_standard);
  886. this.target_list.push(item.target);
  887. this.index_weight_list.push(item.index_weight);
  888. })
  889. this.user_list = this.uniqueArray(this.user_list);
  890. this.index_name_list = this.uniqueArray(this.index_name_list);
  891. this.index_standard_list = this.uniqueArray(this.index_standard_list);
  892. this.target_list = this.uniqueArray(this.target_list);
  893. this.index_weight_list = this.uniqueArray(this.index_weight_list);
  894. }
  895. },
  896. //判断评分节点是否有人评了分
  897. returnIs(list) {
  898. let is = true;
  899. list.forEach(item => {
  900. if (item.code == 'score_supervisor' || item.code == 'special_scorer') {
  901. item.target.forEach(e => {
  902. if (e.status == 2) {
  903. is = false;
  904. }
  905. })
  906. }
  907. })
  908. return is
  909. },
  910. },
  911. created() {
  912. if (this.peIds) {
  913. this.getPackageDtail();
  914. }
  915. },
  916. };
  917. </script>
  918. <style scoped lang="less">
  919. .userName {
  920. position: absolute;
  921. left: 0%;
  922. height: 50px;
  923. width: 100%;
  924. opacity: 0;
  925. }
  926. .results {
  927. border-bottom: 1px solid #f1f1f1;
  928. text-align: center;
  929. font-size: 0.24rem;
  930. }
  931. .results div {
  932. padding: 10px;
  933. }
  934. .line-feed {
  935. white-space: pre-wrap;
  936. }
  937. .all {
  938. flex: 1;
  939. position: relative !important;
  940. background-color: #f5f7fa;
  941. padding-bottom: 0.3rem;
  942. overflow-y: scroll;
  943. }
  944. header {
  945. width: 100%;
  946. height: 0.8rem;
  947. font-size: 0.3rem;
  948. z-index: 1;
  949. }
  950. .isIos {
  951. height: calc(100% - 3.6rem);
  952. }
  953. footer {
  954. width: 100%;
  955. background-color: #fff;
  956. border-top: 1px solid #e2e2e2;
  957. padding: 0.1rem;
  958. .footfoot {
  959. .footcol {
  960. text-align: center;
  961. }
  962. .footBut {
  963. display: flex;
  964. }
  965. }
  966. }
  967. .footcolButno {
  968. border: 1px solid #42a8ff;
  969. width: 1.4rem;
  970. height: 0.8rem;
  971. font-size: 0.28rem;
  972. color: #2f9eff;
  973. background-color: #ffffff;
  974. border-top-left-radius: 3px;
  975. border-bottom-left-radius: 3px;
  976. }
  977. .footcolButok {
  978. border: 0;
  979. width: 1.4rem;
  980. height: 0.8rem;
  981. font-size: 0.28rem;
  982. color: #fff;
  983. background-color: #42a8ff;
  984. border-top-right-radius: 3px;
  985. border-bottom-right-radius: 3px;
  986. }
  987. .tab-box {
  988. display: flex;
  989. align-items: center;
  990. justify-content: center;
  991. border-bottom: 0.01rem solid #f5f7fa;
  992. font-size: 0.28rem;
  993. .tab-item {
  994. flex: 1;
  995. height: 0.8rem;
  996. display: flex;
  997. align-items: center;
  998. justify-content: center;
  999. }
  1000. }
  1001. .popup-title {
  1002. width: 100%;
  1003. height: 0.6rem;
  1004. line-height: 0.6rem;
  1005. font-weight: 600;
  1006. font-size: 0.28rem;
  1007. margin-bottom: 10px;
  1008. text-align: center;
  1009. }
  1010. .filter-options-box {
  1011. width: 100%;
  1012. height: 8rem;
  1013. background-color: white;
  1014. position: absolute;
  1015. top: 1rem;
  1016. left: 0;
  1017. }
  1018. .batch-operate {
  1019. width: 100%;
  1020. background-color: white;
  1021. height: 1rem;
  1022. font-size: 0.28rem;
  1023. color: rgb(146, 146, 146);
  1024. display: flex;
  1025. align-items: center;
  1026. box-sizing: border-box;
  1027. }
  1028. .dropdown-item-title {
  1029. margin-bottom: 10px;
  1030. padding: 0 0 0 10px;
  1031. color: rgb(146, 146, 146);
  1032. font-size: 0.27rem;
  1033. }
  1034. .dropdown-item-content-list {
  1035. width: 100%;
  1036. display: flex;
  1037. flex-wrap: wrap;
  1038. padding: 0 10px;
  1039. margin-bottom: 10px;
  1040. box-sizing: border-box;
  1041. .dropdown-item-content {
  1042. flex: 0 0 calc((100% - 10px)/3);
  1043. height: 0.48rem;
  1044. line-height: 0.48rem;
  1045. background: #F5F7FA;
  1046. border-radius: 0.28rem;
  1047. color: rgb(146, 146, 146);
  1048. font-size: 0.27rem;
  1049. text-align: center;
  1050. margin: 0 5px 5px 0;
  1051. white-space: nowrap;
  1052. text-overflow: ellipsis;
  1053. overflow: hidden;
  1054. transition: 0.3s;
  1055. padding: 0 0.24rem;
  1056. box-sizing: border-box;
  1057. &.active {
  1058. background: #42a8ff;
  1059. color: white;
  1060. }
  1061. &:nth-child(3n) {
  1062. /* 去除第3n个的margin-right */
  1063. margin-right: 0;
  1064. }
  1065. }
  1066. }
  1067. .van-dropdown-item {
  1068. position: relative;
  1069. }
  1070. .btn-container {
  1071. width: 100%;
  1072. background-color: #fff;
  1073. display: flex;
  1074. justify-content: space-around;
  1075. border-top: 0.01rem solid #f5f7fa;
  1076. padding: 10px 0;
  1077. box-sizing: border-box;
  1078. z-index: 10;
  1079. position: absolute;
  1080. bottom: 0;
  1081. left: 0;
  1082. }
  1083. .disabled {
  1084. color: #bbb;
  1085. border-color: #bbb;
  1086. }
  1087. </style>