Affirm - 副本.vue 11 KB

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