| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985 |
- <template>
- <div class="list_container">
- <div class="title_examine">
- <div class="pub_title">学校列表</div>
- <div style="margin-left: auto">
- <el-input v-model="checkOid" placeholder="请输入学校" size="normal" clearable @change="changeOid"
- style="margin-right: 10px; width: 200px"></el-input>
- <el-input v-model="checkOrg" placeholder="请输入组织" size="normal" clearable @change="changeOrg"
- style="margin-right: 10px; width: 200px"></el-input>
- <el-select v-model="checkArea" placeholder="选择区域" clearable filterable @change="changeArea"
- style="margin-right: 10px">
- <el-option v-for="item in regionCList" :key="item.id" :label="item.name" :value="item.name">
- </el-option>
- </el-select>
- <el-button type="primary" size="small" @click="add_school_dialog = true">新增学校</el-button>
- </div>
- </div>
- <div class="tableBox">
- <el-table :data="schoolData" stripe border style="width: 100%" :header-cell-style="headerCellStyle">
- <el-table-column show-overflow-tooltip prop="name" label="学校名称" min-width="45"></el-table-column>
- <el-table-column show-overflow-tooltip prop="org_name" label="组织" min-width="45">
- <template slot-scope="scope">
- {{ scope.row.org_name || "-" }}
- <!-- 如果 org 为空,显示 '-' -->
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip prop="org_code" label="组织编码" min-width="45">
- <template slot-scope="scope">
- {{ scope.row.org_code || "-" }}
- <!-- 如果 org 为空,显示 '-' -->
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip prop="code" label="编码" min-width="45">
- <template slot-scope="scope">
- {{ scope.row.code || "-" }}
- <!-- 如果 org 为空,显示 '-' -->
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip prop="code" label="随机码" min-width="45">
- <template slot-scope="scope">
- {{ scope.row.code2 || "-" }}
- <!-- 如果 org 为空,显示 '-' -->
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip prop="detail" label="描述" min-width="45">
- <template slot-scope="scope">
- {{ scope.row.detail || '-' }} <!-- 如果 org 为空,显示 '-' -->
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip prop="area" label="区域" min-width="45"></el-table-column>
- <el-table-column show-overflow-tooltip prop="ctime" label="创建时间" min-width="45"></el-table-column>
- <el-table-column label="是否禁用/使用期限" min-width="45">
- <template #default="scope">
- <span v-if="scope.row.isLogin === '1' || scope.row.isLogin === 'null' || scope.row.isLogin === ''">启用</span>
- <span v-else-if="scope.row.isLogin === '2'">禁用</span>
- <span v-else>{{ scope.row.isLogin }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="420px">
- <template slot-scope="scope">
- <div class="operate">
- <button @click="update(scope.row)">编辑</button>
- <button @click="enable(scope.row,'enable')">
- {{ scope.row.isLogin === '2' ? '启用' : '禁用' }}
- </button>
- <button v-if="scope.row.isLogin !== '2'"
- @click="open_enable_school(scope.row, 'useDate')">/ 使用期限</button>
- <button @click="toPage(scope.row)">批量创建</button>
- <button @click="permissionSetting(scope.row)"
- v-show="!unShowJurUser.includes(userid)">权限设置</button>
- <button @click="addcommunityL(scope.row)">添加社区</button>
- <!-- <button @click="opengradia(scope.row.id)">年级管理</button> -->
- <button @click="delete_school(scope.row)" style="color: red">
- 删除
- </button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 分页组件 -->
- <el-pagination :current-page="currentPage" :page-size="pageSize" :total="total"
- @current-change="handlePageChange" layout="total,prev, pager, next, jumper">
- </el-pagination>
- <!-- 新增学校弹窗 -->
- <el-dialog title="新增学校" class="table" :visible.sync="add_school_dialog" :before-close="close_add_school"
- width="700px">
- <div class="el_dialog_school_content">
- <form class="el-form">
- <!-- 学校名称 -->
- <div class="el-form-item" style="margin-top: 15px">
- <label class="el-form-item__label" style="width: 100px">学校名称</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <input v-model="sch_name" type="text" autocomplete="off" placeholder="学校名称"
- class="el-input__inner" />
- </div>
- </span>
- </div>
- </div>
- <!-- 地区 -->
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">地区</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <input v-model="region" type="text" autocomplete="off" placeholder="请输入地区"
- class="el-input__inner" />
- </div>
- </span>
- </div>
- </div>
- <!-- 学校编码 -->
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">学校编码</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <input v-model="schoolCode" type="text" autocomplete="off" placeholder="请输入编码"
- class="el-input__inner" />
- </div>
- </span>
- </div>
- </div>
- <!-- 学校随机码 -->
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">随机码</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <input v-model="schoolCode2" type="text" autocomplete="off" placeholder="请输入随机码"
- class="el-input__inner" />
- </div>
- </span>
- </div>
- </div>
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">上级组织</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <el-form :model="school" ref="form">
- <el-select v-model="school.parentOrgId" placeholder="请选择组织"
- class="custom-select" filterable>
- <el-option v-for="(org, index) in organizations" :key="index"
- :label="org.name" :value="org.id">
- {{ org.name }}
- </el-option>
- </el-select>
- </el-form>
- </div>
- </span>
- </div>
- </div>
- <!-- 描述 -->
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">描述</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <input v-model="schoolDetail" type="text" autocomplete="off" placeholder="请输入描述"
- class="el-input__inner" />
- </div>
- </span>
- </div>
- </div>
- <!-- 区域 -->
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">区域</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <el-select v-model="regionC" placeholder="请选择区域" class="custom-select" filterable>
- <el-option v-for="(org, index) in regionCList" :key="index" :label="org.name"
- :value="org.name">
- {{ org.name }}
- </el-option>
- </el-select>
- </div>
- </span>
- </div>
- </div>
- <!-- 年级 -->
- <!-- <div class="flexcol">
- <div style="display: flex;gap: 15px;">
- <span>年级</span>
- <el-checkbox :indeterminate="graisInde" v-model="gracheckAll" @change="handleCheckAllChange">全选</el-checkbox>
- </div>
- <div>
- <el-checkbox-group v-model="checkedGra" @change="hangraChange">
- <el-checkbox v-for="city in gralist" :label="city" :key="city">{{city}}</el-checkbox>
- </el-checkbox-group>
- </div>
- </div> -->
- </form>
- </div>
- <!-- 按钮区域 -->
- <div slot="footer" class="el-dialog__footer">
- <el-button @click="close_add_school">取 消</el-button>
- <el-button type="primary" @click="ajax_add_school">确认</el-button>
- </div>
- </el-dialog>
- <!-- 修改学校弹窗 -->
- <el-dialog title="修改学校" class="table" :visible.sync="add_school_dialog2" :before-close="close_add_school2"
- width="700px">
- <div class="el_dialog_school_content">
- <form class="el-form">
- <!-- 学校名称 -->
- <div class="el-form-item" style="margin-top: 15px">
- <label class="el-form-item__label" style="width: 100px">学校名称</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <input v-model="sch_name" type="text" autocomplete="off" placeholder="学校名称"
- class="el-input__inner" />
- </div>
- </span>
- </div>
- </div>
- <!-- 地区 -->
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">地区</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <input v-model="region" type="text" autocomplete="off" placeholder="请输入地区"
- class="el-input__inner" />
- </div>
- </span>
- </div>
- </div>
- <!-- 学校编码 -->
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">学校编码</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <input v-model="schoolCode" type="text" autocomplete="off" placeholder="请输入编码"
- class="el-input__inner" />
- </div>
- </span>
- </div>
- </div>
- <!-- 学校随机码 -->
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">学校随机码</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <input v-model.trim="schoolCode2" type="text" autocomplete="off" placeholder="请输入随机码"
- class="el-input__inner" />
- </div>
- </span>
- </div>
- </div>
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">上级组织</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <el-form :model="school" ref="form">
- <el-select v-model="school.parentOrgId" clearable placeholder="请选择组织"
- class="custom-select" filterable>
- <el-option v-for="(org, index) in organizations" :key="index"
- :label="org.name" :value="org.id">
- {{ org.name }}
- </el-option>
- </el-select>
- </el-form>
- </div>
- </span>
- </div>
- </div>
- <!-- 描述 -->
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">描述</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <input v-model="schoolDetail" type="text" autocomplete="off" placeholder="请输入描述"
- class="el-input__inner" />
- </div>
- </span>
- </div>
- </div>
- <!-- 区域 -->
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">区域</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <el-select v-model="regionC" placeholder="请选择区域" class="custom-select" filterable>
- <el-option v-for="(org, index) in regionCList" :key="index" :label="org.name"
- :value="org.name">
- {{ org.name }}
- </el-option>
- </el-select>
- </div>
- </span>
- </div>
- </div>
- </form>
- </div>
- <!-- 按钮区域 -->
- <div slot="footer" class="el-dialog__footer">
- <el-button @click="close_add_school2">取 消</el-button>
- <el-button type="primary" @click="updateSchool()">确认</el-button>
- </div>
- </el-dialog>
- <!-- 启用弹窗 -->
- <el-dialog :title="enableDiaTitle" class="table" :visible.sync="enable_school_dialog" :before-close="close_enable_school"
- width="700px">
- <div class="el_dialog_org_content">
- <form class="el-form">
- <!-- 使用期限 -->
- <div class="el-form-item">
- <label class="el-form-item__label">使用期限</label>
- <div class="el-form-item__content">
- <el-date-picker v-model="useDate" format="yyyy-MM-dd" type="date" value-format="yyyy-MM-dd"
- placeholder="请选择使用期限" />
- </div>
- </div>
- </form>
- </div>
- <!-- 按钮区域 -->
- <div slot="footer" class="dialog-footer">
- <el-button @click="close_enable_school">取 消</el-button>
- <el-button type="primary" @click="enable_school">确认</el-button>
- </div>
- </el-dialog>
-
- <el-dialog
- :title="`${cyInfo.name}社区列表`"
- :visible.sync="dialogcommunity"
- width="1000px"
- class="table"
- :before-close="handleClose">
- <div class="cyConTit">
- <div>社区列表</div>
- <el-button type="primary" size="mini" @click="editCy(0)">添加社区</el-button>
- </div>
- <el-table
- :data="cytableData"
- style="width: 100%" v-loading="cyloading">
- <el-table-column
- prop="name"
- label="名称"
- >
- </el-table-column>
- <el-table-column
- prop="username"
- label="创建人"
- >
- </el-table-column>
- <el-table-column
- prop="createtime"
- label="创建时间"
- >
- </el-table-column>
- <el-table-column
- show-overflow-tooltip
- prop="evatime2"
- label="截止日期"
- >
- </el-table-column>
- <el-table-column label="操作" width="200px">
- <template slot-scope="scope">
- <div class="operate">
- <button @click="lookCy(scope.row)">添加人员</button>
- <button @click="editCy(1,scope.row)">修改</button>
- <button @click="editOpen(scope.row)">{{ scope.row.isopen ? '启用' : '禁用' }}</button>
- <button @click="delete_Cy(scope.row)" style="color:red;">删除</button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </el-dialog>
- <el-dialog
- title="社区人员"
- :visible.sync="dialogcyperson"
- width="1000px"
- class="table"
- :before-close="handleClose2">
- <div class="cyConTit">
- <div>人员列表</div>
- <el-button type="primary" size="mini" @click="getTeacher">添加人员</el-button>
- </div>
- <el-table
- :data="cypersontableData"
- style="width: 100%" v-loading="cypersonloading">
- <el-table-column
- prop="name"
- label="名称"
- >
- </el-table-column>
- <el-table-column
- prop="accountNumber"
- label="账号"
- >
- </el-table-column>
- <el-table-column
- prop="organizationname"
- label="学校"
- >
- </el-table-column>
- <el-table-column label="操作" width="200px">
- <template slot-scope="scope">
- <div class="operate">
- <button @click="removeCyperson(scope.row)" style="color:red;">移出</button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </el-dialog>
- <el-dialog
- :title="isedit ?'修改社区':'添加社区'"
- :visible.sync="dialogcyADD"
- width="1000px"
- class="table"
- :before-close="handleClose2">
- <form class="el-form">
- <!-- 名称 -->
- <div class="el-form-item" style="margin-top: 15px">
- <label class="el-form-item__label" style="width: 100px">名称</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <span>
- <div class="add_input el-input el-input--suffix">
- <input v-model="editCyInfo.name" type="text" autocomplete="off" placeholder="社区名称"
- class="el-input__inner" />
- </div>
- </span>
- </div>
- </div>
- <!-- banner -->
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">截止日期</label>
- <el-date-picker
- v-model="editCyInfo.evatime"
- type="datetimerange"
- align="right"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- :default-time="['12:00:00', '08:00:00']">
- </el-date-picker>
- </div>
- <div class="el-form-item" style="align-items:flex-start;">
- <label class="el-form-item__label" style="width: 100px;flex-shrink: 0;">自定义分类</label>
- <div style="">
- <el-button size="mini" type="primary" @click="addType()">添加分类</el-button>
- <div v-if="editCyInfo.typeL && editCyInfo.typeL.length" style="margin-top: 10px;">
- <div class="typeArea" v-for="(item,index) in editCyInfo.typeL" :key="item.id">
- <div style="font-size: 12px;">分类名称</div>
- <div style="display: flex;gap: 20px;margin-top: 2px;">
- <div class="bigtype">
- <el-input
- v-if="item.eit == 0"
- v-model="editCyInfo.typeL[index].name" placeholder="请输入内容">
- </el-input>
- <span style="font-size: 16px;font-weight: 600;" v-else>{{ item.name }}</span>
- </div>
- <span class="btn" @click="Deltype(index)">删除</span>
- <span class="btn" v-if="item.eit == 0" @click="editCyInfo.typeL[index].eit = 1">确定</span>
- <span class="btn" v-else @click="editCyInfo.typeL[index].eit = 0">编辑</span>
- </div>
- <div style="font-size: 12px;margin-top: 10px;">分类标签</div>
- <div class="tagL">
- <template v-if="item.children && item.children.length">
- <span style="display: flex;gap: 10px;align-items: center;" v-for="(i,ind) in item.children" :key="i.id">
- <el-input
- v-if="i.eit == 0"
- v-model="editCyInfo.typeL[index].children[ind].name" placeholder="请输入内容">
- </el-input>
- <span v-else>{{ i.name }}</span>
- <span class="btn" @click="Deltag(index,ind)">删除</span>
- <span class="btn" v-if="i.eit == 0" @click="editCyInfo.typeL[index].children[ind].eit = 1">确定</span>
- <span class="btn" v-else @click="editCyInfo.typeL[index].children[ind].eit = 0">编辑</span>
- </span>
- </template>
- <span style="cursor: pointer;background-color: #409EFF;color: #fff;" @click="Addtag(index)">添加</span>
- </div>
- </div>
- </div>
-
- </div>
- </div>
- <div class="el-form-item">
- <label class="el-form-item__label" style="width: 100px">banner</label>
- <div class="el-form-item__content" style="margin-left: 5px">
- <el-button type="primary" @click="cyImgAdd">添加</el-button>
- </div>
- </div>
- <div class="el-form-item" v-if="editCyInfo.banner">
- <div style="position: relative;">
- <div class="cha" @click="delImg">❌</div>
- <img style="width: 60px;height: 60px;object-fit: cover;" :src="editCyInfo.banner" alt="">
- </div>
- </div>
-
- </form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="handleClose2">取 消</el-button>
- <el-button v-if="isedit == 0" type="primary" @click="AddCy">确定添加</el-button>
- <el-button v-else type="primary" @click="updateCy">确定修改</el-button>
- </span>
- </el-dialog>
- <!-- 添加社区成员 -->
- <el-dialog
- title="添加社区成员"
- :visible.sync="dialogaddCyperson"
- :append-to-body="true"
- width="25%"
- height="80%"
- :close-on-click-modal="false"
- :before-close="handleClose"
- class="addNewPP customWidth"
- >
- <div class="people">
- <div class="people_top">
- <div class="people_top_right">
- <div class="people_search">
- <el-input
- placeholder="搜索成员名称"
- v-model="searchTN"
- @keyup.enter.native="getTeacher"
- ></el-input>
- <div class="search_img" @click="getTeacher">
- <img src="../assets/search.png" alt />
- </div>
- </div>
- </div>
- <div class="people_nav" style="display: flex; align-items: center">
- <div class="check_class_left_title">选择成员</div>
- <div style="display: flex; align-items: center; margin-left: auto">
- <el-checkbox
- v-model="checkAll"
- @change="handleCheckAllChange2"
- class="all_check"
- >全选</el-checkbox
- >
- </div>
- </div>
- </div>
- <div class="t_j_box" style="padding: 15px 10px 0;box-sizing: border-box;">
- <div>姓名</div>
- <div>账号</div>
- <div>学校</div>
- </div>
- <el-checkbox-group
- v-model="checkboxList3"
- class="people_name"
- @change="handleCheckedCitiesChange"
- v-if="teacherJuri.length"
- >
- <el-checkbox
- v-for="item in teacherJuri"
- :key="item.userid"
- :label="item.userid"
- >
- <div class="t_j_box">
- <el-tooltip
- placement="top"
- :content="item.name ? item.name : '暂无姓名'"
- >
- <div>{{ item.name ? item.name : "暂无姓名" }}</div>
- </el-tooltip>
- <el-tooltip placement="top" :content="item.accountNumber.split('@')[0]">
- <div>{{ item.accountNumber.split('@')[0] }}</div>
- </el-tooltip>
- <el-tooltip placement="top" :content="item.organizationname">
- <div>{{ item.organizationname }}</div>
- </el-tooltip>
- </div>
- </el-checkbox>
- </el-checkbox-group>
- <div style="text-align: center; margin-top: 10px" v-else>暂无数据</div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogaddCyperson = false">取 消</el-button>
- <el-button type="primary" @click="addcyperson">确定</el-button>
- </span>
- </el-dialog>
- <!-- 管理年级 -->
- <el-dialog
- title="管理年级"
- :visible.sync="gradia"
- :append-to-body="true"
- width="600"
- :close-on-click-modal="false"
- :before-close="handleClose"
- class="table"
- >
- <div>
- <el-button size="mini" type="primary" @click="graopt(0)">添加年级</el-button>
- </div>
- <el-table
- :data="gratab"
- v-loading="graloading"
- >
- <el-table-column
- prop="name"
- label="年级"
- >
- </el-table-column>
- <el-table-column label="操作" align="center" width="250">
- <template slot-scope="scope">
- <el-button size="mini" type="primary" @click="graopt(1,scope.row)">编辑</el-button>
- <el-button size="mini" type="primary" @click="delGra(scope.row.id)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
-
- </el-dialog>
- <el-dialog
- :title="`${isaddGra ? '修改' : '添加'}年级`"
- :visible.sync="addgradia"
- :append-to-body="true"
- width="600"
- :close-on-click-modal="false"
- :before-close="handleClose"
- class="table"
- >
- <div>{{`${isaddGra ? '修改' : '添加'}年级`}}</div>
- <el-input v-model="graName" placeholder="请输入内容"></el-input>
- <span slot="footer" class="dialog-footer">
- <el-button @click="addgradia = false">取 消</el-button>
- <el-button v-if="isaddGra == 0" type="primary" @click="insertGradeL(graName,graoid)">确定添加</el-button>
- <el-button v-else type="primary" @click="updateGrade()">确定修改</el-button>
- </span>
- </el-dialog>
- <permissionSettingDialog ref="permissionSettingDialogRef" @getData="getSchool" />
- </div>
- </template>
- <script>
- import { addOp,addCommunity,
- getcylist,updateCommunity,
- getAddcyPersonlist,updateCommunityperson,
- getcypersonlist,delCommunity,updateCyOP } from "@/api/user";
- import { insert_school3New,insertGrade,selectGrade,updateGrade } from "@/api/user.js";
- import { API_CONFIG } from "@/common/apiConfig";
- import { mapGetters } from "vuex";
- import permissionSettingDialog from "./dialog/permissionSettingDialog";
- export default {
- name: "schoolList",
- components: {
- permissionSettingDialog,
- },
- data() {
- return {
- gracheckAll: false,
- checkedGra: [],
- gralist: ['一年级','二年级','三年级','四年级','五年级','六年级','七年级','八年级','九年级','高一','高二','高三'],
- graisInde: false, //年级全选按钮
- gradia:false,
- addgradia:false,
- graloading:false,
- gratotal:0,
- grapage:1,
- gratab:[],
- graName:'',
- graoid:'',
- graclaid:'',
- isaddGra:0, //0是添加 1是修改
- // 点击组织操作添加社区弹框
- dialogcommunity:false,
- // 打开添加信息组织弹框,存储的组织信息
- cyInfo:[], //组织信息
- // 社区列表的loading
- cyloading:false,
- // 社区添加与修改所存储的信息
- editCyInfo:{name:'',banner:'',evatime:'',typeL:[]},
- // 添加与修改社区共用一个弹框 0是添加信息 1 修改信息
- isedit:0,
- // 添加与修改社区弹框
- dialogcyADD:false,
- //组织社区列表
- cytableData:[],
- // 添加社区人员的组织人员列表
- teacherJuri:[],
- //已添加社区人员列表
- cypersontableData:[],
- // 添加社区人员列表弹框已选中人员
- checkboxList3:[], //选中的人员
- // 添加社区人员列表全选
- checkAll:false,
- // 社区人员列表弹框
- dialogcyperson:false,
- // 社区人员列表弹框loading
- cypersonloading:false,
- // 添加社区成员弹框
- dialogaddCyperson:false,
- // 添加社区成员弹框人员搜索框
- searchTN:'',
- schoolData: [],
- schoolList: [],
- cn_school: [],
- checkOid: "",
- checkOrg: "",
- checkArea: "",
- currentPage: 1,
- pageSize: 10,
- total: 0,
- add_school_dialog: false,
- add_school_dialog2: false,
- enable_school_dialog: false,
- dialogAction: '',
- useDate: "",
- sch_name: "", //学校名称
- form: {
- name: "",
- account: "",
- organization: "",
- school: "",
- },
- school: {
- OrgId: null, // 初始化 OrgId 为 null 或适当的默认值
- parentOrgId: "",
- },
- region: "", //地区
- schoolCode: "", //学校编码
- schoolCode2: "", //学校编码
- regionC: "cn", //区域
- regionCList: [
- { id: 1, name: "hk" },
- { id: 2, name: "cn" },
- { id: 3, name: "com" },
- ], //区域列表
- organizations: [],
- schoolDetail: "", //学校描述
- schoolType: "1", //学校单选框类型
- loginPermission: "1", //是否允许登录
- nid: "", //修改学校的id
- unShowJurUser: ['0abcb118-9110-11eb-80ad-005056b86db5']
- };
- },
- methods: {
- graopt(val,data){
- this.isaddGra = val;
- if (data && data.id) {
- this.graclaid = data.id;
- this.graName = data.name;
- }else{
- this.graName = '';
- }
- this.addgradia = true;
- },
- //修改年级
- updateGrade() {
- let params = {
- id: this.graclaid,
- n: this.graName,
- oid: this.graoid,
- };
- // this.ajax
- // .get(this.$store.state.api + "updateGrade", params)
- // .then((res) => {
- updateGrade(params)
- .then((res) => {
- if (res.data[0] && res.data[0][0].classname == 1) {
- this.$message({
- message: "不能与其他年级名称相同!",
- type: "error",
- });
- } else {
- this.$message({
- message: "年级修改成功!",
- type: "success",
- });
- this.addgradia = false;
- this.opengradia(this.graoid);
- this.graName = '';
- this.graclaid = '';
- }
- })
- .catch((err) => {
- this.$message({
- message: this.lang.Modificationfailed,
- type: "error",
- });
- console.error(err);
- });
- },
- //获取年级列表
- opengradia(oid) {
- this.gradia = true;
- this.graoid = oid;
- this.graloading = true;
- let params = {
- cu: "",
- oid: oid,
- cn: '',
- page: this.grapage,
- };
- console.log('params',params);
- selectGrade(params)
- .then(async (res) => {
- this.gratotal = res.data[0].length > 0 ? res.data[0][0].num : 0;
- this.gratab = res.data[0];
- this.graloading = false;
- })
- .catch((error) => {
- this.graloading = false;
- console.error("请求失败,错误信息:", error);
- });
- },
- // 添加年级
- handleCheckAllChange(val) {
- this.checkedGra = val ? this.gralist : [];
- this.graisInde = false;
- },
- hangraChange(value) {
- let checkedCount = value.length;
- this.gracheckAll = checkedCount === this.gralist.length;
- this.graisInde = checkedCount > 0 && checkedCount < this.gralist.length;
- },
- addType(){
- this.editCyInfo.typeL.push({
- id: Date.now(),
- name: '',
- eit: 0,
- children: []
- })
- },
- async batchInstgra(oid){
- let kk = []
- for (let index = 0; index < this.checkedGra.length; index++) {
- setTimeout(async () => {
- kk.push(await this.insertGradeL(this.checkedGra[index],oid))
- }, 500);
- }
- Promise.all(kk)
- .then(() => {
- this.checkedGra = [];
- if (kk.indexOf(0) != -1) {
- this.$message.error('年级未全部添加成功')
- }else{
- this.$message.success('年级添加成功')
- }
- })
- .catch((e) => {
- console.log("👉", e);
- });
- },
- //新增年级
- insertGradeL(val,oid) {
- return new Promise((resolve, reject) => {
- let params = {
- name: val,
- oid: oid,
- uid: this.userid,
- };
- // console.log('params',params);
- insertGrade(params)
- .then((res) => {
- if (res.data[0] && res.data[0][0].classname == 1) {
- this.$message({
- message: "不能与其他年级名称相同!",
- type: "error",
- });
- reject(0)
- } else {
- if (this.graoid) {
- this.$message({
- message: "年级添加成功!",
- type: "success",
- });
- this.addgradia = false;
- this.opengradia(this.graoid);
- }
- resolve(1)
- }
- })
- .catch((err) => {
- reject(0)
- console.error(err);
- });
- })
- },
-
- Deltype(ind){
- this.editCyInfo.typeL.splice(ind,1)
- },
- Deltag(index,ind){
- this.editCyInfo.typeL[index].children.splice(ind,1)
- },
- Addtag(index){
- this.editCyInfo.typeL[index].children.push({
- id: Date.now(),
- name: '',
- eit:0,
- })
- },
- // 表头的背景色
- headerCellStyle() {
- return { backgroundColor: "#f1f1f1" };
- },
- changeOrg() {
- this.currentPage = 1;
- this.getSchool();
- },
- changeOid() {
- this.currentPage = 1; // 重置当前页
- this.getSchool(); // 调用获取数据的方法
- },
- changeArea() {
- this.currentPage = 1;
- this.getSchool();
- },
- getSchool() {
- let params = [
- {
- functionName: "getSchoolList",
- sName: this.checkOid,
- oName: this.checkOrg,
- area: this.checkArea,
- page: this.currentPage,
- num: this.pageSize,
- },
- ];
- this.$ajax
- .post(API_CONFIG.baseUrl, params)
- .then((res) => {
- // console.log("返回的数据为:", res.data); // 检查返回的数据
- if (res.data && Array.isArray(res.data[0])) {
- // 使用 map() 提取所有组织名称
- this.schoolData = res.data[0];
- if (
- this.schoolData.length > 0 &&
- res.data[0][0] &&
- res.data[0][0].num !== undefined
- ) {
- this.total = res.data[0][0].num; // 使用 num 的值
- } else {
- this.total = 0; // 设置总数为0
- }
- } else {
- this.total = 0; // 如果没有数据,设置总数为0
- }
- })
- .catch((err) => {
- this.$message.error("查询失败");
- console.error("请求失败,错误信息:", err);
- });
- },
- ajax_school() {
- // 构建请求参数
- let params = [
- {
- functionName: "getAllSchool", // 调用存储过程的名称
- },
- ];
- this.$ajax
- .post(API_CONFIG.baseUrl, params)
- .then((res) => {
- // console.log("返回的数据为:", res.data); // 检查返回的数据
- if (res.data && Array.isArray(res.data[0])) {
- this.cn_school = res.data[0].map((item) => ({
- name: item.name,
- id: item.id,
- org: item.org,
- area: item.area,
- }));
- // 将 name 和 org 都存入 cn_school 数组中
- this.schoolList = res.data[0].map((item) => ({
- name: item.name,
- id: item.id,
- org: item.org,
- area: item.area,
- }));
- // console.log(this.schoolList);
- }
- })
- .catch((err) => {
- this.$message.error("查询失败");
- console.error("请求失败,错误信息:", err);
- });
- },
- // 页码扩展按钮
- handlePageChange(page) {
- this.currentPage = page;
- this.getSchool();
- },
- close_add_school() {
- this.add_school_dialog = false;
- },
- close_add_school2() {
- this.add_school_dialog2 = false;
- this.sch_name = ""; // 清空学校名称
- this.school.parentOrgId = ""; // 清空组织选择
- this.region = ""; // 清空地区选择
- this.regionC = "cn";
- this.schoolType = "1"; // 清空学校类型选择
- this.schoolCode = ""; // 清空学校编码
- this.schoolCode2 = ""; // 清空学校编码
- this.schoolDetail = ""; // 清空学校描述
- this.loginPermission = "1"; // 清空登录权限的选择
- },
- close_enable_school() {
- this.enable_school_dialog = false;
- this.useDate = "";
- },
- //组织查询
- ajax_org() {
- const params = [API_CONFIG.ajax_org]; // 使用配置中的接口参数
- this.$ajax
- .post(API_CONFIG.baseUrl, params)
- .then((res) => {
- // console.log("返回的数据为:", res.data); // 检查返回的数据
- if (res.data && Array.isArray(res.data[0])) {
- // 使用 map() 提取所有组织名称
- this.organizations = res.data[0].map((item) => ({
- name: item.name,
- id: item.id,
- }));
- }
- // console.log("返回的结果为:", this.organizations);
- })
- .catch((err) => {
- this.$message.error("查询失败");
- console.error("请求失败,错误信息:", err);
- });
- },
- ajax_add_school() {
- // 校验学校名称是否为空
- if (!this.sch_name || this.sch_name.trim() === "") {
- this.$message.error("学校名称不能为空!");
- return;
- }
- if (this.schoolCode2 && this.schoolCode2.length && this.schoolCode2.length != 4) return this.$message.error("随机码须4位数");
- // 构建请求参数
- let params =
- {
- u_name: this.sch_name, // 学校名称,绑定到 orgName
- u_org: this.school.parentOrgId || "", // 选择的组织的 ID,绑定到 school.parentOrgId,如果没有选择则为空
- u_dest: this.region || "", // 地区,绑定到 region,如果为空则传空字符串
- u_type: this.schoolType || "", // 学校类型,绑定到 schoolType,如果没有选择则为空
- u_code: this.schoolCode || "", // 学校编码,绑定到 schoolCode,如果为空则传空字符串
- u_code2: this.schoolCode2 || "", // 学校随机码,绑定到 schoolCode,如果为空则传空字符串
- u_detail: this.schoolDetail || "", // 学校描述,绑定到 schoolDetail,如果为空则传空字符串
- u_regionC: this.regionC || "",
- u_isLogin: this.loginPermission === "1" ? 1 : 2, // 是否允许登录,默认传 2(不允许登录)如果没有选择
- uid: this.userid,
- };
- // 发起请求
- insert_school3New(params)
- .then(async (res) => {
- // console.log("👉", res.data);
- if (res.data && res.data[0] && res.data[0][0]) {
- if (res.data[0][0].insertId === 1) {
- this.$message({
- type: "error",
- message: "该学校已存在,请重新选择!",
- });
- return;
- } else {
- this.$message({
- type: "success",
- message: "学校添加成功!",
- });
- // if (this.checkedGra.length) {
- // this.batchInstgra(res.data[0][0].insertId)
- // }
- await addOp({
- uid: this.userid,
- cid: "",
- type: "user_op",
- content: `添加了学校 ${this.sch_name}`,
- });
- }
- } else {
- this.$message.error("插入失败,未返回有效结果");
- }
- // 刷新学校列表
- this.getSchool();
- // 关闭弹窗
- this.add_school_dialog = false;
- // 清空输入框、下拉菜单选择和单选框
- this.sch_name = ""; // 清空学校名称
- this.school.parentOrgId = ""; // 清空组织选择
- this.region = ""; // 清空地区选择
- this.schoolDetail = ""; // 清空学校描述
- this.regionC = "cn";
- this.schoolType = "1"; // 清空学校类型选择
- this.schoolCode = ""; // 清空学校编码
- this.schoolCode2 = ""; // 清空学校随机码
- this.loginPermission = "1"; // 清空登录权限的选择
- })
- .catch((err) => {
- this.$message.error("插入失败");
- console.error("请求失败,错误信息:", err);
- });
- },
- update(row) {
- this.nid = row.id;
- this.add_school_dialog2 = true;
- this.sch_name = row.name;
- this.school.parentOrgId = row.org;
- this.region = row.dest;
- this.schoolCode = row.code;
- this.schoolCode2 = row.code2;
- this.schoolDetail = row.detail;
- this.regionC = row.area;
- },
- updateSchool() {
- if (this.schoolCode2 && this.schoolCode2.length && this.schoolCode2.length != 4) return this.$message.error("随机码须4位数");
- let params = [
- {
- functionName: "updateSchool2N",
- id: this.nid,
- name: this.sch_name,
- dest: this.region || '',
- code: this.schoolCode || '',
- code2: this.schoolCode2 || '',
- organ: this.school.parentOrgId || '',
- detail: this.schoolDetail || '',
- area: this.regionC,
- },
- ];
- this.$ajax
- .post(API_CONFIG.baseUrl, params)
- .then(async (res) => {
- console.log("👉", res.data);
- this.add_school_dialog2 = false;
- this.$message({
- message: "修改成功",
- type: "success",
- });
- this.getSchool();
- // 清空输入框、下拉菜单选择和单选框
- this.sch_name = ""; // 清空学校名称
- this.school.parentOrgId = ""; // 清空组织选择
- this.region = ""; // 清空地区选择
- this.schoolDetail = ""; // 清空学校描述
- this.regionC = "cn";
- this.schoolType = "1"; // 清空学校类型选择
- this.schoolCode = ""; // 清空学校编码
- this.schoolCode2 = ""; // 清空学校随机码
- this.loginPermission = "1"; // 清空登录权限的选择
- await addOp({
- uid: this.userid,
- cid: "",
- type: "user_op",
- content: `修改了学校 ${this.sch_name}${this.nid}`,
- });
- })
- .catch((err) => {
- this.$message.error("修改失败");
- console.log(err);
- });
- },
- formatDate() {
- // 使用示例
- const today = new Date(); // 获取当前日期
- const year = today.getFullYear(); // 获取年份
- const month = String(today.getMonth() + 1).padStart(2, '0'); // 获取月份,注意月份从0开始,所以要加1,并确保是两位数
- const day = String(today.getDate()).padStart(2, '0'); // 获取日期,并确保是两位数
- this.useDate = `${year}-${month}-${day}`; // 返回格式化后的日期字符串
- },
- enable(row,action) {
- if (row.isLogin === '2') {
- this.enable_school_dialog = true;
- this.nid = row.id;
- this.dialogAction = action;
- this.formatDate();
- }
- else {
- this.disableSchool(row);
- }
- },
- open_enable_school(row) {
- this.enable_school_dialog = true;
- this.nid = row.id;
- this.dialogAction = 'useDate';
- if (row.isLogin === '1' || row.isLogin === 'null' || row.isLogin === '') {
- this.formatDate();
- } else {
- this.useDate = row.isLogin;
- }
- },
- enable_school() {
- let params = [
- {
- functionName: "enableSchool",
- id: this.nid,
- date: this.useDate
- }
- ];
- this.$ajax
- .post(API_CONFIG.baseUrl, params)
- .then(async (res) => {
- console.log("👉", res.data);
- this.enable_school_dialog = false;
- this.useDate = "";
- if (this.dialogAction === 'enable') {
- this.$message({
- message: '启用成功',
- type: 'success'
- });
- } else if (this.dialogAction === 'useDate') {
- this.$message({
- message: '设置成功',
- type: 'success'
- });
- }
- // this.formatDate();
- this.getSchool();
- await addOp({
- uid: this.userid,
- cid: "",
- type: "user_op",
- content: `启用了学校 ${this.sch_name} ${this.nid}`,
- });
- })
- .catch((err) => {
- this.$message.error("启用失败");
- console.log(err);
- });
- },
- disableSchool(row) {
- let params = [
- {
- functionName: "disableSchool",
- id: row.id,
- },
- ];
- this.$confirm("确定禁用此学校记录吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.$ajax
- .post(API_CONFIG.baseUrl, params)
- .then(async (res) => {
- console.log("👉", res.data);
- this.$message({
- message: '禁用成功',
- type: 'success'
- });
- this.getSchool();
- await addOp({
- uid: this.userid,
- cid: "",
- type: "user_op",
- content: `禁用了学校 ${row.name} ${row.id}`,
- });
- })
- })
- .catch((err) => {
- console.log(err);
- });
- },
- delete_school(row) {
- this.nid = row.id;
- let params = [
- {
- functionName: "deleteSchool",
- id: this.nid,
- },
- ];
- this.$confirm("确定删除此学校记录吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.$ajax.post(API_CONFIG.baseUrl, params).then(async (res) => {
- console.log("👉", res.data);
- this.$message({
- message: "删除成功",
- type: "success",
- });
- this.getSchool();
- await addOp({
- uid: this.userid,
- cid: "",
- type: "user_op",
- content: `删除了学校 ${row.name}${row.id}`,
- });
- });
- })
- .catch((err) => {
- this.$message.error("删除失败");
- console.log(err);
- });
- },
- async getUserId(oid, org) {
- let params = [
- {
- functionName: "select_Suffix", // 调用存储过程的名称
- org: org, //组织id
- oid: oid, //学校id
- },
- ];
- try {
- const res = await this.$ajax.post(API_CONFIG.baseUrl, params);
- console.log("getSuffix", res);
- let data = res.data[0];
- let orgData = res.data[1];
- let ap =
- data.length > 0
- ? data[0].userid
- : orgData.length > 0
- ? orgData[0].userid
- : "";
- return ap;
- } catch (err) {
- console.error("请求失败,错误信息:", err);
- }
- },
- async toPage(row) {
- const oid = row.id;
- const org = row.org;
- let userid = await this.getUserId(oid, org);
- await addOp({
- uid: this.userid,
- cid: "",
- type: "user_op",
- content: `点击了批量添加 ${row.name}${row.id}`,
- });
- const url = `https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/?#/teacher?userid=${userid ? userid : this.userid
- }&oid=${oid}&org=${org}`;
- window.open(url, "_blank");
- },
- permissionSetting(data) {
- this.$refs.permissionSettingDialogRef.open(data, "school");
- },
- // 打开添加社区弹框,
- addcommunityL(val){
- console.log('val',val);
- this.cyInfo = val
- this.getCy()
- this.dialogcommunity = true
- },
- // 打开添加社区获取已添加的社区列表
- getCy(){
- this.cyloading = true;
- let params = {
- oid: this.cyInfo.id,
- n: '', //预留搜索框
- page: 1,
- num: 10000,
- };
- getcylist(params)
- .then(async (res) => {
- console.log(res);
- let data = res.data[0]
- data.forEach(e => {
-
- if (e.evatime) {
- e.evatime = JSON.parse(e.evatime)
- e.evatime2 = e.evatime.map(dateStr => this.formatDateCy(dateStr)).join('——')
- }
- e.typeL = e.typeL ? JSON.parse(e.typeL) : '';
- });
- this.cytableData = data
- console.log('this.cytableData',this.cytableData);
-
- this.cyloading = false;
- })
- .catch((error) => {
- this.cyloading = false;
- console.error("请求失败,错误信息:", error);
- });
- },
- formatDateCy(dateStr, format = 'YYYY-MM-DD HH:mm:ss') {
- const date = new Date(dateStr);
-
- const pad = (num) => num.toString().padStart(2, '0');
-
- const year = date.getFullYear();
- const month = pad(date.getMonth() + 1);
- const day = pad(date.getDate());
- const hours = pad(date.getHours());
- const minutes = pad(date.getMinutes());
- const seconds = pad(date.getSeconds());
-
- return format
- .replace('YYYY', year)
- .replace('MM', month)
- .replace('DD', day)
- .replace('HH', hours)
- .replace('mm', minutes)
- .replace('ss', seconds);
- },
- // 禁用启用社区
- editOpen(val){
- this.cyloading = true
- let open = val.isopen ? '0' : '1'
- let params = {
- idL: val.id,
- op: open
- };
- console.log('params',params);
-
- updateCyOP(params)
- .then(async (response) => {
- if (response) {
- await addOp({
- uid: this.userid,
- cid: "",
- type: "user_op",
- content: `${open ? '禁用' : '启用'}了${val.name}社区`,
- });
- this.$message({
- type: "success",
- message: "修改成功",
- });
- this.cyloading = false
- this.getCy()
- }
- })
- .catch((error) => {
- this.cyloading = false
- console.error("请求失败,错误信息:", error);
- });
- },
- // 点击添加社区 0 是添加社区 1是修改社区信息
- editCy(val,row){
- console.log('row',row);
-
- this.isedit = val
- if (val == 1) {
- let kol = JSON.parse(JSON.stringify(row))
- if (kol && !kol.typeL) {
- kol.typeL = []
- }
- this.editCyInfo = kol
- }
- this.dialogcyADD = true
- },
- // 添加组织社区
- AddCy(){
- if (!this.editCyInfo.name) return this.$message.error('请添加名称')
- let params = {
- uid:this.userid,
- nam: this.editCyInfo.name,
- oid:this.cyInfo.id,
- ban: this.editCyInfo.banner,
- eva: this.editCyInfo.evatime ? JSON.stringify(this.editCyInfo.evatime) : '',
- typ: (this.editCyInfo.typeL && this.editCyInfo.typeL.length) ? JSON.stringify(this.editCyInfo.typeL) : '',
- };
- addCommunity(params)
- .then(async (response) => {
- if (response) {
- console.log('response',response);
-
- await addOp({
- uid: this.userid,
- cid: "",
- type: "user_op",
- content: `添加了${this.editCyInfo.name}社区`,
- });
- this.$message({
- type: "success",
- message: "添加成功",
- });
- this.dialogcyADD = false;
- this.getCy()
- this.editCyInfo = {name:'',banner:'',evatime:'',typeL:[]};
- }
- })
- .catch((error) => {
- console.error("请求失败,错误信息:", error);
- });
- },
- // 修改社区信息
- updateCy(){
- if (!this.editCyInfo.name) return this.$message.error('请添加名称')
- let params = {
- idL:this.editCyInfo.id,
- nam: this.editCyInfo.name,
- ban: this.editCyInfo.banner,
- eva: this.editCyInfo.evatime ? JSON.stringify(this.editCyInfo.evatime) : '',
- typ: (this.editCyInfo.typeL && this.editCyInfo.typeL.length) ? JSON.stringify(this.editCyInfo.typeL) : '',
- };
- console.log('params',params);
- updateCommunity(params)
- .then(async (response) => {
- if (response) {
- console.log('response',response);
-
- await addOp({
- uid: this.userid,
- cid: "",
- type: "user_op",
- content: `修改了${this.editCyInfo.name}社区`,
- });
- this.$message({
- type: "success",
- message: "修改成功",
- });
- this.dialogcyADD = false;
- this.getCy()
- this.editCyInfo = {name:'',banner:'',evatime:'',typeL:[]};
- }
- })
- .catch((error) => {
- console.error("请求失败,错误信息:", error);
- });
- },
- // 删除社区
- delete_Cy(val){
- this.$confirm("确定删除吗?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- let params = {
- idL:val.id
- };
- console.log('params',params);
-
- delCommunity(params)
- .then(async (response) => {
- if (response) {
- console.log('response',response);
-
- await addOp({
- uid: this.userid,
- cid: "",
- type: "user_op",
- content: `删除了${val.name}社区`,
- });
- this.$message({
- type: "success",
- message: "删除成功",
- });
- this.getCy()
- }
- })
- })
- .catch(() => {});
- },
- async cyImgAdd(){
- let _url = await this.uploadFile("image/*");
- this.editCyInfo.banner = _url
- },
- // 清除照片
- delImg(){
- this.editCyInfo.banner = ''
- },
- // 全选
- handleCheckAllChange2(val){
- this.checkboxList3 = val ? this.teacherJuri.map(e=>e.userid) : [];
- this.checkAll = val
- // console.log('this.checkboxList3',this.checkboxList3);
- },
- // 单选
- handleCheckedCitiesChange(value){
- let checkedCount = value.length;
- this.checkAll = checkedCount === this.teacherJuri.length;
- // console.log('this.checkboxList3',this.checkboxList3);
- },
- // 添加社区人员
- addcyperson(){
- console.log('ok');
- let params = {
- id:this.editCyInfo.id,
- tea:this.checkboxList3.join(','),
- };
- console.log('params',params);
-
- updateCommunityperson(params)
- .then(async (response) => {
- if (response) {
- console.log('response',response);
-
- await addOp({
- uid: this.userid,
- cid: "",
- type: "user_op",
- content: `修改了${this.editCyInfo.name}社区人员`,
- });
- this.$message({
- type: "success",
- message: "修改成功",
- });
- this.lookCy(this.editCyInfo)
- this.dialogaddCyperson = false;
- }
- })
- .catch((error) => {
- console.error("请求失败,错误信息:", error);
- });
- },
- // 移出社区人员
- removeCyperson(val){
- console.log(val);
- this.$confirm("确定移出吗?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- let person = this.cypersontableData.filter(e=> e.userid != val.userid).map(e=>e.userid)
- console.log('person',person);
-
- let params = {
- id:this.editCyInfo.id,
- tea: person.join(','),
- };
- console.log('params',params);
-
- updateCommunityperson(params)
- .then(async (response) => {
- if (response) {
- console.log('response',response);
-
- await addOp({
- uid: this.userid,
- cid: "",
- type: "user_op",
- content: `移出了${this.editCyInfo.name}社区${val.userid}人员`,
- });
- this.$message({
- type: "success",
- message: "移出成功",
- });
- this.dialogaddCyperson = false;
- this.lookCy(this.editCyInfo)
- }
- })
- })
- .catch(() => {});
- },
- // 查看社区人员
- lookCy(val){
- this.editCyInfo = val;
- this.dialogcyperson = true;
- this.cypersonloading = true;
-
- let params = {
- id: val.id,
- };
-
- getcypersonlist(params)
- .then(async (res) => {
- console.log(res);
- this.cypersonloading = false;
- this.cypersontableData = res.data[0]
- })
- .catch((error) => {
- this.cypersonloading = false;
- console.error("请求失败,错误信息:", error);
- });
- },
- // 添加社区人员获取人员列表
- getTeacher() {
- let params = {
- oid: this.cyInfo.org ? this.cyInfo.org : this.cyInfo.id,
- inp: this.searchTN,
- page: 1,
- num: 10
- };
-
- getAddcyPersonlist(params)
- .then(async (res) => {
- console.log(res);
- this.teacherJuri = res.data[0];
- this.checkboxList3 = this.cypersontableData.map(e=> e.userid)
- this.dialogaddCyperson = true
-
- })
- .catch((error) => {
- console.error("请求失败,错误信息:", error);
- });
- },
- uploadFile(accept = "*") {
- return new Promise((resolve) => {
- const input = document.createElement("input");
- input.type = "file";
- input.accept = accept;
- input.onchange = (event) => {
- const file = event.target.files[0];
- if (file) {
- let credentials = {
- accessKeyId: "AKIATLPEDU37QV5CHLMH",
- secretAccessKey: "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",
- }; //秘钥形式的登录上传
- window.AWS.config.update(credentials);
- window.AWS.config.region = "cn-northwest-1"; //设置区域
- let bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
- // let _name = file.name;
- // let size = file.size;
- let params = {
- Key:
- file.name.split(".")[0] +
- new Date().getTime() +
- "." +
- file.name.split(".")[file.name.split(".").length - 1],
- ContentType: file.type,
- Body: file,
- "Access-Control-Allow-Credentials": "*",
- ACL: "public-read",
- }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
- let options = {
- partSize: 2048 * 1024 * 1024,
- queueSize: 2,
- leavePartsOnError: true,
- };
- bucket
- .upload(params, options)
- .on("httpUploadProgress", (evt) => {
- console.log(evt);
- })
- .send((err, data) => {
- if (err) {
- this.$message.error("上传失败");
- return resolve("");
- } else {
- return resolve(data.Location);
- }
- });
- } else {
- resolve("");
- }
- };
- input.click();
- });
- },
- handleClose(done){
- done();
- },
- handleClose2(){
- this.editCyInfo = ''
- this.editCyInfo = {name:'',banner:'',evatime:'',typeL:[]};
- this.dialogcyADD=false;
- this.dialogcyperson = false
- }
- },
- mounted() {
- this.getSchool();
- this.ajax_org();
- this.ajax_school();
- },
- computed: {
- ...mapGetters(["userid"]),
- enableDiaTitle() {
- return this.dialogAction === 'enable' ? '启用学校' : '设置使用期限'
- }
- },
- };
- </script>
- <style scoped>
- .list_container {
- width: 100%;
- height: 100%;
- padding: 10px;
- box-sizing: border-box;
- overflow: auto;
- }
- /* 新增学校的内容容器 */
- .el_dialog_school_content {
- color: #606266;
- font-size: 14px;
- /* height: 300px; */
- }
- .el-form-item {
- margin-bottom: 22px;
- display: flex;
- align-items: center;
- /* border: 1px solid black; */
- }
- .el-form-item__label {
- font-size: 14px;
- color: #606266;
- line-height: 40px;
- margin-left: 20px;
- width: 70px;
- }
- .el-form-item__content {
- line-height: 40px;
- position: relative;
- font-size: 14px;
- }
- .table>>>.el-dialog__header {
- padding: 15px 20px;
- background: #454545;
- }
- .table>>>.el-dialog__title {
- color: #fff;
- }
- .tableBox {
- margin: 10px 0;
- }
- .operate {
- display: flex;
- gap: 5px;
- }
- .operate button {
- background: none;
- border: none;
- cursor: pointer;
- color: #308fff;
- }
- .cyConTit{
- display: flex;
- justify-content: space-between;
- }
- .addNewPP >>> .el-dialog__body {
- padding: 5px 20px;
- }
- .addNewPP >>> .el-dialog {
- margin-top: 5vh !important;
- }
- .customWidth >>> .el-dialog {
- min-width: 500px !important;
- }
- .people {
- border: 1px solid rgb(229 229 229);
- /* height: 495px; */
- height: 350px;
- border-radius: 5px;
- width: 100%;
- overflow: auto;
- }
- .people_top {
- display: flex;
- width: 100%;
- /* justify-content: space-between; */
- /* align-items: center; */
- flex-direction: column;
- padding: 10px 10px 0;
- box-sizing: border-box;
- }
- .people_top_right {
- height: 40px;
- margin-bottom: 10px;
- }
- .people_search {
- display: flex;
- position: relative;
- }
- .people_search >>> .el-input__inner {
- /* height: 25px; */
- width: 100%;
- }
- .search_img {
- width: 20px;
- height: 20px;
- position: absolute;
- right: 10px;
- top: 50%;
- transform: translateY(-50%);
- }
- .search_img > img {
- width: 100%;
- height: 100%;
- }
- .people_name {
- display: flex;
- justify-content: flex-start;
- padding: 20px 10px;
- flex-direction: column;
- flex-wrap: wrap;
- }
- .people_name >>> .el-checkbox {
- width: 100%;
- display: flex;
- align-items: center;
- margin-bottom: 10px;
- }
- .people_name >>> .el-checkbox__label {
- text-overflow: ellipsis;
- overflow: hidden;
- width: calc(100%);
- }
- .t_j_box{
- display: flex;
- justify-content: space-between;
- }
- .t_j_box div{
- width: 100px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .cha{
- position: absolute;top: 0;right: 5px;
- cursor: pointer;
- }
- .custom-tree-node {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: 14px;
- padding-right: 8px;
- }
- .tagL{
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- gap: 2px;
- }
- .tagL >>> .el-input__inner{
- height: 30px;
- line-height: 30px;
- width: 120px;
- }
- .tagL span{
- background: aqua;
- padding: 5px 3px;
- border-radius: 5px;
- flex-shrink: 0;
- }
- .btn{
- cursor: pointer;
- display: flex;
- align-items: center;
- }
- .bigtype{
- display: flex;
- align-items: center;
- gap: 10px;
- }
- .bigtype >>> .el-input__inner{
- height: 30px;
- line-height: 30px;
- width: 120px;
- }
- .typeArea{
- border: 1px #ccc solid;padding: 5px;border-radius: 10px;
- }
- .alltype{
- margin-top: 10px;
- display: flex;
- flex-direction: column;
- gap: 15px;
- }
- .flexcol{
- display: flex;
- flex-direction: column;
- gap: 10px;
- }
- </style>
|