lesseeEdit.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833
  1. <!-- 主页模块 主页一览-->
  2. <template>
  3. <div>
  4. <div class="head">
  5. <span class="headicon">基本信息</span>
  6. </div>
  7. <div class="top-buttons">
  8. <el-button type="primary"
  9. size="small"
  10. @click="save">保存</el-button>
  11. <el-button v-show="state"
  12. size="small"
  13. @click="backToAdd">保存并继续添加</el-button>
  14. <el-button size="small"
  15. @click="back">返回列表</el-button>
  16. </div>
  17. <div class="form">
  18. <el-form ref="ruleForm"
  19. :model="ruleForm"
  20. label-position="right"
  21. label-width="120px"
  22. :rules="rules">
  23. <el-form-item label="公司中文名称"
  24. prop="tenantName"
  25. class="aaa">
  26. <el-input v-model="ruleForm.tenantName"
  27. size="small"
  28. @change="edited = true"
  29. class="page-form-input"
  30. maxlength="90" />
  31. </el-form-item>
  32. <el-form-item label="公司英文名称"
  33. prop="tenantEnName"
  34. class="aaa">
  35. <el-input v-model="ruleForm.tenantEnName"
  36. size="small"
  37. @change="edited = true"
  38. class="page-form-input"
  39. maxlength="90" />
  40. </el-form-item>
  41. <el-form-item label="公司简称">
  42. <el-input size="small"
  43. v-model="ruleForm.compSimpleNameEn"
  44. class="page-form-input"
  45. disabled />
  46. <el-tooltip class="item"
  47. effect="light"
  48. content="用于标记采购单号规则标识"
  49. placement="bottom-start">
  50. <svg-icon icon-class="talk"
  51. class="talk" />
  52. </el-tooltip>
  53. </el-form-item>
  54. <el-form-item label="公司域名"
  55. prop="compDomainName"
  56. class="aaa">
  57. <el-input maxlength="40"
  58. class="page-form-input"
  59. @change="edited = true"
  60. size="small"
  61. v-model="ruleForm.compDomainName" />
  62. </el-form-item>
  63. <el-form-item label="联系人"
  64. prop="linkmanName"
  65. class="aaa">
  66. <el-input v-model="ruleForm.linkmanName"
  67. size="small"
  68. @change="edited = true"
  69. class="page-form-input" />
  70. </el-form-item>
  71. <el-form-item label="联系电话"
  72. prop="linkmanPhone">
  73. <el-input v-model="ruleForm.linkmanPhone"
  74. @change="edited = true"
  75. size="small"
  76. class="page-form-input" />
  77. </el-form-item>
  78. <el-form-item label="联系人邮箱"
  79. prop="linkmanEmail">
  80. <el-input v-model="ruleForm.linkmanEmail"
  81. @change="edited = true"
  82. size="small"
  83. class="page-form-input" />
  84. </el-form-item>
  85. <el-form-item label="专属客服"
  86. prop="customerServiceStaffId"
  87. class="aaa">
  88. <el-select v-model="ruleForm.customerServiceStaffId"
  89. placeholder="请选择"
  90. @change="edited = true">
  91. <el-option v-for="item in options"
  92. :key="item.operatorId"
  93. :label="item.operatorName"
  94. :value="item.operatorId" />
  95. </el-select>
  96. </el-form-item>
  97. <el-form-item label="服务类型"
  98. prop="serviceType"
  99. class="aaa">
  100. <el-select v-model="ruleForm.serviceType"
  101. placeholder="请选择"
  102. @change="edited = true">
  103. <el-option label="船端"
  104. value="SHIP_CLIENT" />
  105. <el-option label="岸端"
  106. value="COAST_CLIENT" />
  107. <el-option label="船端+岸端"
  108. value="SHIP_COAST_CLIENT" />
  109. </el-select>
  110. </el-form-item>
  111. <!-- <el-form-item label="入驻船舶数"
  112. prop="enteringShipNumber">
  113. <el-input v-model="ruleForm.enteringShipNumber"
  114. size="small"
  115. class="page-form-input"
  116. @change="edited = true" />
  117. </el-form-item> -->
  118. <!-- 船舶总数量 -->
  119. <el-form-item label="入驻船舶数"
  120. prop="shipNumber">
  121. <el-input v-model="ruleForm.shipNumber"
  122. size="small"
  123. class="page-form-input"
  124. @change="edited = true" />
  125. </el-form-item>
  126. <el-form-item label="税务登记号"
  127. prop="compImo">
  128. <el-input v-model="ruleForm.compImo"
  129. @change="edited = true"
  130. size="small"
  131. class="page-form-input" />
  132. </el-form-item>
  133. <el-form-item label="合同时间"
  134. prop="contractStartDate">
  135. <el-date-picker v-model="ruleForm.contractStartDate"
  136. format="yyyy 年 MM 月 dd 日"
  137. value-format="yyyy-MM-dd"
  138. type="date"
  139. placeholder="选择日期"
  140. @change="edited = true" />
  141. </el-form-item>
  142. <el-form-item label="到期时间"
  143. prop="contractEndDate">
  144. <el-date-picker v-model="ruleForm.contractEndDate"
  145. format="yyyy 年 MM 月 dd 日"
  146. value-format="yyyy-MM-dd"
  147. type="date"
  148. placeholder="选择日期"
  149. @change="edited = true" />
  150. </el-form-item>
  151. </el-form>
  152. </div>
  153. <div class="head head2">
  154. <span class="headicon">开通服务</span>
  155. </div>
  156. <div class="top-buttons">
  157. <el-button size="small"
  158. type="primary"
  159. @click="addServe"
  160. :loading="loading">开通服务</el-button>
  161. </div>
  162. <el-dialog title="开通服务"
  163. :visible.sync="dialogVisible"
  164. width="40%"
  165. :close-on-click-modal="false"
  166. @closed="handleDialogClosed">
  167. <el-collapse v-if="dialogVisible"
  168. v-loading="loading">
  169. <el-collapse-item v-for="plugin in dialogTreeData"
  170. :key="plugin.pluginCode">
  171. <template slot="title">
  172. <svg-icon icon-class="ship"
  173. class="svg-icon" />
  174. <div class="plugin-name">{{ plugin.pluginName }}</div>
  175. </template>
  176. <div class="collapse-item-content">
  177. <div class="collapse-item-content-item">
  178. <div class="title">属性设置</div>
  179. <template v-for="(radioAttr, idx) in Object.values(plugin.radioAttribute)">
  180. <el-radio-group v-model="radioAttr.selected"
  181. :key="idx">
  182. <el-radio v-for="radio in radioAttr.options"
  183. :key="radio.attributeCode"
  184. :label="radio.attributeCode">{{ radio.attributeName }}</el-radio>
  185. </el-radio-group>
  186. </template>
  187. <el-checkbox v-for="attr in plugin.checkboxAttributes"
  188. v-model="attr.selected"
  189. :key="attr.attributeCode">
  190. {{ attr.attributeName }}
  191. </el-checkbox>
  192. </div>
  193. <div class="collapse-item-content-item">
  194. <div class="title">服务设置</div>
  195. <el-tree :data="plugin.pluginServers"
  196. show-checkbox
  197. :default-checked-keys="dialogDefaultCheckedKeyObj[plugin.pluginCode]"
  198. @check-change="checkChange(plugin.pluginCode,'pluginService' + plugin.pluginCode)"
  199. node-key="serviceCode"
  200. :props="{ label: 'serviceName', children: 'children' }"
  201. :ref="'pluginService' + plugin.pluginCode" />
  202. </div>
  203. </div>
  204. </el-collapse-item>
  205. </el-collapse>
  206. <div slot="footer"
  207. class="dialog-footer">
  208. <el-button @click="handleDialogCancel"
  209. :disabled="loading">取 消</el-button>
  210. <el-button type="primary"
  211. @click="handleActive"
  212. :loading="loading">确 定</el-button>
  213. </div>
  214. </el-dialog>
  215. <div class="activatedServices">
  216. <el-collapse>
  217. <el-collapse-item v-for="plugin in pageTreeData"
  218. :key="plugin.pluginId">
  219. <div slot="title"
  220. class="payedPlugin">
  221. <div class="basic">
  222. <svg-icon icon-class="ship"
  223. class="svg-icon" />
  224. <div class="plugin-name">{{ plugin.pluginName }}</div>
  225. </div>
  226. <div class="plugin-extra">
  227. <div>开通时间:{{ plugin.pluginOpenedDate }}</div>
  228. <div class="plugin-extra-end-date">到期时间:{{ plugin.pluginExpiredDate }}</div>
  229. <div class="plugin-extra-seperator"></div>
  230. <div class="plugin-extra-left-days"
  231. :class="leftDays(plugin.pluginOpenedDate, plugin.pluginExpiredDate) < 100 && leftDays(plugin.pluginOpenedDate, plugin.pluginExpiredDate) >= 0 && 'red'">剩余天数:{{ { start: plugin.pluginOpenedDate, end: plugin.pluginExpiredDate } | leftDays }}天</div>
  232. </div>
  233. </div>
  234. <div class="collapse-item-content">
  235. <el-tree :data="plugin.activatedServices"
  236. :props="{ label: 'label', children: 'tenantServiceItems' }"></el-tree>
  237. </div>
  238. </el-collapse-item>
  239. </el-collapse>
  240. </div>
  241. </div>
  242. </template>
  243. <script>
  244. import {
  245. tenantChangeInfo,
  246. operators,
  247. tenantDetail,
  248. plugins,
  249. activablePlugins,
  250. activate,
  251. tenantChangeshipNumber,
  252. tenantcompIpm
  253. } from "../../api/lessee";
  254. import { validPhone, validEmail, isNumber } from "../../utils/validate";
  255. const shipNumber = (rule, value, callback) => {
  256. if (value == null || value === "") {
  257. callback(new Error("带星号的不能为空"));
  258. } else if (!isNumber(value)) {
  259. callback(new Error("只能是正整数"));
  260. } else {
  261. callback();
  262. }
  263. };
  264. const checkEmail = (rule, value, callback) => {
  265. if (value == null || value === "") {
  266. callback();
  267. } else if (!validEmail(value)) {
  268. callback(new Error("邮箱格式不正确"));
  269. } else {
  270. callback();
  271. }
  272. };
  273. const validcodePhonee = (rule, value, callback) => {
  274. if (value === "") {
  275. callback(new Error("带星号的不能为空"));
  276. } else if (!validPhone(value)) {
  277. callback(new Error("手机号格式填写错误"));
  278. } else {
  279. callback();
  280. }
  281. };
  282. export default {
  283. name: "Lessee",
  284. filters: {
  285. leftDays ({ start, end }) {
  286. return Math.floor(
  287. (new Date(end).getTime() - new Date(start).getTime()) /
  288. (1000 * 3600 * 24)
  289. );
  290. }
  291. },
  292. data () {
  293. return {
  294. state: true,
  295. rowMsg: "",
  296. showlist: "",
  297. tenantId: "",
  298. ruleForm: {
  299. },
  300. edited: false,
  301. rules: {
  302. tenantName: [
  303. {
  304. required: true,
  305. message: "",
  306. trigger: "blur"
  307. }
  308. ],
  309. tenantEnName: [
  310. {
  311. required: true,
  312. trigger: "blur"
  313. }
  314. ],
  315. compImo: [
  316. {
  317. required: true,
  318. trigger: "blur"
  319. }
  320. ],
  321. compSimpleNameEn: [
  322. {
  323. required: true,
  324. message: "",
  325. trigger: "blur"
  326. }
  327. ],
  328. compDomainName: [
  329. {
  330. required: true,
  331. message: "",
  332. trigger: "blur"
  333. }
  334. ],
  335. linkmanName: [
  336. {
  337. required: true,
  338. message: "",
  339. trigger: "blur"
  340. }
  341. ],
  342. serviceType: [
  343. {
  344. required: true,
  345. message: "",
  346. trigger: "blur"
  347. }
  348. ],
  349. linkmanPhone: [
  350. {
  351. required: true,
  352. validator: validcodePhonee,
  353. trigger: "blur"
  354. }
  355. ],
  356. customerServiceStaffId: [
  357. {
  358. required: true,
  359. message: "",
  360. trigger: "blur"
  361. }
  362. ],
  363. enteringShipNumber: [
  364. {
  365. required: true,
  366. message: "",
  367. trigger: "blur"
  368. }
  369. ],
  370. shipNumber: [
  371. {
  372. required: true,
  373. validator: shipNumber,
  374. message: "",
  375. trigger: "blur"
  376. }
  377. ],
  378. contractStartDate: [
  379. {
  380. required: true,
  381. validator: this.checkContractStartDate,
  382. trigger: "change"
  383. }
  384. ],
  385. contractEndDate: [
  386. {
  387. required: true,
  388. validator: this.checkContractEndDate,
  389. trigger: "change"
  390. }
  391. ],
  392. linkmanEmail: [
  393. {
  394. validator: checkEmail,
  395. trigger: "blur"
  396. }
  397. ]
  398. },
  399. options: [],
  400. dialogTreeData: [],
  401. dialogDefaultCheckedKeyObj: {},
  402. pageTreeData: [],
  403. loading: false,
  404. dialogVisible: false
  405. };
  406. },
  407. created () {
  408. if (this.$route.params.state === false) {
  409. this.state = false;
  410. } else {
  411. this.state = true;
  412. }
  413. this.tenantId = sessionStorage.getItem("tenantId");
  414. // 查询租户详细信息以及专属客服列表
  415. this.checkMsg();
  416. this.checkList();
  417. this.getPayedServices();
  418. },
  419. methods: {
  420. checkChange (key, ref) {
  421. const nodes = this.$refs[ref][0].getCheckedNodes(true, false);
  422. const keys = [];
  423. nodes.forEach(v => {
  424. keys.push(v.id);
  425. });
  426. this.$set(this.dialogDefaultCheckedKeyObj, key, keys);
  427. },
  428. leftDays (start, end) {
  429. return Math.floor(
  430. (new Date(end).getTime() - new Date(start).getTime()) /
  431. (1000 * 3600 * 24)
  432. );
  433. },
  434. checkList () {
  435. operators({
  436. currentPage: "",
  437. pageSize: ""
  438. }).then(response => {
  439. this.options = response.data.records;
  440. });
  441. },
  442. checkMsg () {
  443. tenantDetail({
  444. tenantId: this.tenantId
  445. }).then(response => {
  446. this.ruleForm = response.data;
  447. tenantcompIpm({
  448. compId: this.ruleForm.compId
  449. }).then(response1 => {
  450. this.$set(this.ruleForm,'compImo',response1.data.compImo)
  451. })
  452. });
  453. },
  454. // 合同时间验证
  455. checkContractStartDate (rule, value, callback) {
  456. this.$refs.ruleForm.clearValidate("contractEndDate");
  457. const end = this.ruleForm.contractEndDate;
  458. if (!value) {
  459. callback(new Error("合同开始日期不能为空"));
  460. } else if (end > value) {
  461. callback();
  462. } else {
  463. callback(new Error("合同开始日期须早于结束日期"));
  464. }
  465. },
  466. checkContractEndDate (rule, value, callback) {
  467. this.$refs.ruleForm.clearValidate("contractStartDate");
  468. const start = this.ruleForm.contractStartDate;
  469. if (!value) {
  470. callback(new Error("合同结束日期不能为空"));
  471. } else if (value > start) {
  472. callback();
  473. } else {
  474. callback(new Error("合同结束日期须晚于开始日期"));
  475. }
  476. },
  477. save () {
  478. this.$refs.ruleForm.validate(valid => {
  479. if (valid) {
  480. tenantChangeInfo(this.ruleForm)
  481. .then(response => {
  482. if (response.code === "MANAGEMENT_010") {
  483. this.$message({
  484. message: "公司域名重复",
  485. type: "error",
  486. showClose: true
  487. });
  488. } else if (response.code === "OPERATION_001") {
  489. this.$message({
  490. message: "用户名已存在",
  491. type: "error",
  492. showClose: true
  493. });
  494. } else if (response.code === "OPERATION_002") {
  495. this.$message({
  496. message: "用户名已存在",
  497. type: "error",
  498. showClose: true
  499. });
  500. } else if (response.code === "OPERATION_003") {
  501. this.$message({
  502. message: "公司中文名称/公司英文名称/手机号已被占用",
  503. type: "error",
  504. showClose: true
  505. });
  506. } else {
  507. tenantChangeshipNumber({compId:this.ruleForm.compId,compImo:this.ruleForm.compImo})
  508. .then(response => {
  509. this.$message({
  510. message: "保存成功",
  511. type: "success",
  512. showClose: true
  513. });
  514. })
  515. this.$router.push({
  516. name: "lessee"
  517. });
  518. }
  519. })
  520. .catch(() => {
  521. this.showlist = false;
  522. this.$message({
  523. message: "保存失败",
  524. type: "error",
  525. showClose: true
  526. });
  527. });
  528. } else {
  529. this.showlist = false;
  530. this.$message({
  531. message: "带星号的为必填项或格式填写错误",
  532. type: "error",
  533. showClose: true
  534. });
  535. return false;
  536. }
  537. });
  538. },
  539. back () {
  540. if (this.edited) {
  541. this.$confirm("租户信息尚未保存,确定要离开吗?", "提示", {
  542. type: "warning"
  543. })
  544. .then(() => {
  545. this.$router.push({
  546. name: "lessee"
  547. });
  548. })
  549. .catch(() => { });
  550. } else {
  551. this.$router.push({
  552. name: "lessee"
  553. });
  554. }
  555. },
  556. backToAdd () {
  557. this.$router.back();
  558. },
  559. async addServe () {
  560. await this.getAvailabelServices();
  561. this.dialogVisible = true;
  562. },
  563. handleDialogCancel () {
  564. this.dialogVisible = false;
  565. },
  566. handleDialogClosed () {
  567. this.dialogTreeData = [];
  568. },
  569. // 获取未选择的、可用的插件列表
  570. async getAvailabelServices () {
  571. this.loading = true;
  572. const response = await activablePlugins({ tenantId: this.tenantId });
  573. this.dialogTreeData = this.convertDialogTreeData(response.data);
  574. await this.getPayedServices();
  575. this.loading = false;
  576. },
  577. // 获取租户已购买的插件列表
  578. async getPayedServices (compare = true) {
  579. const response = await plugins({ tenantId: this.tenantId });
  580. this.pageTreeData = response.data.map(plugin => {
  581. return {
  582. ...plugin,
  583. activatedServices: plugin.activatedServices.map(service => {
  584. return {
  585. ...service,
  586. label: service.serviceName,
  587. tenantServiceItems: service.tenantServiceItems.map(item => {
  588. return { ...item, label: item.serviceItemName };
  589. })
  590. };
  591. })
  592. };
  593. });
  594. // 如果dialog里有值,就对比勾选服务
  595. if (compare && this.dialogTreeData.length > 0) {
  596. this.pageTreeData.forEach(plugin => {
  597. let serviceCodes = [];
  598. plugin.activatedServices.forEach(service => {
  599. if (
  600. !service.tenantServiceItems ||
  601. service.tenantServiceItems.length === 0
  602. ) {
  603. serviceCodes.push(service.serviceCode);
  604. } else {
  605. serviceCodes = serviceCodes.concat(
  606. service.tenantServiceItems.map(itm => itm.serviceItemCode)
  607. );
  608. }
  609. });
  610. this.dialogDefaultCheckedKeyObj[plugin.pluginCode] = serviceCodes;
  611. });
  612. }
  613. },
  614. // 开通服务
  615. handleActive () {
  616. const selectedServices = [];
  617. let pluginAttributes = [];
  618. for (let index = 0; index < this.dialogTreeData.length; index++) {
  619. const plugin = this.dialogTreeData[index];
  620. // 填写activatedServices字段
  621. const tree = this.$refs["pluginService" + plugin.pluginCode][0];
  622. const treeSelectedServices = tree.getCheckedNodes();
  623. const halfSelectedServices = tree.getHalfCheckedNodes();
  624. const tmp = treeSelectedServices.concat(halfSelectedServices);
  625. treeSelectedServices.forEach(itm => {
  626. if (itm.parentServiceCode !== "-1") {
  627. // 这个是serviceitem
  628. if (
  629. !selectedServices.some(
  630. item => item.serviceCode === itm.parentServiceCode
  631. )
  632. ) {
  633. // 没重复的service,则添加这个service
  634. const service = tmp.find(
  635. item => item.serviceCode === itm.parentServiceCode
  636. );
  637. const wantToAddService = {};
  638. wantToAddService.serviceCode = service.serviceCode;
  639. wantToAddService.pluginCode = service.pluginCode;
  640. wantToAddService.serviceExpiredDate =
  641. this.ruleForm.contractEndDate + " 00:00:00";
  642. wantToAddService.tenantServiceItems = [
  643. {
  644. serviceItemCode: itm.serviceCode,
  645. serviceItemName: itm.serviceName
  646. }
  647. ];
  648. selectedServices.push(wantToAddService);
  649. } else {
  650. // 有重复的,则直接往service的tenantServiceItems字段塞
  651. const service = selectedServices.find(
  652. item => item.serviceCode === itm.parentServiceCode
  653. );
  654. service.tenantServiceItems.push({
  655. serviceItemCode: itm.serviceCode,
  656. serviceItemName: itm.serviceName
  657. });
  658. }
  659. } else if (
  660. !itm.tenantServiceItems ||
  661. itm.tenantServiceItems.length === 0
  662. ) {
  663. // 只有service级,没有serviceItem级,则这个service也要加上
  664. selectedServices.push({
  665. serviceCode: itm.serviceCode,
  666. pluginCode: itm.pluginCode,
  667. serviceExpiredDate: this.ruleForm.contractEndDate + " 00:00:00",
  668. tenantServiceItems: []
  669. });
  670. }
  671. });
  672. // 填写pluginAttributes字段
  673. const radio = plugin.radioAttribute;
  674. for (let index = 0; index < Object.values(radio).length; index++) {
  675. const radioItem = Object.values(radio)[index];
  676. if (radioItem.selected) {
  677. pluginAttributes.push({ attributeCode: radioItem.selected, pluginCode: radioItem.pluginCode });
  678. // Todo:校验错误需要修改,应该先判断有无服务属性,然后再做检查,而且有的是radio有的是checkbox
  679. // } else {
  680. // this.$message({
  681. // message: '请先设置服务属性',
  682. // type: 'error',
  683. // showClose: true
  684. // })
  685. // return;
  686. }
  687. }
  688. const checkboxAttributeCode = plugin.checkboxAttributes
  689. .filter(itm => itm.selected)
  690. .map(item => {
  691. return { attributeCode: item.attributeCode, pluginCode: item.pluginCode };
  692. });
  693. pluginAttributes = pluginAttributes.concat(checkboxAttributeCode);
  694. }
  695. this.loading = true;
  696. activate({
  697. tenantId: this.tenantId,
  698. activatedServices: selectedServices,
  699. pluginAttributes
  700. })
  701. .then(() => {
  702. this.loading = false;
  703. this.$message({
  704. type: "success",
  705. message: "开通成功",
  706. showClose: true
  707. });
  708. this.dialogVisible = false;
  709. this.getPayedServices(false);
  710. })
  711. .catch(() => {
  712. this.loading = false;
  713. this.$message({
  714. type: "error",
  715. message: "开通失败",
  716. showClose: true
  717. });
  718. });
  719. },
  720. // Helper
  721. convertDialogTreeData (arr) {
  722. return arr.map(item => {
  723. const radioAttribute = {};
  724. const checkboxAttributes = [];
  725. item.pluginAttributes.forEach(attr => {
  726. if (attr.multipleChoiceFlag === "1") {
  727. if (radioAttribute[attr.attributeType]) {
  728. radioAttribute[attr.attributeType].options.push(attr);
  729. } else {
  730. radioAttribute[attr.attributeType] = {
  731. selected: "",
  732. options: [attr]
  733. };
  734. }
  735. if (!radioAttribute[attr.attributeType].selected) {
  736. radioAttribute[attr.attributeType].selected = attr.isOpening
  737. ? attr.attributeCode
  738. : "";
  739. }
  740. radioAttribute[attr.attributeType].pluginCode = item.pluginCode
  741. } else {
  742. attr.selected = attr.isOpening;
  743. checkboxAttributes.push(attr);
  744. }
  745. });
  746. let newVar = {
  747. ...item,
  748. radioAttribute,
  749. checkboxAttributes,
  750. pluginServers: item.pluginServers.map(service => {
  751. return { ...service, pluginCode: item.pluginCode };
  752. })
  753. };
  754. return newVar;
  755. });
  756. }
  757. }
  758. };
  759. </script>
  760. <style scoped lang="scss">
  761. @import "../../styles/variables.scss";
  762. .form,
  763. .head2 {
  764. margin-top: 40px;
  765. }
  766. .talk {
  767. color: #666666;
  768. cursor: pointer;
  769. height: 19px;
  770. line-height: 19px;
  771. font-size: 25px;
  772. }
  773. .activatedServices {
  774. margin-top: 20px;
  775. }
  776. .first-level-tree-node {
  777. .property {
  778. display: flex;
  779. }
  780. }
  781. .collapse-item-content {
  782. padding-left: 32px;
  783. }
  784. .collapse-item-content-item {
  785. line-height: 2;
  786. // display: flex;
  787. .title {
  788. margin-right: 8px;
  789. }
  790. }
  791. .svg-icon,
  792. .plugin-name {
  793. margin-left: 8px;
  794. }
  795. .payedPlugin {
  796. width: 100%;
  797. display: flex;
  798. justify-content: space-between;
  799. .basic {
  800. display: flex;
  801. align-items: center;
  802. }
  803. }
  804. .plugin-extra {
  805. display: flex;
  806. align-items: center;
  807. .plugin-extra-end-date {
  808. margin-left: 16px;
  809. }
  810. .plugin-extra-seperator {
  811. margin-left: 8px;
  812. height: 14px;
  813. background-color: #999;
  814. width: 1px;
  815. }
  816. .plugin-extra-left-days {
  817. margin-left: 8px;
  818. }
  819. .red {
  820. color: $red;
  821. }
  822. }
  823. .aaa {
  824. /deep/.el-form-item__error {
  825. display: none;
  826. }
  827. }
  828. </style>