organList.vue 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628
  1. <template>
  2. <div class="list_container">
  3. <div class="title_examine">
  4. <div class="pub_title">组织列表</div>
  5. <div style="margin-left: auto;">
  6. <el-input v-model="checkOrg" placeholder="请输入组织" size="normal" clearable @change="changeOrg"
  7. style="margin-right: 10px; width: 200px"></el-input>
  8. <el-select v-model="checkArea" placeholder="选择区域" clearable filterable @change="changeArea"
  9. style="margin-right: 10px">
  10. <el-option v-for="item in regionCList" :key="item.id" :label="item.name" :value="item.name">
  11. </el-option>
  12. </el-select>
  13. <el-button type="primary" size="small" @click="add_organ_dialog = true;">新增组织</el-button>
  14. </div>
  15. </div>
  16. <div class="tableBox">
  17. <el-table :data="organizations" stripe border style="width: 100%" :header-cell-style="headerCellStyle">
  18. <el-table-column show-overflow-tooltip prop="name" label="组织名称" min-width="45"></el-table-column>
  19. <el-table-column show-overflow-tooltip prop="code" label="编码" min-width="45">
  20. <template slot-scope="scope">
  21. {{ scope.row.code || '-' }} <!-- 如果 org 为空,显示 '-' -->
  22. </template>
  23. </el-table-column>
  24. <el-table-column show-overflow-tooltip prop="code" label="随机码" min-width="45">
  25. <template slot-scope="scope">
  26. {{ scope.row.code2 || "-" }}
  27. <!-- 如果 org 为空,显示 '-' -->
  28. </template>
  29. </el-table-column>
  30. <el-table-column show-overflow-tooltip prop="detail" label="描述" min-width="45">
  31. <template slot-scope="scope">
  32. {{ scope.row.detail || '-' }} <!-- 如果 org 为空,显示 '-' -->
  33. </template>
  34. </el-table-column>
  35. <el-table-column show-overflow-tooltip prop="area" label="区域" min-width="45"></el-table-column>
  36. <el-table-column show-overflow-tooltip prop="ctime" label="创建时间" min-width="45"></el-table-column>
  37. <el-table-column label="是否禁用/使用期限" min-width="45">
  38. <template #default="scope">
  39. <span v-if="scope.row.isLogin === '1' || scope.row.isLogin === 'null' || scope.row.isLogin === ''">启用</span>
  40. <span v-else-if="scope.row.isLogin === '2'">禁用</span>
  41. <span v-else>{{ scope.row.isLogin }}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="操作" width="380px">
  45. <template slot-scope="scope">
  46. <div class="operate">
  47. <button @click="update(scope.row)">编辑</button>
  48. <button @click="enable(scope.row, 'enable')">
  49. {{ scope.row.isLogin === '2' ? '启用' : '禁用' }}
  50. </button>
  51. <button v-if="scope.row.isLogin !== '2'"
  52. @click="open_enable_organ(scope.row, 'useDate')">/&nbsp;使用期限</button>
  53. <button @click="toPage(scope.row)">批量创建</button>
  54. <button @click="permissionSetting(scope.row)"
  55. v-show="!unShowJurUser.includes(userid)">权限设置</button>
  56. <button @click="addcommunityL(scope.row)">添加社区</button>
  57. <button @click="delete_organ(scope.row)" style="color:red;">删除</button>
  58. </div>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. </div>
  63. <!-- 分页组件 -->
  64. <el-pagination :current-page="currentPage" :page-size="pageSize" :total="total"
  65. @current-change="handlePageChange" layout="total,prev, pager, next, jumper">
  66. </el-pagination>
  67. <!-- 新增组织弹窗 -->
  68. <el-dialog title="新增组织" class="table" :visible.sync="add_organ_dialog" :before-close="close_add_organ"
  69. width="700px">
  70. <div class="el_dialog_org_content">
  71. <form class="el-form">
  72. <!-- 组织名称 -->
  73. <div class="el-form-item" style="margin-top: 15px">
  74. <label class="el-form-item__label" style="width: 100px">组织名称</label>
  75. <div class="el-form-item__content" style="margin-left: 5px">
  76. <span>
  77. <div class="add_input el-input el-input--suffix">
  78. <input v-model="orgName" type="text" autocomplete="off" placeholder="组织名称"
  79. class="el-input__inner" />
  80. </div>
  81. </span>
  82. </div>
  83. </div>
  84. <!-- 地区 -->
  85. <div class="el-form-item">
  86. <label class="el-form-item__label" style="width: 100px">组织编码</label>
  87. <div class="el-form-item__content" style="margin-left: 5px">
  88. <span>
  89. <div class="add_input el-input el-input--suffix">
  90. <input v-model="randomCode" type="text" autocomplete="off" placeholder="请输入随机码"
  91. class="el-input__inner" />
  92. </div>
  93. </span>
  94. </div>
  95. </div>
  96. <!-- 随机码 -->
  97. <div class="el-form-item">
  98. <label class="el-form-item__label" style="width: 100px">随机码</label>
  99. <div class="el-form-item__content" style="margin-left: 5px">
  100. <span>
  101. <div class="add_input el-input el-input--suffix">
  102. <input v-model="randomCode2" type="text" autocomplete="off" placeholder="请输入随机码"
  103. class="el-input__inner" />
  104. </div>
  105. </span>
  106. </div>
  107. </div>
  108. <!-- 描述 -->
  109. <div class="el-form-item">
  110. <label class="el-form-item__label" style="width: 100px">描述</label>
  111. <div class="el-form-item__content" style="margin-left: 5px">
  112. <span>
  113. <div class="add_input el-input el-input--suffix">
  114. <input v-model="orgDetail" type="text" autocomplete="off" placeholder="请输入描述"
  115. class="el-input__inner" />
  116. </div>
  117. </span>
  118. </div>
  119. </div>
  120. <!-- 区域 -->
  121. <div class="el-form-item">
  122. <label class="el-form-item__label" style="width: 100px">区域</label>
  123. <div class="el-form-item__content" style="margin-left: 5px">
  124. <span>
  125. <div class="add_input el-input el-input--suffix">
  126. <el-select v-model="regionC" placeholder="请选择区域" class="custom-select" filterable>
  127. <el-option v-for="(org, index) in regionCList" :key="index" :label="org.name"
  128. :value="org.name">
  129. {{ org.name }}
  130. </el-option>
  131. </el-select>
  132. </div>
  133. </span>
  134. </div>
  135. </div>
  136. </form>
  137. </div>
  138. <!-- 按钮区域 -->
  139. <div slot="footer" class="el-dialog__footer" style="margin-top: 88px;">
  140. <el-button @click="close_add_organ">取 消</el-button>
  141. <el-button type="primary" @click="ajax_add_org">确认</el-button>
  142. </div>
  143. </el-dialog>
  144. <!-- 修改组织弹窗 -->
  145. <el-dialog title="修改组织" class="table" :visible.sync="add_organ_dialog2" :before-close="close_add_organ2"
  146. width="700px">
  147. <div class="el_dialog_org_content">
  148. <form class="el-form">
  149. <!-- 组织名称 -->
  150. <div class="el-form-item" style="margin-top: 15px">
  151. <label class="el-form-item__label" style="width: 100px">组织名称</label>
  152. <div class="el-form-item__content" style="margin-left: 5px">
  153. <span>
  154. <div class="add_input el-input el-input--suffix">
  155. <input v-model="orgName" type="text" autocomplete="off" placeholder="组织名称"
  156. class="el-input__inner" />
  157. </div>
  158. </span>
  159. </div>
  160. </div>
  161. <!-- 地区 -->
  162. <div class="el-form-item">
  163. <label class="el-form-item__label" style="width: 100px">组织编码</label>
  164. <div class="el-form-item__content" style="margin-left: 5px">
  165. <span>
  166. <div class="add_input el-input el-input--suffix">
  167. <input v-model="randomCode" type="text" autocomplete="off" placeholder="请输入随机码"
  168. class="el-input__inner" />
  169. </div>
  170. </span>
  171. </div>
  172. </div>
  173. <!-- 随机码 -->
  174. <div class="el-form-item">
  175. <label class="el-form-item__label" style="width: 100px">组织随机码</label>
  176. <div class="el-form-item__content" style="margin-left: 5px">
  177. <span>
  178. <div class="add_input el-input el-input--suffix">
  179. <input v-model="randomCode2" type="text" autocomplete="off" placeholder="请输入随机码"
  180. class="el-input__inner" />
  181. </div>
  182. </span>
  183. </div>
  184. </div>
  185. <!-- 描述 -->
  186. <div class="el-form-item">
  187. <label class="el-form-item__label" style="width: 100px">描述</label>
  188. <div class="el-form-item__content" style="margin-left: 5px">
  189. <span>
  190. <div class="add_input el-input el-input--suffix">
  191. <input v-model="orgDetail" type="text" autocomplete="off" placeholder="请输入描述"
  192. class="el-input__inner" />
  193. </div>
  194. </span>
  195. </div>
  196. </div>
  197. <!-- 区域 -->
  198. <div class="el-form-item">
  199. <label class="el-form-item__label" style="width: 100px">区域</label>
  200. <div class="el-form-item__content" style="margin-left: 5px">
  201. <span>
  202. <div class="add_input el-input el-input--suffix">
  203. <el-select v-model="regionC" placeholder="请选择区域" class="custom-select" filterable>
  204. <el-option v-for="(org, index) in regionCList" :key="index" :label="org.name"
  205. :value="org.name">
  206. {{ org.name }}
  207. </el-option>
  208. </el-select>
  209. </div>
  210. </span>
  211. </div>
  212. </div>
  213. </form>
  214. </div>
  215. <!-- 按钮区域 -->
  216. <div slot="footer" class="el-dialog__footer" style="margin-top: 88px;">
  217. <el-button @click="close_add_organ2">取 消</el-button>
  218. <el-button type="primary" @click="updateOrgan">确认</el-button>
  219. </div>
  220. </el-dialog>
  221. <!-- 启用弹窗 -->
  222. <el-dialog :title="enableDiaTitle" class="table" :visible.sync="enable_organ_dialog"
  223. :before-close="close_enable_organ" width="700px">
  224. <div class="el_dialog_org_content">
  225. <form class="el-form">
  226. <!-- 使用期限 -->
  227. <div class="el-form-item">
  228. <label class="el-form-item__label">使用期限</label>
  229. <div class="el-form-item__content">
  230. <el-date-picker v-model="useDate" format="yyyy-MM-dd" type="date" value-format="yyyy-MM-dd"
  231. placeholder="请选择使用期限" />
  232. </div>
  233. </div>
  234. </form>
  235. </div>
  236. <!-- 按钮区域 -->
  237. <div slot="footer" class="dialog-footer">
  238. <el-button @click="close_enable_organ">取 消</el-button>
  239. <el-button type="primary" @click="enable_organ">确认</el-button>
  240. </div>
  241. </el-dialog>
  242. <el-dialog
  243. :title="`${cyInfo.name}社区列表`"
  244. :visible.sync="dialogcommunity"
  245. width="1000px"
  246. class="table"
  247. :before-close="handleClose">
  248. <div class="cyConTit">
  249. <div>社区列表</div>
  250. <el-button type="primary" size="mini" @click="editCy(0)">添加社区</el-button>
  251. </div>
  252. <el-table
  253. :data="cytableData"
  254. style="width: 100%" v-loading="cyloading">
  255. <el-table-column
  256. prop="name"
  257. label="名称"
  258. >
  259. </el-table-column>
  260. <el-table-column
  261. prop="username"
  262. label="创建人"
  263. >
  264. </el-table-column>
  265. <el-table-column
  266. prop="createtime"
  267. label="创建时间"
  268. >
  269. </el-table-column>
  270. <el-table-column
  271. show-overflow-tooltip
  272. prop="evatime2"
  273. label="截止日期"
  274. >
  275. </el-table-column>
  276. <el-table-column label="操作" width="200px">
  277. <template slot-scope="scope">
  278. <div class="operate">
  279. <button @click="lookCy(scope.row)">添加人员</button>
  280. <button @click="editCy(1,scope.row)">修改</button>
  281. <button @click="editOpen(scope.row)">{{ scope.row.isopen ? '启用' : '禁用' }}</button>
  282. <button @click="delete_Cy(scope.row)" style="color:red;">删除</button>
  283. </div>
  284. </template>
  285. </el-table-column>
  286. </el-table>
  287. </el-dialog>
  288. <el-dialog
  289. title="社区人员"
  290. :visible.sync="dialogcyperson"
  291. width="1000px"
  292. class="table"
  293. :before-close="handleClose2">
  294. <div class="cyConTit">
  295. <div>人员列表</div>
  296. <el-button type="primary" size="mini" @click="getTeacher">添加人员</el-button>
  297. </div>
  298. <el-table
  299. :data="cypersontableData"
  300. style="width: 100%" v-loading="cypersonloading">
  301. <el-table-column
  302. prop="name"
  303. label="名称"
  304. >
  305. </el-table-column>
  306. <el-table-column
  307. prop="accountNumber"
  308. label="账号"
  309. >
  310. </el-table-column>
  311. <el-table-column
  312. prop="organizationname"
  313. label="学校"
  314. >
  315. </el-table-column>
  316. <el-table-column label="操作" width="200px">
  317. <template slot-scope="scope">
  318. <div class="operate">
  319. <button @click="removeCyperson(scope.row)" style="color:red;">移出</button>
  320. </div>
  321. </template>
  322. </el-table-column>
  323. </el-table>
  324. </el-dialog>
  325. <el-dialog
  326. :title="isedit ?'修改社区':'添加社区'"
  327. :visible.sync="dialogcyADD"
  328. width="1000px"
  329. class="table"
  330. :before-close="handleClose2">
  331. <form class="el-form">
  332. <!-- 名称 -->
  333. <div class="el-form-item" style="margin-top: 15px">
  334. <label class="el-form-item__label" style="width: 100px">名称</label>
  335. <div class="el-form-item__content" style="margin-left: 5px">
  336. <span>
  337. <div class="add_input el-input el-input--suffix">
  338. <input v-model="editCyInfo.name" type="text" autocomplete="off" placeholder="社区名称"
  339. class="el-input__inner" />
  340. </div>
  341. </span>
  342. </div>
  343. </div>
  344. <!-- banner -->
  345. <div class="el-form-item">
  346. <label class="el-form-item__label" style="width: 100px">截止日期</label>
  347. <el-date-picker
  348. v-model="editCyInfo.evatime"
  349. type="datetimerange"
  350. align="right"
  351. start-placeholder="开始日期"
  352. end-placeholder="结束日期"
  353. :default-time="['12:00:00', '08:00:00']">
  354. </el-date-picker>
  355. </div>
  356. <div class="el-form-item" style="align-items:flex-start;">
  357. <label class="el-form-item__label" style="width: 100px;flex-shrink: 0;">自定义分类</label>
  358. <div style="">
  359. <el-button size="mini" type="primary" @click="addType()">添加分类</el-button>
  360. <div v-if="editCyInfo.typeL && editCyInfo.typeL.length" class="alltype">
  361. <div class="typeArea" v-for="(item,index) in editCyInfo.typeL" :key="item.id">
  362. <div style="font-size: 12px;">分类名称</div>
  363. <div style="display: flex;gap: 20px;">
  364. <div class="bigtype">
  365. <el-input
  366. v-if="item.eit == 0"
  367. v-model="editCyInfo.typeL[index].name" placeholder="请输入内容">
  368. </el-input>
  369. <span style="font-size: 16px;font-weight: 600;" v-else>{{ item.name }}</span>
  370. </div>
  371. <span class="btn" @click="Deltype(index)">删除</span>
  372. <span class="btn" v-if="item.eit == 0" @click="editCyInfo.typeL[index].eit = 1">确定</span>
  373. <span class="btn" v-else @click="editCyInfo.typeL[index].eit = 0">编辑</span>
  374. </div>
  375. <div style="font-size: 12px;margin-top: 10px;">分类标签</div>
  376. <div class="tagL">
  377. <template v-if="item.children && item.children.length">
  378. <span style="display: flex;gap: 10px;align-items: center;" v-for="(i,ind) in item.children" :key="i.id">
  379. <el-input
  380. v-if="i.eit == 0"
  381. v-model="editCyInfo.typeL[index].children[ind].name" placeholder="请输入内容">
  382. </el-input>
  383. <span v-else>{{ i.name }}</span>
  384. <span class="btn" @click="Deltag(index,ind)">删除</span>
  385. <span class="btn" v-if="i.eit == 0" @click="editCyInfo.typeL[index].children[ind].eit = 1">确定</span>
  386. <span class="btn" v-else @click="editCyInfo.typeL[index].children[ind].eit = 0">编辑</span>
  387. </span>
  388. </template>
  389. <span style="cursor: pointer;background-color: #409EFF;color: #fff;" @click="Addtag(index)">添加</span>
  390. </div>
  391. </div>
  392. </div>
  393. </div>
  394. </div>
  395. <div class="el-form-item">
  396. <label class="el-form-item__label" style="width: 100px">banner</label>
  397. <div class="el-form-item__content" style="margin-left: 5px">
  398. <el-button type="primary" @click="cyImgAdd">添加</el-button>
  399. </div>
  400. </div>
  401. <div class="el-form-item" v-if="editCyInfo.banner">
  402. <div style="position: relative;">
  403. <div class="cha" @click="delImg">❌</div>
  404. <img style="width: 60px;height: 60px;object-fit: cover;" :src="editCyInfo.banner" alt="">
  405. </div>
  406. </div>
  407. </form>
  408. <span slot="footer" class="dialog-footer">
  409. <el-button @click="handleClose2">取 消</el-button>
  410. <el-button v-if="isedit == 0" type="primary" @click="AddCy">确定添加</el-button>
  411. <el-button v-else type="primary" @click="updateCy">确定修改</el-button>
  412. </span>
  413. </el-dialog>
  414. <el-dialog
  415. title="添加社区成员"
  416. :visible.sync="dialogaddCyperson"
  417. :append-to-body="true"
  418. width="25%"
  419. height="80%"
  420. :close-on-click-modal="false"
  421. :before-close="handleClose"
  422. class="addNewPP customWidth"
  423. >
  424. <div class="people">
  425. <div class="people_top">
  426. <div class="people_top_right">
  427. <div class="people_search">
  428. <el-input
  429. placeholder="搜索成员名称"
  430. v-model="searchTN"
  431. @keyup.enter.native="getTeacher"
  432. ></el-input>
  433. <div class="search_img" @click="getTeacher">
  434. <img src="../assets/search.png" alt />
  435. </div>
  436. </div>
  437. </div>
  438. <div class="people_nav" style="display: flex; align-items: center">
  439. <div class="check_class_left_title">选择成员</div>
  440. <div style="display: flex; align-items: center; margin-left: auto">
  441. <el-checkbox
  442. v-model="checkAll"
  443. @change="handleCheckAllChange2"
  444. class="all_check"
  445. >全选</el-checkbox
  446. >
  447. </div>
  448. </div>
  449. </div>
  450. <div class="t_j_box" style="padding: 15px 10px 0;box-sizing: border-box;">
  451. <div>姓名</div>
  452. <div>账号</div>
  453. <div>学校</div>
  454. </div>
  455. <el-checkbox-group
  456. v-model="checkboxList3"
  457. class="people_name"
  458. @change="handleCheckedCitiesChange"
  459. v-if="teacherJuri.length"
  460. >
  461. <el-checkbox
  462. v-for="item in teacherJuri"
  463. :key="item.userid"
  464. :label="item.userid"
  465. >
  466. <div class="t_j_box">
  467. <el-tooltip
  468. placement="top"
  469. :content="item.name ? item.name : '暂无姓名'"
  470. >
  471. <div>{{ item.name ? item.name : "暂无姓名" }}</div>
  472. </el-tooltip>
  473. <el-tooltip placement="top" :content="item.accountNumber.split('@')[0]">
  474. <div>{{ item.accountNumber.split('@')[0] }}</div>
  475. </el-tooltip>
  476. <el-tooltip placement="top" :content="item.organizationname">
  477. <div>{{ item.organizationname }}</div>
  478. </el-tooltip>
  479. </div>
  480. </el-checkbox>
  481. </el-checkbox-group>
  482. <div style="text-align: center; margin-top: 10px" v-else>暂无数据</div>
  483. </div>
  484. <span slot="footer" class="dialog-footer">
  485. <el-button @click="dialogaddCyperson = false">取 消</el-button>
  486. <el-button type="primary" @click="addcyperson">确定</el-button>
  487. </span>
  488. </el-dialog>
  489. <permissionSettingDialog ref="permissionSettingDialogRef" @getData="getOrgan" />
  490. </div>
  491. </template>
  492. <script>
  493. import { API_CONFIG } from '@/common/apiConfig';
  494. import { addOp,addCommunity,
  495. getcylist,updateCommunity,
  496. getAddcyPersonlist,updateCommunityperson,
  497. getcypersonlist,delCommunity,updateCyOP } from "@/api/user";
  498. import { mapGetters } from 'vuex';
  499. import permissionSettingDialog from './dialog/permissionSettingDialog'
  500. export default {
  501. name: 'onList',
  502. components: {
  503. permissionSettingDialog
  504. },
  505. data() {
  506. return {
  507. // 点击组织操作添加社区弹框
  508. dialogcommunity:false,
  509. // 打开添加信息组织弹框,存储的组织信息
  510. cyInfo:[], //组织信息
  511. // 社区列表的loading
  512. cyloading:false,
  513. // 社区添加与修改所存储的信息
  514. editCyInfo:{name:'',banner:'',evatime:'',typeL:[]},
  515. // 添加与修改社区共用一个弹框 0是添加信息 1 修改信息
  516. isedit:0,
  517. // 添加与修改社区弹框
  518. dialogcyADD:false,
  519. //组织社区列表
  520. cytableData:[],
  521. // 添加社区人员的组织人员列表
  522. teacherJuri:[],
  523. //已添加社区人员列表
  524. cypersontableData:[],
  525. // 添加社区人员列表弹框已选中人员
  526. checkboxList3:[], //选中的人员
  527. // 添加社区人员列表全选
  528. checkAll:false,
  529. // 社区人员列表弹框
  530. dialogcyperson:false,
  531. // 社区人员列表弹框loading
  532. cypersonloading:false,
  533. // 添加社区成员弹框
  534. dialogaddCyperson:false,
  535. // 添加社区成员弹框人员搜索框
  536. searchTN:'',
  537. organizations: [],
  538. organList: [],
  539. checkOrg: "",
  540. checkArea: "",
  541. currentPage: 1,
  542. pageSize: 10,
  543. total: 0,
  544. add_organ_dialog: false,
  545. add_organ_dialog2: false,
  546. enable_organ_dialog: false,
  547. dialogAction: "",
  548. useDate: "",
  549. orgName: "",
  550. randomCode: "",
  551. randomCode2: "",
  552. orgDetail: "",
  553. regionC: 'cn',
  554. uLogin: "1", // 登录状态 (1 或 2)
  555. radio: "1",
  556. regionCList: [
  557. { id: 1, name: 'hk' },
  558. { id: 2, name: 'cn' },
  559. { id: 3, name: 'com' }
  560. ], //区域列表
  561. form: {
  562. organ: ""
  563. },
  564. organ: {},
  565. unShowJurUser: ['0abcb118-9110-11eb-80ad-005056b86db5']
  566. }
  567. },
  568. computed: {
  569. ...mapGetters(['userid']),
  570. enableDiaTitle() {
  571. return this.dialogAction === 'enable' ? '启用组织' : '设置使用期限'
  572. }
  573. },
  574. // created() {
  575. // this.formatDate();
  576. // },
  577. methods: {
  578. addType(){
  579. this.editCyInfo.typeL.push({
  580. id: Date.now(),
  581. name: '',
  582. eit: 0,
  583. children: []
  584. })
  585. },
  586. Deltype(ind){
  587. this.editCyInfo.typeL.splice(ind,1)
  588. },
  589. Deltag(index,ind){
  590. this.editCyInfo.typeL[index].children.splice(ind,1)
  591. },
  592. Addtag(index){
  593. this.editCyInfo.typeL[index].children.push({
  594. id: Date.now(),
  595. name: '',
  596. eit:0,
  597. })
  598. },
  599. // 表头的背景色
  600. headerCellStyle() {
  601. return { backgroundColor: "#f1f1f1" };
  602. },
  603. changeOrg() {
  604. this.currentPage = 1;
  605. this.getOrgan();
  606. },
  607. changeArea() {
  608. this.currentPage = 1;
  609. this.getOrgan();
  610. },
  611. getOrgan() {
  612. let params = [
  613. {
  614. functionName: "getOrgan",
  615. org: this.checkOrg,
  616. area: this.checkArea,
  617. page: this.currentPage,
  618. num: this.pageSize,
  619. }
  620. ];
  621. this.$ajax
  622. .post(API_CONFIG.baseUrl, params)
  623. .then((res) => {
  624. console.log("返回的数据为:", res.data); // 检查返回的数据
  625. if (res.data && Array.isArray(res.data[0])) {
  626. // 使用 map() 提取所有组织名称
  627. this.organizations = res.data[0]
  628. this.total = res.data[0].length ? res.data[0][0].num : 0;
  629. console.log(this.organizations);
  630. }
  631. })
  632. .catch((err) => {
  633. this.$message.error("查询失败");
  634. console.error("请求失败,错误信息:", err);
  635. });
  636. },
  637. ajax_org() {
  638. const params = [API_CONFIG.ajax_org]; // 使用配置中的接口参数
  639. this.$ajax
  640. .post(API_CONFIG.baseUrl, params)
  641. .then((res) => {
  642. // console.log("返回的数据为:", res.data); // 检查返回的数据
  643. if (res.data && Array.isArray(res.data[0])) {
  644. // 使用 map() 提取所有组织名称
  645. this.organList = res.data[0].map((item) => ({
  646. name: item.name,
  647. id: item.id,
  648. }));
  649. }
  650. // console.log("返回的结果为:",this.organizations);
  651. })
  652. .catch((err) => {
  653. this.$message.error("查询失败");
  654. console.error("请求失败,错误信息:", err);
  655. });
  656. },
  657. // 页码扩展按钮
  658. handlePageChange(page) {
  659. this.currentPage = page;
  660. this.getOrgan();
  661. },
  662. //新增学校关闭
  663. close_add_organ() {
  664. this.regionC = 'cn'
  665. this.add_organ_dialog = false;
  666. },
  667. //修改学校关闭
  668. close_add_organ2() {
  669. this.orgName = "";
  670. this.randomCode = "";
  671. this.randomCode2 = "";
  672. this.orgDetail = "";
  673. this.regionC = 'cn'
  674. this.add_organ_dialog2 = false;
  675. },
  676. close_enable_organ() {
  677. this.enable_organ_dialog = false;
  678. this.useDate = "";
  679. },
  680. //新增组织
  681. ajax_add_org() {
  682. // 获取弹窗中的输入内容
  683. let orgName = this.orgName; // 组织名称
  684. let randomCode = this.randomCode || ""; // 随机码(可为空)
  685. let randomCode2 = this.randomCode2 || ""; // 随机码(可为空)
  686. let uLogin = this.radio; // 获取复选框选中的值(1 或 2)
  687. if (randomCode2 && randomCode2.length && randomCode2.length != 4) return this.$message.error("随机码须4位数");
  688. // 验证组织名称不能为空
  689. if (!orgName) {
  690. this.$message.error("组织名称不能为空");
  691. return;
  692. }
  693. // 构造请求参数
  694. let params = [
  695. {
  696. functionName: API_CONFIG.ajax_add_orgN.functionName, // 调用存储过程的名称
  697. u_name: orgName, // 组织名称
  698. u_create: this.userid, // u_create 固定为0
  699. u_code: randomCode, // 随机码(可以为空)
  700. u_code2: randomCode2, // 随机码(可以为空)
  701. u_detail: this.orgDetail, // 描述
  702. u_regionC: this.regionC,
  703. u_login: uLogin, // 登录状态
  704. },
  705. ];
  706. // 发起请求
  707. this.$ajax
  708. .post(API_CONFIG.baseUrl, params)
  709. .then(async (res) => {
  710. console.log(res.data);
  711. // 检查返回的结果
  712. if (res.data && res.data[0] && res.data[0][0]) {
  713. if (res.data[0][0].name === 1) {
  714. this.$message({
  715. type: "error",
  716. message: "该组织已存在,请重新选择!",
  717. });
  718. return;
  719. } else {
  720. this.$message({
  721. type: "success",
  722. message: "添加成功!",
  723. });
  724. await addOp({
  725. uid: this.userid,
  726. cid: "",
  727. type: "user_op",
  728. content: `添加了组织 ${orgName}`,
  729. });
  730. }
  731. } else {
  732. this.$message.error("插入失败,未返回有效结果");
  733. }
  734. // 刷新组织列表
  735. this.getOrgan();
  736. //关闭弹窗
  737. this.add_organ_dialog = false;
  738. // 清空输入框、下拉菜单选择和单选框
  739. this.orgName = ""; // 清空学校名称
  740. this.orgDetail = ""; // 清空学校描述
  741. this.regionC = 'cn'
  742. this.randomCode = ""; // 清空地区选择
  743. this.randomCode2 = ""; // 清空地区选择
  744. this.uLogin = "1"; // 清空学校类型选择
  745. })
  746. .catch((err) => {
  747. this.$message.error("插入失败");
  748. console.error("请求失败,错误信息:", err);
  749. });
  750. },
  751. update(row) {
  752. this.add_organ_dialog2 = true;
  753. this.nid = row.id;
  754. this.orgName = row.name;
  755. this.randomCode = row.code;
  756. this.randomCode2 = row.code2;
  757. this.regionC = row.area;
  758. this.orgDetail = row.detail;
  759. console.log(row);
  760. },
  761. updateOrgan() {
  762. if (this.randomCode2 &&this.randomCode2.length && this.randomCode2.length != 4) return this.$message.error("随机码须4位数");
  763. let params = [
  764. {
  765. functionName: "updateOrgan2N",
  766. id: this.nid,
  767. name: this.orgName,
  768. code: this.randomCode || '',
  769. code2: this.randomCode2 || '',
  770. detail: this.orgDetail || '',
  771. area: this.regionC
  772. }
  773. ];
  774. this.$ajax
  775. .post(API_CONFIG.baseUrl, params)
  776. .then(async (res) => {
  777. console.log("👉", res.data);
  778. this.add_organ_dialog2 = false;
  779. this.$message({
  780. message: '修改成功',
  781. type: 'success'
  782. });
  783. this.getOrgan();
  784. // 清空输入框、下拉菜单选择和单选框
  785. this.orgName = ""; // 清空学校名称
  786. this.orgDetail = ""; // 清空学校描述
  787. this.regionC = 'cn'
  788. this.randomCode = ""; // 清空地区选择
  789. this.randomCode2 = ""; // 清空地区选择
  790. this.uLogin = "1"; // 清空学校类型选择
  791. await addOp({
  792. uid: this.userid,
  793. cid: "",
  794. type: "user_op",
  795. content: `修改了组织 ${this.orgName} ${this.nid}`,
  796. });
  797. })
  798. .catch((err) => {
  799. this.$message.error("修改失败");
  800. console.log(err);
  801. });
  802. },
  803. formatDate() {
  804. // 使用示例
  805. const today = new Date(); // 获取当前日期
  806. const year = today.getFullYear(); // 获取年份
  807. const month = String(today.getMonth() + 1).padStart(2, '0'); // 获取月份,注意月份从0开始,所以要加1,并确保是两位数
  808. const day = String(today.getDate()).padStart(2, '0'); // 获取日期,并确保是两位数
  809. this.useDate = `${year}-${month}-${day}`; // 返回格式化后的日期字符串
  810. },
  811. enable(row, action) {
  812. if (row.isLogin === '2') {
  813. this.enable_organ_dialog = true;
  814. this.nid = row.id;
  815. this.dialogAction = action;
  816. this.formatDate();
  817. console.log(row);
  818. }
  819. else {
  820. this.disableOrgan(row);
  821. }
  822. },
  823. open_enable_organ(row) {
  824. this.enable_organ_dialog = true;
  825. this.nid = row.id;
  826. this.dialogAction = 'useDate';
  827. if (row.isLogin === '1' || row.isLogin === 'null' || row.isLogin === '') {
  828. this.formatDate();
  829. } else {
  830. this.useDate = row.isLogin;
  831. }
  832. },
  833. enable_organ() {
  834. let params = [
  835. {
  836. functionName: "enableOrgan",
  837. id: this.nid,
  838. date: this.useDate
  839. }
  840. ];
  841. this.$ajax
  842. .post(API_CONFIG.baseUrl, params)
  843. .then(async (res) => {
  844. console.log("👉", res.data);
  845. this.enable_organ_dialog = false;
  846. this.useDate = "";
  847. if (this.dialogAction === 'enable') {
  848. this.$message({
  849. message: '启用成功',
  850. type: 'success'
  851. });
  852. } else if (this.dialogAction === 'useDate') {
  853. this.$message({
  854. message: '设置成功',
  855. type: 'success'
  856. });
  857. }
  858. // this.formatDate();
  859. this.getOrgan();
  860. console.log(11111);
  861. await addOp({
  862. uid: this.userid,
  863. cid: "",
  864. type: "user_op",
  865. content: `启用了组织 ${this.orgName} ${this.nid}`,
  866. });
  867. })
  868. .catch((err) => {
  869. this.$message.error("启用失败");
  870. console.log(err);
  871. });
  872. },
  873. disableOrgan(row) {
  874. this.nid = row.id;
  875. let params = [
  876. {
  877. functionName: "disableOrgan",
  878. id: this.nid
  879. }
  880. ];
  881. this.$confirm("确定禁用此组织记录吗?", "提示", {
  882. confirmButtonText: "确定",
  883. cancelButtonText: "取消",
  884. type: "warning",
  885. })
  886. .then(() => {
  887. this.$ajax
  888. .post(API_CONFIG.baseUrl, params)
  889. .then(async (res) => {
  890. console.log("👉", res.data);
  891. this.$message({
  892. message: '禁用成功',
  893. type: 'success'
  894. });
  895. this.getOrgan();
  896. await addOp({
  897. uid: this.userid,
  898. cid: "",
  899. type: "user_op",
  900. content: `禁用了组织 ${row.name} ${row.id}`,
  901. });
  902. })
  903. })
  904. .catch((err) => {
  905. console.log(err);
  906. });
  907. },
  908. delete_organ(row) {
  909. this.nid = row.id;
  910. let params = [
  911. {
  912. functionName: "deleteOrgan",
  913. id: this.nid
  914. }
  915. ];
  916. this.$confirm("确定删除此组织记录吗?", "提示", {
  917. confirmButtonText: "确定",
  918. cancelButtonText: "取消",
  919. type: "warning",
  920. })
  921. .then(() => {
  922. this.$ajax
  923. .post(API_CONFIG.baseUrl, params)
  924. .then(async (res) => {
  925. console.log("👉", res.data);
  926. this.$message({
  927. message: '删除成功',
  928. type: 'success'
  929. });
  930. this.getOrgan();
  931. await addOp({
  932. uid: this.userid,
  933. cid: "",
  934. type: "user_op",
  935. content: `删除了组织 ${row.name} ${row.id}`,
  936. });
  937. })
  938. })
  939. .catch((err) => {
  940. this.$message.error("删除失败");
  941. console.log(err);
  942. });
  943. },
  944. async getUserId(oid, org) {
  945. let params = [
  946. {
  947. functionName: "select_Suffix", // 调用存储过程的名称
  948. org: org, //组织id
  949. oid: oid, //学校id
  950. },
  951. ];
  952. try {
  953. const res = await this.$ajax.post(API_CONFIG.baseUrl, params);
  954. console.log('getSuffix', res);
  955. let data = res.data[0];
  956. let orgData = res.data[1];
  957. let ap = data.length > 0 ? data[0].userid : orgData.length > 0 ? orgData[0].userid : "";
  958. return ap
  959. } catch (err) {
  960. console.error("请求失败,错误信息:", err);
  961. }
  962. },
  963. async toPage(row) {
  964. const oid = "";
  965. const org = row.id;
  966. await addOp({
  967. uid: this.userid,
  968. cid: "",
  969. type: "user_op",
  970. content: `点击了批量添加 ${row.name}${row.id}`,
  971. });
  972. let userid = await this.getUserId(oid, org);
  973. const url = `https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/?#/teacher?userid=${userid ? userid : this.userid}&oid=${oid}&org=${org}`;
  974. window.open(url, '_blank');
  975. },
  976. permissionSetting(data) {
  977. this.$refs.permissionSettingDialogRef.open(data, "org");
  978. },
  979. // 打开添加社区弹框,
  980. addcommunityL(val){
  981. console.log('val',val);
  982. this.cyInfo = val
  983. this.getCy()
  984. this.dialogcommunity = true
  985. },
  986. // 打开添加社区获取已添加的社区列表
  987. getCy(){
  988. this.cyloading = true;
  989. let params = {
  990. oid: this.cyInfo.id,
  991. n: '', //预留搜索框
  992. page: 1,
  993. num: 10000,
  994. };
  995. getcylist(params)
  996. .then(async (res) => {
  997. console.log(res);
  998. let data = res.data[0]
  999. data.forEach(e => {
  1000. if (e.evatime) {
  1001. e.evatime = JSON.parse(e.evatime)
  1002. e.evatime2 = e.evatime.map(dateStr => this.formatDateCy(dateStr)).join('——')
  1003. }
  1004. e.typeL = e.typeL ? JSON.parse(e.typeL) : '';
  1005. });
  1006. this.cytableData = data
  1007. this.cyloading = false;
  1008. })
  1009. .catch((error) => {
  1010. this.cyloading = false;
  1011. console.error("请求失败,错误信息:", error);
  1012. });
  1013. },
  1014. formatDateCy(dateStr, format = 'YYYY-MM-DD HH:mm:ss') {
  1015. const date = new Date(dateStr);
  1016. const pad = (num) => num.toString().padStart(2, '0');
  1017. const year = date.getFullYear();
  1018. const month = pad(date.getMonth() + 1);
  1019. const day = pad(date.getDate());
  1020. const hours = pad(date.getHours());
  1021. const minutes = pad(date.getMinutes());
  1022. const seconds = pad(date.getSeconds());
  1023. return format
  1024. .replace('YYYY', year)
  1025. .replace('MM', month)
  1026. .replace('DD', day)
  1027. .replace('HH', hours)
  1028. .replace('mm', minutes)
  1029. .replace('ss', seconds);
  1030. },
  1031. // 禁用启用社区
  1032. editOpen(val){
  1033. this.cyloading = true
  1034. let open = val.isopen ? '0' : '1'
  1035. let params = {
  1036. idL: val.id,
  1037. op: open
  1038. };
  1039. console.log('params',params);
  1040. updateCyOP(params)
  1041. .then(async (response) => {
  1042. if (response) {
  1043. await addOp({
  1044. uid: this.userid,
  1045. cid: "",
  1046. type: "user_op",
  1047. content: `${open ? '禁用' : '启用'}了${val.name}社区`,
  1048. });
  1049. this.$message({
  1050. type: "success",
  1051. message: "修改成功",
  1052. });
  1053. this.cyloading = false
  1054. this.getCy()
  1055. }
  1056. })
  1057. .catch((error) => {
  1058. this.cyloading = false
  1059. console.error("请求失败,错误信息:", error);
  1060. });
  1061. },
  1062. // 点击添加社区 0 是添加社区 1是修改社区信息
  1063. editCy(val,row){
  1064. console.log('row',row);
  1065. this.isedit = val
  1066. if (val == 1) {
  1067. let kol = JSON.parse(JSON.stringify(row))
  1068. if (kol && !kol.typeL) {
  1069. kol.typeL = []
  1070. }
  1071. this.editCyInfo = kol
  1072. }
  1073. this.dialogcyADD = true
  1074. },
  1075. // 添加组织社区
  1076. AddCy(){
  1077. if (!this.editCyInfo.name) return this.$message.error('请添加名称')
  1078. let params = {
  1079. uid:this.userid,
  1080. nam: this.editCyInfo.name,
  1081. oid:this.cyInfo.id,
  1082. ban: this.editCyInfo.banner,
  1083. eva: this.editCyInfo.evatime ? JSON.stringify(this.editCyInfo.evatime) : '',
  1084. typ: (this.editCyInfo.typeL && this.editCyInfo.typeL.length) ? JSON.stringify(this.editCyInfo.typeL) : '',
  1085. };
  1086. addCommunity(params)
  1087. .then(async (response) => {
  1088. if (response) {
  1089. console.log('response',response);
  1090. await addOp({
  1091. uid: this.userid,
  1092. cid: "",
  1093. type: "user_op",
  1094. content: `添加了${this.editCyInfo.name}社区`,
  1095. });
  1096. this.$message({
  1097. type: "success",
  1098. message: "添加成功",
  1099. });
  1100. this.dialogcyADD = false;
  1101. this.getCy()
  1102. this.editCyInfo = {name:'',banner:'',evatime:'',typeL:[]};
  1103. }
  1104. })
  1105. .catch((error) => {
  1106. console.error("请求失败,错误信息:", error);
  1107. });
  1108. },
  1109. // 修改社区信息
  1110. updateCy(){
  1111. if (!this.editCyInfo.name) return this.$message.error('请添加名称')
  1112. let params = {
  1113. idL:this.editCyInfo.id,
  1114. nam: this.editCyInfo.name,
  1115. ban: this.editCyInfo.banner,
  1116. eva: this.editCyInfo.evatime ? JSON.stringify(this.editCyInfo.evatime) : '',
  1117. typ: (this.editCyInfo.typeL && this.editCyInfo.typeL.length) ? JSON.stringify(this.editCyInfo.typeL) : '',
  1118. };
  1119. console.log('params',params);
  1120. updateCommunity(params)
  1121. .then(async (response) => {
  1122. if (response) {
  1123. console.log('response',response);
  1124. await addOp({
  1125. uid: this.userid,
  1126. cid: "",
  1127. type: "user_op",
  1128. content: `修改了${this.editCyInfo.name}社区`,
  1129. });
  1130. this.$message({
  1131. type: "success",
  1132. message: "修改成功",
  1133. });
  1134. this.dialogcyADD = false;
  1135. this.getCy()
  1136. this.editCyInfo = {name:'',banner:'',evatime:'',typeL:[]};
  1137. }
  1138. })
  1139. .catch((error) => {
  1140. console.error("请求失败,错误信息:", error);
  1141. });
  1142. },
  1143. // 删除社区
  1144. delete_Cy(val){
  1145. this.$confirm("确定删除吗?", {
  1146. confirmButtonText: "确定",
  1147. cancelButtonText: "取消",
  1148. type: "warning",
  1149. })
  1150. .then(() => {
  1151. let params = {
  1152. idL:val.id
  1153. };
  1154. console.log('params',params);
  1155. delCommunity(params)
  1156. .then(async (response) => {
  1157. if (response) {
  1158. console.log('response',response);
  1159. await addOp({
  1160. uid: this.userid,
  1161. cid: "",
  1162. type: "user_op",
  1163. content: `删除了${val.name}社区`,
  1164. });
  1165. this.$message({
  1166. type: "success",
  1167. message: "删除成功",
  1168. });
  1169. this.getCy()
  1170. }
  1171. })
  1172. })
  1173. .catch(() => {});
  1174. },
  1175. async cyImgAdd(){
  1176. let _url = await this.uploadFile("image/*");
  1177. this.editCyInfo.banner = _url
  1178. },
  1179. // 清除照片
  1180. delImg(){
  1181. this.editCyInfo.banner = ''
  1182. },
  1183. // 全选
  1184. handleCheckAllChange2(val){
  1185. this.checkboxList3 = val ? this.teacherJuri.map(e=>e.userid) : [];
  1186. this.checkAll = val
  1187. // console.log('this.checkboxList3',this.checkboxList3);
  1188. },
  1189. // 单选
  1190. handleCheckedCitiesChange(value){
  1191. let checkedCount = value.length;
  1192. this.checkAll = checkedCount === this.teacherJuri.length;
  1193. // console.log('this.checkboxList3',this.checkboxList3);
  1194. },
  1195. // 添加社区人员
  1196. addcyperson(){
  1197. console.log('ok');
  1198. let params = {
  1199. id:this.editCyInfo.id,
  1200. tea:this.checkboxList3.join(','),
  1201. };
  1202. console.log('params',params);
  1203. updateCommunityperson(params)
  1204. .then(async (response) => {
  1205. if (response) {
  1206. console.log('response',response);
  1207. await addOp({
  1208. uid: this.userid,
  1209. cid: "",
  1210. type: "user_op",
  1211. content: `修改了${this.editCyInfo.name}社区人员`,
  1212. });
  1213. this.$message({
  1214. type: "success",
  1215. message: "修改成功",
  1216. });
  1217. this.lookCy(this.editCyInfo)
  1218. this.dialogaddCyperson = false;
  1219. }
  1220. })
  1221. .catch((error) => {
  1222. console.error("请求失败,错误信息:", error);
  1223. });
  1224. },
  1225. // 移出社区人员
  1226. removeCyperson(val){
  1227. console.log(val);
  1228. this.$confirm("确定移出吗?", {
  1229. confirmButtonText: "确定",
  1230. cancelButtonText: "取消",
  1231. type: "warning",
  1232. })
  1233. .then(() => {
  1234. let person = this.cypersontableData.filter(e=> e.userid != val.userid).map(e=>e.userid)
  1235. console.log('person',person);
  1236. let params = {
  1237. id:this.editCyInfo.id,
  1238. tea: person.join(','),
  1239. };
  1240. console.log('params',params);
  1241. updateCommunityperson(params)
  1242. .then(async (response) => {
  1243. if (response) {
  1244. console.log('response',response);
  1245. await addOp({
  1246. uid: this.userid,
  1247. cid: "",
  1248. type: "user_op",
  1249. content: `修改了${this.editCyInfo.name}社区${val.userid}人员`,
  1250. });
  1251. this.$message({
  1252. type: "success",
  1253. message: "移出成功",
  1254. });
  1255. this.dialogaddCyperson = false;
  1256. this.lookCy(this.editCyInfo)
  1257. }
  1258. })
  1259. })
  1260. .catch(() => {});
  1261. },
  1262. // 查看社区人员
  1263. lookCy(val){
  1264. this.editCyInfo = val;
  1265. this.dialogcyperson = true;
  1266. this.cypersonloading = true;
  1267. let params = {
  1268. id: val.id,
  1269. };
  1270. getcypersonlist(params)
  1271. .then(async (res) => {
  1272. console.log(res);
  1273. this.cypersonloading = false;
  1274. this.cypersontableData = res.data[0]
  1275. })
  1276. .catch((error) => {
  1277. this.cypersonloading = false;
  1278. console.error("请求失败,错误信息:", error);
  1279. });
  1280. },
  1281. // 添加社区人员获取人员列表
  1282. getTeacher() {
  1283. let params = {
  1284. oid: this.cyInfo.id,
  1285. inp: this.searchTN,
  1286. page: 1,
  1287. num: 10
  1288. };
  1289. getAddcyPersonlist(params)
  1290. .then(async (res) => {
  1291. console.log(res);
  1292. this.teacherJuri = res.data[0];
  1293. this.checkboxList3 = this.cypersontableData.map(e=> e.userid)
  1294. this.dialogaddCyperson = true
  1295. })
  1296. .catch((error) => {
  1297. console.error("请求失败,错误信息:", error);
  1298. });
  1299. },
  1300. uploadFile(accept = "*") {
  1301. return new Promise((resolve) => {
  1302. const input = document.createElement("input");
  1303. input.type = "file";
  1304. input.accept = accept;
  1305. input.onchange = (event) => {
  1306. const file = event.target.files[0];
  1307. if (file) {
  1308. let credentials = {
  1309. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  1310. secretAccessKey: "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",
  1311. }; //秘钥形式的登录上传
  1312. window.AWS.config.update(credentials);
  1313. window.AWS.config.region = "cn-northwest-1"; //设置区域
  1314. let bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
  1315. // let _name = file.name;
  1316. // let size = file.size;
  1317. let params = {
  1318. Key:
  1319. file.name.split(".")[0] +
  1320. new Date().getTime() +
  1321. "." +
  1322. file.name.split(".")[file.name.split(".").length - 1],
  1323. ContentType: file.type,
  1324. Body: file,
  1325. "Access-Control-Allow-Credentials": "*",
  1326. ACL: "public-read",
  1327. }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
  1328. let options = {
  1329. partSize: 2048 * 1024 * 1024,
  1330. queueSize: 2,
  1331. leavePartsOnError: true,
  1332. };
  1333. bucket
  1334. .upload(params, options)
  1335. .on("httpUploadProgress", (evt) => {
  1336. console.log(evt);
  1337. })
  1338. .send((err, data) => {
  1339. if (err) {
  1340. this.$message.error("上传失败");
  1341. return resolve("");
  1342. } else {
  1343. return resolve(data.Location);
  1344. }
  1345. });
  1346. } else {
  1347. resolve("");
  1348. }
  1349. };
  1350. input.click();
  1351. });
  1352. },
  1353. handleClose(done){
  1354. done();
  1355. },
  1356. handleClose2(){
  1357. this.editCyInfo = ''
  1358. this.editCyInfo = {name:'',banner:'',evatime:'',typeL:[]};
  1359. this.dialogcyADD=false;
  1360. this.dialogcyperson = false
  1361. }
  1362. },
  1363. mounted() {
  1364. this.getOrgan();
  1365. this.ajax_org();
  1366. }
  1367. }
  1368. </script>
  1369. <style scoped>
  1370. .list_container {
  1371. width: 100%;
  1372. height: 100%;
  1373. padding: 10px;
  1374. box-sizing: border-box;
  1375. overflow: auto;
  1376. }
  1377. .tableBox {
  1378. margin: 10px 0;
  1379. }
  1380. .operate {
  1381. display: flex;
  1382. gap: 5px;
  1383. }
  1384. /* 新增组织的内容容器 */
  1385. .el_dialog_org_content {
  1386. color: #606266;
  1387. font-size: 14px;
  1388. height: 120px;
  1389. }
  1390. .el-form-item {
  1391. margin-bottom: 22px;
  1392. display: flex;
  1393. align-items: center;
  1394. /* border: 1px solid black; */
  1395. }
  1396. .el-form-item__label {
  1397. font-size: 14px;
  1398. color: #606266;
  1399. line-height: 40px;
  1400. margin-left: 20px;
  1401. width: 70px;
  1402. }
  1403. .el-form-item__content {
  1404. line-height: 40px;
  1405. position: relative;
  1406. font-size: 14px;
  1407. }
  1408. .table>>>.el-dialog__header {
  1409. padding: 15px 20px;
  1410. background: #454545;
  1411. }
  1412. .table>>>.el-dialog__title {
  1413. color: #fff;
  1414. }
  1415. .operate button {
  1416. background: none;
  1417. border: none;
  1418. cursor: pointer;
  1419. color: #308fff;
  1420. }
  1421. .cyConTit{
  1422. display: flex;
  1423. justify-content: space-between;
  1424. }
  1425. .addNewPP >>> .el-dialog__body {
  1426. padding: 5px 20px;
  1427. }
  1428. .addNewPP >>> .el-dialog {
  1429. margin-top: 5vh !important;
  1430. }
  1431. .customWidth >>> .el-dialog {
  1432. min-width: 500px !important;
  1433. }
  1434. .people {
  1435. border: 1px solid rgb(229 229 229);
  1436. /* height: 495px; */
  1437. height: 350px;
  1438. border-radius: 5px;
  1439. width: 100%;
  1440. overflow: auto;
  1441. }
  1442. .people_top {
  1443. display: flex;
  1444. width: 100%;
  1445. /* justify-content: space-between; */
  1446. /* align-items: center; */
  1447. flex-direction: column;
  1448. padding: 10px 10px 0;
  1449. box-sizing: border-box;
  1450. }
  1451. .people_top_right {
  1452. height: 40px;
  1453. margin-bottom: 10px;
  1454. }
  1455. .people_search {
  1456. display: flex;
  1457. position: relative;
  1458. }
  1459. .people_search >>> .el-input__inner {
  1460. /* height: 25px; */
  1461. width: 100%;
  1462. }
  1463. .search_img {
  1464. width: 20px;
  1465. height: 20px;
  1466. position: absolute;
  1467. right: 10px;
  1468. top: 50%;
  1469. transform: translateY(-50%);
  1470. }
  1471. .search_img > img {
  1472. width: 100%;
  1473. height: 100%;
  1474. }
  1475. .people_name {
  1476. display: flex;
  1477. justify-content: flex-start;
  1478. padding: 20px 10px;
  1479. flex-direction: column;
  1480. flex-wrap: wrap;
  1481. }
  1482. .people_name >>> .el-checkbox {
  1483. width: 100%;
  1484. display: flex;
  1485. align-items: center;
  1486. margin-bottom: 10px;
  1487. }
  1488. .people_name >>> .el-checkbox__label {
  1489. text-overflow: ellipsis;
  1490. overflow: hidden;
  1491. width: calc(100%);
  1492. }
  1493. .t_j_box{
  1494. display: flex;
  1495. justify-content: space-between;
  1496. }
  1497. .t_j_box div{
  1498. width: 100px;
  1499. overflow: hidden;
  1500. text-overflow: ellipsis;
  1501. white-space: nowrap;
  1502. }
  1503. .cha{
  1504. position: absolute;top: 0;right: 5px;
  1505. cursor: pointer;
  1506. }
  1507. .custom-tree-node {
  1508. flex: 1;
  1509. display: flex;
  1510. align-items: center;
  1511. justify-content: space-between;
  1512. font-size: 14px;
  1513. padding-right: 8px;
  1514. }
  1515. .tagL{
  1516. display: flex;
  1517. align-items: center;
  1518. flex-wrap: wrap;
  1519. gap: 2px;
  1520. }
  1521. .tagL >>> .el-input__inner{
  1522. height: 30px;
  1523. line-height: 30px;
  1524. width: 120px;
  1525. }
  1526. .tagL span{
  1527. background: aqua;
  1528. padding: 5px 3px;
  1529. border-radius: 5px;
  1530. flex-shrink: 0;
  1531. }
  1532. .btn{
  1533. cursor: pointer;
  1534. display: flex;
  1535. align-items: center;
  1536. }
  1537. .bigtype{
  1538. display: flex;
  1539. align-items: center;
  1540. gap: 10px;
  1541. }
  1542. .bigtype >>> .el-input__inner{
  1543. height: 30px;
  1544. line-height: 30px;
  1545. width: 120px;
  1546. }
  1547. .typeArea{
  1548. border: 1px #ccc solid;padding: 5px;border-radius: 10px;
  1549. }
  1550. .alltype{
  1551. margin-top: 10px;
  1552. display: flex;
  1553. flex-direction: column;
  1554. gap: 15px;
  1555. }
  1556. </style>