| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025 |
- <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(addCyperType)">添加人员</el-button>
- </div>
- <el-table
- :data="cypersontableData"
- style="width: 100%"
- height="600"
- 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="cypersonBox" v-loading="addcyPerloading">
- <div class="cypersonBoxLeft">
- <span @click="getTeacher(1)" :class="addCyperType == 1 ? 'cybck' : '' ">教师</span>
- <span @click="getTeacher(2)" :class="addCyperType == 2 ? 'cybck' : '' ">学生</span>
- </div>
- <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(addCyperType)"
- ></el-input>
- <div class="search_img" @click="getTeacher(addCyperType)">
- <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>
- </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 {
- addcyPerloading:false,
- gracheckAll: false,
- checkedGra: [],
- gralist: ['一年级','二年级','三年级','四年级','五年级','六年级','七年级','八年级','九年级','高一','高二','高三'],
- graisInde: false, //年级全选按钮
- gradia:false,
- addgradia:false,
- graloading:false,
- gratotal:0,
- grapage:1,
- gratab:[],
- graName:'',
- graoid:'',
- graclaid:'',
- addCyperType: 1, //1教师 2学生
- 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(val = 1) {
- this.addCyperType = val
- this.addcyPerloading= true
- let params = {
- oid: this.cyInfo.org ? this.cyInfo.org : this.cyInfo.id,
- inp: this.searchTN,
- typ: this.addCyperType,
- 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
- this.addcyPerloading= false
- })
- .catch((error) => {
- this.addcyPerloading= false
- 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;
- }
- .cypersonBox{
- display: flex;
- gap: 5px;
- }
- .cypersonBoxLeft{
- display: flex;
- flex-direction: column;
- gap: 5px;
- width: 100px;
- }
- .cypersonBox span{
- width: 100%;
- padding: 10px 0;
- text-align: center;
- border-radius: 5px;
- cursor: pointer;
- }
- .cybck{
- background: #308fff;
- color: #fff;
- }
- </style>
|