Examine.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <div class="all">
  3. <div class="flex-box-ce" style="margin-left: 10px;margin-top: 30px;">
  4. <span>审批:</span>
  5. <el-switch v-model="enable" :active-value="1" :inactive-value="0"></el-switch>
  6. </div>
  7. <div class="flex-box-ce" v-show="enable == 1" style="position: relative;background-color: #F5F9FF;padding:20px;border-radius: 5px;margin-top: 20px;max-width: 1000px;">
  8. <div class="flex-box-v flex-center-center flex-d-wrap flow" :class="[isActive == index ? 'isActive' : '']" v-for="(item, index) in review" :key="index">
  9. <div @click="activeFlow(index)" class="flex-box-v flex-center-center flow-item">
  10. <div class="fontColorB font-flex-word" v-show="item.type == 1" style="width: 120px;">{{ options[item.manager_level - 1].label }}</div>
  11. <div class="fontColorB font-flex-word" v-show="item.type == 2" style="width: 120px;">
  12. <span v-if="item.employeeList.length > 0">{{ item.employeeList[0].name }}等({{ item.employeeList.length }})人</span>
  13. <span v-else>未指定人员</span>
  14. </div>
  15. <div class="fontColorB font-flex-word" v-show="item.type == 3" style="width: 120px;">被考核人</div>
  16. <i class="el-icon-error" style="font-size: 18px;color: #C0C4CC;" @click="deleteFlow(index)"></i>
  17. </div>
  18. <div class="flow-index">
  19. <span></span>
  20. <div class="dian"></div>
  21. <i class="el-icon-arrow-up jt-top" v-if="isActive == index"></i>
  22. <div class="add-flow" v-if="review.length == index + 1">
  23. <i class="el-icon-circle-plus-outline blue" style="cursor: pointer;" v-if="review.length!=6" @click="addFlow()"></i>
  24. <i class="el-icon-video-pause fontColorF" v-else></i>
  25. </div>
  26. </div>
  27. <div class="flow-box" v-show="isActive == index">
  28. <el-form label-width="80px">
  29. <el-form-item>
  30. <div class="form-titem">审批人:</div>
  31. <el-radio-group v-model="item.type">
  32. <el-radio :label="1">部门主管(指定一级)
  33. <el-tooltip class="item" effect="dark" content="指定某一级主管" placement="top-start">
  34. <i class="fontColorF el-icon-warning"></i>
  35. </el-tooltip>
  36. </el-radio>
  37. <el-radio :label="2">指定成员</el-radio>
  38. <el-radio :label="3">被考核人
  39. <el-tooltip class="item" effect="dark" content="被考核对象,即员工本人" placement="top-start">
  40. <i class="fontColorF el-icon-warning"></i>
  41. </el-tooltip>
  42. </el-radio>
  43. </el-radio-group>
  44. <div class="flex-box-ce" style="margin-top: 10px;" v-show="item.type == 1">
  45. <span>被考核人的</span>
  46. <el-select v-model="item.manager_level" placeholder="请选择级别" style="margin: 0 10px;">
  47. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
  48. </el-select>
  49. <el-tooltip class="item" effect="dark" content="找不到确认人时,由上级管理员替代" placement="top-start"><i class="fontColorF el-icon-warning"></i></el-tooltip>
  50. </div>
  51. <div class="border flex-box-ce" style="position: relative;" v-show="item.type == 2">
  52. <div class="fontColorF flex-1" v-if="item.employeeList.length == 0">请选择指定人员</div>
  53. <div v-else style="width: 180px;" class="font-flex-word">
  54. <span v-for="(j, index2) in item.employeeList" :key="index2">
  55. <i v-if="index2 != 0">,</i>
  56. {{ j.name }}
  57. </span>
  58. </div>
  59. <span v-if="item.employeeList.length > 0" class="blue">{{ item.employeeList.length }}人</span>
  60. <i class="el-icon-arrow-down icon-right" v-else></i>
  61. <div @click="setEmployeeList(item, index)" class="inputDc"></div>
  62. </div>
  63. </el-form-item>
  64. <el-form-item v-if="item.type!=3">
  65. <div class="form-titem">审批人多人时:</div>
  66. <el-radio-group v-model="item.multi_executor">
  67. <el-radio :label="1">依次确认</el-radio>
  68. <el-radio :label="2">任一人审批</el-radio>
  69. <el-radio :label="3">均需审批</el-radio>
  70. </el-radio-group>
  71. </el-form-item>
  72. <el-form-item>
  73. <div class="form-titem">允许审批人:</div>
  74. <el-checkbox v-model="item.transfer">转交</el-checkbox>
  75. <el-checkbox v-model="item.refuse">驳回</el-checkbox>
  76. </el-form-item>
  77. </el-form>
  78. </div>
  79. </div>
  80. </div>
  81. <!-- 选择子管理员 -->
  82. <EmployeeSelector :selected="selected" :is_filtration_creator="false" :visible.sync="setAdministrator" @confirm="confirmAdministrator" />
  83. </div>
  84. </template>
  85. <script>
  86. import EmployeeSelector from '@/components/public/EmployeeSelector';
  87. import BrawerBox from '@/components/public/BrawerBox';
  88. export default {
  89. components: { EmployeeSelector, BrawerBox },
  90. name: 'Examine',
  91. props:{
  92. data:{
  93. type:Object,
  94. default:{}
  95. }
  96. },
  97. data() {
  98. return {
  99. loading: false,
  100. isActive: '0',
  101. selected: { employee: [], dept: [] }, //执行者列表
  102. setAdministrator: false,
  103. flowIndex: 0,
  104. enable: 0, //是否启用 1-启用 0-禁用
  105. unique: 1, //评分人去重 1-是 0-否
  106. review: [//审批节点
  107. {
  108. type: 1, //用户种类 1-主管 2-指定成员 3-被考核人 4-角色
  109. action: [ //允许审批人动作
  110. 'transfer', //转交
  111. 'refuse' //驳回
  112. ],
  113. transfer: true, //转交
  114. refuse: true, //驳回
  115. manager_level: 1, //主管级别(只有用户种类为主管有效)
  116. supervisor_confirm: 1, //找不到确认人时是否由上级主管代替(只有评分人类型为主管时有效) 1-是 0-否
  117. is_supervisor_confirm: true,
  118. multi_executor: 3, //审批人多人时选项 1-依次确认 2-任一人审批 3-均需审批(只有用户种类为主管、指定成员、角色时有效)
  119. employee_ids: [], //用户id列表(只有用户种类为指定成员时有效)
  120. employeeList:[],
  121. role_name: 'creator' //角色名(只有用户种类为角色时有效)
  122. }
  123. ],
  124. options: [
  125. {
  126. value: 1,
  127. label: '直属部门主管'
  128. },
  129. {
  130. value: 2,
  131. label: '二级部门主管'
  132. },
  133. {
  134. value: 3,
  135. label: '三级部门主管'
  136. },
  137. {
  138. value: 4,
  139. label: '四级部门主管'
  140. },
  141. {
  142. value: 5,
  143. label: '五级部门主管'
  144. },
  145. {
  146. value: 6,
  147. label: '六级部门主管'
  148. }
  149. ]
  150. };
  151. },
  152. watch: {
  153. data(val){
  154. if(val.enable){
  155. this.recoverData();
  156. }
  157. },
  158. enable(val) {
  159. if(val==1){
  160. this.$emit('setIs','',5)
  161. }else{
  162. this.$emit('setIs','已禁用',5)
  163. }
  164. }
  165. },
  166. created() {},
  167. mounted() {},
  168. methods: {
  169. recoverData(){
  170. let data=this.data;
  171. let employeeMap=this.$getEmployeeList()
  172. this.enable=data.enable;
  173. this.unique=data.unique;
  174. data.reviewer.forEach(item=>{
  175. item.is_supervisor_confirm=item.supervisor_confirm==1? true:false;
  176. item.manager_level=item.manager_level==0? 1:item.manager_level
  177. item.employeeList=item.employee_ids.map(item=>{
  178. return employeeMap[item]
  179. })
  180. item.transfer=item.action.indexOf('transfer')>=0? true:false
  181. item.refuse=item.action.indexOf('refuse')>=0? true:false
  182. })
  183. this.review=JSON.parse(JSON.stringify(data.reviewer))
  184. },
  185. activeFlow(index) {
  186. this.isActive = index;
  187. },
  188. //删除主管
  189. deleteFlow(index) {
  190. this.$confirm('确定删除', '提示', {
  191. confirmButtonText: '确定',
  192. cancelButtonText: '取消',
  193. type: 'warning'
  194. })
  195. .then(() => {
  196. if(this.review.length==1){
  197. this.$message.error('至少保留一个');
  198. return false
  199. }
  200. this.review.splice(index, 1);
  201. this.isActive = this.review.length - 1;
  202. })
  203. .catch(() => {});
  204. },
  205. //添加主管
  206. addFlow() {
  207. var leth = this.review.length + 1;
  208. var review ={
  209. type: 1, //用户种类 1-主管 2-指定成员 3-被考核人 4-角色
  210. action: [ //允许审批人动作
  211. 'transfer', //转交
  212. 'refuse' //驳回
  213. ],
  214. transfer: true, //转交
  215. refuse: true, //驳回
  216. manager_level: leth, //主管级别(只有用户种类为主管有效)
  217. supervisor_confirm: 1, //找不到确认人时是否由上级主管代替(只有评分人类型为主管时有效) 1-是 0-否
  218. is_supervisor_confirm: true,
  219. multi_executor: 1, //审批人多人时选项 1-依次确认 2-任一人审批 3-均需审批(只有用户种类为主管、指定成员、角色时有效)
  220. employee_ids: [], //用户id列表(只有用户种类为指定成员时有效)
  221. employeeList:[],
  222. role_name: 'creator' //角色名(只有用户种类为角色时有效)
  223. };
  224. this.review.push(review);
  225. },
  226. setEmployeeList(item, index) {
  227. this.flowIndex = index;
  228. this.selected.employee = item.employeeList;
  229. this.setAdministrator = true;
  230. },
  231. confirmAdministrator(e) {
  232. this.review[this.flowIndex].employeeList = e.employee.length > 0 ? e.employee : [];
  233. },
  234. submitForm() {}
  235. }
  236. };
  237. </script>
  238. <style scoped="scoped">
  239. .border {
  240. -webkit-appearance: none;
  241. background-color: #fff;
  242. background-image: none;
  243. border-radius: 4px;
  244. border: 1px solid #dcdfe6;
  245. -webkit-box-sizing: border-box;
  246. box-sizing: border-box;
  247. color: #606266;
  248. font-size: inherit;
  249. height: auto;
  250. outline: 0;
  251. padding: 0 15px;
  252. width: 250px;
  253. position: relative;
  254. }
  255. .all {
  256. font-size: 14px;
  257. }
  258. .nweTitle {
  259. margin: 30px 0;
  260. padding-left: 10px;
  261. border-left: 3px solid #409eff;
  262. }
  263. .flow {
  264. margin-right: 30px;
  265. cursor: pointer;
  266. }
  267. .flow-item {
  268. border-radius: 3px;
  269. width: 120px;
  270. /* height: 50px; */
  271. position: relative;
  272. /* margin-top: 30px; */
  273. box-sizing: border-box;
  274. text-align: center;
  275. /* border: 1px solid #f4f6f9; */
  276. }
  277. .flow-item .el-icon-error {
  278. position: absolute;
  279. right: 0px;
  280. top: -14px;
  281. display: none;
  282. }
  283. .flow-item:hover {
  284. /* background-color: #e7f5fe; */
  285. font-weight: 600;
  286. font-size: 16px;
  287. }
  288. .flow-item:hover .el-icon-error {
  289. display: block !important;
  290. }
  291. .flow-item .el-icon-error:hover {
  292. color: #f56c6c !important;
  293. }
  294. .flow-item .fontColorT {
  295. margin-top: 10px;
  296. }
  297. .flow-index {
  298. width: 120px;
  299. text-align: center;
  300. position: relative;
  301. margin-top: 10px;
  302. }
  303. .flow-index span {
  304. width: 18px;
  305. height: 18px;
  306. border-radius: 50%;
  307. border: 1px solid #ccc;
  308. color: #909399;
  309. display: inline-block;
  310. line-height: 22px;
  311. font-size: 12px;
  312. position: relative;
  313. }
  314. .flow-index span::after{
  315. width: 10px;
  316. height: 10px;
  317. content: " ";
  318. top: 50%;
  319. left: 50%;
  320. margin-top: -5px;
  321. margin-left: -5px;
  322. background-color: #409eff;
  323. border-radius: 50%;
  324. position: absolute;
  325. }
  326. .add-flow {
  327. position: absolute;
  328. right: -100px;
  329. z-index: 2;
  330. top: 0px;
  331. }
  332. .add-flow i {
  333. font-size: 26px;
  334. }
  335. .isActive .flow-item {
  336. /* background-color: #ecf5ff; */
  337. font-weight: 600;
  338. font-size: 16px;
  339. color: #409eff !important;
  340. }
  341. .isActive .flow-item .fontColorB,
  342. .isActive .fontColorT {
  343. color: #409eff !important;
  344. }
  345. .isActive .flow-index span {
  346. border: 1px solid #409eff !important;
  347. color: #409eff !important;
  348. }
  349. .isActive .el-icon-error {
  350. display: block;
  351. }
  352. .dian {
  353. position: absolute;
  354. height: 1px;
  355. border-top: 1px dashed #ccc;
  356. width: 127px;
  357. top: 40%;
  358. left: 71px;
  359. }
  360. .flow-box {
  361. /* border: 1px dashed #409eff; */
  362. border-radius: 3px;
  363. padding: 20px;
  364. width: 1000px;
  365. position: absolute;
  366. left: 0;
  367. right: 0;
  368. top: 120px;
  369. background-color: rgb(245, 249, 255);;
  370. z-index: 2;
  371. }
  372. .jt-top {
  373. position: absolute;
  374. color: #409eff;
  375. font-size: 18px;
  376. font-weight: 600;
  377. top: 50px;
  378. left: 50px;
  379. background-color: #fff;
  380. z-index: 3;
  381. }
  382. .inputDc {
  383. position: absolute;
  384. top: 0;
  385. width: 250px;
  386. left: 0;
  387. bottom: 0;
  388. z-index: 9;
  389. }
  390. </style>