correlation.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. <template>
  2. <div class="correlationbox">
  3. <div class="nowuser">
  4. <p class="correlationbox-title">当前操作用户:</p>
  5. <div class="userlist">
  6. <div class="photobox">
  7. <PersonalPhoto style="cursor: pointer;" :name="nowUsers.name" width="40px" height="40px" fontSize="12px" class="pigpicture" v-if="!nowUsers.picture"></PersonalPhoto>
  8. <el-image style="width: 50px; height: 50px;border-radius:50%" :src="nowUsers.picture" fit="fill" v-else></el-image>
  9. </div>
  10. <div class="userlist-name">{{nowUsers.name}}({{nowUsers.mobile}})</div>
  11. </div>
  12. </div>
  13. <div class="school-list-header">
  14. <div class="correlationbox-titles">目前用户所关联学校:<span>关联数量:<span class="correlationbox-num">{{nowUsers.handleSchools.length}}</span></span></div>
  15. <div class="correlationbox-btn">
  16. <el-button type="primary" size="small" v-if="removeBatchschool.length >0 && PowerShow && adminOrleader===false" @click="multipeRemove"> 移除选中学校</el-button>
  17. <el-button type="primary" size="small" v-else-if="removeBatchschool.length ===0 && PowerShow && adminOrleader===true" disabled>移除选中学校</el-button>
  18. </div>
  19. </div>
  20. <!-- <p class="correlationbox-title">目前用户所关联学校:</p>
  21. <div class="correlationbox-btn">
  22. <el-button type="primary" size="small" v-if="multipleSchool.length >0 && PowerShow" @click="multipleCorrelation">关联选中学校</el-button>
  23. <el-button type="primary" size="small" v-else-if="multipleSchool.length ===0 && PowerShow" disabled>关联选中学校</el-button>
  24. </div> -->
  25. <div class="possessbox">
  26. <el-table :data="nowUsers.handleSchools" style="width: 100%" height="20vh" size="small" @selection-change="removeBatch" v-loading="loadingData.possess" element-loading-text="数据加载中..." empty-text='暂无相关数据'>
  27. <el-table-column type="selection" v-if="PowerShow" />
  28. <el-table-column label="校徽" align="center">
  29. <template #default="scope">
  30. <el-image style="width: 40px; height: 40px;" :src="scope.row.picture" fit="fill" v-if="scope.row.picture"></el-image>
  31. <div class="notimage" v-else>暂无<br />图片</div>
  32. </template>
  33. </el-table-column>
  34. <el-table-column prop="name" label="名称" align="center" />
  35. <el-table-column prop="id" label="学校简码" align="center" />
  36. <!-- <el-table-column prop="name" label="版本" />
  37. <el-table-column prop="name" label="目前顾问" /> -->
  38. <el-table-column align="center">
  39. <template #header>
  40. <el-select v-model="areaList.existValue" placeholder="Select" size="small" @change="correlaSchool">
  41. <el-option v-for="item in areaList.data" :key="item.value" :label="item.label" :value="item.value" />
  42. </el-select>
  43. </template>
  44. <template #default="scope">
  45. <!-- <span class="areaitem-name">{{scope.row.areaName}}</span><span class="areaitem-insti">({{scope.row.institution}})</span> -->
  46. <span class="areaitem-name">{{scope.row.areaName}}</span>
  47. <span class="areaitem-insti" v-if="scope.row.institution">({{scope.row.institution}})</span>
  48. <span class="areaitem-insti" v-else>{{scope.row.institution}}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column fixed="right" label="操作" width='80' align="center" v-if="PowerShow && adminOrleader===false">
  52. <template #default="scope">
  53. <el-button type="text" size="small" @click="removeSchool(scope.row,scope.$index)">取消关联</el-button>
  54. </template>
  55. </el-table-column>
  56. </el-table>
  57. </div>
  58. <!-- <div class="nodata" v-else-if="nowUsers.handleSchools.length ===0">
  59. <div>暂无关联学校</div>
  60. </div> -->
  61. <div class="school-list">
  62. <div class="school-list-header">
  63. <div class="correlationbox-titles">学校列表:</div>
  64. <div class="correlationbox-search">
  65. <el-input v-model="schoolSearch" placeholder="输入学校名称/简码 搜索" :prefix-icon="Search" size="small" clearable />
  66. </div>
  67. <div class="correlationbox-btn">
  68. <el-button type="primary" size="small" v-if="multipleSchool.length >0 && PowerShow && adminOrleader===false" @click="multipleCorrelation">关联选中学校</el-button>
  69. <el-button type="primary" size="small" v-else-if="multipleSchool.length ===0 && PowerShow && adminOrleader===true" disabled>关联选中学校</el-button>
  70. </div>
  71. </div>
  72. <div class="listbox">
  73. <el-table :data="tableData" id="schoolList" style="width: 100%" height="45vh" size="small" @selection-change="checkSchool" empty-text='暂无相关搜索数据' v-loading="loadingData.list" element-loading-text="数据加载中...">
  74. <el-table-column type="selection" v-if="PowerShow" />
  75. <el-table-column label="校徽" align="center">
  76. <template #default="scope">
  77. <el-image style="width: 40px; height: 40px;" :src="scope.row.picture" fit="fill" v-if="scope.row.picture"></el-image>
  78. <div class="notimage" v-else>暂无<br />图片</div>
  79. </template>
  80. </el-table-column>
  81. <el-table-column prop="name" label="名称" align="center" />
  82. <el-table-column prop="id" label="学校简码" align="center" />
  83. <!-- <el-table-column prop="name" label="版本" /> -->
  84. <el-table-column prop="assisName" label="目前顾问" align="center" />
  85. <el-table-column align="center">
  86. <template #header>
  87. <el-select v-model="areaList.value" placeholder="Select" size="small" @change="getAreaschool">
  88. <el-option v-for="item in areaList.data" :key="item.value" :label="item.label" :value="item.value" />
  89. </el-select>
  90. </template>
  91. <template #default="scope">
  92. <span class="areaitem-name">{{scope.row.areaName}}</span>
  93. <span class="areaitem-insti" v-if="scope.row.institution">({{scope.row.institution}})</span>
  94. <span class="areaitem-insti" v-else>{{scope.row.institution}}</span>
  95. </template>
  96. </el-table-column>
  97. <el-table-column fixed="right" label="操作" width='80' align="center" v-if="PowerShow && adminOrleader===false">
  98. <template #default="scope">
  99. <el-button type="text" size="small" @click="correlation(scope.row,tableData)">关联学校</el-button>
  100. </template>
  101. </el-table-column>
  102. </el-table>
  103. </div>
  104. </div>
  105. </div>
  106. </template>
  107. <script>
  108. import { ref, getCurrentInstance, watch, onMounted } from 'vue'
  109. import { ElMessage, ElLoading, ElMessageBox } from 'element-plus'
  110. import { Search } from '@element-plus/icons'
  111. import { useStore } from 'vuex'
  112. export default {
  113. props: {
  114. userdata: {
  115. type: Object,
  116. default: () => { },
  117. },
  118. areadata: {
  119. type: Object,
  120. default: () => [],
  121. }
  122. },
  123. components: {
  124. Search
  125. },
  126. setup (props, context) {
  127. let { proxy } = getCurrentInstance()
  128. const store = useStore()
  129. let PowerShow = proxy.$access.identifyPosition(JSON.parse(localStorage.getItem('id_token')))
  130. const tableDatas = ref([])
  131. let tableData = ref([])
  132. let nowUsers = ref()
  133. let multipleSchool = ref([])
  134. let removeBatchschool = ref([])
  135. let schoolSearch = ref('')
  136. let original = ref([])
  137. let timer = ref('')
  138. let nextpageToken = ref('')
  139. let scrollHeight = ref('init')
  140. let loadingData = ref({
  141. possess: true,
  142. list: false,
  143. })
  144. let areaList = ref({
  145. existValue: 'all',
  146. value: 'all',
  147. data: [
  148. { value: 'all', label: '全部', situate: 'all' },
  149. ]
  150. })
  151. //关联筛选原始data
  152. let correlaData = ref([])
  153. let adminOrleader = ref(false)
  154. onMounted(() => {
  155. //监听表格滚动事件
  156. // let table = mutipleTable.value._value.layout.table.refs.bodyWrapper;
  157. let table = document.getElementById('schoolList')
  158. console.log(table, '查看是否获取到')
  159. table.addEventListener("scroll", (res) => { loadmore(res) }, true);
  160. })
  161. const loadmore = (res) => {
  162. // console.log(res, res.target.scrollHeight, res.target.scrollTop + res.target.clientHeight, '实际高度')
  163. if (res.target.scrollTop && ((res.target.scrollHeight - 10) <= (res.target.scrollTop + res.target.clientHeight))) {
  164. scrollHeight.value = (res.target.scrollHeight - 10) - (res.target.scrollTop + res.target.clientHeight)
  165. console.log(scrollHeight.value, '值')
  166. }
  167. }
  168. function getSchoolList (value, state) {
  169. console.log(value, nextpageToken.value, '触发下一页')
  170. if ((nextpageToken.value === null) && state !== 'restart') {
  171. ElMessage.success('已经到最底了')
  172. return
  173. }
  174. loadingData.value.list = true
  175. let data = value ? { contToken: value } : {}
  176. proxy.$api
  177. .getSchooldata(data)
  178. .then((res) => {
  179. console.log(res, '学校的返回列表')
  180. // res.state === 200 ? (tableData.value = res.schoolAssists) : ''
  181. if (res.state === 200) {
  182. for (let i in res.schoolAssists) {
  183. if (res.schoolAssists[i].assists) {
  184. res.schoolAssists[i].assisName = ''
  185. let datas = res.schoolAssists[i].assists
  186. for (let y in datas) {
  187. res.schoolAssists[i].assisName = res.schoolAssists[i].assisName + datas[y].tmdName + ','
  188. }
  189. }
  190. }
  191. nextpageToken.value = res.continuationToken
  192. //处理学区呈现
  193. console.log(areaList.value.data, '是否有数据')
  194. for (let y in res.schoolAssists) {
  195. let areaValue = res.schoolAssists[y].areaId
  196. console.log(areaValue, '学区的值')
  197. res.schoolAssists[y].areaName = ''
  198. res.schoolAssists[y].institution = ''
  199. for (let i in areaList.value.data) {
  200. areaValue === areaList.value.data[i].value ? (res.schoolAssists[y].areaName = areaList.value.data[i].label, res.schoolAssists[y].institution = areaList.value.data[i].situate) : ''
  201. }
  202. }
  203. console.log(res.schoolAssists, '是否有数据')
  204. if (!value) {
  205. tableData.value = res.schoolAssists;
  206. original.value = JSON.parse(JSON.stringify(res.schoolAssists));
  207. } else {
  208. tableData.value.push(...res.schoolAssists)
  209. // original.value = tableData.value
  210. scrollHeight.value = 'init'
  211. }
  212. processingSchool()
  213. }
  214. })
  215. .catch((err) => {
  216. ElMessage.error('获取学校列表失败')
  217. })
  218. }
  219. function correlation (value, data) {
  220. console.log(value, data)
  221. ElMessageBox.confirm(`请问您确定将 ${nowUsers.value.name} 设为 ${value.name} 顾问,进行数据关联吗 ?`, '关联学校', {
  222. confirmButtonText: proxy.$t(`commonMsg.confirm`),
  223. cancelButtonText: proxy.$t(`commonMsg.closes`),
  224. type: 'success',
  225. center: true,
  226. }).then(() => {
  227. let schoolArr = [value.id]
  228. let roles = nowUsers.value.handleRoles[0] === 'sales' ? 'sales' : nowUsers.value.handleRoles[0] === 'assist' ? 'assist' : nowUsers.value.handleRoles[0] === 'admin' || nowUsers.value.handleRoles[0] === 'leader' ? '' : ''
  229. let data = { partitionKey: nowUsers.value.partitionKey, userId: nowUsers.value.userId, tmdId: nowUsers.value.tmdId, schoolIds: schoolArr, busy: 'add', role: roles }
  230. proxy.$api
  231. .setAistschool(data)
  232. .then((res) => {
  233. console.log(res, '成功的返回')
  234. res.state === 200
  235. ? (nowUsers.value.handleSchools.push(value), getSchoolList('', 'restart'), processingSchool(), ElMessage.success('操作成功'), context.emit('changerestart', true))
  236. : res.state === 201
  237. ? (ElMessage.success('已关联,请勿重复操作'), getSchoolList('', 'restart'))
  238. : ''
  239. })
  240. .catch((error) => {
  241. ElMessage.error('关联失败,API异常')
  242. })
  243. })
  244. }
  245. function removeSchool (value, index) {
  246. console.log(value, index)
  247. ElMessageBox.confirm(`请问您确定将 ${nowUsers.value.name} 与 ${value.name} 取消关联吗 ?`, '取消关联', {
  248. confirmButtonText: proxy.$t(`commonMsg.confirm`),
  249. cancelButtonText: proxy.$t(`commonMsg.closes`),
  250. type: 'error',
  251. center: true,
  252. }).then(() => {
  253. let schoolArr = [value.id]
  254. let roles = nowUsers.value.handleRoles[0] === 'sales' ? 'sales' : nowUsers.value.handleRoles[0] === 'assist' ? 'assist' : nowUsers.value.handleRoles[0] === 'admin' || nowUsers.value.handleRoles[0] === 'leader' ? '' : ''
  255. let data = { partitionKey: nowUsers.value.partitionKey, userId: nowUsers.value.userId, tmdId: nowUsers.value.tmdId, schoolIds: schoolArr, busy: 'del', role: roles }
  256. proxy.$api
  257. .setAistschool(data)
  258. .then((res) => {
  259. res.state === 200 ? (nowUsers.value.handleSchools.splice(index, 1), getSchoolList('', 'restart'), processingSchool(), context.emit('changerestart', true), ElMessage.success('操作成功')) : ''
  260. })
  261. .catch((error) => {
  262. ElMessage.error('取消关联失败,API异常')
  263. })
  264. })
  265. }
  266. function checkSchool (value, row) {
  267. multipleSchool.value = value
  268. console.log(multipleSchool.value, '111')
  269. }
  270. function removeBatch (value) {
  271. removeBatchschool.value = value
  272. }
  273. function multipleCorrelation () {
  274. let schoolData = multipleSchool.value
  275. let schoolName = ''
  276. if (schoolData.length < 5) {
  277. schoolData.forEach((item) => {
  278. schoolName = schoolName + ',' + item.name
  279. })
  280. } else {
  281. for (let i = 0; i < 5; i++) {
  282. schoolName = schoolName + ',' + schoolData[i].name
  283. }
  284. schoolName = schoolName + '等...'
  285. }
  286. ElMessageBox.confirm(`请问您确定将 ${nowUsers.value.name} 设为 ${schoolName} 学校的顾问,进行数据关联吗 ?`, '关联学校', {
  287. confirmButtonText: proxy.$t(`commonMsg.confirm`),
  288. cancelButtonText: proxy.$t(`commonMsg.closes`),
  289. type: 'success',
  290. center: true,
  291. }).then(() => {
  292. let schoolArr = []
  293. for (let i in schoolData) {
  294. schoolArr.push(schoolData[i].id)
  295. }
  296. console.log(nowUsers.value, '用户信息')
  297. let roles = nowUsers.value.handleRoles[0] === 'sales' ? 'sales' : nowUsers.value.handleRoles[0] === 'assist' ? 'assist' : nowUsers.value.handleRoles[0] === 'admin' || nowUsers.value.handleRoles[0] === 'leader' ? '' : ''
  298. let data = { partitionKey: nowUsers.value.partitionKey, userId: nowUsers.value.userId, tmdId: nowUsers.value.tmdId, schoolIds: schoolArr, busy: 'add', role: roles }
  299. proxy.$api
  300. .setAistschool(data)
  301. .then((res) => {
  302. console.log(res, '成功的返回')
  303. res.state === 200
  304. ? ((nowUsers.value.handleSchools = nowUsers.value.handleSchools.concat(schoolData)), getSchoolList('', 'restart'), processingSchool(), context.emit('changerestart', true), ElMessage.success('操作成功'))
  305. : res.state === 201
  306. ? (ElMessage.success('已关联,请勿重复操作'), getSchoolList('', 'restart'))
  307. : ''
  308. })
  309. .catch((error) => {
  310. ElMessage.error('关联失败,API异常')
  311. })
  312. })
  313. }
  314. function multipeRemove () {
  315. let schoolData = removeBatchschool.value
  316. let schoolName = ''
  317. console.log(schoolData, '学校信息')
  318. if (schoolData.length < 5) {
  319. schoolData.forEach((item) => {
  320. schoolName = schoolName ? schoolName + ',' + item.name : item.name
  321. })
  322. } else {
  323. for (let i = 0; i < 5; i++) {
  324. schoolName = schoolName ? schoolName + ',' + schoolData[i].name : schoolData[i].name
  325. }
  326. schoolName = schoolName + '等...'
  327. }
  328. ElMessageBox.confirm(`请问您确定将 ${schoolName} 移除学校关联,取消数据关联吗 ?`, '取消关联学校', {
  329. confirmButtonText: proxy.$t(`commonMsg.confirm`),
  330. cancelButtonText: proxy.$t(`commonMsg.closes`),
  331. type: 'warning',
  332. center: true,
  333. }).then(() => {
  334. let schoolArr = []
  335. for (let s of schoolData) {
  336. s.id ? schoolArr.push(s.id) : ''
  337. }
  338. let roles = nowUsers.value.handleRoles[0] === 'sales' ? 'sales' : nowUsers.value.handleRoles[0] === 'assist' ? 'assist' : nowUsers.value.handleRoles[0] === 'admin' || nowUsers.value.handleRoles[0] === 'leader' ? '' : ''
  339. let data = { partitionKey: nowUsers.value.partitionKey, userId: nowUsers.value.userId, tmdId: nowUsers.value.tmdId, schoolIds: schoolArr, busy: 'del', role: roles }
  340. proxy.$api
  341. .setAistschool(data)
  342. .then((res) => {
  343. if (res.state === 200) {
  344. console.log(schoolData, '内容')
  345. schoolData.forEach((item, index) => {
  346. let iteId = item.id
  347. console.log(iteId, 'ID值')
  348. for (let e in nowUsers.value.handleSchools) {
  349. console.log(nowUsers.value.handleSchools, '值')
  350. iteId === nowUsers.value.handleSchools[e].id ? nowUsers.value.handleSchools.splice(e, 1) : ''
  351. }
  352. })
  353. getSchoolList('', 'restart')
  354. processingSchool()
  355. context.emit('changerestart', true)
  356. ElMessage.success('操作成功')
  357. }
  358. })
  359. .catch((error) => {
  360. ElMessage.error('取消关联失败,API异常')
  361. })
  362. })
  363. }
  364. function processingSchool (state) {
  365. console.log(tableData.value, original.value, '原始数据和变更数据')
  366. state ? tableData.value = original.value : ''
  367. let allSchool = JSON.parse(JSON.stringify(tableData.value))
  368. let handleSchools = nowUsers.value.handleSchools
  369. for (let i in handleSchools) {
  370. let schoolInfo = handleSchools[i].id
  371. for (let s in allSchool) {
  372. allSchool[s].id === schoolInfo ? allSchool.splice(s, 1) : ''
  373. }
  374. }
  375. tableData.value = allSchool
  376. loadingData.value.list = false
  377. }
  378. function debounce (fn, wait) {
  379. if (timer.value !== null) {
  380. clearTimeout(timer.value)
  381. }
  382. timer.value = setTimeout(fn, wait)
  383. }
  384. function personnelSearch () {
  385. let names = schoolSearch.value
  386. let reg = new RegExp("[\\u4E00-\\u9FFF]+", "g")
  387. let data = reg.test(names) ? { name: names } : { scId: names }
  388. proxy.$api.getSchooldata(data).then((res) => {
  389. if (res.state === 200) {
  390. for (let i in res.schoolAssists) {
  391. if (res.schoolAssists[i].assists) {
  392. res.schoolAssists[i].assisName = ''
  393. let datas = res.schoolAssists[i].assists
  394. for (let y in datas) {
  395. res.schoolAssists[i].assisName = res.schoolAssists[i].assisName + datas[y].tmdName + ','
  396. }
  397. }
  398. }
  399. tableData.value = res.schoolAssists
  400. processingSchool()
  401. }
  402. }).catch((error) => {
  403. ElMessage.error('搜索学校失败,API异常')
  404. })
  405. }
  406. //加载所有学区信息
  407. async function areaData () {
  408. await proxy.$api.getCapacity({}).then((res) => {
  409. console.log(res, '学区信息')
  410. res.state === 200 ? (res.areas.forEach((item) => { areaList.value.data.push({ value: item.id, label: item.name, situate: item.institution }) }), store.commit('getPoint', areaList.value.data)) : ''
  411. }).catch((error) => {
  412. ElMessage.error('API异常,获取学区失败')
  413. })
  414. }
  415. //筛选学区数据列表
  416. function getAreaschool (value) {
  417. console.log(value, 'V')
  418. tableData.value = []
  419. let data = value !== 'all' ? { areaId: value } : getSchoolList('', 'restart')
  420. if (value !== 'all') {
  421. loadingData.value.list = true
  422. proxy.$api.getForareaSchool(data).then((res) => {
  423. console.log(res, '现在区域拥有的学校')
  424. if (res.state === 200) {
  425. for (let y in res.joinAreaSchools) {
  426. let areaValue = res.joinAreaSchools[y].areaId
  427. res.joinAreaSchools[y].areaName = ''
  428. res.joinAreaSchools[y].institution = ''
  429. res.joinAreaSchools[y].assisName = ''
  430. for (let i in areaList.value.data) {
  431. areaValue === areaList.value.data[i].value ? (res.joinAreaSchools[y].areaName = areaList.value.data[i].label, res.joinAreaSchools[y].institution = areaList.value.data[i].situate) : ''
  432. }
  433. for (let e in res.joinAreaSchools[y].assists) {
  434. res.joinAreaSchools[y].assisName !== '' ? res.joinAreaSchools[y].assisName = res.joinAreaSchools[y].assisName + ',' + res.joinAreaSchools[y].assists[e].tmdName : res.joinAreaSchools[y].assisName = res.joinAreaSchools[y].assists[e].tmdName
  435. }
  436. }
  437. tableData.value = res.joinAreaSchools
  438. processingSchool()
  439. nextpageToken.value = null
  440. }
  441. loadingData.value.list = false
  442. }).catch((error) => {
  443. ElMessage.error('获取筛选学校列表失败')
  444. loadingData.value.list = false
  445. })
  446. }
  447. }
  448. //关联的筛选
  449. function correlaSchool (value) {
  450. console.log(value, '筛选')
  451. let targetId = value
  452. if (targetId === 'all') {
  453. nowUsers.value.handleSchools = correlaData.value
  454. } else {
  455. let filterData = nowUsers.value.handleSchools.filter((item) => {
  456. return item.areaId === targetId
  457. })
  458. nowUsers.value.handleSchools = filterData
  459. }
  460. }
  461. //处理显示目前关联的
  462. function nowRelevance (value) {
  463. console.log(value, '这个人的身份')
  464. nowUsers.value = JSON.parse(JSON.stringify(value))
  465. let nowUserdata = nowUsers.value
  466. nowUserdata.handleSchools.forEach((item) => {
  467. let areaIds = item.areaId
  468. item.areaName = ''; item.institution = ''
  469. for (let i of areaList.value.data) {
  470. i.value === areaIds ? (item.areaName = i.label, item.institution = i.situate) : ''
  471. }
  472. })
  473. nowUsers.value.handleSchools = nowUserdata.handleSchools
  474. correlaData.value = nowUserdata.handleSchools
  475. value.handleRoles.includes('admin') || value.handleRoles.includes('leader') ? adminOrleader.value = true : adminOrleader.value = false
  476. loadingData.value.possess = false
  477. }
  478. watch(scrollHeight, (newdata, olddata) => {
  479. console.log(newdata, olddata, '监听的数据')
  480. if (newdata < olddata) {
  481. newdata <= 0 ? getSchoolList(nextpageToken.value) : ''
  482. }
  483. })
  484. watch(
  485. props,
  486. (newuser) => {
  487. newuser ? (areaList.value.data.push(...newuser.areadata), nowRelevance(newuser.userdata), processingSchool(true)) : ''
  488. console.log(nowUsers.value, '触发监听')
  489. },
  490. { immediate: true, deep: true }
  491. )
  492. watch(schoolSearch, (newdata) => {
  493. if (newdata.trim().length !== 0) {
  494. debounce(personnelSearch, 500)
  495. } else {
  496. tableData.value = original.value
  497. }
  498. })
  499. getSchoolList()
  500. // areaData()
  501. return {
  502. tableData,
  503. tableDatas,
  504. correlation,
  505. removeSchool,
  506. nowUsers,
  507. getSchoolList,
  508. checkSchool,
  509. multipleSchool,
  510. multipleCorrelation,
  511. processingSchool,
  512. PowerShow,
  513. schoolSearch,
  514. timer,
  515. personnelSearch,
  516. scrollHeight,
  517. areaData,
  518. loadingData,
  519. areaList,
  520. getAreaschool,
  521. removeBatchschool,
  522. multipeRemove,
  523. removeBatch,
  524. nowRelevance,
  525. correlaData,
  526. correlaSchool,
  527. adminOrleader
  528. }
  529. },
  530. }
  531. </script>
  532. <style scoped>
  533. .correlationbox {
  534. width: 100%;
  535. }
  536. .correlationbox-title {
  537. font-size: 14px;
  538. color: #b2bec3;
  539. text-align: left;
  540. }
  541. .possessbox {
  542. width: 100%;
  543. overflow: hidden;
  544. height: 20vh;
  545. /* border: 1px solid #ccc; */
  546. }
  547. .school-list {
  548. width: 100%;
  549. margin-top: 7%;
  550. }
  551. .nodata {
  552. width: 100%;
  553. height: 20vh;
  554. display: flex;
  555. justify-content: center;
  556. align-items: center;
  557. }
  558. .nodata {
  559. font-size: 18px;
  560. color: #bdc3c7;
  561. font-weight: 700;
  562. }
  563. .userlist {
  564. width: 100%;
  565. text-align: center;
  566. display: flex;
  567. justify-content: center;
  568. align-items: center;
  569. }
  570. .userlist-name {
  571. font-size: 14px;
  572. color: #7f8c8d;
  573. }
  574. .photobox {
  575. display: inline-block;
  576. width: 20%;
  577. vertical-align: top;
  578. }
  579. .userlist-name {
  580. text-align: left;
  581. display: inline-block;
  582. width: 60%;
  583. vertical-align: top;
  584. line-height: 40px;
  585. margin-left: 0%;
  586. font-size: 18px;
  587. }
  588. .school-list-header {
  589. width: 100%;
  590. display: flex;
  591. justify-content: space-between;
  592. }
  593. .correlationbox-titles {
  594. width: 20%;
  595. font-size: 14px;
  596. color: #b2bec3;
  597. text-align: left;
  598. }
  599. .correlationbox-search {
  600. width: 45%;
  601. }
  602. .correlationbox-btn {
  603. width: 30%;
  604. text-align: right;
  605. }
  606. .notimage {
  607. width: 40px;
  608. height: 40px;
  609. line-height: 20px;
  610. text-align: center;
  611. background-color: #bdc3c7;
  612. font-size: 6px;
  613. color: #ecf0f1;
  614. margin: 0 auto;
  615. }
  616. .areaitem-name,
  617. .correlationbox-num {
  618. color: #409eff;
  619. }
  620. .areaitem-insti {
  621. color: #909399;
  622. }
  623. </style>
  624. <style>
  625. .school-list-header .el-button--small {
  626. min-height: 25px;
  627. padding: 7px 10px;
  628. }
  629. </style>