index.vue 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!--部门数据-->
  5. <el-col :span="2" :xs="24">
  6. <div class="head-container">
  7. <el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search" style="margin-bottom: 20px" />
  8. </div>
  9. <div class="head-container">
  10. <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" @node-click="handleNodeClick" />
  11. </div>
  12. </el-col>
  13. <!--用户数据-->
  14. <el-col :span="22" :xs="24">
  15. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  16. <el-form-item label="ID" prop="userId">
  17. <el-input v-model="queryParams.userId" placeholder="请输入员工ID" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery" />
  18. </el-form-item>
  19. <el-form-item label="员工后台昵称" prop="nickName">
  20. <el-input v-model="queryParams.nickName" placeholder="请输入员工后台昵称" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery" />
  21. </el-form-item>
  22. <el-form-item label="手机号码" prop="phonenumber">
  23. <el-input v-model="queryParams.phonenumber" placeholder="请输入手机号码" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery" />
  24. </el-form-item>
  25. <el-form-item label="状态" prop="status">
  26. <el-select v-model="queryParams.status" placeholder="员工状态" clearable size="small" style="width: 240px" @change="handleQuery">
  27. <el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item label="企微状态" prop="qwStatus">
  31. <el-select v-model="queryParams.qwStatus" placeholder="企微绑定状态" clearable size="small" style="width: 240px" @change="handleQuery">
  32. <el-option v-for="dict in qwStatusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="创建时间">
  36. <el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  37. </el-form-item>
  38. <el-form-item>
  39. <el-button icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  40. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  41. </el-form-item>
  42. </el-form>
  43. <el-row :gutter="10" class="mb8">
  44. <el-col :span="1.5">
  45. <el-button plain type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['company:user:add']">新增</el-button>
  46. </el-col>
  47. <el-col :span="1.5">
  48. <el-button plain type="success" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['company:user:edit']">修改</el-button>
  49. </el-col>
  50. <el-col :span="1.5">
  51. <el-button plain type="success" icon="el-icon-edit" size="mini" :disabled="multiple" @click="batchEditRole"v-hasPermi="['company:user:edit']">批量修改角色</el-button>
  52. </el-col>
  53. <el-col :span="1.5">
  54. <el-button plain type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['company:user:remove']">删除</el-button>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button plain type="info" icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['company:user:import']">导入</el-button>
  58. </el-col>
  59. <el-col :span="1.5">
  60. <el-button plain type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['company:user:export']">导出</el-button>
  61. </el-col>
  62. <el-col :span="1.5">
  63. <el-button
  64. type="primary"
  65. plain
  66. size="mini"
  67. @click="synOpen=true"
  68. v-hasPermi="['qw:user:sync']"
  69. >同步企微员工和部门</el-button>
  70. </el-col>
  71. <el-col :span="1.5">
  72. <el-button
  73. type="primary"
  74. plain
  75. size="mini"
  76. @click="synNameOpen=true"
  77. v-hasPermi="['qw:user:sync']"
  78. >同步企微员工名称</el-button>
  79. </el-col>
  80. <el-col :span="1.5">
  81. <el-button
  82. type="primary"
  83. plain
  84. size="mini"
  85. :disabled="multiple"
  86. @click="handerCompanyUserAreaList"
  87. >批量设置销售所属区域</el-button>
  88. </el-col>
  89. <el-col :span="1.5">
  90. <el-button
  91. type="primary"
  92. plain
  93. size="mini"
  94. :disabled="multiple"
  95. @click="handleSetRegister"
  96. >设置单独注册会员</el-button>
  97. </el-col>
  98. <el-col :span="1.5">
  99. <el-button
  100. type="primary"
  101. plain
  102. size="mini"
  103. :disabled="multiple"
  104. @click="handleAllowedAllRegister"
  105. >允许注册会员开关</el-button>
  106. </el-col>
  107. <el-col :span="1.5">
  108. <el-button
  109. type="primary"
  110. plain
  111. size="mini"
  112. @click="handleBindCompanyUserCode"
  113. >生成注册/绑定销售二维码</el-button>
  114. </el-col>
  115. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  116. </el-row>
  117. <el-table height="500" border v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
  118. <el-table-column type="selection" width="50" align="center" />
  119. <el-table-column label="ID" align="center" prop="userId" :show-overflow-tooltip="true" />
  120. <el-table-column label="员工后台账号" align="center" prop="userName" :show-overflow-tooltip="true" width="100" />
  121. <el-table-column label="员工后台昵称" align="center" prop="nickName" :show-overflow-tooltip="true" 员工后台 width="100"/>
  122. <el-table-column label="部门" align="center" prop="deptName" :show-overflow-tooltip="true" />
  123. <el-table-column label="手机号码" align="center" prop="phonenumber" width="120" />
  124. <el-table-column label="账户角色" align="center" :show-overflow-tooltip="true" width="150">
  125. <template slot-scope="scope">
  126. <span v-if="scope.row.roleNames && scope.row.roleNames.length > 0">
  127. {{ scope.row.roleNames.join('、') }}
  128. </span>
  129. <span v-else>-</span>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="二维码" align="center" prop="qrCodeWeixin">
  133. <template slot-scope="scope">
  134. <!-- 显示已上传的二维码 -->
  135. <el-image
  136. v-if="scope.row.qrCodeWeixin"
  137. style="width: 80px; height: 80px; margin-bottom: 5px; display: block; margin-left: auto; margin-right: auto;"
  138. :src="scope.row.qrCodeWeixin"
  139. :preview-src-list="[scope.row.qrCodeWeixin]"
  140. fit="contain">
  141. <div slot="error" class="image-slot">
  142. <i class="el-icon-picture-outline"></i>
  143. </div>
  144. </el-image>
  145. <!-- 上传组件 -->
  146. <el-upload
  147. class="avatar-uploader"
  148. action="#"
  149. :show-file-list="false"
  150. :http-request="(options) => handleCustomUpload(options, scope.row)"
  151. :before-upload="(file) => beforeImageUpload(file, scope.row)"
  152. >
  153. <el-button size="small" type="primary" :loading="scope.row.uploading">
  154. {{ scope.row.qrCodeWeixin ? '更换图片' : '上传图片' }}
  155. <i class="el-icon-upload el-icon--right"></i>
  156. </el-button>
  157. </el-upload>
  158. <div v-if="scope.row.uploadError" class="el-upload__tip" style="color: red;">
  159. {{ scope.row.uploadError }}
  160. </div>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="状态" align="center">
  164. <template slot-scope="scope">
  165. <el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
  166. </template>
  167. </el-table-column>
  168. <el-table-column label="企微状态" align="center">
  169. <template slot-scope="scope">
  170. <dict-tag :options="qwStatusOptions" :value="scope.row.qwStatus"/>
  171. </template>
  172. </el-table-column>
  173. <el-table-column label="绑定的企微号" align="center">
  174. <template slot-scope="scope">
  175. <div v-if="scope.row.qwUsers && scope.row.qwUsers.length > 0">
  176. <div v-for="user in scope.row.qwUsers" :key="user.id">
  177. <el-tag size="mini">{{ user.qwUserName }}</el-tag>
  178. </div>
  179. </div>
  180. <div v-else>
  181. <dict-tag :options="qwStatusOptions" :value="scope.row.qwStatus"/>
  182. </div>
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="区域" align="center" prop="addressId">
  186. </el-table-column>
  187. <el-table-column label="创建时间" sortable align="center" prop="createTime" width="160">
  188. <template slot-scope="scope">
  189. <span>{{ parseTime(scope.row.createTime) }}</span>
  190. </template>
  191. </el-table-column>
  192. <el-table-column label="是否单独注册会员" align="center" prop="isNeedRegisterMember" width="80px">
  193. <template slot-scope="scope">
  194. <el-tag
  195. :type="scope.row.isNeedRegisterMember === 1 ? 'success' : 'info'">{{scope.row.isNeedRegisterMember === 1 ? '是' : '否' }}</el-tag>
  196. </template>
  197. </el-table-column>
  198. <el-table-column label="允许注册会员" align="center" prop="isNeedRegisterMember" width="80px">
  199. <template slot-scope="scope">
  200. <el-tag
  201. :type="scope.row.isAllowedAllRegister === 1 ? 'success' : 'info'">{{scope.row.isAllowedAllRegister === 1 ? '是' : '否' }}</el-tag>
  202. </template>
  203. </el-table-column>
  204. <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
  205. <template slot-scope="scope">
  206. <el-button
  207. size="mini"
  208. type="text"
  209. icon="el-icon-connection"
  210. plain
  211. v-if="scope.row.doctorId!=null"
  212. @click="handleUpdateDoctor(scope.row)"
  213. >换绑医生</el-button>
  214. <el-button
  215. size="mini"
  216. type="text"
  217. plain
  218. icon="el-icon-link"
  219. v-else
  220. @click="handleUpdateDoctor(scope.row)"
  221. >绑定医生</el-button>
  222. <el-button
  223. size="mini"
  224. type="text"
  225. icon="el-icon-unlock"
  226. plain
  227. v-if="scope.row.doctorId!=null"
  228. @click="handleUnBindUserId(scope.row)"
  229. >解绑医生</el-button>
  230. <el-button
  231. v-if="scope.row.qwStatus == 0"
  232. size="mini"
  233. type="text"
  234. icon="el-icon-edit"
  235. @click="qwBind(scope.row)"
  236. v-hasPermi="['qw:user:bind']"
  237. >绑定企微</el-button>
  238. <el-button
  239. v-else
  240. size="mini"
  241. type="text"
  242. icon="el-icon-edit"
  243. @click="qwBind(scope.row)"
  244. v-hasPermi="['qw:user:bind']"
  245. >查或换绑企微</el-button>
  246. <el-button
  247. size="mini"
  248. type="text"
  249. icon="el-icon-user"
  250. plain
  251. @click="handleBindUser(scope.row)"
  252. >绑定用户</el-button>
  253. <el-button v-if="scope.row.userType !== '00'" size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['company:user:edit']">修改</el-button>
  254. <el-button v-if="scope.row.userType !== '00'" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['company:user:remove']">删除</el-button>
  255. <el-button size="mini" type="text" icon="el-icon-key" @click="handleResetPwd(scope.row)" v-hasPermi="['company:user:resetPwd']">重置密码</el-button>
  256. </template>
  257. </el-table-column>
  258. </el-table>
  259. <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  260. </el-col>
  261. </el-row>
  262. <!-- 批量修改角色对话框 -->
  263. <el-dialog title="批量修改角色" :visible.sync="batchRoleDialogVisible" width="500px" append-to-body>
  264. <el-form :model="batchRoleForm" label-width="80px">
  265. <el-form-item label="选择角色">
  266. <el-select v-model="selectedRoleIds" multiple placeholder="请选择角色" style="width: 100%;">
  267. <el-option
  268. v-for="item in roleOptions"
  269. :key="item.roleId"
  270. :label="item.roleName"
  271. :value="item.roleId">
  272. </el-option>
  273. </el-select>
  274. </el-form-item>
  275. </el-form>
  276. <div slot="footer" class="dialog-footer">
  277. <el-button @click="batchRoleDialogVisible = false">取 消</el-button>
  278. <el-button type="primary" @click="submitBatchRoles">确 定</el-button>
  279. </div>
  280. </el-dialog>
  281. <!--当点击查或换绑微信时候弹出此框-->
  282. <el-dialog title="绑定企微账号" :visible.sync="qwOpen" width="800px" append-to-body >
  283. <el-form ref="form" :model="form" label-width="80px" >
  284. <el-form-item label="查询" prop="companyUserId">
  285. <el-button type="primary" icon="el-icon-search" @click="selectQwUser()" size="mini">搜索账号</el-button>
  286. </el-form-item>
  287. <el-form-item label="企微账号" prop="companyUserId">
  288. <el-tag
  289. style="margin-left: 5px"
  290. size="medium"
  291. :key="id"
  292. v-for="id in qwUser"
  293. closable
  294. :disable-transitions="false"
  295. @close="handleClosegroupUser(id)">
  296. <span v-for="list in qwUserList" :key="list.qwUserId" v-if="list.id==id">{{list.qwUserName}}({{list.corpName}})
  297. </span>
  298. </el-tag>
  299. </el-form-item>
  300. </el-form>
  301. <div slot="footer" class="dialog-footer">
  302. <el-button type="primary" @click="qwSubmitForm">绑 定</el-button>
  303. <el-button @click="qwCancel">取 消</el-button>
  304. </div>
  305. </el-dialog>
  306. <el-dialog title="选择企微主体" :visible.sync="synOpen" width="800px" append-to-body>
  307. <el-form label-width="80px">
  308. <el-form-item label="企微公司" prop="corpId">
  309. <el-select v-model="synform.corpId" placeholder="企微公司" >
  310. <el-option
  311. v-for="dict in myQwCompanyList"
  312. :key="dict.dictValue"
  313. :label="dict.dictLabel"
  314. :value="dict.dictValue"
  315. />
  316. </el-select>
  317. </el-form-item>
  318. </el-form>
  319. <div slot="footer" class="dialog-footer">
  320. <el-button type="primary" @click="synSubmitForm">确 定</el-button>
  321. <el-button @click="synOpen=false">取 消</el-button>
  322. </div>
  323. </el-dialog>
  324. <el-dialog title="选择企微主体" :visible.sync="synNameOpen" width="800px" append-to-body>
  325. <el-form label-width="80px">
  326. <el-form-item label="企微公司" prop="corpId">
  327. <el-select v-model="synNameform.corpId" placeholder="企微公司" >
  328. <el-option
  329. v-for="dict in myQwCompanyList"
  330. :key="dict.dictValue"
  331. :label="dict.dictLabel"
  332. :value="dict.dictValue"
  333. />
  334. </el-select>
  335. </el-form-item>
  336. </el-form>
  337. <div slot="footer" class="dialog-footer">
  338. <el-button type="primary" @click="synNameSubmitForm">确 定</el-button>
  339. <el-button @click="synNameOpen=false">取 消</el-button>
  340. </div>
  341. </el-dialog>
  342. <!-- 添加或修改参数配置对话框 -->
  343. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
  344. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  345. <el-row>
  346. <el-col :span="12">
  347. <!-- <el-form-item label="员工账号" prop="userName">-->
  348. <!-- <el-input v-model="form.userName" placeholder="请输入员工后台账号" />-->
  349. <!-- </el-form-item>-->
  350. <el-form-item label="员工姓名" prop="nickName">
  351. <el-input v-model="form.nickName" placeholder="请输入员工后台昵称" />
  352. </el-form-item>
  353. </el-col>
  354. <el-col :span="12">
  355. <el-form-item label="归属部门" prop="deptId">
  356. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
  357. </el-form-item>
  358. </el-col>
  359. </el-row>
  360. <el-row>
  361. <el-col :span="12">
  362. <el-form-item label="手机号码" prop="phonenumber">
  363. <el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" />
  364. </el-form-item>
  365. </el-col>
  366. <el-col :span="12">
  367. <el-form-item label="邮箱" prop="email">
  368. <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
  369. </el-form-item>
  370. </el-col>
  371. </el-row>
  372. <el-row>
  373. <el-col :span="12">
  374. <el-form-item label="员工账号" prop="userName">
  375. <el-input v-model="form.userName" placeholder="请输入员工工号" />
  376. </el-form-item>
  377. </el-col>
  378. <el-col :span="12">
  379. <el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
  380. <el-input v-model="form.password" placeholder="请输入用户密码" type="password" show-password />
  381. </el-form-item>
  382. </el-col>
  383. </el-row>
  384. <el-row>
  385. <el-col :span="12">
  386. <el-form-item label="员工性别">
  387. <el-select v-model="form.sex" placeholder="请选择">
  388. <el-option v-for="dict in sexOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option>
  389. </el-select>
  390. </el-form-item>
  391. </el-col>
  392. <el-col :span="12">
  393. <el-form-item label="状态">
  394. <el-radio-group v-model="form.status">
  395. <el-radio v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictValue">{{dict.dictLabel}}</el-radio>
  396. </el-radio-group>
  397. </el-form-item>
  398. </el-col>
  399. </el-row>
  400. <el-row>
  401. <el-col :span="12">
  402. <el-form-item label="岗位">
  403. <el-select v-model="form.postIds" multiple placeholder="请选择">
  404. <el-option v-for="item in postOptions" :key="item.postId" :label="item.postName" :value="item.postId" :disabled="item.status == 1"></el-option>
  405. </el-select>
  406. </el-form-item>
  407. </el-col>
  408. <el-col :span="12">
  409. <el-form-item label="角色">
  410. <el-select v-model="form.roleIds" multiple placeholder="请选择">
  411. <el-option v-for="item in roleOptions" :key="item.roleId" :label="item.roleName" :value="item.roleId" :disabled="item.status == 1"></el-option>
  412. </el-select>
  413. </el-form-item>
  414. </el-col>
  415. </el-row>
  416. <el-row>
  417. <el-col :span="12">
  418. <el-form-item label="身份证号">
  419. <el-input v-model="form.idCard" placeholder="请输入身份证号" maxlength="18" />
  420. </el-form-item>
  421. </el-col>
  422. <el-col :span="12">
  423. <el-form-item label="销售区域" prop="addressId">
  424. <el-select v-model="form.addressId" filterable placeholder="请选择所属销售的区域" style="width: 200px;">
  425. <el-option
  426. v-for="item in citysAreaList"
  427. :key="item.cityId"
  428. :label="item.cityName"
  429. :value="item.cityId"
  430. ></el-option>
  431. </el-select>
  432. </el-form-item>
  433. </el-col>
  434. </el-row>
  435. <!-- <el-row>-->
  436. <!-- <el-col :span="24">-->
  437. <!-- <el-form-item label="数据权限">-->
  438. <!-- <el-radio-group v-model="form.userType">-->
  439. <!-- <el-radio v-for="dict in userTypeOptions" :key="dict.dictValue" :label="dict.dictValue">{{dict.dictLabel}}</el-radio>-->
  440. <!-- </el-radio-group>-->
  441. <!-- </el-form-item>-->
  442. <!-- </el-col>-->
  443. <!-- </el-row>-->
  444. <!-- <el-row>
  445. <el-col :span="24">
  446. <el-form-item label="看课域名">
  447. <el-input
  448. v-model="form.domain"
  449. style="width: 250px"
  450. placeholder="请生成域名"
  451. @change="onDomainBlur"
  452. disabled
  453. ></el-input>
  454. <el-button type="primary" style="margin-left: 20px" @click="generateDomain">生成域名</el-button>
  455. </el-form-item>
  456. </el-col>
  457. </el-row>-->
  458. <el-row>
  459. <el-col :span="24">
  460. <el-form-item label="备注">
  461. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
  462. </el-form-item>
  463. </el-col>
  464. </el-row>
  465. </el-form>
  466. <div slot="footer" class="dialog-footer">
  467. <el-button type="primary" @click="submitForm">确 定</el-button>
  468. <el-button @click="cancel">取 消</el-button>
  469. </div>
  470. </el-dialog>
  471. <el-dialog :title="title" :visible.sync="bindCompanyOpen" width="700px" append-to-body>
  472. <el-form ref="formBindCompany" :model="formBindCompany" :rules="bindCompanyRules" label-width="80px">
  473. <el-row>
  474. <el-col :span="12">
  475. <el-form-item label="企微主体" prop="corpId">
  476. <el-select v-model="formBindCompany.corpId" placeholder="企微主体" size="small">
  477. <el-option
  478. v-for="dict in myQwCompanyList"
  479. :key="dict.dictValue"
  480. :label="dict.dictLabel"
  481. :value="dict.dictValue"
  482. />
  483. </el-select>
  484. </el-form-item>
  485. </el-col>
  486. </el-row>
  487. <el-row>
  488. <el-col :span="12">
  489. <el-form-item label="归属部门" prop="deptId">
  490. <treeselect v-model="formBindCompany.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
  491. </el-form-item>
  492. </el-col>
  493. </el-row>
  494. <el-row>
  495. <el-col :span="12">
  496. <el-form-item label="角色" prop="roleIds">
  497. <el-select v-model="formBindCompany.roleIds" multiple placeholder="请选择">
  498. <el-option v-for="item in roleOptions" :key="item.roleId" :label="item.roleName" :value="item.roleId "></el-option>
  499. </el-select>
  500. </el-form-item>
  501. </el-col>
  502. </el-row>
  503. <el-row>
  504. <el-col :span="12">
  505. <el-form-item label="销售区域" prop="addressId">
  506. <el-select v-model="formBindCompany.addressId" filterable placeholder="请选择所属销售的区域" style="width: 200px;">
  507. <el-option
  508. v-for="item in citysAreaList"
  509. :key="item.cityId"
  510. :label="item.cityName"
  511. :value="item.cityId"
  512. ></el-option>
  513. </el-select>
  514. </el-form-item>
  515. </el-col>
  516. </el-row>
  517. </el-form>
  518. <div slot="footer" class="dialog-footer">
  519. <el-button type="primary" @click="submitBingCompanyForm">确 定</el-button>
  520. <el-button @click="cancelBind">取 消</el-button>
  521. </div>
  522. </el-dialog>
  523. <!-- 修改 selectUser 组件的引用 -->
  524. <el-dialog :title="user.title" :visible.sync="user.open" width="1000px" append-to-body>
  525. <selectUser ref="selectUser" @bindQwUser="bindQwUser" @close="handleSelectUserClose"/>
  526. </el-dialog>
  527. <el-dialog :title="companyUserArea.title" :visible.sync="companyUserArea.open" width="300px" append-to-body>
  528. <el-select v-model="addressId" filterable placeholder="请选择所属销售的区域" style="width: 200px;">
  529. <el-option
  530. v-for="item in citysAreaList"
  531. :key="item.cityId"
  532. :label="item.cityName"
  533. :value="item.cityId"
  534. ></el-option>
  535. </el-select>
  536. <div slot="footer" style="text-align: center;">
  537. <el-button type="primary" @click="submitFormArea(addressId)">确 定</el-button>
  538. <el-button @click="cancelArea">取 消</el-button>
  539. </div>
  540. </el-dialog>
  541. <!-- 设置单独注册会员弹窗 -->
  542. <!-- 设置单独注册会员 -->
  543. <el-dialog title="设置单独注册会员" :visible.sync="registerOpen" width="400px" append-to-body>
  544. <el-form ref="registerForm" :model="registerForm" label-width="160px">
  545. <el-form-item label="是否开启单独注册">
  546. <el-switch v-model="registerForm.status" :active-value="true" :inactive-value="false"></el-switch>
  547. </el-form-item>
  548. </el-form>
  549. <template #footer>
  550. <div class="dialog-footer">
  551. <el-button type="primary" @click="submitRegisterForm">确 定</el-button>
  552. <el-button @click="registerOpen = false">取 消</el-button>
  553. </div>
  554. </template>
  555. </el-dialog>
  556. <!-- 允许注册会员 -->
  557. <el-dialog title="允许注册会员" :visible.sync="allowedAllRegisterOpen" width="400px" append-to-body>
  558. <el-form ref="allowedAllRegisterForm" :model="allowedAllRegisterForm" label-width="160px">
  559. <el-form-item label="是否允许注册会员">
  560. <el-switch v-model="allowedAllRegisterForm.status" :active-value="true" :inactive-value="false"></el-switch>
  561. </el-form-item>
  562. </el-form>
  563. <template #footer>
  564. <div class="dialog-footer">
  565. <el-button type="primary" @click="submitAllowedAllRegisterForm">确 定</el-button>
  566. <el-button @click="allowedAllRegisterOpen = false">取 消</el-button>
  567. </div>
  568. </template>
  569. </el-dialog>
  570. <el-dialog :title="bindCompanyUrl.title" v-if="bindCompanyUrl.open" :visible.sync="bindCompanyUrl.open" width="450px" append-to-body>
  571. <div style="padding-bottom:15px;" >
  572. <img :src="bindCompanyUrl.url" width="400px">
  573. </div>
  574. <div slot="footer" class="dialog-footer">
  575. <el-button @click="downloadImage(bindCompanyUrl.url, bindCompanyUrl.name+'.png')">下载二维码</el-button>
  576. </div>
  577. </el-dialog>
  578. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  579. <el-upload
  580. ref="upload"
  581. :limit="1"
  582. accept=".xlsx, .xls"
  583. :headers="upload.headers"
  584. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  585. :disabled="upload.isUploading"
  586. :on-progress="handleFileUploadProgress"
  587. :on-success="handleFileSuccess"
  588. :auto-upload="false"
  589. drag
  590. >
  591. <i class="el-icon-upload"></i>
  592. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  593. <div class="el-upload__tip text-center" slot="tip">
  594. <div class="el-upload__tip" slot="tip">
  595. </div>
  596. <span>仅允许导入xls、xlsx格式文件。</span>
  597. <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
  598. </div>
  599. </el-upload>
  600. <div slot="footer" class="dialog-footer">
  601. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  602. <el-button @click="upload.open = false">取 消</el-button>
  603. </div>
  604. </el-dialog>
  605. <el-dialog :title="doctor.title" :visible.sync="doctor.open" width="800px" append-to-body>
  606. <selectDoctor ref="selectDoctor" @bindCompanyUserDoctorId="bindCompanyUserDoctorId"></selectDoctor>
  607. </el-dialog>
  608. <!-- 绑定用户对话框 -->
  609. <el-dialog title="绑定用户" :visible.sync="bindUserDialog.open" width="900px" append-to-body @close="resetBindUserForm">
  610. <el-form :model="bindUserForm" label-width="100px">
  611. <el-form-item label="手机号码">
  612. <el-input
  613. v-model="bindUserForm.phone"
  614. placeholder="请输入手机号码(完全匹配)"
  615. clearable
  616. style="width: 300px;"
  617. @keyup.enter.native="queryFsUserByPhone"
  618. >
  619. <el-button slot="append" icon="el-icon-search" @click="queryFsUserByPhone">查询</el-button>
  620. </el-input>
  621. </el-form-item>
  622. </el-form>
  623. <!-- 已绑定用户信息 -->
  624. <div v-if="boundUsersList.length > 0" style="margin-bottom: 20px;">
  625. <el-divider content-position="left">已绑定用户</el-divider>
  626. <el-table :data="boundUsersList" border style="width: 100%">
  627. <el-table-column prop="userId" label="用户ID" width="100" align="center"></el-table-column>
  628. <el-table-column prop="nickname" label="用户名称" align="center"></el-table-column>
  629. <el-table-column prop="phone" label="电话" align="center"></el-table-column>
  630. </el-table>
  631. </div>
  632. <!-- 查询结果 -->
  633. <div v-if="fsUserList.length > 0">
  634. <el-divider content-position="left">查询结果(可多选)</el-divider>
  635. <el-table
  636. :data="fsUserList"
  637. border
  638. v-loading="bindUserLoading"
  639. @selection-change="handleFsUserSelectionChange"
  640. style="width: 100%"
  641. >
  642. <el-table-column type="selection" width="55" align="center"></el-table-column>
  643. <el-table-column prop="userId" label="用户ID" width="100" align="center"></el-table-column>
  644. <el-table-column prop="nickname" label="用户名称" align="center"></el-table-column>
  645. <el-table-column prop="phone" label="电话" align="center"></el-table-column>
  646. </el-table>
  647. </div>
  648. <div v-else-if="bindUserForm.phone && !bindUserLoading" style="text-align: center; padding: 20px; color: #909399;">
  649. 暂无查询结果
  650. </div>
  651. <div v-if="bindUserLoading" style="text-align: center; padding: 20px;">
  652. <i class="el-icon-loading"></i> 查询中...
  653. </div>
  654. <div slot="footer" class="dialog-footer">
  655. <el-button @click="bindUserDialog.open = false">取 消</el-button>
  656. <el-button type="primary" @click="submitBindUser" :disabled="selectedFsUserIds.length === 0">确 定</el-button>
  657. </div>
  658. </el-dialog>
  659. </div>
  660. </template>
  661. <script>
  662. import {
  663. qwList,
  664. delUser,
  665. addUser,
  666. getUser,
  667. updateUser,
  668. exportUser,
  669. resetUserPwd,
  670. importTemplate,
  671. getCitysAreaList,
  672. changeUserStatus,
  673. generateSubDomain,
  674. setIsRegisterMember,
  675. updateCompanyUserAreaList,
  676. isAllowedAllRegister, unBindDoctorId, bindDoctorId,updateBatchUserRoles,
  677. queryFsUserByPhone,
  678. batchBindCompanyUserId,
  679. getBoundUsers
  680. } from "@/api/company/companyUser";
  681. import { getToken } from "@/utils/auth";
  682. import { treeselect } from "@/api/company/companyDept";
  683. import Treeselect from "@riophae/vue-treeselect";
  684. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  685. import {bindQwUser, getQwUserList, addQwUser, getQwUser, getQwUserByIds,addQwUserName} from '@/api/qw/user';
  686. import { syncDept } from '@/api/qw/qwDept';
  687. import { getMyQwUserList,getMyQwCompanyList } from "@/api/qw/user";
  688. import selectUser from "@/views/company/components/selectQwUser.vue";
  689. import { getConfigByKey } from "@/api/company/companyConfig";
  690. import axios from "axios";
  691. import {addCodeUrl} from "../../../api/company/companyUser";
  692. import selectDoctor from "@/views/qw/user/selectDoctor.vue";
  693. export default {
  694. name: "User",
  695. components: {selectDoctor, Treeselect ,selectUser},
  696. data() {
  697. return {
  698. doctor: {
  699. open: false,
  700. title: '绑定医生'
  701. },
  702. doctorForm: {
  703. userId: null,
  704. doctorId: null
  705. },
  706. uploadUrl: process.env.VUE_APP_BASE_API+"/company/user/common/uploadOSS",
  707. // 遮罩层
  708. loading: false,
  709. qwUserList:[],
  710. qwUserId:[],
  711. myQwCompanyList:[],
  712. qwUser:[],
  713. user:{
  714. open:false,
  715. title:"搜索企业"
  716. },
  717. // 选中数组
  718. ids: [],
  719. //允许注册会员
  720. isAllowedAllRegister: [],
  721. //是否单独注册
  722. isNeedRegisterMember: [],
  723. synform:{corpId:null},
  724. synOpen:false,
  725. synNameform:{corpId:null},
  726. synNameOpen:false,
  727. // 非单个禁用
  728. single: true,
  729. // 非多个禁用
  730. multiple: true,
  731. // 显示搜索条件
  732. showSearch: true,
  733. // 总条数
  734. total: 0,
  735. // 用户表格数据
  736. userList: null,
  737. // 弹出层标题
  738. title: "",
  739. // 部门树选项
  740. deptOptions: undefined,
  741. // 是否显示弹出层
  742. open: false,
  743. bindCompanyOpen: false,
  744. qwOpen:false,
  745. // 部门名称
  746. deptName: undefined,
  747. // 日期范围
  748. dateRange: [],
  749. // 状态数据字典
  750. statusOptions: [],
  751. // 性别状态字典
  752. sexOptions: [],
  753. // 岗位选项
  754. postOptions: [],
  755. // 角色选项
  756. roleOptions: [],
  757. userTypeOptions:[
  758. { "dictLabel": "临时管理员","dictValue": "02"},
  759. { "dictLabel": "普通用户","dictValue": "01"}
  760. ],
  761. qwForm:{
  762. id:null,
  763. companyUserId:null,
  764. },
  765. companyUserArea:{
  766. open:false,
  767. title:"分配区域",
  768. },
  769. //选择的区域
  770. addressId:null,
  771. citysAreaList:[],
  772. // 表单参数
  773. form: {},
  774. formBindCompany: {},
  775. bindCompanyUrl:{
  776. open:false,
  777. title:"绑定/注册销售二维码",
  778. name:null,
  779. url:null,
  780. },
  781. form1: {},
  782. defaultProps: {
  783. children: "children",
  784. label: "label",
  785. },
  786. // 用户导入参数
  787. upload: {
  788. // 是否显示弹出层(用户导入)
  789. open: false,
  790. // 弹出层标题(用户导入)
  791. title: "",
  792. // 是否禁用上传
  793. isUploading: false,
  794. // 是否更新已经存在的用户数据
  795. updateSupport: 0,
  796. // 设置上传的请求头部
  797. headers: { Authorization: "Bearer " + getToken() },
  798. // 上传的地址
  799. url: process.env.VUE_APP_BASE_API + "/company/user/importCompanyUser",
  800. },
  801. // 查询参数
  802. queryParams: {
  803. pageNum: 1,
  804. pageSize: 10,
  805. userId: null,
  806. userName: null,
  807. phonenumber: null,
  808. status: null,
  809. deptId: null,
  810. qwStatus:null,
  811. },
  812. qwStatusOptions:[],
  813. registerOpen: false,
  814. registerForm: {
  815. status: false,
  816. },
  817. // 表单校验
  818. rules: {
  819. userName: [
  820. { required: true, message: "员工工号不能为空", trigger: "blur" },
  821. ],
  822. nickName: [
  823. { required: true, message: "员工姓名不能为空", trigger: "blur" },
  824. ],
  825. deptId: [
  826. { required: true, message: "归属部门不能为空", trigger: "blur" },
  827. ],
  828. addressId: [
  829. { required: true, message: "销售所属区域不能为空", trigger: "blur" },
  830. ],
  831. password: [
  832. { required: true, message: "员工密码不能为空", trigger: "blur" },
  833. {
  834. pattern: /^(?=.*[A-Za-z])(?=.*\d)(?=.*[^A-Za-z0-9]).{8,20}$/,
  835. message: "密码长度为 8-20 位,必须包含字母、数字和特殊字符",
  836. trigger: ["blur", "change"],
  837. }
  838. ],
  839. idCard: [
  840. { required: true, message: "身份证号不能为空", trigger: "blur" },
  841. ],
  842. // email: [
  843. // { required: true, message: "邮箱地址不能为空", trigger: "blur" },
  844. // {
  845. // type: "email",
  846. // message: "'请输入正确的邮箱地址",
  847. // trigger: ["blur", "change"],
  848. // },
  849. // ],
  850. phonenumber: [
  851. { required: true, message: "手机号码不能为空", trigger: "blur" },
  852. {
  853. pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  854. message: "请输入正确的手机号码",
  855. trigger: "blur",
  856. },
  857. ],
  858. },
  859. // 表单校验
  860. bindCompanyRules: {
  861. deptId: [
  862. { required: true, message: "归属部门不能为空", trigger: "blur" },
  863. ],
  864. addressId: [
  865. { required: true, message: "销售所属区域不能为空", trigger: "blur" },
  866. ],
  867. roleIds: [
  868. { required: true, message: "角色不能为空", trigger: "blur" },
  869. ],
  870. corpId: [
  871. { required: true, message: "角色不能为空", trigger: "blur" },
  872. ],
  873. },
  874. // 是否允许注册会员开关
  875. allowedAllRegisterOpen: false,
  876. allowedAllRegisterForm: {
  877. status: true
  878. },
  879. // 在 data() 中添加
  880. batchRoleDialogVisible: false,
  881. selectedRoleIds: [],
  882. batchRoleForm: {
  883. userIds: [],
  884. roleIds: []
  885. },
  886. // 绑定用户相关
  887. bindUserDialog: {
  888. open: false,
  889. title: '绑定用户'
  890. },
  891. bindUserForm: {
  892. phone: '',
  893. companyUserId: null
  894. },
  895. fsUserList: [],
  896. selectedFsUserIds: [],
  897. boundUsersList: [],
  898. bindUserLoading: false,
  899. };
  900. },
  901. watch: {
  902. // 根据名称筛选部门树
  903. deptName(val) {
  904. this.$refs.tree.filter(val);
  905. },
  906. },
  907. created() {
  908. this.getList();
  909. this.getTreeselect();
  910. this.getDicts("sys_normal_disable").then((response) => {
  911. this.statusOptions = response.data;
  912. });
  913. this.getDicts("company_user_sex").then((response) => {
  914. this.sexOptions = response.data;
  915. });
  916. this.getDicts("sys_qw_user_status").then(response => {
  917. this.qwStatusOptions = response.data;
  918. });
  919. getConfigByKey("his.login").then(response => {
  920. this.form1 =JSON.parse(response.data.configValue);
  921. });
  922. getCitysAreaList().then(res=>{
  923. this.citysAreaList=res.data;
  924. })
  925. getMyQwCompanyList().then(response => {
  926. this.myQwCompanyList = response.data;
  927. });
  928. },
  929. methods: {
  930. onDomainBlur() {
  931. if (this.form.domain != null) {
  932. let value = this.form.domain.trim();
  933. // 强制只保留第一个 http://
  934. const httpCount = (value.match(/http:\/\//g) || []).length;
  935. if (httpCount > 1) {
  936. value = value.replace(/(http:\/\/)+/, 'http://'); // 只留第一个
  937. }
  938. // 如果不是 http:// 开头,自动补充
  939. if (!value.startsWith('http://')) {
  940. value = 'http://' + value.replace(/^https?:\/\//, ''); // 去掉其他 http(s):// 再补
  941. }
  942. this.form.domain = value; // 重新赋值,保证输入正确
  943. // 正则校验最终格式,提醒用户
  944. const domainPattern = /^http:\/\/([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/;
  945. if (!domainPattern.test(this.form.domain)) {
  946. return this.$message.error('请输入正确格式的域名,如:http://xxx.xxx.com');
  947. }
  948. }
  949. },
  950. // 添加处理 selectUser 关闭的方法
  951. handleSelectUserClose() {
  952. this.user.open = false
  953. // 如果 selectUser 组件有 clearSelection 方法,也可以调用
  954. if (this.$refs.selectUser && typeof this.$refs.selectUser.clearSelection === 'function') {
  955. this.$refs.selectUser.clearSelection()
  956. }
  957. },
  958. // edit G start
  959. // 修改 selectQwUser 方法
  960. selectQwUser() {
  961. this.user.open = true;
  962. // 在下次DOM更新后设置已选中的项
  963. this.$nextTick(() => {
  964. if (this.$refs.selectUser && this.qwUserList.length > 0) {
  965. // 将已选中的用户传递给子组件
  966. this.$refs.selectUser.setSelectedUsers(this.qwUserList);
  967. }
  968. });
  969. },
  970. // 修改 bindQwUser 方法
  971. bindQwUser(row) {
  972. // this.user.open = false; // 暂时注释掉这行,改为在 handleBatchBind 中处理
  973. if (!this.qwUserList.some(item => item.id == row.id)) {
  974. this.qwUserList.push(row)
  975. }
  976. if (!this.qwUser.some(item => item == row.id)) {
  977. this.qwUser.push(row.id)
  978. }
  979. },
  980. // 修改 qwBind 方法
  981. qwBind(row) {
  982. this.qwUser = [];
  983. this.qwUserList = [];
  984. this.qwForm.companyUserId = row.userId;
  985. getUser(row.userId).then((response) => {
  986. if (response.data.qwUserId != null) {
  987. // 保存已绑定的企微用户ID列表
  988. this.qwUser = ((response.data.qwUserId).split(",").map(Number));
  989. getQwUserByIds(this.qwUser).then(res => {
  990. this.qwUserList = res.data;
  991. });
  992. }
  993. // 先打开"绑定企微账号"对话框
  994. this.qwOpen = true;
  995. });
  996. },
  997. // 在 methods 中添加批量修改角色的方法
  998. batchEditRole() {
  999. if (this.ids.length === 0) {
  1000. this.$message.warning("请至少选择一个用户");
  1001. return;
  1002. }
  1003. // 获取角色列表数据
  1004. getUser().then((response) => {
  1005. this.roleOptions = response.roles;
  1006. this.batchRoleDialogVisible = true;
  1007. this.selectedRoleIds = []; // 清空之前的选择
  1008. });
  1009. },
  1010. // 添加批量角色更新提交方法
  1011. submitBatchRoles() {
  1012. // 验证选择的角色
  1013. if (!this.selectedRoleIds || this.selectedRoleIds.length === 0) {
  1014. this.$message.warning("请至少选择一个角色");
  1015. return;
  1016. }
  1017. console.log(this.ids)
  1018. console.log(this.selectedRoleIds)
  1019. // 调用API批量更新用户角色
  1020. updateBatchUserRoles({ userIds: this.ids, roleIds: this.selectedRoleIds })
  1021. .then(response => {
  1022. if (response.code === 200) {
  1023. this.$message.success("批量修改角色成功");
  1024. this.batchRoleDialogVisible = false;
  1025. this.getList(); // 刷新列表
  1026. }
  1027. });
  1028. },
  1029. // edit G end
  1030. /** 查询用户列表 */
  1031. getList() {
  1032. this.loading = true;
  1033. qwList(this.addDateRange(this.queryParams, this.dateRange)).then(
  1034. (response) => {
  1035. this.userList = response.rows;
  1036. this.total = response.total;
  1037. this.loading = false;
  1038. console.log(" this.userList ", this.userList)
  1039. }
  1040. );
  1041. },
  1042. handleClosegroupUser(list) {
  1043. const index = this.qwUser.findIndex(t => t === list);
  1044. if (index !== -1) {
  1045. this.qwUser.splice(index, 1);
  1046. }
  1047. },
  1048. /** 查询部门下拉树结构 */
  1049. getTreeselect() {
  1050. treeselect().then((response) => {
  1051. this.deptOptions = response.data;
  1052. });
  1053. },
  1054. // 筛选节点
  1055. filterNode(value, data) {
  1056. if (!value) return true;
  1057. return data.label.indexOf(value) !== -1;
  1058. },
  1059. // 节点单击事件
  1060. handleNodeClick(data) {
  1061. this.queryParams.deptId = data.id;
  1062. this.getList();
  1063. },
  1064. // 用户状态修改
  1065. handleStatusChange(row) {
  1066. let text = row.status === "0" ? "启用" : "停用";
  1067. this.$confirm(
  1068. '确认要"' + text + '""' + row.userName + '"用户吗?',
  1069. "警告",
  1070. {
  1071. confirmButtonText: "确定",
  1072. cancelButtonText: "取消",
  1073. type: "warning",
  1074. }
  1075. )
  1076. .then(function() {
  1077. return changeUserStatus(row.userId, row.status);
  1078. })
  1079. .then(() => {
  1080. this.msgSuccess(text + "成功");
  1081. })
  1082. .catch(function() {
  1083. row.status = row.status === "0" ? "1" : "0";
  1084. });
  1085. },
  1086. // 取消按钮
  1087. cancel() {
  1088. this.open = false;
  1089. this.reset();
  1090. },
  1091. cancelBind() {
  1092. this.bindCompanyOpen = false;
  1093. this.resetBindCompany();
  1094. },
  1095. submitFormArea(address) {
  1096. const uIds = this.ids;
  1097. if (address == null) {
  1098. this.$message.error("请选择地区");
  1099. return;
  1100. }
  1101. updateCompanyUserAreaList({ userIds: uIds, addressId: address }).then(res => {
  1102. this.companyUserArea.open = false;
  1103. this.getList();
  1104. this.msgSuccess("操作成功");
  1105. })
  1106. },
  1107. cancelArea() {
  1108. this.companyUserArea.open = false;
  1109. this.addressId = null;
  1110. },
  1111. qwCancel() {
  1112. this.qwOpen = false;
  1113. this.qwUserId = null;
  1114. },
  1115. handerCompanyUserAreaList() {
  1116. this.companyUserArea.open = true;
  1117. },
  1118. // 表单重置
  1119. reset() {
  1120. this.form = {
  1121. userId: undefined,
  1122. deptId: undefined,
  1123. userName: undefined,
  1124. nickName: undefined,
  1125. password: undefined,
  1126. idCard: undefined,
  1127. phonenumber: undefined,
  1128. userType: "01",
  1129. email: undefined,
  1130. sex: undefined,
  1131. status: "0",
  1132. remark: undefined,
  1133. domain: null,
  1134. postIds: [],
  1135. roleIds: [],
  1136. };
  1137. this.resetForm("form");
  1138. },
  1139. resetBindCompany() {
  1140. this.formBindCompany = {
  1141. deptId: null,
  1142. addressId: null,
  1143. roleIds: [],
  1144. };
  1145. this.resetForm("formBindCompany");
  1146. },
  1147. /** 搜索按钮操作 */
  1148. handleQuery() {
  1149. this.queryParams.page = 1;
  1150. this.getList();
  1151. },
  1152. /** 重置按钮操作 */
  1153. resetQuery() {
  1154. this.dateRange = [];
  1155. this.resetForm("queryForm");
  1156. this.handleQuery();
  1157. },
  1158. // 多选框选中数据
  1159. handleSelectionChange(selection) {
  1160. this.ids = selection.map((item) => item.userId);
  1161. this.isNeedRegisterMember = selection.map((item) => item.isNeedRegisterMember);
  1162. this.isAllowedAllRegister = selection.map((item) => item.isAllowedAllRegister);
  1163. this.single = selection.length != 1;
  1164. this.multiple = !selection.length;
  1165. },
  1166. /** 新增按钮操作 */
  1167. handleAdd() {
  1168. this.reset();
  1169. this.getTreeselect();
  1170. getUser().then((response) => {
  1171. this.postOptions = response.posts;
  1172. this.roleOptions = response.roles;
  1173. this.open = true;
  1174. this.title = "添加员工";
  1175. this.form.password = this.form1.loginPassword;
  1176. console.log(" this.form1 ", this.form1)
  1177. });
  1178. },
  1179. handleBindCompanyUserCode() {
  1180. this.reset();
  1181. this.getTreeselect();
  1182. getUser().then((response) => {
  1183. this.postOptions = response.posts;
  1184. this.roleOptions = response.roles;
  1185. this.bindCompanyOpen = true;
  1186. this.title = "创建 新增/绑定销售 的二维码";
  1187. });
  1188. },
  1189. /** 修改按钮操作 */
  1190. handleUpdate(row) {
  1191. this.reset();
  1192. this.getTreeselect();
  1193. const userId = row.userId || this.ids;
  1194. getUser(userId).then((response) => {
  1195. this.form = response.data;
  1196. this.postOptions = response.posts;
  1197. this.roleOptions = response.roles;
  1198. this.form.postIds = response.postIds;
  1199. this.form.roleIds = response.roleIds;
  1200. this.open = true;
  1201. this.title = "修改员工";
  1202. this.form.password = "";
  1203. });
  1204. },
  1205. /** 重置密码按钮操作 */
  1206. handleResetPwd(row) {
  1207. this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
  1208. confirmButtonText: "确定",
  1209. cancelButtonText: "取消",
  1210. inputPlaceholder: "8-20 位,包含字母、数字和特殊字符",
  1211. inputValidator: (value) => {
  1212. const pattern = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[^A-Za-z0-9]).{8,20}/;
  1213. const hasChinese = /[\u4e00-\u9fa5]/.test(value);
  1214. const hasFullWidth = /[!-~]/.test(value);
  1215. if (hasChinese) return '不能包含中文字符';
  1216. if (hasFullWidth) return '不能包含全角符号,请使用英文输入法';
  1217. if (!pattern.test(value)) return '密码格式错误:需包含字母、数字和英文特殊字符,长度为 8-20 位';
  1218. return true;
  1219. }
  1220. })
  1221. .then(({ value }) => {
  1222. resetUserPwd(row.userId, value).then((response) => {
  1223. if (response.code === 200) {
  1224. this.msgSuccess("修改成功,新密码是:" + value);
  1225. }
  1226. });
  1227. })
  1228. .catch(() => {
  1229. });
  1230. },
  1231. /** 提交按钮 */
  1232. submitForm: function() {
  1233. // this.onDomainBlur();
  1234. // const domainPattern = /^http:\/\/([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/;
  1235. // if (this.form.domain!=null && !domainPattern.test(this.form.domain)) {
  1236. // this.$message.error('请输入正确格式的域名,如:http://xxx.xxx.com');
  1237. // return;
  1238. // }
  1239. this.$refs["form"].validate((valid) => {
  1240. if (valid) {
  1241. if (this.form.userId != undefined) {
  1242. updateUser(this.form).then((response) => {
  1243. if (response.code === 200) {
  1244. this.msgSuccess("修改成功");
  1245. this.open = false;
  1246. this.getList();
  1247. }
  1248. });
  1249. } else {
  1250. addUser(this.form).then((response) => {
  1251. if (response.code === 200) {
  1252. this.msgSuccess("新增成功");
  1253. this.open = false;
  1254. this.getList();
  1255. }
  1256. });
  1257. }
  1258. }
  1259. });
  1260. },
  1261. downloadImage(imageSrc, fileName) {
  1262. const link = document.createElement('a');
  1263. link.href = imageSrc;
  1264. link.download = fileName || '绑定或新增销售.png';
  1265. document.body.appendChild(link);
  1266. link.click();
  1267. document.body.removeChild(link);
  1268. },
  1269. submitBingCompanyForm: function() {
  1270. this.$refs["formBindCompany"].validate((valid) => {
  1271. if (valid) {
  1272. let loadingRock = this.$loading({
  1273. lock: true,
  1274. text: '生成二维码中~~请不要刷新页面!!',
  1275. spinner: 'el-icon-loading',
  1276. background: 'rgba(0, 0, 0, 0.7)'
  1277. });
  1278. addCodeUrl(this.formBindCompany).then((response) => {
  1279. this.bindCompanyOpen = false;
  1280. this.bindCompanyUrl.url = response.data.url
  1281. this.bindCompanyUrl.open = true;
  1282. this.bindCompanyUrl.name = "绑定或新增 销售二维码";
  1283. }).finally(res => {
  1284. loadingRock.close();
  1285. })
  1286. }
  1287. });
  1288. },
  1289. /**
  1290. * 同步企业微信员工
  1291. */
  1292. synSubmitForm() {
  1293. this.synOpen = false;
  1294. this.loading = true;
  1295. /*this.msgSuccess("");
  1296. let loadingRock = this.$loading({
  1297. lock: true,
  1298. text: '同步中.....请等待.....请不要重复点击!!',
  1299. spinner: 'el-icon-loading',
  1300. background: 'rgba(0, 0, 0, 0.7)'
  1301. });*/
  1302. addQwUser(this.synform.corpId).then(response => {
  1303. //this.msgSuccess("同步成功");
  1304. this.msgSuccess("正在同步中...");
  1305. this.getList();
  1306. this.synOpen = false;
  1307. }).finally(() => {
  1308. this.loading = false;
  1309. this.synOpen = false;
  1310. //loadingRock.close();
  1311. });
  1312. },
  1313. synNameSubmitForm() {
  1314. this.synNameOpen = false;
  1315. this.loading = true;
  1316. addQwUserName(this.synNameform.corpId).then(response => {
  1317. // this.msgSuccess("同步成功");
  1318. this.msgSuccess("正在同步中...");
  1319. this.getList();
  1320. this.synNameOpen = false;
  1321. }).finally(() => {
  1322. this.loading = false;
  1323. this.synNameOpen = false;
  1324. //loadingRock.close();
  1325. });
  1326. },
  1327. /**
  1328. * 同步企业微信部门
  1329. */
  1330. qwSyncDept() {
  1331. syncDept().then(response => {
  1332. this.msgSuccess("同步成功");
  1333. this.getList();
  1334. }).catch(() => {
  1335. this.msgError("同步失败:" + response.msg);
  1336. })
  1337. },
  1338. qwSubmitForm() {
  1339. let loadingRock = this.$loading({
  1340. lock: true,
  1341. text: '绑定中.....同步客户信息中.....',
  1342. spinner: 'el-icon-loading',
  1343. background: 'rgba(0, 0, 0, 0.7)'
  1344. });
  1345. this.qwForm.id = (this.qwUser).join(',');
  1346. bindQwUser(this.qwForm).then(response => {
  1347. this.msgSuccess("绑定成功");
  1348. this.qwOpen = false;
  1349. this.getList();
  1350. this.qwUserId = null;
  1351. this.qwUser = [];
  1352. }).finally(res => {
  1353. loadingRock.close()
  1354. });
  1355. },
  1356. /** 删除按钮操作 */
  1357. handleDelete(row) {
  1358. // 确保 userIds 始终是数组
  1359. let userIds = row.userId || this.ids;
  1360. if (!Array.isArray(userIds)) {
  1361. userIds = [userIds];
  1362. }
  1363. // 筛选出 userType 为 '00' 的 userId
  1364. const excludedUserIds = this.userList
  1365. .filter(user => user.userType == '00')
  1366. .map(user => user.userId);
  1367. // 从 userIds 中剔除这些 userId
  1368. const finalUserIds = userIds.filter(userId =>
  1369. !excludedUserIds.includes(userId)
  1370. );
  1371. if (finalUserIds.length === 0) {
  1372. return this.msgInfo("除管理员外无其他的账号,请重新选择");
  1373. }
  1374. this.$confirm(
  1375. '是否确认删除员工编号为"' + finalUserIds + '"的数据项?【注意:删除后绑定的企业微信相关信息可能会错乱!!】',
  1376. "警告",
  1377. {
  1378. confirmButtonText: "确定",
  1379. cancelButtonText: "取消",
  1380. type: "warning",
  1381. }
  1382. )
  1383. .then(function() {
  1384. return delUser(finalUserIds);
  1385. })
  1386. .then(() => {
  1387. this.getList();
  1388. this.msgSuccess("删除成功");
  1389. })
  1390. .catch(function() {
  1391. });
  1392. },
  1393. /** 导出按钮操作 */
  1394. handleExport() {
  1395. const queryParams = this.queryParams;
  1396. this.$confirm("是否确认导出所有用户数据项?", "警告", {
  1397. confirmButtonText: "确定",
  1398. cancelButtonText: "取消",
  1399. type: "warning",
  1400. })
  1401. .then(function() {
  1402. return exportUser(queryParams);
  1403. })
  1404. .then((response) => {
  1405. this.download(response.msg);
  1406. })
  1407. .catch(function() {
  1408. });
  1409. },
  1410. /** 导入按钮操作 */
  1411. handleImport() {
  1412. this.upload.title = "用户导入";
  1413. this.upload.open = true;
  1414. },
  1415. /** 下载模板操作 */
  1416. importTemplate() {
  1417. importTemplate().then((response) => {
  1418. this.download(response.msg);
  1419. });
  1420. },
  1421. // 文件上传中处理
  1422. handleFileUploadProgress(event, file, fileList) {
  1423. this.upload.isUploading = true;
  1424. },
  1425. // 文件上传成功处理
  1426. handleFileSuccess(response, file, fileList) {
  1427. this.upload.open = false;
  1428. this.upload.isUploading = false;
  1429. this.$refs.upload.clearFiles();
  1430. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  1431. this.getList();
  1432. },
  1433. // 提交上传文件
  1434. submitFileForm() {
  1435. this.$refs.upload.submit();
  1436. },
  1437. generateDomain() {
  1438. let queryParams;
  1439. if (this.form.userId) {
  1440. queryParams = {
  1441. 'userId': this.form.userId,
  1442. }
  1443. }
  1444. generateSubDomain(queryParams).then(response => {
  1445. this.form.domain = response.data
  1446. });
  1447. },
  1448. /** 设置单独注册会员按钮操作 */
  1449. handleSetRegister() {
  1450. this.registerOpen = true;
  1451. if (this.isNeedRegisterMember && this.isNeedRegisterMember.some(item => item === 0)) {
  1452. this.registerForm.status = false;
  1453. } else {
  1454. this.registerForm.status = true;
  1455. }
  1456. },
  1457. /** 提交设置单独注册会员 */
  1458. submitRegisterForm() {
  1459. setIsRegisterMember({ status: this.registerForm.status }, this.ids).then(response => {
  1460. if (response.code === 200) {
  1461. this.msgSuccess("设置成功");
  1462. this.registerOpen = false;
  1463. this.getList();
  1464. }
  1465. });
  1466. },
  1467. /** 开关是否允许所有方式注册会员 */
  1468. handleAllowedAllRegister() {
  1469. this.allowedAllRegisterOpen = true;
  1470. if (this.isAllowedAllRegister && this.isAllowedAllRegister.some(item => item === 0)) {
  1471. this.allowedAllRegisterForm.status = false;
  1472. } else {
  1473. this.allowedAllRegisterForm.status = true;
  1474. }
  1475. // this.allowedAllRegisterForm.status = true;
  1476. },
  1477. // 提交
  1478. submitAllowedAllRegisterForm() {
  1479. isAllowedAllRegister({ status: this.allowedAllRegisterForm.status }, this.ids).then(response => {
  1480. if (response.code === 200) {
  1481. this.msgSuccess("操作成功");
  1482. this.allowedAllRegisterOpen = false;
  1483. this.getList();
  1484. }
  1485. });
  1486. },
  1487. /**
  1488. * 上传文件之前的钩子,参数为上传的文件,若返回 false 或者返回 Promise且被 reject,则停止上传。
  1489. * @param {File} file - 用户选择的文件对象
  1490. * @param {Object} row - 当前行的数据对象
  1491. */
  1492. beforeImageUpload(file, row) {
  1493. // 清除之前的错误信息
  1494. this.$set(row, 'uploadError', '');
  1495. const isJPG = file.type === 'image/jpeg';
  1496. const isPNG = file.type === 'image/png';
  1497. const isGIF = file.type === 'image/gif'; // 根据需要添加更多格式
  1498. const isValidFormat = isJPG || isPNG || isGIF;
  1499. const isLt2M = file.size / 1024 / 1024 < 2; // 限制图片大小为 2MB
  1500. if (!isValidFormat) {
  1501. const errorMsg = '上传二维码图片只能是 JPG/PNG/GIF 格式!';
  1502. this.$message.error(errorMsg);
  1503. this.$set(row, 'uploadError', errorMsg); // 在行内显示错误
  1504. return false;
  1505. }
  1506. if (!isLt2M) {
  1507. const errorMsg = '上传二维码图片大小不能超过 2MB!';
  1508. this.$message.error(errorMsg);
  1509. this.$set(row, 'uploadError', errorMsg); // 在行内显示错误
  1510. return false;
  1511. }
  1512. return true; // 校验通过,允许上传
  1513. },
  1514. /**
  1515. * 自定义上传方法
  1516. * @param {Object} options - Element UI upload 组件传递的参数,包含 file, onSuccess, onError, onProgress 等
  1517. * @param {Object} row - 当前行的数据对象
  1518. */
  1519. async handleCustomUpload(options, row) {
  1520. const file = options.file;
  1521. const formData = new FormData();
  1522. formData.append('file', file);
  1523. formData.append('userId', row.userId)
  1524. this.$set(row, 'uploading', true);
  1525. this.$set(row, 'uploadError', '');
  1526. try {
  1527. const response = await axios.post(this.uploadUrl, formData, {
  1528. headers: {
  1529. 'Content-Type': 'multipart/form-data',
  1530. },
  1531. onUploadProgress: progressEvent => {
  1532. const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
  1533. console.log(`上传进度: ${percentCompleted}%`);
  1534. }
  1535. });
  1536. if (response.data && (response.data.url || (response.data.data && response.data.data.url))) {
  1537. const imageUrl = response.data.url || response.data.data.url;
  1538. this.$set(row, 'qrCodeWeixin', imageUrl); // 更新行数据中的图片URL
  1539. this.$message.success('图片上传成功!');
  1540. options.onSuccess(response.data, file); // 通知el-upload上传成功 (虽然我们自定义了,但调用一下也无妨)
  1541. } else {
  1542. const errorMsg = response.data.message || '图片上传失败,服务器未返回有效URL';
  1543. this.$message.error(errorMsg);
  1544. this.$set(row, 'uploadError', errorMsg);
  1545. options.onError(new Error(errorMsg), file); // 通知el-upload上传失败
  1546. }
  1547. } catch (error) {
  1548. console.error('上传失败:', error);
  1549. let errorMsg = '图片上传失败';
  1550. if (error.response && error.response.data && error.response.data.message) {
  1551. errorMsg = error.response.data.message;
  1552. } else if (error.message) {
  1553. errorMsg = error.message;
  1554. }
  1555. this.$message.error(errorMsg);
  1556. this.$set(row, 'uploadError', errorMsg);
  1557. options.onError(error, file); // 通知el-upload上传失败
  1558. } finally {
  1559. this.$set(row, 'uploading', false); // 无论成功失败,结束上传状态
  1560. }
  1561. },
  1562. requestUpload() {
  1563. },
  1564. beforeUpload() {
  1565. console.log(file.type)
  1566. const isPic =
  1567. file.type === 'image/jpeg' ||
  1568. file.type === 'image/png' ||
  1569. file.type === 'image/gif' ||
  1570. file.type === 'image/jpg' ||
  1571. file.type === 'audio/mpeg'
  1572. const isLt2M = file.size / 1024 / 1024 < 2
  1573. if (!isPic) {
  1574. this.$message.error('上传图片只能是 JPG、JPEG、PNG、GIF 格式!')
  1575. return false
  1576. }
  1577. if (!isLt2M) {
  1578. this.$message.error('上传头像图片大小不能超过 2MB!')
  1579. }
  1580. return isPic && isLt2M
  1581. },
  1582. handleUpdateDoctor(row) {
  1583. this.doctor.title = "绑定医生"
  1584. this.doctor.open = true;
  1585. this.doctorForm.userId = row.userId;
  1586. },
  1587. bindCompanyUserDoctorId(row) {
  1588. console.log(row)
  1589. this.doctorForm.doctorId = row;
  1590. bindDoctorId(this.doctorForm).then(res => {
  1591. if (res.code == 200) {
  1592. this.$message.success('绑定成功')
  1593. } else {
  1594. this.$message.error('绑定失败:', res.msg)
  1595. }
  1596. this.getList()
  1597. this.doctor.open = false;
  1598. })
  1599. },
  1600. handleUnBindUserId(val) {
  1601. this.$confirm(
  1602. '确认解绑医生:<span style="color: green;">' + val.nickName + '' +
  1603. '</span> 的医生?',
  1604. {
  1605. confirmButtonText: "确定",
  1606. cancelButtonText: "取消",
  1607. type: "warning",
  1608. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  1609. }
  1610. ).then(() => {
  1611. return unBindDoctorId(val.userId);
  1612. }).then(response => {
  1613. this.getList();
  1614. this.msgSuccess("解绑成功");
  1615. }).finally(res => {
  1616. this.getList();
  1617. })
  1618. },
  1619. /** 绑定用户按钮操作 */
  1620. handleBindUser(row) {
  1621. this.bindUserForm.companyUserId = row.userId;
  1622. this.bindUserForm.phone = '';
  1623. this.fsUserList = [];
  1624. this.selectedFsUserIds = [];
  1625. this.boundUsersList = [];
  1626. this.bindUserDialog.open = true;
  1627. // 查询已绑定的用户
  1628. this.loadBoundUsers(row.userId);
  1629. },
  1630. /** 查询已绑定的用户 */
  1631. loadBoundUsers(companyUserId) {
  1632. getBoundUsers(companyUserId).then(response => {
  1633. if (response.code === 200 && response.data) {
  1634. this.boundUsersList = Array.isArray(response.data) ? response.data : [response.data];
  1635. } else {
  1636. this.boundUsersList = [];
  1637. }
  1638. }).catch(() => {
  1639. this.boundUsersList = [];
  1640. });
  1641. },
  1642. /** 根据手机号码查询fs_user */
  1643. queryFsUserByPhone() {
  1644. if (!this.bindUserForm.phone) {
  1645. this.$message.warning('请输入手机号码');
  1646. return;
  1647. }
  1648. // 验证手机号码格式
  1649. const phonePattern = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
  1650. if (!phonePattern.test(this.bindUserForm.phone)) {
  1651. this.$message.error('请输入正确的手机号码');
  1652. return;
  1653. }
  1654. this.bindUserLoading = true;
  1655. queryFsUserByPhone(this.bindUserForm.phone).then(response => {
  1656. this.bindUserLoading = false;
  1657. if (response.code === 200) {
  1658. if (response.data) {
  1659. // 如果返回的是单个对象,转换为数组
  1660. this.fsUserList = Array.isArray(response.data) ? response.data : [response.data];
  1661. if (this.fsUserList.length === 0) {
  1662. this.$message.info('未找到匹配的用户');
  1663. }
  1664. } else {
  1665. this.fsUserList = [];
  1666. this.$message.info('未找到匹配的用户');
  1667. }
  1668. } else {
  1669. this.fsUserList = [];
  1670. this.$message.error(response.msg || '查询失败');
  1671. }
  1672. }).catch(error => {
  1673. this.bindUserLoading = false;
  1674. this.fsUserList = [];
  1675. this.$message.error('查询失败');
  1676. });
  1677. },
  1678. /** 处理fs_user选择变化 */
  1679. handleFsUserSelectionChange(selection) {
  1680. this.selectedFsUserIds = selection.map(item => item.userId);
  1681. },
  1682. /** 提交绑定用户 */
  1683. submitBindUser() {
  1684. if (this.selectedFsUserIds.length === 0) {
  1685. this.$message.warning('请至少选择一个用户');
  1686. return;
  1687. }
  1688. const data = {
  1689. companyUserId: this.bindUserForm.companyUserId,
  1690. fsUserIds: this.selectedFsUserIds
  1691. };
  1692. batchBindCompanyUserId(data).then(response => {
  1693. if (response.code === 200) {
  1694. this.$message.success('绑定成功');
  1695. this.bindUserDialog.open = false;
  1696. this.getList();
  1697. } else {
  1698. this.$message.error(response.msg || '绑定失败');
  1699. }
  1700. }).catch(error => {
  1701. this.$message.error('绑定失败');
  1702. });
  1703. },
  1704. /** 重置绑定用户表单 */
  1705. resetBindUserForm() {
  1706. this.bindUserForm = {
  1707. phone: '',
  1708. companyUserId: null
  1709. };
  1710. this.fsUserList = [];
  1711. this.selectedFsUserIds = [];
  1712. this.boundUsersList = [];
  1713. this.bindUserLoading = false;
  1714. },
  1715. },
  1716. }
  1717. </script>