CauthList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <div class="CauthList_container" >
  3. <span style="fontSize:16px;">请选择新增试用的品种:</span>
  4. <!-- 权益合并的和FICC -->
  5. <ul class="menu_lists" style="marginBottom:40px;" v-if="autharr[0] && autharr[0].RaiMerge != 2">
  6. <li v-for="item in autharr" :key="item.ClassifyName" class="menu_item">
  7. <el-checkbox :indeterminate="item.isIndeterminate" v-model="item.checkAll" :disabled="item.defaultAuth.length" style="marginRight:30px;fontWeight:bold;minWidth:90px;" @change="handleCheckAll(item)">{{item.ClassifyName+':'}}</el-checkbox>
  8. <el-checkbox-group v-model="item.CheckList" @change="handleChecked(item)">
  9. <!-- PermissionType 为2 代表的是权益区分主客观的客观 1表示权益区分主客观的主观 0表示为不区分主客观的行业包括FICC的 -->
  10. <el-checkbox v-for="list in item.Items.filter(it => it.PermissionType!=2)" :label="list.ChartPermissionId" :key="list.ChartPermissionId" class="list_item" :disabled="item.defaultAuth.indexOf(list.ChartPermissionId)!=-1" >{{list.PermissionName}}</el-checkbox>
  11. </el-checkbox-group>
  12. </li>
  13. </ul>
  14. <!-- 权益拆分 -->
  15. <div v-if="autharr[0] && autharr[0].RaiMerge == 2" class="qy_menuList">
  16. <el-table :data="autharr[0].dataList" :show-header="false" border :span-method="spanMethod">
  17. <el-table-column align="center">
  18. <template slot-scope="scope">
  19. <span v-if="!scope.row.PermissionTypeName">
  20. {{scope.row.PermissionTypeName}}
  21. </span>
  22. <el-checkbox :label="scope.row.PermissionTypeName.value" v-else @change="handleCheckQY(scope.row.PermissionTypeName)"
  23. v-model="scope.row.PermissionTypeName.isCheckAll" :disabled="scope.row.PermissionTypeName.isDisabled"
  24. :indeterminate="scope.row.PermissionTypeName.isIndeterminate"></el-checkbox>
  25. </template>
  26. </el-table-column>
  27. <el-table-column align="center" v-if="autharr[0].existIds.includes(22)">
  28. <template slot-scope="scope">
  29. <el-checkbox v-if="scope.row.medicine.value === '医药'" :label="scope.row.medicine.value" :indeterminate="scope.row.medicine.isIndeterminate"
  30. @change="handleCheckQY(scope.row.medicine)" v-model="scope.row.medicine.isCheckAll" :disabled="scope.row.medicine.isDisabled"></el-checkbox>
  31. <el-checkbox-group v-model="qyCheckList" v-else >
  32. <el-checkbox :label="scope.row.medicine.value" class="checkbox-flex"
  33. :disabled="scope.row.medicine.isDisabled">{{''}}</el-checkbox>
  34. </el-checkbox-group>
  35. </template>
  36. </el-table-column>
  37. <el-table-column align="center" v-if="autharr[0].existIds.includes(21)">
  38. <template slot-scope="scope">
  39. <el-checkbox v-if="scope.row.consumption.value === '消费'" :label="scope.row.consumption.value" :indeterminate="scope.row.consumption.isIndeterminate"
  40. @change="handleCheckQY(scope.row.consumption)" v-model="scope.row.consumption.isCheckAll" :disabled="scope.row.consumption.isDisabled"></el-checkbox>
  41. <el-checkbox-group v-model="qyCheckList" v-else >
  42. <el-checkbox :label="scope.row.consumption.value" class="checkbox-flex"
  43. :disabled="scope.row.consumption.isDisabled">{{''}}</el-checkbox>
  44. </el-checkbox-group>
  45. </template>
  46. </el-table-column>
  47. <el-table-column align="center" v-if="autharr[0].existIds.includes(20)">
  48. <template slot-scope="scope">
  49. <el-checkbox v-if="scope.row.technology.value === '科技'" :label="scope.row.technology.value" :indeterminate="scope.row.technology.isIndeterminate"
  50. @change="handleCheckQY(scope.row.technology)" v-model="scope.row.technology.isCheckAll" :disabled="scope.row.technology.isDisabled"></el-checkbox>
  51. <el-checkbox-group v-model="qyCheckList" v-else >
  52. <el-checkbox :label="scope.row.technology.value" class="checkbox-flex"
  53. :disabled="scope.row.technology.isDisabled">{{''}}</el-checkbox>
  54. </el-checkbox-group>
  55. </template>
  56. </el-table-column>
  57. <el-table-column align="center" v-if="autharr[0].existIds.includes(19)">
  58. <template slot-scope="scope">
  59. <el-checkbox v-if="scope.row.smart.value === '智造'" :label="scope.row.smart.value" :indeterminate="scope.row.smart.isIndeterminate"
  60. @change="handleCheckQY(scope.row.smart)" v-model="scope.row.smart.isCheckAll" :disabled="scope.row.smart.isDisabled"></el-checkbox>
  61. <el-checkbox-group v-model="qyCheckList" v-else >
  62. <el-checkbox :label="scope.row.smart.value" class="checkbox-flex"
  63. :disabled="scope.row.smart.isDisabled">{{''}}</el-checkbox>
  64. </el-checkbox-group>
  65. </template>
  66. </el-table-column>
  67. <el-table-column align="center" v-if="autharr[0].existIds.includes(23)">
  68. <template slot-scope="scope">
  69. <span v-if="scope.row.strategy.value === '策略'">
  70. {{scope.row.strategy.value}}
  71. </span>
  72. <el-checkbox-group v-model="qyCheckList" v-else >
  73. <el-checkbox :label="scope.row.strategy.value" class="checkbox-flex"
  74. :disabled="scope.row.strategy.isDisabled">{{''}}</el-checkbox>
  75. </el-checkbox-group>
  76. </template>
  77. </el-table-column>
  78. <el-table-column align="center" v-if="autharr[0].existIds.includes(29)">
  79. <template slot-scope="scope">
  80. <span v-if="scope.row.experts.value === '专家'">
  81. {{scope.row.experts.value}}
  82. </span>
  83. <el-checkbox-group v-model="qyCheckList" v-else >
  84. <el-checkbox :label="scope.row.experts.value" class="checkbox-flex"
  85. :disabled="scope.row.experts.isDisabled">{{''}}</el-checkbox>
  86. </el-checkbox-group>
  87. </template>
  88. </el-table-column>
  89. <el-table-column align="center" v-if="autharr[0].existIds.includes(30)">
  90. <template slot-scope="scope">
  91. <span v-if="scope.row.roadshow.value === '路演服务'">
  92. {{scope.row.roadshow.value}}
  93. </span>
  94. <el-checkbox-group v-model="qyCheckList" v-else >
  95. <el-checkbox :label="scope.row.roadshow.value" class="checkbox-flex"
  96. :disabled="scope.row.roadshow.isDisabled">{{''}}</el-checkbox>
  97. </el-checkbox-group>
  98. </template>
  99. </el-table-column>
  100. <el-table-column align="center" v-if="autharr[0].existIds.includes(53)">
  101. <template slot-scope="scope">
  102. <span v-if="scope.row.fixedCrop.value === '固收'">
  103. {{scope.row.fixedCrop.value}}
  104. </span>
  105. <el-checkbox-group v-model="qyCheckList" v-else >
  106. <el-checkbox :label="scope.row.fixedCrop.value" class="checkbox-flex"
  107. :disabled="scope.row.fixedCrop.isDisabled">{{''}}</el-checkbox>
  108. </el-checkbox-group>
  109. </template>
  110. </el-table-column>
  111. <el-table-column align="center" v-if="autharr[0].existIds.includes(31)">
  112. <template slot-scope="scope">
  113. <span v-if="scope.row.choose.value === '研选订阅'">
  114. {{scope.row.choose.value}}
  115. </span>
  116. <el-checkbox-group v-model="qyCheckList" v-else >
  117. <el-checkbox :label="scope.row.choose.value" class="checkbox-flex"
  118. :disabled="scope.row.choose.isDisabled">{{''}}</el-checkbox>
  119. </el-checkbox-group>
  120. </template>
  121. </el-table-column>
  122. <el-table-column align="center" width="100px" v-if="autharr[0].existIds.includes(52)">
  123. <template slot-scope="scope">
  124. <span v-if="scope.row.points.value === '研选扣点包'">
  125. {{scope.row.points.value}}
  126. </span>
  127. <el-checkbox-group v-model="qyCheckList" v-else >
  128. <el-checkbox :label="scope.row.points.value" class="checkbox-flex"
  129. :disabled="scope.row.points.isDisabled">{{''}}</el-checkbox>
  130. </el-checkbox-group>
  131. </template>
  132. </el-table-column>
  133. </el-table>
  134. </div>
  135. <div style="display:flex;justify-content:center;margin:75px 0 26px;">
  136. <el-button type="primary" style="width:80px;marginRight:24px;" @click="addHandle">确定</el-button>
  137. <el-button style="width:80px;" @click="$emit('close')">取消</el-button>
  138. </div>
  139. </div>
  140. </template>
  141. <script>
  142. // 权益的ID:
  143. /**
  144. * 科技-主观(20)-客观(37)
  145. * 消费-主观(21)-客观(38)
  146. * 医药-主观(22)-客观(39)
  147. * 智造-主观(19)-客观(36)
  148. * 策略(23)
  149. * 专家(29)
  150. * 固收(53)
  151. * 调研(54)
  152. * 路演服务(30)
  153. * 研选订阅(31)
  154. * 研选扣点包(52)
  155. */
  156. import { customInterence } from '@/api/api.js'
  157. export default {
  158. name:'',
  159. props:{
  160. id: {
  161. type:Number,
  162. },
  163. autharr:{
  164. type:Array,
  165. default:[]
  166. }
  167. },
  168. watch: {
  169. autharr(value){
  170. if(value[0] && value[0].customType=='权益') this.qyCheckList = value[0].CheckList
  171. },
  172. qyCheckList(value){
  173. // 根据复选框选择的情况 改变医药、消费、科技、智造、主客观复选框的状态
  174. let arr = ['medicine','consumption','technology','smart']
  175. for (let i = 0; i < arr.length; i++) {
  176. let element = arr[i];
  177. let arrLength = value.filter(item => {
  178. return item == this.autharr[0].dataList[1][element].value || item == this.autharr[0].dataList[2][element].value
  179. }).length
  180. if(arrLength == 2){
  181. this.autharr[0].dataList[0][element].isCheckAll=true
  182. this.autharr[0].dataList[0][element].isIndeterminate=false
  183. }else if(arrLength == 1){
  184. this.autharr[0].dataList[0][element].isCheckAll=false
  185. this.autharr[0].dataList[0][element].isIndeterminate=true
  186. }else{
  187. this.autharr[0].dataList[0][element].isCheckAll=false
  188. this.autharr[0].dataList[0][element].isIndeterminate=false
  189. }
  190. }
  191. for (let i = 0; i < 2; i++) {
  192. let arrLength = value.filter(item => {
  193. return item == this.autharr[0].dataList[i+1].medicine.value || item == this.autharr[0].dataList[i+1].consumption.value ||
  194. item == this.autharr[0].dataList[i+1].technology.value || item == this.autharr[0].dataList[i+1].smart.value
  195. }).length
  196. if(arrLength == 4){
  197. this.autharr[0].dataList[i+1].PermissionTypeName.isCheckAll=true
  198. this.autharr[0].dataList[i+1].PermissionTypeName.isIndeterminate=false
  199. }else if(arrLength == 0){
  200. this.autharr[0].dataList[i+1].PermissionTypeName.isCheckAll=false
  201. this.autharr[0].dataList[i+1].PermissionTypeName.isIndeterminate=false
  202. }else{
  203. this.autharr[0].dataList[i+1].PermissionTypeName.isCheckAll=false
  204. this.autharr[0].dataList[i+1].PermissionTypeName.isIndeterminate=true
  205. }
  206. }
  207. }
  208. },
  209. data () {
  210. return {
  211. qyCheckList:[],
  212. permissionIds:{
  213. 19:36, //智造
  214. 20:37, //科技
  215. 21:38, //消费
  216. 22:39, //医药
  217. } //主观:客观
  218. };
  219. },
  220. methods: {
  221. /* 确认新增 */
  222. addHandle() {
  223. let checkArr = [];
  224. // ficc和权益合并
  225. if(this.autharr[0] && this.autharr[0].RaiMerge != 2){
  226. this.autharr.forEach(item => {
  227. if(item.CheckList.length) {
  228. checkArr.push(item.CheckList)
  229. }
  230. })
  231. }else{
  232. // 权益拆分
  233. checkArr = this.qyCheckList
  234. }
  235. customInterence.addTryout({
  236. CompanyId:this.id,
  237. ChartPermissionId:checkArr.join()
  238. }).then(res => {
  239. if(res.Ret===200) {
  240. this.$message.success(res.Msg)
  241. this.$emit('addOver')
  242. }
  243. })
  244. },
  245. /* 选择全选或取消全选 */
  246. handleCheckAll(item) {
  247. // 取到所有的子菜单id
  248. let ids = item.Items.map(item =>{
  249. return item.ChartPermissionId
  250. })
  251. item.CheckList = item.checkAll ? ids : [];
  252. item.isIndeterminate = false;
  253. },
  254. /* 复选框組选中时 */
  255. handleChecked(item) {
  256. if(item.RaiMerge==1){
  257. // 权益合并
  258. item.Items.map((it,i)=>{
  259. if(item.CheckList.includes(it.ChartPermissionId) && it.PermissionType==1){
  260. // 主观被选上,将客观的ID也push上
  261. item.CheckList.push(this.permissionIds[it.ChartPermissionId])
  262. }else if(!item.CheckList.includes(it.ChartPermissionId) && it.PermissionType==1){
  263. if(item.CheckList.indexOf(this.permissionIds[it.ChartPermissionId])!=-1){
  264. item.CheckList.splice(item.CheckList.indexOf(this.permissionIds[it.ChartPermissionId]),1)
  265. }
  266. }
  267. })
  268. }
  269. item.CheckList = [...new Set(item.CheckList)]
  270. let len = item.Items.filter(it => item.CheckList.includes(it.ChartPermissionId)).length
  271. item.checkAll = len === item.Items.length;
  272. item.isIndeterminate = len > 0 && len < item.Items.length;
  273. },
  274. // 权益选择套餐方法
  275. // 合并单元格
  276. spanMethod({ row, rowIndex, column,columnIndex }){
  277. if([5,6,7,8,9].includes(columnIndex)){
  278. if(rowIndex == 1){
  279. return [2,1]
  280. }else if(rowIndex == 2){
  281. return [0,0]
  282. }
  283. }
  284. },
  285. handleCheckQY(item){
  286. let arr = ['medicine','consumption','technology','smart']
  287. let arrCh = ['医药','消费','科技','智造']
  288. // 全选
  289. if(item.isCheckAll){
  290. if(item.value == '主观'){
  291. for (let i = 0; i < arr.length; i++) {
  292. const element = arr[i];
  293. this.qyCheckList.push(this.autharr[0].dataList[1][element].value)
  294. this.qyCheckList = [...new Set(this.qyCheckList)]
  295. }
  296. }else if(item.value == '客观'){
  297. for (let i = 0; i < arr.length; i++) {
  298. const element = arr[i];
  299. this.qyCheckList.push(this.autharr[0].dataList[2][element].value)
  300. this.qyCheckList = [...new Set(this.qyCheckList)]
  301. }
  302. }else{
  303. for (let i = 0; i < arr.length; i++) {
  304. const element = arr[i];
  305. const elementCh = arrCh[i];
  306. if(item.value == elementCh){
  307. this.qyCheckList.push(this.autharr[0].dataList[1][element].value,this.autharr[0].dataList[2][element].value)
  308. this.qyCheckList = [...new Set(this.qyCheckList)]
  309. break
  310. }
  311. }
  312. }
  313. }else{ //全部不选
  314. if(item.value == '主观'){
  315. for (let i = 0; i < arr.length; i++) {
  316. const element = arr[i];
  317. // 需要删除的索引
  318. let deleteIndex = this.qyCheckList.findIndex(id=> {
  319. return id == this.autharr[0].dataList[1][element].value && (!this.autharr[0].dataList[2][element].isDisabled)
  320. });
  321. if(deleteIndex!=-1) this.qyCheckList.splice(deleteIndex,1)
  322. }
  323. }else if(item.value == '客观'){
  324. for (let i = 0; i < arr.length; i++) {
  325. const element = arr[i];
  326. let deleteIndex = this.qyCheckList.findIndex(id=> {
  327. return id == this.autharr[0].dataList[2][element].value && (!this.autharr[0].dataList[2][element].isDisabled)
  328. });
  329. if(deleteIndex!=-1) this.qyCheckList.splice(deleteIndex,1)
  330. }
  331. }else{
  332. for (let i = 0; i < arr.length; i++) {
  333. const element = arr[i];
  334. const elementCh = arrCh[i];
  335. if(item.value == elementCh){
  336. for (let i = 0; i < 2; i++) {
  337. let deleteIndex = this.qyCheckList.findIndex(id=> {
  338. return id == this.autharr[0].dataList[i+1][element].value && (!this.autharr[0].dataList[i+1][element].isDisabled)
  339. });
  340. if(deleteIndex!=-1) this.qyCheckList.splice(deleteIndex,1)
  341. }
  342. break
  343. }
  344. }
  345. }
  346. }
  347. }
  348. },
  349. created() {},
  350. mounted() {},
  351. }
  352. </script>
  353. <style lang='scss' scoped>
  354. .CauthList_container {
  355. .menu_lists {
  356. padding: 30px 0;
  357. border-radius: 4px;
  358. .menu_item {
  359. display: flex;
  360. // align-items: center;
  361. margin-bottom: 30px;
  362. &:last-child {
  363. margin-bottom: 0;
  364. }
  365. .list_item {
  366. margin-right: 20px;
  367. margin-bottom: 10px;
  368. &:last-child {
  369. margin-right: 0;
  370. }
  371. }
  372. }
  373. }
  374. .qy_menuList{
  375. margin-top:45px;
  376. .checkbox-flex{
  377. display: flex;
  378. flex-direction: column;
  379. align-items: center;
  380. justify-content: center;
  381. }
  382. }
  383. }
  384. </style>