shoreMemberAdd.vue 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068
  1. <!-- 组织架构模块 添加船舶页面 -->
  2. <template>
  3. <div class="box-body"
  4. v-loading="loading">
  5. <div class="label-box">
  6. <span class="label-title">{{ title }}</span>
  7. <div class="button-float">
  8. <el-button v-if="!id"
  9. type="primary"
  10. @click="save('ruleForm', false)">保存并继续新建</el-button>
  11. <el-button type="primary"
  12. @click="save('ruleForm', true)">保存</el-button>
  13. <el-button @click="cancel">返回</el-button>
  14. </div>
  15. </div>
  16. <div class="main-list">
  17. <el-form ref="ruleForm"
  18. :model="ruleForm"
  19. :rules="rules"
  20. class="demo-ruleForm">
  21. <el-form-item label="中文名"
  22. prop="staffName">
  23. <el-input v-model="ruleForm.staffName"
  24. placeholder="请输入"
  25. maxlength="20" />
  26. </el-form-item>
  27. <el-form-item label="账号"
  28. v-if="id"
  29. class="serviceType">
  30. <span class="tips">
  31. <svg-icon icon-class="tips" />
  32. <p>成员唯一标识,可以使用工号、邮箱等<br />公司系统内统一的ID</p>
  33. </span>
  34. <el-input v-model="ruleForm.staffAccount"
  35. maxlength="20"
  36. placeholder="登录账号唯一标识" />
  37. </el-form-item>
  38. <el-form-item label="账号"
  39. prop="staffAccount"
  40. class="serviceType"
  41. v-else>
  42. <span class="tips">
  43. <svg-icon icon-class="tips" />
  44. <p>成员唯一标识,可以使用工号、邮箱等<br />公司系统内统一的ID</p>
  45. </span>
  46. <el-input v-model="ruleForm.staffAccount"
  47. maxlength="20"
  48. placeholder="登录账号唯一标识" />
  49. </el-form-item>
  50. <el-form-item label="修改密码"
  51. prop="loginPasswordNew"
  52. v-if="id">
  53. <el-input clearable
  54. :type="inputType"
  55. autocomplete="new-password"
  56. name="password"
  57. @focus="changeInputType"
  58. v-model="ruleForm.loginPasswordNew"
  59. placeholder="密码任意6位数字,大小写字母,符号组合"
  60. minlength="6"
  61. maxlength="20" />
  62. </el-form-item>
  63. <el-form-item label="密码"
  64. prop="loginPassword"
  65. v-if="!id">
  66. <el-input clearable
  67. :type="inputType"
  68. autocomplete="new-password"
  69. name="password"
  70. @focus="changeInputType"
  71. v-model="ruleForm.loginPassword"
  72. minlength="6"
  73. maxlength="20"
  74. placeholder="密码任意6位数字,大小写字母,符号组合" />
  75. </el-form-item>
  76. <el-form-item label="确认密码"
  77. prop="loginPasswordAgain"
  78. v-if="
  79. (id &&
  80. ruleForm.loginPasswordNew &&
  81. ruleForm.loginPasswordNew.length > 0) ||
  82. !id
  83. ">
  84. <el-input clearable
  85. :type="inputType"
  86. autocomplete="new-password"
  87. name="password"
  88. @focus="changeInputType"
  89. v-model="ruleForm.loginPasswordAgain"
  90. minlength="6"
  91. maxlength="20"
  92. placeholder="请再次确认密码" />
  93. </el-form-item>
  94. <el-form-item label="确认密码"
  95. v-show="
  96. !(
  97. (id &&
  98. ruleForm.loginPasswordNew &&
  99. ruleForm.loginPasswordNew.length > 0) ||
  100. !id
  101. )
  102. ">
  103. <el-input clearable
  104. :type="inputType"
  105. autocomplete="new-password"
  106. name="password"
  107. @focus="changeInputType"
  108. v-model="ruleForm.loginPasswordAgain"
  109. minlength="6"
  110. maxlength="20"
  111. placeholder="请再次确认密码" />
  112. </el-form-item>
  113. <el-form-item label="手机号"
  114. prop="staffMobilePhone">
  115. <el-input v-model="ruleForm.staffMobilePhone"
  116. placeholder="请输入常用手机号" />
  117. </el-form-item>
  118. <el-form-item label="公司/部门"
  119. prop="underCompId"
  120. class="dept-comp">
  121. <el-select v-model="ruleForm.underCompId"
  122. placeholder="请选择"
  123. @change="changeDept">
  124. <el-option v-for="item in companyList"
  125. :key="item.compId"
  126. :label="item.compName"
  127. :value="item.compId" />
  128. </el-select>
  129. <el-select v-model="ruleForm.deptId"
  130. placeholder="请选择"
  131. @change="changeRole">
  132. <el-option v-for="item in deptList"
  133. :key="item.deptId"
  134. :label="item.deptName"
  135. :value="item.deptId" />
  136. </el-select>
  137. </el-form-item>
  138. </el-form>
  139. <div class="department">
  140. <div>
  141. <span class="star font">职务</span>
  142. <span class="ontent"
  143. v-if="zhiwu1.roleName">{{
  144. zhiwu1.roleName
  145. }}</span>
  146. <span class="operaction"
  147. @click="setwork">设置</span>
  148. </div>
  149. <!-- <div class="lastspan">
  150. <span class="star font">关联船舶</span>
  151. <div class="ontent"
  152. style="width: 800px;">
  153. <span v-for="(item, key) in seleteShipList"
  154. :key="key"
  155. v-show="item.vesselId"
  156. class="ontent shipName">{{ item.vesselName }}</span>
  157. <span style="padding-left: 4px;"
  158. class="operaction shipSelectSet"
  159. @click="setChargeShip">设置</span>
  160. </div>
  161. </div> -->
  162. <div style="display:flex">
  163. <span class=" font">兼职职务</span>
  164. <span class="operaction"
  165. @click="partTimeSetting">设置</span>
  166. <div class="boxClass">
  167. <div v-for="(item, index) in jobList"
  168. :key="index"
  169. v-show="item.roleId"
  170. style="margin-bottom: 10px">
  171. <span class=" aaa">兼职{{ index + 1 }}:{{ item.roleName }}</span>
  172. <!-- <div class="lastspan">
  173. <span class="star bbb">关联船舶</span>
  174. <div class="ontent"
  175. style="width: 800px;">
  176. <span v-for="(item, index) in item.asd"
  177. :key="item.vesselId + index"
  178. v-show="item.vesselId"
  179. class="ontent shipName">{{ item.vesselName }}</span>
  180. <span class="operaction shipSelectSet"
  181. @click="setUpShip(item)">设置</span>
  182. </div>
  183. </div> -->
  184. </div>
  185. </div>
  186. </div>
  187. </div>
  188. <div class="uphead">
  189. <span class="imghead font">上传签名:</span>
  190. <img :src="
  191. ruleForm.electronicSignature === ''
  192. ? url
  193. : ruleForm.electronicSignature
  194. "
  195. class="img" />
  196. <input type="file"
  197. class="kyc-passin"
  198. @change="uploadPhoto($event)" />
  199. <span class="talk">支持上传jpg/png文件,大小不能超过1M</span>
  200. </div>
  201. </div>
  202. <!-- 主要职务选择 -->
  203. <el-dialog title="设置成员主职职务"
  204. :visible.sync="mainJobSelection"
  205. width="650px"
  206. center
  207. :close-on-click-modal="false">
  208. <div class="checkBoxClass">
  209. <span class="member">成员将属于以下职务</span>
  210. <el-radio-group @change="handleCheckAllChanges"
  211. v-model="post"
  212. class="postBox">
  213. <el-radio class="checkBoxCla"
  214. v-for="(item, key) in data1"
  215. :key="key"
  216. :label="item.roleId">{{ item.roleName }}</el-radio>
  217. </el-radio-group>
  218. </div>
  219. <span slot="footer"
  220. class="dialog-footer">
  221. <el-button @click="mainJobSelection = false">取 消</el-button>
  222. <el-button type="primary"
  223. @click="setMainJob">确 定</el-button>
  224. </span>
  225. </el-dialog>
  226. <!--6.设置成员职务-->
  227. <el-dialog title="设置兼职职务职务"
  228. :visible.sync="setDuty"
  229. width="650px"
  230. center
  231. :close-on-click-modal="false">
  232. <div class="adddepartment">
  233. <div class="adddepartment1">
  234. <div v-loading="roleLoading">
  235. <div class="block">
  236. <el-tree class="ship-tree"
  237. :props="props"
  238. node-key="id"
  239. :load="loadNode"
  240. lazy>
  241. <!-- @change="val => radioGroupChange(data, val, node)" -->
  242. <template slot-scope="{ node, data }">
  243. <span v-if="node.level === 2">
  244. <el-checkbox-group v-model="data.check" @change="val => radioGroupChange(data, val, node)">
  245. <el-checkbox class="zhiwuChecks"
  246. v-for="item in data.roid"
  247. :key="item.roleId"
  248. :label="item">
  249. {{ item.roleName }}
  250. </el-checkbox>
  251. </el-checkbox-group>
  252. </span>
  253. <span v-else>{{ data.deptName }}</span>
  254. </template>
  255. </el-tree>
  256. </div>
  257. </div>
  258. </div>
  259. <div class="adddepartment2">
  260. <span class="adddepartment4">成员将属于以下职务</span>
  261. <div class="primaryzw">
  262. <div class="ciyaozhiwu"
  263. v-for="(item, index) in jobList"
  264. :key="index">
  265. {{ item.roleName }}
  266. <span class="zhiwuDel"
  267. @click="delZhiWu(item)">删除</span>
  268. </div>
  269. </div>
  270. </div>
  271. </div>
  272. <span slot="footer"
  273. class="dialog-footer">
  274. <el-button @click="setDuty = false">取 消</el-button>
  275. <el-button type="primary"
  276. @click="setDutysave">确 定</el-button>
  277. </span>
  278. </el-dialog>
  279. <!-- 7.关联船舶 -->
  280. <el-dialog title="负责船舶"
  281. :visible.sync="chargeShip"
  282. width="650px"
  283. center
  284. :close-on-click-modal="false">
  285. <div class="adddepartment">
  286. <div class="adddepartment1"
  287. v-loading="loadingVessel">
  288. <div class="search-box">
  289. <el-input class="search-keyword"
  290. v-model.trim="searchKeyword"
  291. maxlength="50"
  292. placeholder="请输入船舶名称"
  293. clearable
  294. @clear="getClear"
  295. @keyup.enter.native="getList" />
  296. <svg-icon icon-class="searchIcon"
  297. class="searchIcon"
  298. @click="getList" />
  299. </div>
  300. <el-checkbox :indeterminate="isIndeterminate"
  301. v-model="checkAll"
  302. @change="handleCheckAllChange">全选</el-checkbox>
  303. <!--<el-checkbox :indeterminate="isIndeterminate" v-model="checkAntiFlag" @change="checkAnti">反选</el-checkbox>-->
  304. <el-checkbox-group v-model="shipCheckList"
  305. @change="handleCheckedCitiesChange">
  306. <el-checkbox class="zhiwuCheck"
  307. v-for="(item, index) in shipList"
  308. :label="item.vesselId"
  309. :key="item.vesselId + index">
  310. {{ item.vesselName }}
  311. </el-checkbox>
  312. </el-checkbox-group>
  313. </div>
  314. <div class="adddepartment2">
  315. <span class="adddepartment4">成员将属于以下船舶</span>
  316. <div class="primaryzw">
  317. <div class="ciyaozhiwu"
  318. v-for="(item, index) in seleteShipList"
  319. :key="index">
  320. {{ item.vesselName }}
  321. <span class="zhiwuDel"
  322. @click="delShipSelect(item.vesselId)">删除</span>
  323. </div>
  324. </div>
  325. </div>
  326. </div>
  327. <span slot="footer"
  328. class="dialog-footer">
  329. <el-button @click="getNowList">取 消</el-button>
  330. <el-button type="primary"
  331. @click="saveChargeShip">确 定</el-button>
  332. </span>
  333. </el-dialog>
  334. <!-- 兼职船舶 -->
  335. <el-dialog title="负责船舶"
  336. :visible.sync="partTimeJobShip"
  337. width="650px"
  338. center
  339. :close-on-click-modal="false">
  340. <div class="adddepartment">
  341. <div class="adddepartment1"
  342. v-loading="loadingVessel">
  343. <div class="search-box">
  344. <el-input class="search-keyword"
  345. v-model.trim="searchKeyword"
  346. maxlength="50"
  347. placeholder="请输入船舶名称"
  348. clearable
  349. @clear="getClear"
  350. @keyup.enter.native="getList" />
  351. <svg-icon icon-class="searchIcon"
  352. class="searchIcon"
  353. @click="getList" />
  354. </div>
  355. <el-checkbox :indeterminate="isIndeterminates"
  356. v-model="checkAll"
  357. @change="handleCheckAllChangess">全选</el-checkbox>
  358. <!--<el-checkbox :indeterminate="isIndeterminate" v-model="checkAllAnti" @change="checkAnti">反选</el-checkbox>-->
  359. <el-checkbox-group v-model="shipCheckLists"
  360. @change="handleCheckedCitiesChangess">
  361. <el-checkbox class="zhiwuCheck"
  362. v-for="(item, index) in shipLists"
  363. :label="item.vesselId"
  364. :key="item.vesselId + index">
  365. {{ item.vesselName }}
  366. </el-checkbox>
  367. </el-checkbox-group>
  368. </div>
  369. <div class="adddepartment2">
  370. <span class="adddepartment4">成员将属于以下船舶</span>
  371. <div class="primaryzw">
  372. <div class="ciyaozhiwu"
  373. v-for="(item, index) in seleteShipLists"
  374. :key="index">
  375. {{ item.vesselName }}
  376. <span class="zhiwuDel"
  377. @click="delShipSelects(item.vesselId)">删除</span>
  378. </div>
  379. </div>
  380. </div>
  381. </div>
  382. <span slot="footer"
  383. class="dialog-footer">
  384. <el-button @click="cancels">取 消</el-button>
  385. <el-button type="primary"
  386. @click="determine">确 定</el-button>
  387. </span>
  388. </el-dialog>
  389. </div>
  390. </template>
  391. <script>
  392. import { addadmin,checkApp } from "../../api/organization/orgAddMan";
  393. import {
  394. getOssInterimCredentials,
  395. GotOssAccessConfig,
  396. uploadShipFiles
  397. } from "../../api/upload";
  398. import { client } from "../../utils/alioss";
  399. import { validPassword } from "../../utils/validate";
  400. import shoreApi from "../../api/organization/shore";
  401. import {
  402. staffInfo,
  403. changeInfo,
  404. saveRole,
  405. companyVessels,
  406. getDeptListByCompId
  407. } from "../../api/shoreBasedMembers";
  408. const validPasswordRule = function (rule, value, callback) {
  409. if (value)
  410. if (!validPassword(value)) {
  411. callback(
  412. // this.$message({
  413. // message: '密码为6到20位数字密码任意组合!',
  414. // type: 'error'
  415. // })
  416. new Error("密码为6到20位数字密码任意组合")
  417. );
  418. return;
  419. } else {
  420. callback();
  421. return;
  422. }
  423. callback();
  424. // if (!validPassword(value)) {
  425. // callback(new Error('密码为6到20位数字密码任意组合'));
  426. // } else {
  427. // callback();
  428. // }
  429. };
  430. export default {
  431. name: "shoreMemberAdd",
  432. data () {
  433. const validcodeId = (rule, value, callback) => {
  434. const reg = /[0-9a-zA-Z]$/;
  435. if (!reg.test(value)) {
  436. callback(
  437. new Error("账号必须是由数字和字母组合")
  438. // this.$message({
  439. // type: 'error',
  440. // message: '账号必须是由数字和字母组合',
  441. // showClose: true,
  442. // })
  443. );
  444. } else {
  445. callback();
  446. }
  447. };
  448. const validcodeName = (rule, value, callback) => {
  449. const reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/;
  450. if (!reg.test(value)) {
  451. callback(
  452. new Error("密码必须是由6位数字和字母组合")
  453. // this.$message({
  454. // type: 'error',
  455. // message: '密码必须是由6位数字和字母组合',
  456. // showClose: true,
  457. // })
  458. );
  459. } else {
  460. callback();
  461. }
  462. };
  463. const validPasswordAgain = (rule, value, callback) => {
  464. if (value === "") {
  465. callback(
  466. this.$message({
  467. type: "error",
  468. message: "带*号的为必填项",
  469. showClose: true
  470. })
  471. );
  472. } else if (
  473. (value !== this.ruleForm.loginPassword && !this.id) ||
  474. (value !== this.ruleForm.loginPasswordNew && this.id)
  475. ) {
  476. callback(
  477. this.$message({
  478. type: "error",
  479. message: "两次密码不一致",
  480. showClose: true
  481. })
  482. );
  483. } else {
  484. callback();
  485. }
  486. };
  487. const validcodePhonee = (rule, value, callback) => {
  488. const reg = /^1[345789]\d{9}$/;
  489. if (!reg.test(value)) {
  490. callback(
  491. new Error("手机号格式填写错误")
  492. // this.$message({
  493. // type: 'error',
  494. // message: '手机号格式填写错误',
  495. // showClose: true,
  496. // })
  497. );
  498. } else {
  499. callback();
  500. }
  501. };
  502. return {
  503. aaabbb: [],
  504. postList: [],
  505. post: "",
  506. mainJobSelection: false,
  507. isIndeterminate: false,
  508. isIndeterminates: false,
  509. loadingVessel: false,
  510. checkAll: false,
  511. checkAntiFlag: false,
  512. compId: sessionStorage.getItem("enterprise-front-companyId"),
  513. searchKeyword: "", // 关联船舶 搜索关键词
  514. datamsg: "",
  515. title: "",
  516. /* 页面传递来的数据 */
  517. checklist: [
  518. {
  519. value: ""
  520. }
  521. ],
  522. Department: "",
  523. Departmentname: "",
  524. /* 设置部门 */
  525. checklist1: [
  526. {
  527. key: "",
  528. value: ""
  529. }
  530. ],
  531. Department1: "",
  532. Departmentname1: "",
  533. zwmsg: "",
  534. // 船舶
  535. checklist2: [],
  536. /* 设置关联船舶 */
  537. url:
  538. "http://winsea-saas-test.oss-cn-shanghai.aliyuncs.com/default-logo.png",
  539. setUpTheDepartment: false,
  540. setDuty: false,
  541. chargeShip: false,
  542. partTimeJobShip: false,
  543. loading: false,
  544. ruleForm: {
  545. deptId: "",
  546. staffName: "",
  547. staffAccount: "",
  548. loginPassword: "",
  549. loginPasswordAgain: "",
  550. loginPasswordAgainNew: "",
  551. loginPasswordNew: "",
  552. staffMobilePhone: "",
  553. electronicSignature: "",
  554. majorRoleId: "",
  555. roles: [
  556. {
  557. roleId: "",
  558. major: "1"
  559. }
  560. ],
  561. vessels: [{vesselId:'e88a798337c14cd7b8e0dfe7f9efdf5a',vesselName:'试用船舶'}],
  562. roleVesselIds: []
  563. },
  564. rules: {
  565. staffAccount: [
  566. {
  567. required: true,
  568. // validator: validcodeId,
  569. trigger: "blur",
  570. message: "请输入账号"
  571. }
  572. ],
  573. loginPassword: [
  574. {
  575. required: true,
  576. validator: validcodeName,
  577. trigger: "blur"
  578. }
  579. ],
  580. loginPasswordAgain: [
  581. {
  582. required: true,
  583. validator: validPasswordAgain,
  584. trigger: "blur"
  585. }
  586. ],
  587. loginPasswordNew: [
  588. {
  589. validator: validPasswordRule,
  590. trigger: "blur"
  591. }
  592. ],
  593. staffName: [
  594. {
  595. required: true,
  596. trigger: "blur",
  597. message: "请输入中文名"
  598. }
  599. ],
  600. staffMobilePhone: [
  601. {
  602. required: true,
  603. validator: validcodePhonee,
  604. trigger: "blur"
  605. }
  606. ],
  607. underCompId: [
  608. {
  609. required: true,
  610. trigger: "change"
  611. }
  612. ]
  613. },
  614. data: [],
  615. data5: [],
  616. data6: [],
  617. data1: [
  618. {
  619. id: "",
  620. label: "",
  621. disabled: true,
  622. children: []
  623. }
  624. ],
  625. shipList: [],
  626. shipLists: [],
  627. primaryzw: "1",
  628. zhiwuCheckList: [],
  629. zhiwuChec1kList: [],
  630. zhiwu1: {},
  631. zhiwu2: [],
  632. zhiwu11: {},
  633. shipCheckList: [],
  634. shipCheckLists: [],
  635. seleteShipList: [],
  636. seleteShipLists: [],
  637. companyList: [],
  638. deptList: [],
  639. inputType: "text",
  640. isChrome: true,
  641. roleLoading: false,
  642. id: this.$route.query.id,
  643. postId: "",
  644. partTimeJobList: [],
  645. partTimeDepartmentList: [],
  646. checkedCities: [],
  647. props: {
  648. label: "name",
  649. children: "children",
  650. isLeaf: "leaf"
  651. },
  652. check: [],
  653. aaaaaa: [],
  654. gggg: []
  655. };
  656. },
  657. computed: {
  658. jobList () {
  659. let res = [];
  660. Object.keys(this.check).forEach((value, index) => {
  661. this.check[value].forEach(ite => {
  662. console.log(ite,res)
  663. // if(res.length>0){
  664. // if(res.every( function( item, index, array ){ return item.roleId!=ite.roleId})){
  665. // console.log(ite)
  666. // res.push(ite);
  667. // }else{
  668. // console.log(ite)
  669. // }
  670. // }else{
  671. res.push(ite);
  672. // }
  673. });
  674. });
  675. let _a = res.filter(v => v);
  676. _a.forEach(v => {
  677. if (v.asd === undefined) v.asd = [];
  678. });
  679. return _a;
  680. }
  681. },
  682. created () {
  683. this.baseInfo();
  684. },
  685. methods: {
  686. async loadNode (node, resolve) {
  687. if (node.level === 0) {
  688. // 发起一级请求
  689. return resolve(this.partTimeDepartmentList);
  690. }
  691. if (node.level === 1) {
  692. // 发起二级请求
  693. let uuid = node.data.deptId;
  694. let response = await shoreApi.queryRoleSelectData({
  695. vesselBankFlag: "B",
  696. underCompId: this.ruleForm.underCompId,
  697. deptId: uuid
  698. });
  699. this.partTimeJobList = response;
  700. if (this.partTimeJobList !== null)
  701. this.partTimeJobList = this.partTimeJobList.map(itemA => {
  702. return {
  703. ...itemA,
  704. deptId: uuid
  705. };
  706. });
  707. let _check = [];
  708. for (let variable of this.partTimeJobList) {
  709. let curr;
  710. for (let variable2 of this.jobList) {
  711. if (variable.roleId === variable2.roleId) curr = variable;
  712. }
  713. if (curr) {
  714. _check.push(curr);
  715. // break;
  716. }
  717. }
  718. this.jobList.forEach(item => {
  719. item.asd.forEach(itemA => {
  720. _check.forEach(itemB => {
  721. if (item.deptId === itemB.deptId)
  722. if (itemB.asd === undefined) {
  723. itemB.asd = [];
  724. } else {
  725. itemB.asd.push(itemA);
  726. }
  727. });
  728. });
  729. });
  730. this.aaabbb[uuid] = _check;
  731. return resolve([
  732. {
  733. id: node.data.deptId,
  734. roid: this.partTimeJobList,
  735. check: _check,
  736. leaf: true
  737. }
  738. ]);
  739. }
  740. if (node.level > 1) {
  741. return resolve([]);
  742. }
  743. },
  744. radioGroupChange (data, val, node) {
  745. this.check=[]
  746. for (let i = 0; i < val.length; i++) {
  747. data.id=val[i].deptId+'_'+val[i].roleId
  748. this.$set(this.check, data.id, [val[i]]);
  749. }
  750. // console.log(this.check)
  751. this.aaabbb[data.id] = val;
  752. },
  753. //tree
  754. remove (node, data) {
  755. // const parent = node.parent;
  756. // const children = parent.data.children || parent.data;
  757. // const index = children.findIndex(d => d.id === data.id);
  758. // children.splice(index, 1);
  759. },
  760. // 取消
  761. cancels () {
  762. this.partTimeJobShip = false;
  763. // this.ruleForm.roleVesselIds = [];
  764. // this.jobList.forEach(item => {
  765. // item.asd.forEach(ite => {
  766. // this.ruleForm.roleVesselIds.push(item.roleId + "_" + ite.vesselId);
  767. // });
  768. // });
  769. },
  770. // 确定
  771. determine () {
  772. this.partTimeJobShip = false;
  773. this.ruleForm.roleVesselIds = [];
  774. this.jobList.forEach(item => {
  775. item.asd.forEach(ite => {
  776. this.ruleForm.roleVesselIds.push(item.roleId + "_" + ite.vesselId);
  777. });
  778. });
  779. },
  780. append (data) {
  781. const newChild = { id: id++, label: "testtest", children: [] };
  782. if (!data.children) {
  783. this.$set(data, "children", []);
  784. }
  785. data.children.push(newChild);
  786. },
  787. getList () {
  788. // 船舶
  789. shoreApi
  790. .getVessels({ searchKeyword: this.searchKeyword })
  791. .then(response => {
  792. this.shipList = response;
  793. this.shipLists = response;
  794. let _isIndeterminate = false;
  795. this.shipList.forEach(v => {
  796. this.seleteShipList.forEach(v2 => {
  797. if (v2.vesselId === v.vesselId) _isIndeterminate = true;
  798. });
  799. });
  800. this.shipLists.forEach(v => {
  801. this.seleteShipList.forEach(v2 => {
  802. if (v2.vesselId === v.vesselId) _isIndeterminate = true;
  803. });
  804. });
  805. this.isIndeterminate = _isIndeterminate;
  806. this.isIndeterminates = _isIndeterminate;
  807. let _checkAll = false;
  808. let selectMum = 0;
  809. this.shipList.forEach(v => {
  810. this.seleteShipList.forEach(v2 => {
  811. if (v2.vesselId === v.vesselId) selectMum++;
  812. });
  813. });
  814. this.shipLists.forEach(v => {
  815. this.seleteShipList.forEach(v2 => {
  816. if (v2.vesselId === v.vesselId) selectMum++;
  817. });
  818. });
  819. if (this.shipList.length === selectMum) {
  820. _checkAll = true;
  821. this.isIndeterminate = false;
  822. } else {
  823. _checkAll = false;
  824. }
  825. if (this.shipLists.length === selectMum) {
  826. _checkAll = true;
  827. this.isIndeterminates = false;
  828. } else {
  829. _checkAll = false;
  830. }
  831. this.checkAll = _checkAll;
  832. });
  833. },
  834. getClear () {
  835. this.searchKeyword = null;
  836. this.getList();
  837. },
  838. //反选
  839. checkAnti (val) {
  840. // console.log(val,'反选')
  841. this.checkAll = !val;
  842. // if(val){
  843. // this.checkAll = false;
  844. // }
  845. let citiesId = [];
  846. let shipCheck = [];
  847. this.shipList.forEach(item => {
  848. citiesId.push({ vesselId: item.vesselId, vesselName: item.vesselName });
  849. shipCheck.push(item.vesselId);
  850. });
  851. if (this.shipCheckList.length === this.shipList.length) {
  852. this.isIndeterminate = false;
  853. this.shipCheckList = [];
  854. this.seleteShipList = [];
  855. } else if (this.shipCheckList.length === 0) {
  856. this.isIndeterminate = false;
  857. this.shipCheckList = shipCheck;
  858. this.seleteShipList = citiesId;
  859. }
  860. },
  861. // 关联船舶全选
  862. handleCheckAllChange (val) {
  863. if (val) {
  864. this.checkAntiFlag = false;
  865. }
  866. // this.checkAntiFlag = !val;
  867. // console.log(val,'正选')
  868. let citiesId = [];
  869. let shipCheck = [];
  870. this.shipList.forEach(item => {
  871. citiesId.push({ vesselId: item.vesselId, vesselName: item.vesselName });
  872. shipCheck.push(item.vesselId);
  873. });
  874. this.shipCheckList = val ? shipCheck : [];
  875. this.seleteShipList = val ? citiesId : [];
  876. this.isIndeterminate = false;
  877. },
  878. // 关联船舶单选
  879. handleCheckedCitiesChange (value) {
  880. // 差集
  881. let t = [];
  882. this.shipList.forEach(v1 => {
  883. let b = Object.assign({}, v1);
  884. value.forEach(v2 => {
  885. if (v2 === v1.vesselId) b = null;
  886. });
  887. t.push(b);
  888. });
  889. //加
  890. this.shipList.forEach(item => {
  891. value.forEach(gitem => {
  892. if (item.vesselId === gitem) {
  893. let currIndex = this.seleteShipList.findIndex(
  894. value => value.vesselId === gitem
  895. );
  896. if (currIndex === -1)
  897. this.seleteShipList.push({
  898. vesselId: item.vesselId,
  899. vesselName: item.vesselName
  900. });
  901. }
  902. });
  903. });
  904. // 删
  905. let _t = t.filter(v => !!v);
  906. let a = this.seleteShipList.filter(v => {
  907. let r = true;
  908. _t.forEach(v2 => {
  909. if (v.vesselId === v2.vesselId) r = false;
  910. });
  911. return r;
  912. });
  913. this.seleteShipList = a;
  914. let _isIndeterminate = false;
  915. this.shipList.forEach(v => {
  916. if (value.includes(v.vesselId)) {
  917. _isIndeterminate = true;
  918. }
  919. });
  920. this.isIndeterminate = _isIndeterminate;
  921. let _checkAll = false;
  922. let selectMum = 0;
  923. this.shipList.forEach(v => {
  924. if (value.includes(v.vesselId)) {
  925. selectMum++;
  926. }
  927. });
  928. if (this.shipList.length === selectMum) {
  929. _checkAll = true;
  930. this.isIndeterminate = false;
  931. } else {
  932. _checkAll = false;
  933. }
  934. this.checkAll = _checkAll;
  935. },
  936. // 关联船舶全选
  937. handleCheckAllChangess (val) {
  938. let citiesId = [];
  939. let shipChecks = [];
  940. this.shipLists.forEach(item => {
  941. citiesId.push({ vesselId: item.vesselId, vesselName: item.vesselName });
  942. shipChecks.push(item.vesselId);
  943. });
  944. this.shipCheckLists = val ? shipChecks : [];
  945. this.seleteShipLists = val ? citiesId : [];
  946. this.gggg.asd = val ? citiesId : [];
  947. this.isIndeterminates = false;
  948. },
  949. // 关联船舶单选
  950. handleCheckedCitiesChangess (value) {
  951. // 差集
  952. let t = [];
  953. this.shipLists.forEach(v1 => {
  954. let b = Object.assign({}, v1);
  955. value.forEach(v2 => {
  956. if (v2 === v1.vesselId) b = null;
  957. });
  958. t.push(b);
  959. });
  960. //加
  961. this.shipLists.forEach(item => {
  962. value.forEach(gitem => {
  963. if (item.vesselId === gitem) {
  964. let currIndex = this.seleteShipLists.findIndex(
  965. value => value.vesselId === gitem
  966. );
  967. if (currIndex === -1)
  968. this.seleteShipLists.push({
  969. vesselId: item.vesselId,
  970. vesselName: item.vesselName
  971. });
  972. this.gggg.asd = this.seleteShipLists;
  973. }
  974. });
  975. });
  976. // 删
  977. let _t = t.filter(v => !!v);
  978. let a = this.seleteShipLists.filter(v => {
  979. let r = true;
  980. _t.forEach(v2 => {
  981. if (v.vesselId === v2.vesselId) r = false;
  982. });
  983. return r;
  984. });
  985. this.seleteShipLists = a;
  986. this.gggg.asd = a;
  987. let _isIndeterminates = false;
  988. this.shipLists.forEach(v => {
  989. if (value.includes(v.vesselId)) {
  990. _isIndeterminates = true;
  991. }
  992. });
  993. this.isIndeterminates = _isIndeterminates;
  994. let _checkAll = false;
  995. let selectMum = 0;
  996. this.shipLists.forEach(v => {
  997. if (value.includes(v.vesselId)) {
  998. selectMum++;
  999. }
  1000. });
  1001. if (this.shipLists.length === selectMum) {
  1002. _checkAll = true;
  1003. this.isIndeterminates = false;
  1004. } else {
  1005. _checkAll = false;
  1006. }
  1007. this.checkAll = _checkAll;
  1008. },
  1009. // 选船操作
  1010. shipCheck (id) {
  1011. this.seleteShipList = [];
  1012. for (let i = 0; i < id.length; i++) {
  1013. this.seleteShipList.push({
  1014. vesselId: id[i],
  1015. vesselName: this.shipList.find(item => item.vesselId === id[i])
  1016. .vesselName
  1017. });
  1018. }
  1019. },
  1020. // 选船操作
  1021. shipChecks (id) {
  1022. this.seleteShipLists = [];
  1023. for (let i = 0; i < id.length; i++) {
  1024. this.seleteShipLists.push({
  1025. vesselId: id[i],
  1026. vesselName: this.shipLists.find(item => item.vesselId === id[i])
  1027. .vesselName
  1028. });
  1029. }
  1030. },
  1031. changeInputType () {
  1032. this.inputType = "password";
  1033. },
  1034. // 当前页面信息
  1035. getMemberInfo () {
  1036. this.loading = true;
  1037. staffInfo({ staffId: this.id }).then(response => {
  1038. this.ruleForm = response;
  1039. this.zhiwu1.roleId = this.ruleForm.majorRoleId;
  1040. if (this.ruleForm.underCompId) {
  1041. this.changeDept(this.ruleForm.underCompId);
  1042. }
  1043. if (this.ruleForm.deptId) {
  1044. shoreApi
  1045. .queryRoleSelectData({
  1046. vesselBankFlag: "B",
  1047. underCompId: this.ruleForm.underCompId,
  1048. deptId: this.ruleForm.deptId
  1049. })
  1050. .then(response => {
  1051. this.data6 = response.map(item => {
  1052. return {
  1053. ...item,
  1054. state: false
  1055. };
  1056. });
  1057. this.data1 = this.data6;
  1058. this.roleLoading = false;
  1059. });
  1060. }
  1061. if (!this.ruleForm.electronicSignature) {
  1062. this.ruleForm.electronicSignature = this.url;
  1063. }
  1064. // console.log(response)
  1065. // TODO: 此处存在疑问点?
  1066. this.zhiwu1.roleName = response.majorRole
  1067. ? response.majorRole.roleName
  1068. : "";
  1069. this.post = response.majorRole ? response.majorRole.roleId : "";
  1070. if (response.majorRole && response.majorRole.vessels)
  1071. response.majorRole.vessels.forEach(item => {
  1072. this.seleteShipList.push(item);
  1073. this.aaaaaa.push(item.vesselId);
  1074. });
  1075. response.roles.forEach(item => {
  1076. this.$set(this.check, `${item.deptId}_${item.roleId}`, [item]);
  1077. this.$set(this.aaabbb, `${item.deptId}_${item.roleId}`, [item]);
  1078. if (item.vessels !== null)
  1079. item.vessels.forEach(itemD => {
  1080. Object.keys(this.check).forEach((value, index) => {
  1081. if (value === `${item.deptId}_${item.roleId}`) {
  1082. this.check[value].forEach(ite => {
  1083. if (ite.asd === undefined) {
  1084. ite.asd = [];
  1085. }
  1086. ite.asd.push(itemD);
  1087. });
  1088. }
  1089. });
  1090. });
  1091. });
  1092. response.roles.forEach(item => {
  1093. if (item.vessels !== null) {
  1094. item.vessels = item.vessels.map(ite => {
  1095. return {
  1096. ...ite,
  1097. roleId: item.roleId
  1098. };
  1099. });
  1100. }
  1101. });
  1102. this.ruleForm.roleVesselIds = [];
  1103. response.roles.forEach(item => {
  1104. if (item.vessels !== null)
  1105. item.vessels.forEach(itemA => {
  1106. this.ruleForm.roleVesselIds.push(
  1107. itemA.roleId + "_" + itemA.vesselId
  1108. );
  1109. // this.jobList.forEach(ite => {
  1110. // if (ite.roleId === item.roleId) {
  1111. // ite.asd.push(itemA);
  1112. // }
  1113. // });
  1114. });
  1115. });
  1116. // TODO: 此处存在
  1117. this.ruleForm.vessels = response.majorRole
  1118. ? response.majorRole.vessels
  1119. : "";
  1120. // let vessels = response.vessels.filter(function(v) {
  1121. // return v;
  1122. // });
  1123. // this.shipCheckList = [];
  1124. // this.seleteShipList = vessels.filter(v => {
  1125. // let t = false;
  1126. // this.shipList.forEach(v2 => {
  1127. // if (v2.vesselId === v.vesselId) {
  1128. // t = true;
  1129. // this.shipCheckList.push(v.vesselId);
  1130. // }
  1131. // });
  1132. // return t;
  1133. // });
  1134. let checkedCount = this.shipCheckList.length;
  1135. this.checkAll = checkedCount === this.shipList.length;
  1136. this.isIndeterminate =
  1137. checkedCount > 0 && checkedCount < this.shipList.length;
  1138. // if (response.roles.length > 0) {
  1139. // this.zhiwu1 = response.roles[0];
  1140. // response.roles.find(item => {
  1141. // if (item.major === "1") {
  1142. // this.zhiwu1 = {
  1143. // roleId: item.roleId,
  1144. // roleName: item.roleName,
  1145. // major: "1"
  1146. // };
  1147. // }
  1148. // this.zhiwuCheckList.push(item.roleId);
  1149. // });
  1150. // this.zhiwu2 = response.roles.filter(item => {
  1151. // return item.major !== "1";
  1152. // });
  1153. // }
  1154. this.loading = false;
  1155. });
  1156. },
  1157. // 上传签名
  1158. uploadPhoto (e) {
  1159. const fileTypes = [".jpg", ".png"];
  1160. const filePath = e.target.value;
  1161. if (filePath) {
  1162. let isNext = false;
  1163. const fileEnd = filePath.substring(filePath.indexOf("."));
  1164. for (let i = 0; i < fileTypes.length; i++) {
  1165. if (fileTypes[i] === fileEnd) {
  1166. isNext = true;
  1167. break;
  1168. }
  1169. }
  1170. if (!isNext) {
  1171. this.$message({
  1172. message: "不接受此类型文件",
  1173. type: "error",
  1174. showClose: true
  1175. });
  1176. e.target.value = "";
  1177. return false;
  1178. }
  1179. } else {
  1180. return false;
  1181. }
  1182. const file = e.target.files[0];
  1183. uploadShipFiles(file, {
  1184. companyId: this.compId || "",
  1185. modelId: ""
  1186. }).then(response => {
  1187. this.ruleForm.electronicSignature =
  1188. this.$store.getters.baseInfo.fileUrl + response.appendixPath;
  1189. this.$message({
  1190. type: "success",
  1191. message: "上传签名成功!",
  1192. showClose: true
  1193. });
  1194. });
  1195. },
  1196. cancel () {
  1197. this.$router.go(-1);
  1198. },
  1199. // 数据转换
  1200. getSelectLabel () {
  1201. this.ruleForm.majorRoleId = this.zhiwu1.roleId;
  1202. // 公司
  1203. this.ruleForm.underCompName = this.companyList.find(
  1204. item => item.compId === this.ruleForm.underCompId
  1205. ).compName;
  1206. // 部门
  1207. this.ruleForm.deptName = this.deptList.find(
  1208. item => item.deptId === this.ruleForm.deptId
  1209. ).deptName;
  1210. if (this.ruleForm.loginPasswordNew) {
  1211. this.ruleForm.loginPassword = this.ruleForm.loginPasswordNew;
  1212. }
  1213. },
  1214. // 编辑
  1215. editSave () {
  1216. this.ruleForm.staffId = this.id;
  1217. changeInfo(this.ruleForm)
  1218. .then(() => {
  1219. // this.cancel();
  1220. this.$message({
  1221. message: "保存成功",
  1222. type: "success",
  1223. showClose: true
  1224. });
  1225. // for(var i =0;i<this.zhiwu2.length;i++){
  1226. // var param = {
  1227. // staffId:this.id,
  1228. // roleId:this.zhiwu2[i].roleId,
  1229. // roleMajor:'0'
  1230. // }
  1231. // saveRole(param).then(() => {
  1232. // })
  1233. // }
  1234. // this.getMemberInfo();
  1235. this.$router.go(-1);
  1236. this.loading = false;
  1237. })
  1238. .catch(code => {
  1239. this.loading = false;
  1240. if (code === "MANAGEMENT_002") {
  1241. this.$message({
  1242. type: "error",
  1243. message: "手机号冲突!",
  1244. showClose: true
  1245. });
  1246. return false;
  1247. }
  1248. if (code === "MANAGEMENT_001") {
  1249. this.$message({
  1250. type: "error",
  1251. message: "用户名冲突!",
  1252. showClose: true
  1253. });
  1254. return false;
  1255. }
  1256. if (code === "MANAGEMENT_003") {
  1257. this.$message({
  1258. type: "error",
  1259. message: "邮箱冲突!",
  1260. showClose: true
  1261. });
  1262. return false;
  1263. }
  1264. if (code === "MANAGEMENT_010") {
  1265. this.$message({
  1266. type: "error",
  1267. message: "成员名称重复!",
  1268. showClose: true
  1269. });
  1270. return false;
  1271. }
  1272. });
  1273. },
  1274. // 保存
  1275. addSave (flag) {
  1276. addadmin(this.ruleForm)
  1277. .then(() => {
  1278. // this.cancel();
  1279. var commonUser={};
  1280. commonUser.phone = this.ruleForm.staffMobilePhone
  1281. checkApp(commonUser).then(()=>{
  1282. })
  1283. this.$message({
  1284. message: "保存成功",
  1285. type: "success",
  1286. showClose: true
  1287. });
  1288. if (flag) {
  1289. this.$router.go(-1);
  1290. } else {
  1291. this.clearZhiwu();
  1292. this.checklist = [
  1293. {
  1294. value: ""
  1295. }
  1296. ];
  1297. this.checklist1 = [
  1298. {
  1299. value: ""
  1300. }
  1301. ];
  1302. this.seleteShipList = [];
  1303. this.ruleForm.staffName = "";
  1304. this.ruleForm.deptId = "";
  1305. this.url =
  1306. "http://winsea-saas-test.oss-cn-shanghai.aliyuncs.com/default-logo.png";
  1307. this.$nextTick(() => {
  1308. this.$refs.ruleForm.clearValidate();
  1309. this.$refs.ruleForm.resetFields();
  1310. });
  1311. }
  1312. this.loading = false;
  1313. })
  1314. .catch(code => {
  1315. this.loading = false;
  1316. if (code === "MANAGEMENT_002") {
  1317. this.$message({
  1318. type: "error",
  1319. message: "手机号冲突!",
  1320. showClose: true
  1321. });
  1322. return false;
  1323. }
  1324. if (code === "MANAGEMENT_001") {
  1325. this.$message({
  1326. type: "error",
  1327. message: "用户名冲突!",
  1328. showClose: true
  1329. });
  1330. return false;
  1331. }
  1332. if (code === "MANAGEMENT_003") {
  1333. this.$message({
  1334. type: "error",
  1335. message: "邮箱冲突!",
  1336. showClose: true
  1337. });
  1338. return false;
  1339. }
  1340. });
  1341. },
  1342. // 保存
  1343. save (formName, flag) {
  1344. this.$refs[formName].validate(valid => {
  1345. if (valid) {
  1346. if (this.ruleForm.roles.length !== 0)
  1347. if (this.ruleForm.roles[0].roleId === "" || this.zhiwu1.roleName === null) {
  1348. this.$message({
  1349. type: "warning",
  1350. message: "请先设置职务!",
  1351. showClose: true
  1352. });
  1353. return false;
  1354. }
  1355. // else if (this.ruleForm.vessels.length === 0) {
  1356. // this.$message({
  1357. // type: "warning",
  1358. // message: "请先设置关联船舶!",
  1359. // showClose: true,
  1360. // });
  1361. // return false;
  1362. // }
  1363. this.loading = true;
  1364. this.getSelectLabel();
  1365. if (this.id) {
  1366. this.editSave();
  1367. } else {
  1368. this.addSave(flag);
  1369. }
  1370. this.isIndeterminate = false;
  1371. } else {
  1372. this.$message({
  1373. message: "带*号的为必填项",
  1374. type: "error",
  1375. showClose: true
  1376. });
  1377. return false;
  1378. }
  1379. });
  1380. },
  1381. // 设置职务
  1382. setwork () {
  1383. if (this.ruleForm.deptId) {
  1384. this.mainJobSelection = true;
  1385. } else {
  1386. this.$message({
  1387. message: "请先选择部门!",
  1388. type: "warning",
  1389. showClose: true
  1390. });
  1391. }
  1392. },
  1393. // 设置船
  1394. setChargeShip () {
  1395. // console.info(this.seleteShipList, this.aaaaaa);
  1396. this.chargeShip = true;
  1397. this.shipCheckList = this.seleteShipList.map(item => item.vesselId);
  1398. // this.shipCheckList = this.aaaaaa;
  1399. this.isIndeterminate = true;
  1400. },
  1401. setUpShip (data) {
  1402. this.gggg = data;
  1403. if (this.gggg.asd.length !== 0) {
  1404. let _aaa = [];
  1405. this.gggg.asd.forEach(item => {
  1406. _aaa.push(item.vesselId);
  1407. });
  1408. this.shipCheckLists = _aaa;
  1409. this.isIndeterminates = true;
  1410. } else {
  1411. this.shipCheckLists = this.gggg.asd;
  1412. this.isIndeterminates = false;
  1413. }
  1414. this.seleteShipLists = this.gggg.asd;
  1415. this.partTimeJobShip = true;
  1416. },
  1417. // 兼职设置
  1418. partTimeSetting () {
  1419. if (this.ruleForm.deptId) {
  1420. this.setDuty = true;
  1421. } else {
  1422. this.$message({
  1423. message: "请先选择部门!",
  1424. type: "warning",
  1425. showClose: true
  1426. });
  1427. }
  1428. },
  1429. // 基础数据
  1430. async baseInfo () {
  1431. // 公司
  1432. shoreApi.compAndChildrenInfo().then(res => {
  1433. res[0].children.unshift({
  1434. compId: res[0].compId,
  1435. compName: res[0].compName
  1436. });
  1437. this.companyList = res[0].children;
  1438. });
  1439. // 船舶
  1440. this.loadingVessel = true;
  1441. let res = await shoreApi.getVessels();
  1442. this.loadingVessel = false;
  1443. this.shipList = res;
  1444. this.shipLists = res;
  1445. if (this.id) {
  1446. this.getMemberInfo();
  1447. this.title = "编辑成员";
  1448. } else {
  1449. this.title = "添加成员";
  1450. }
  1451. // 职员
  1452. this.roleLoading = true;
  1453. shoreApi.queryRoleSelectData({ vesselBankFlag: "B" }).then(response => {
  1454. this.roleLoading = false;
  1455. this.data5 = response.map(item => {
  1456. return {
  1457. ...item,
  1458. state: false
  1459. };
  1460. });
  1461. });
  1462. },
  1463. changeRole (id) {
  1464. this.roleLoading = true;
  1465. shoreApi
  1466. .queryRoleSelectData({
  1467. vesselBankFlag: "B",
  1468. underCompId: this.ruleForm.underCompId,
  1469. deptId: id
  1470. })
  1471. .then(response => {
  1472. this.data6 = response.map(item => {
  1473. return {
  1474. ...item,
  1475. state: false
  1476. };
  1477. });
  1478. this.data1 = this.data6;
  1479. if (!this.data1.find(item => item.roleId === this.zhiwu1.roleId)) {
  1480. this.zhiwu1.roleName = null;
  1481. }
  1482. this.data1.forEach(item => {
  1483. this.zhiwu2.forEach((gitem, gindex) => {
  1484. if (gitem.roleId == item.roleId) {
  1485. this.zhiwu2.splice(gindex, 1);
  1486. }
  1487. this.zhiwuCheckList.forEach((citem, cindex) => {
  1488. if (gitem.roleId == citem) {
  1489. this.zhiwuCheckList.splice(cindex, 1);
  1490. }
  1491. });
  1492. });
  1493. });
  1494. // this.zhiwuCheckList.push(item.roleId);
  1495. // if(this.zhiwu2.find(item => item.roleId === this.zhiwu1.roleId)){
  1496. // this.zhiwu2 = [];
  1497. // }
  1498. this.roleLoading = false;
  1499. });
  1500. },
  1501. changeDept (id) {
  1502. // 部门
  1503. getDeptListByCompId({ vesselBankFlag: "B", underCompId: id }).then(
  1504. response => {
  1505. this.postId = id;
  1506. this.deptList = response;
  1507. this.partTimeDepartmentList = response;
  1508. }
  1509. );
  1510. },
  1511. adddepartmentDel () {
  1512. this.resetChecked();
  1513. this.checklist = [
  1514. {
  1515. key: "",
  1516. value: ""
  1517. }
  1518. ];
  1519. },
  1520. /* 删除 */
  1521. resetChecked (key, value) {
  1522. this.$refs.tree.setCheckedKeys([key]);
  1523. this.checklist.push({
  1524. key,
  1525. value
  1526. });
  1527. },
  1528. // /* 清空 */
  1529. // check(data) {
  1530. // this.checklist = [];
  1531. // const key = data.id;
  1532. // const value = data.label;
  1533. // this.resetChecked(key, value);
  1534. // },
  1535. departmentsave () {
  1536. this.setUpTheDepartment = false;
  1537. this.ruleForm.deptId = this.checklist[0].key;
  1538. },
  1539. // 主要职务单选
  1540. handleCheckAllChanges (value) {
  1541. // this.zhiwu1 = {
  1542. // roleName: this.data1.find(item => item.roleId === value).roleName
  1543. // };
  1544. this.zhiwu1 = {
  1545. major:1,
  1546. roleId: value,
  1547. roleName: this.data1.find(item => item.roleId === value).roleName
  1548. };
  1549. },
  1550. /* 保存 */
  1551. // 设置主要职务
  1552. setMainJob () {
  1553. this.setDuty = false;
  1554. this.zhiwu11 = this.zhiwu1;
  1555. const zhiwuAll = [];
  1556. zhiwuAll.push(this.zhiwu1);
  1557. this.ruleForm.roles = zhiwuAll.concat(this.zhiwu2);
  1558. this.mainJobSelection = false;
  1559. },
  1560. /* 设置职务 */
  1561. setDutysave () {
  1562. // if (this.zhiwu1.roleId) {
  1563. this.setDuty = false;
  1564. this.ruleForm.roleVesselIds = [];
  1565. this.zhiwu2 = []
  1566. this.zhiwu11 = this.zhiwu1;
  1567. const zhiwuAll = [];
  1568. zhiwuAll.push(this.zhiwu1);
  1569. this.jobList.forEach(item => {
  1570. item.asd.forEach(ite => {
  1571. this.ruleForm.roleVesselIds.push(item.roleId + "_" + ite.vesselId);
  1572. });
  1573. this.zhiwu2.push({
  1574. roleId: item.roleId,
  1575. roleName: this.partTimeJobList.find(item1 => item1.roleId === item.roleId)
  1576. .roleName,
  1577. major: "0"
  1578. });
  1579. zhiwuAll.push({
  1580. roleId: item.roleId,
  1581. roleName: this.partTimeJobList.find(item1 => item1.roleId === item.roleId)
  1582. .roleName,
  1583. major: "0"
  1584. });
  1585. });
  1586. this.ruleForm.roles = zhiwuAll
  1587. // } else {
  1588. // this.$message({
  1589. // type: "error",
  1590. // message: "请选择主要职务",
  1591. // showClose: true
  1592. // });
  1593. // }
  1594. },
  1595. getNowList () {
  1596. this.chargeShip = false;
  1597. this.searchKeyword = null;
  1598. this.getList();
  1599. },
  1600. saveChargeShip () {
  1601. this.getNowList();
  1602. this.ruleForm.vessels = this.seleteShipList;
  1603. },
  1604. zhiwu2Check (data) {
  1605. this.zhiwu2 = [];
  1606. for (let i = 0; i < data.length; i++) {
  1607. this.zhiwu2.push({
  1608. roleId: data[i],
  1609. roleName: this.partTimeJobList.find(item => item.roleId === data[i])
  1610. .roleName,
  1611. major: "0"
  1612. });
  1613. }
  1614. },
  1615. // 职务操作
  1616. zhiwuCheck (id) {
  1617. // if (this.primaryzw == "1") {
  1618. // this.zhiwuCheckList = [];
  1619. // this.zhiwuCheckList.push(data[data.length - 1]);
  1620. // this.zhiwu1 = {
  1621. // roleId: data[data.length - 1],
  1622. // roleName: this.data1.find(
  1623. // item => item.roleId === data[data.length - 1]
  1624. // ).roleName,
  1625. // major: "1"
  1626. // };
  1627. // } else {
  1628. // this.zhiwu2 = [];
  1629. // for (let i = 0; i < data.length; i++) {
  1630. // this.zhiwu2.push({
  1631. // roleId: data[i],
  1632. // roleName: this.data5.find(item => item.roleId === data[i]).roleName,
  1633. // major: "0"
  1634. // });
  1635. // }
  1636. // }
  1637. this.roleLoading = true;
  1638. shoreApi
  1639. .queryRoleSelectData({
  1640. vesselBankFlag: "B",
  1641. underCompId: this.ruleForm.underCompId,
  1642. deptId: id.join(",")
  1643. })
  1644. .then(response => {
  1645. this.partTimeJobList = response;
  1646. // this.data6 = response.map(item => {
  1647. // return {
  1648. // ...item,
  1649. // state: false
  1650. // };
  1651. // });
  1652. // this.data1 = this.data6;
  1653. this.roleLoading = false;
  1654. });
  1655. },
  1656. zhiwuRadio1 (data) {
  1657. this.data1 = this.data6;
  1658. for (let i = 0; i < this.data1.length; i++) {
  1659. this.data1[i].state = false;
  1660. }
  1661. for (let i = 0; i < this.zhiwu2.length; i++) {
  1662. for (let j = 0; j < this.data1.length; j++) {
  1663. if (this.zhiwu2[i].roleId == this.data1[j].roleId) {
  1664. this.data1[j].state = true;
  1665. }
  1666. }
  1667. }
  1668. this.zhiwuCheckList = [];
  1669. this.zhiwuCheckList.push(data);
  1670. },
  1671. zhiwuRadio2 (data) {
  1672. this.data1 = this.data5;
  1673. for (let i = 0; i < this.data1.length; i++) {
  1674. this.data1[i].state = false;
  1675. }
  1676. for (let i = 0; i < this.data1.length; i++) {
  1677. if (this.zhiwu1.roleId == this.data1[i].roleId) {
  1678. this.data1[i].state = true;
  1679. }
  1680. }
  1681. this.zhiwuCheckList = [];
  1682. if (data.length > 0) {
  1683. for (let i = 0; i < data.length; i++) {
  1684. this.zhiwuCheckList.push(data[i].roleId);
  1685. }
  1686. }
  1687. },
  1688. delZhiWu (data) {
  1689. for (
  1690. let i = 0;
  1691. i < this.aaabbb[`${data.deptId}_${data.roleId}`].length;
  1692. i++
  1693. ) {
  1694. if (
  1695. this.aaabbb[`${data.deptId}_${data.roleId}`][i].roleId == data.roleId
  1696. ) {
  1697. this.aaabbb[`${data.deptId}_${data.roleId}`].splice(i, 1);
  1698. }
  1699. }
  1700. for (let i = 0; i < this.jobList.length; i++) {
  1701. if (data.roleId === this.jobList[i].roleId) {
  1702. this.jobList.splice(i, 1);
  1703. this.$forceUpdate();
  1704. }
  1705. }
  1706. // for (let i = 0; i < this.data1.length; i++) {
  1707. // if (data.roleId == this.data1[i].roleId) {
  1708. // this.data1[i].state = false;
  1709. // }
  1710. // }
  1711. },
  1712. // 弹出框确认关闭
  1713. handleClose (done) {
  1714. this.clearZhiwu();
  1715. done();
  1716. },
  1717. clearZhiwu () {
  1718. this.zhiwu11 = [];
  1719. this.zhiwu1 = {};
  1720. this.zhiwu2 = [];
  1721. this.zhiwuCheckList = [];
  1722. this.primaryzw = "1";
  1723. this.shipCheckList = [];
  1724. this.seleteShipList = [];
  1725. },
  1726. delShipSelect (data) {
  1727. const num = this.shipCheckList.indexOf(data);
  1728. this.shipCheckList.splice(num, 1);
  1729. for (let i = 0; i < this.seleteShipList.length; i++) {
  1730. if (this.seleteShipList[i].vesselId == data) {
  1731. this.seleteShipList.splice(i, 1);
  1732. }
  1733. }
  1734. if (this.seleteShipList.length === 0) {
  1735. this.isIndeterminate = false;
  1736. } else {
  1737. this.isIndeterminate = true;
  1738. }
  1739. },
  1740. delShipSelects (data) {
  1741. const num = this.shipCheckLists.indexOf(data);
  1742. this.shipCheckLists.splice(num, 1);
  1743. for (let i = 0; i < this.seleteShipLists.length; i++) {
  1744. if (this.seleteShipLists[i].vesselId == data) {
  1745. this.seleteShipLists.splice(i, 1);
  1746. }
  1747. }
  1748. this.gggg.asd = this.seleteShipLists;
  1749. if (this.seleteShipLists.length === 0) {
  1750. this.isIndeterminate = false;
  1751. } else {
  1752. this.isIndeterminate = true;
  1753. }
  1754. }
  1755. }
  1756. };
  1757. </script>
  1758. <style scoped lang="scss">
  1759. .dept-comp {
  1760. /deep/ .el-select:nth-child(1) {
  1761. margin-right: 10px;
  1762. }
  1763. /deep/ .el-input__inner,
  1764. .el-select {
  1765. width: 203px !important;
  1766. }
  1767. }
  1768. .serviceType {
  1769. /deep/ .el-form-item__label {
  1770. padding-right: 25px;
  1771. }
  1772. .el-form-item__content {
  1773. position: relative;
  1774. }
  1775. .tips {
  1776. font-size: 20px;
  1777. color: #999;
  1778. position: absolute;
  1779. left: -25px;
  1780. cursor: pointer;
  1781. z-index: 99;
  1782. &:hover {
  1783. p {
  1784. display: block;
  1785. }
  1786. }
  1787. p {
  1788. display: none;
  1789. box-shadow: 0 1px 8px rgba(137, 142, 146, 0.34);
  1790. font-size: 12px;
  1791. line-height: 16px;
  1792. background: #fff;
  1793. color: #333;
  1794. padding: 3px;
  1795. margin: 0;
  1796. margin-top: -4px;
  1797. border-radius: 5px;
  1798. height: 40px;
  1799. }
  1800. }
  1801. }
  1802. .border {
  1803. width: 960px;
  1804. height: 100%;
  1805. border-left: 1px solid #cccccc;
  1806. }
  1807. .organization-box {
  1808. height: calc(86vh - 10px);
  1809. overflow-y: auto;
  1810. border: none;
  1811. }
  1812. .uphead {
  1813. margin: 20px 0;
  1814. height: 60px;
  1815. line-height: 60px;
  1816. }
  1817. .img {
  1818. display: inline-block;
  1819. height: 60px;
  1820. width: 60px;
  1821. border-radius: 10px;
  1822. vertical-align: sub;
  1823. }
  1824. .kyc-passin {
  1825. margin-left: 20px;
  1826. width: 170px;
  1827. }
  1828. .talk {
  1829. font-size: 12px;
  1830. color: #999999;
  1831. }
  1832. /deep/.el-dialog__body {
  1833. padding: 0;
  1834. }
  1835. /deep/ .el-dialog--center .el-dialog__body {
  1836. padding: 0;
  1837. }
  1838. .adddepartment {
  1839. height: 400px;
  1840. display: flex;
  1841. justify-content: space-between;
  1842. }
  1843. .adddepartment1 {
  1844. padding: 20px;
  1845. width: 50%;
  1846. overflow-y: auto;
  1847. .el-checkbox-group {
  1848. padding-left: 15px;
  1849. }
  1850. .search-box {
  1851. margin-bottom: 10px;
  1852. .search-keyword {
  1853. margin-right: 30px;
  1854. }
  1855. }
  1856. }
  1857. .adddepartment2 {
  1858. padding: 20px;
  1859. width: 50%;
  1860. background-color: #eeeeee;
  1861. }
  1862. /deep/.el-tree-node__content {
  1863. height: 40px;
  1864. }
  1865. .adddepartment3 {
  1866. height: 36px;
  1867. line-height: 36px;
  1868. background-color: #ffffff;
  1869. position: relative;
  1870. margin-bottom: 5px;
  1871. }
  1872. .adddepartment4 {
  1873. display: inline-block;
  1874. margin-bottom: 20px;
  1875. }
  1876. .adddepartmentLeft {
  1877. width: 195px;
  1878. display: inline-block;
  1879. position: absolute;
  1880. left: 10px;
  1881. overflow: hidden;
  1882. text-overflow: ellipsis;
  1883. white-space: nowrap;
  1884. }
  1885. .shipName {
  1886. padding: 4px 8px;
  1887. background-color: #dde9fc;
  1888. margin-right: 10px;
  1889. margin-bottom: 10px;
  1890. }
  1891. .ddv1 {
  1892. //width: 730px;
  1893. vertical-align: top;
  1894. margin-top: 2px;
  1895. }
  1896. .ddv1 > span {
  1897. float: left;
  1898. }
  1899. .adddepartmentDel {
  1900. display: inline-block;
  1901. position: absolute;
  1902. right: 20px;
  1903. color: #1d6ced;
  1904. cursor: pointer;
  1905. }
  1906. /deep/.el-form-item .el-input__inner {
  1907. width: 420px;
  1908. }
  1909. .main-list {
  1910. height: calc(42vh);
  1911. }
  1912. .primaryzw {
  1913. width: 100%;
  1914. margin-bottom: 30px;
  1915. }
  1916. .zhiwuCheck {
  1917. display: block;
  1918. margin-top: 10px;
  1919. }
  1920. .zhiwuChecks {
  1921. display: block;
  1922. margin-left: -30px;
  1923. }
  1924. .zhuyaozhiwu {
  1925. margin-top: 10px;
  1926. background-color: #ffffff;
  1927. padding: 3px 8px;
  1928. // display: inline-block;
  1929. }
  1930. .ciyaozhiwu {
  1931. background-color: #ffffff;
  1932. padding: 5px 10px;
  1933. // display: inline-block;
  1934. margin-top: 10px;
  1935. }
  1936. .zhiwuradio {
  1937. margin-top: 5px;
  1938. margin-right: 10px;
  1939. }
  1940. .zhiwuDel {
  1941. margin-inline-start: 10px;
  1942. color: #1d6ced;
  1943. cursor: pointer;
  1944. float: right;
  1945. }
  1946. .lastspan {
  1947. display: flex;
  1948. }
  1949. .ddv1 {
  1950. flex: 1;
  1951. }
  1952. .inputPsd {
  1953. -webkit-text-security: disc;
  1954. }
  1955. /deep/ .el-form-item__error {
  1956. display: block;
  1957. }
  1958. .dept-comp {
  1959. /deep/ .el-form-item__error {
  1960. display: none;
  1961. }
  1962. /deep/ .el-form-item__content {
  1963. /deep/ .el-input {
  1964. width: 202px;
  1965. }
  1966. }
  1967. }
  1968. /deep/ .el-form-item__content {
  1969. /deep/ .el-input {
  1970. width: 420px;
  1971. }
  1972. }
  1973. .member {
  1974. display: inline-block;
  1975. margin: 10px 0 0 10px;
  1976. }
  1977. .checkBoxClass {
  1978. // float: left;
  1979. width: 650px;
  1980. height: 100%;
  1981. }
  1982. .checkBoxCla {
  1983. width: 25%;
  1984. margin: 10px 0 10px 20px;
  1985. }
  1986. .boxClass {
  1987. margin-left: 10px;
  1988. }
  1989. .aaa {
  1990. display: inline-block;
  1991. padding-right: 12px;
  1992. font-size: 14px;
  1993. color: #666666;
  1994. margin-bottom: 15px;
  1995. }
  1996. .bbb {
  1997. display: inline-block;
  1998. padding-right: 12px;
  1999. font-size: 14px;
  2000. color: #666666;
  2001. }
  2002. .postBox {
  2003. width: 100%;
  2004. }
  2005. .ship-tree {
  2006. /deep/.el-tree-node__content {
  2007. height: auto;
  2008. }
  2009. /deep/.el-radio-group {
  2010. display: flex;
  2011. flex-direction: column;
  2012. text-align: left;
  2013. & > .el-radio {
  2014. margin: 2px;
  2015. }
  2016. }
  2017. }
  2018. </style>