index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944
  1. <template>
  2. <div id="qianpeiArrange">
  3. <table-list
  4. :tableSets="tableSet"
  5. :tableData="tableData"
  6. :navText="navText"
  7. @addClick="addClick"
  8. :loading="loading"
  9. @editInfo="editInfo"
  10. >
  11. <template slot="btn" slot-scope="props">
  12. <el-button
  13. type="text"
  14. @click="addClick(props.scope.row, 0)"
  15. :disabled="props.scope.row.status === 1"
  16. >修改计划</el-button
  17. >
  18. <el-button
  19. type="text"
  20. @click="editGoods(props.scope.row)"
  21. :disabled="props.scope.row.status === 1"
  22. >适用商品</el-button
  23. >
  24. <el-button type="text" @click="watchs(props.scope.row)">预览</el-button>
  25. <el-button
  26. type="text"
  27. @click="del(props.scope.row, 1)"
  28. v-if="props.scope.row.status === 0"
  29. >启用</el-button
  30. >
  31. <el-button
  32. type="text"
  33. @click="del(props.scope.row, 2)"
  34. v-if="props.scope.row.status === 1"
  35. >关闭</el-button
  36. >
  37. <el-button type="text" @click="del(props.scope.row, 3)">删除</el-button>
  38. </template>
  39. </table-list>
  40. <pagination
  41. :total="total"
  42. :pageSize="pageSize"
  43. :currentPage="currentPage"
  44. @handleSizeChange="handleSizeChange"
  45. @handleCurrentChange="handleCurrentChange"
  46. />
  47. <el-dialog
  48. @closed="loadingClose"
  49. :visible.sync="dialogVisible"
  50. width="610px"
  51. :show-close="false"
  52. :close-on-click-modal="false"
  53. >
  54. <div slot="title" class="hearders">
  55. <div class="leftTitle">
  56. {{ statusPop === 1 ? "添加" : statusPop === 0 ? "修改" : "详情" }}
  57. </div>
  58. <div class="rightBoxs">
  59. <img src="@/assets/images/Close@2x.png" alt="" @click="close" />
  60. </div>
  61. </div>
  62. <div>
  63. <el-form
  64. label-position="right"
  65. label-width="150px"
  66. :model="listData"
  67. :rules="rules"
  68. ref="listData"
  69. >
  70. <el-form-item label="前培标题" prop="beforeName">
  71. <el-input
  72. :disabled="statusPop === 2"
  73. v-model="listData.beforeName"
  74. ></el-input>
  75. </el-form-item>
  76. <el-form-item label="关联题卷" required prop="beforeStatus">
  77. <el-select v-model="listData.beforeStatus" placeholder="请选择">
  78. <el-option
  79. v-for="item in optionsApis"
  80. :key="item.value"
  81. :label="item.label"
  82. :value="item.value"
  83. >
  84. </el-option>
  85. </el-select>
  86. </el-form-item>
  87. <el-form-item label="" prop="beforeUrl" v-if="listData.beforeStatus">
  88. <el-radio-group v-model="listData.beforeUrl">
  89. <el-radio
  90. style="margin-bottom: 10px"
  91. v-for="(item, index) in radioApi"
  92. :key="index"
  93. :label="item.beforeUrlId"
  94. >{{ item.urlName }} - {{ item.url }}</el-radio
  95. >
  96. </el-radio-group>
  97. </el-form-item>
  98. <el-form-item label="学习开放时间" required>
  99. <el-col :span="11">
  100. <el-form-item prop="beforeStartTime">
  101. <el-date-picker
  102. type="datetime"
  103. placeholder="开始日期"
  104. @change="changeEndTime(1)"
  105. v-model="listData.beforeStartTime"
  106. style="width: 100%"
  107. value-format="timestamp"
  108. ></el-date-picker>
  109. </el-form-item>
  110. </el-col>
  111. <el-col class="line" style="text-align: center" :span="2">-</el-col>
  112. <el-col :span="11">
  113. <el-form-item prop="beforeEndTime">
  114. <el-date-picker
  115. type="datetime"
  116. placeholder="结束日期"
  117. @change="changeEndTime(2)"
  118. v-model="listData.beforeEndTime"
  119. style="width: 100%"
  120. value-format="timestamp"
  121. ></el-date-picker>
  122. </el-form-item>
  123. </el-col>
  124. </el-form-item>
  125. </el-form>
  126. </div>
  127. <span slot="footer" class="dialog-footer">
  128. <el-button @click="close">取 消</el-button>
  129. <el-button
  130. type="primary"
  131. :loading="disabledBtn"
  132. v-if="statusPop !== 2"
  133. @click="submit('listData')"
  134. >确 定</el-button
  135. >
  136. </span>
  137. </el-dialog>
  138. <el-dialog
  139. :visible.sync="dialogVisiblenew"
  140. width="560px"
  141. :show-close="false"
  142. :close-on-click-modal="false"
  143. >
  144. <div slot="title" class="hearders">
  145. <div class="leftTitle">适用商品</div>
  146. <div class="rightBoxs">
  147. <img
  148. src="@/assets/images/Close@2x.png"
  149. alt=""
  150. @click="dialogVisiblenew = false"
  151. />
  152. </div>
  153. </div>
  154. <div>
  155. <el-form
  156. label-position="right"
  157. label-width="150px"
  158. :model="listDataGoods"
  159. :rules="rulesnew"
  160. ref="listDataGoods"
  161. >
  162. <el-form-item label="商品类型" prop="goodsType">
  163. <el-select
  164. v-model="listDataGoods.goodsType"
  165. placeholder="请选择"
  166. disabled
  167. >
  168. <el-option
  169. v-for="item in options"
  170. :key="item.value"
  171. :label="item.label"
  172. :value="item.value"
  173. >
  174. </el-option>
  175. </el-select>
  176. </el-form-item>
  177. <el-form-item label="业务层级" prop="educationTypeId">
  178. <el-select
  179. v-model="listDataGoods.educationTypeId"
  180. placeholder="选择教育类型"
  181. @change="listDataGoods.businessId = ''"
  182. :disabled="statusPop === 0"
  183. >
  184. <el-option
  185. v-for="item in educationType"
  186. :key="item.id"
  187. :label="item.educationName"
  188. :value="item.id"
  189. >
  190. </el-option>
  191. </el-select>
  192. </el-form-item>
  193. <el-form-item
  194. label=""
  195. prop="businessId"
  196. v-if="listDataGoods.educationTypeId"
  197. >
  198. <el-select
  199. v-model="listDataGoods.businessId"
  200. :disabled="statusPop === 0"
  201. placeholder="选择业务层次"
  202. >
  203. <el-option
  204. v-for="item in businessList"
  205. :key="item.id"
  206. :label="item.projectName + '-' + item.businessName"
  207. :value="item.id"
  208. >
  209. </el-option>
  210. </el-select>
  211. </el-form-item>
  212. <el-form-item label="适用商品" prop="goodsId">
  213. <span v-if="!listDataGoods.businessId" style="color: #f56c6c"
  214. >请先选择业务层级</span
  215. >
  216. <el-checkbox-group
  217. style="overflow: auto; max-height: 500px"
  218. v-model="listDataGoods.goodsId"
  219. v-else-if="listDataGoods.businessId && goodsList.length"
  220. >
  221. <el-checkbox
  222. v-for="(item, index) in goodsList"
  223. :key="index"
  224. :label="item.goodsId"
  225. :disabled="
  226. item.goodsStatus === 0 &&
  227. bfListData.goodsId.indexOf(item.goodsId) === -1
  228. "
  229. >{{ item.code + "-" + item.goodsName + "-" }}
  230. <span
  231. :style="
  232. item.goodsStatus === 0 &&
  233. bfListData.goodsId.indexOf(item.goodsId) === -1
  234. ? ''
  235. : 'color:#F56C6C'
  236. "
  237. >¥{{ item.standPrice }}</span
  238. ></el-checkbox
  239. >
  240. </el-checkbox-group>
  241. <span style="color: #f56c6c" v-else>该业务层级下,无适用商品</span>
  242. </el-form-item>
  243. </el-form>
  244. </div>
  245. <span slot="footer" class="dialog-footer">
  246. <el-button @click="dialogVisiblenew = false">取 消</el-button>
  247. <el-button
  248. type="primary"
  249. v-if="statusPop !== 2"
  250. @click="submitnew('listDataGoods')"
  251. >确 定</el-button
  252. >
  253. </span>
  254. </el-dialog>
  255. <el-dialog
  256. :visible.sync="dialoginfoWatch"
  257. width="860px"
  258. :show-close="false"
  259. :close-on-click-modal="false"
  260. >
  261. <div slot="title" class="hearders">
  262. <div class="leftTitle">【{{ infoData.beforeName }}】预览</div>
  263. <div class="rightBoxs">
  264. <img
  265. src="@/assets/images/Close@2x.png"
  266. alt=""
  267. @click="dialoginfoWatch = false"
  268. />
  269. </div>
  270. </div>
  271. <div>
  272. <el-form :model="infoData" class="demo-form-inline" label-width="120px">
  273. <el-button type="info" style="margin-bottom: 20px" size="mini"
  274. >前培计划信息</el-button
  275. >
  276. <el-form-item label="前培标题:">
  277. <span>{{ infoData.beforeName }}</span>
  278. </el-form-item>
  279. <el-form-item label="关联题卷:">
  280. <span v-for="(item, index) in optionsApis" :key="index">
  281. <span v-if="item.value === infoData.beforeStatus">{{
  282. item.label
  283. }}</span>
  284. </span>
  285. <span>{{ infoData.urlName }}</span> <span>{{ infoData.url }}</span>
  286. </el-form-item>
  287. <el-form-item label="开放时间:">
  288. <span>{{ $methodsTools.onlyForma(infoData.beforeStartTime) }}</span>
  289. <span>{{ $methodsTools.onlyForma(infoData.beforeEndTime) }}</span>
  290. </el-form-item>
  291. <el-button type="info" style="margin-bottom: 20px" size="mini"
  292. >适用商品</el-button
  293. >
  294. <el-form-item label="商品类型:">
  295. <span v-for="(item, index) in options" :key="index">{{
  296. item.value === infoData.goodsType ? item.label : ""
  297. }}</span>
  298. </el-form-item>
  299. <el-form-item label="业务层级:">
  300. <span
  301. >{{ infoData.educationName }}-{{ infoData.projectName }}-{{
  302. infoData.businessName
  303. }}</span
  304. >
  305. </el-form-item>
  306. <el-form-item label="适用商品:">
  307. <div v-for="(item, index) in infoData.examNumberGoods" :key="index">
  308. {{ index + 1 }}.{{ item.code }}-{{ item.goodsName }}-<span
  309. style="color: #f56c6c"
  310. >¥{{ item.standPrice }}</span
  311. >
  312. </div>
  313. </el-form-item>
  314. </el-form>
  315. </div>
  316. <span slot="footer" class="dialog-footer">
  317. <el-button @click="dialoginfoWatch = false">取 消</el-button>
  318. </span>
  319. </el-dialog>
  320. </div>
  321. </template>
  322. <script>
  323. import { mapGetters } from "vuex";
  324. import searchBox from "@/components/searchBox";
  325. import tableList from "@/components/tableList";
  326. import pagination from "@/components/pagination";
  327. export default {
  328. name: "QianpeiArrange",
  329. components: { searchBox, tableList, pagination },
  330. data() {
  331. return {
  332. disabledBtn: false,
  333. loading: false, //当前表单加载是否加载动画
  334. navText: {
  335. title: "前培安排",
  336. index: 0,
  337. ch: "条",
  338. num: true,
  339. changeWidth: "300px",
  340. choice: true,
  341. border: true,
  342. addHide: false,
  343. backFatherBtn: {
  344. status: false,
  345. title: "未定义",
  346. },
  347. },
  348. // 表单
  349. tableSet: [
  350. {
  351. label: "前培编码",
  352. prop: "code",
  353. hidden: true,
  354. },
  355. {
  356. label: "前培标题",
  357. prop: "beforeName",
  358. hidden: true,
  359. },
  360. {
  361. label: "报名开放时间",
  362. prop1: "beforeStartTime",
  363. prop2: "beforeEndTime",
  364. hidden: true,
  365. scope: "TimeLists",
  366. Diszing: false,
  367. },
  368. {
  369. label: "使用状态",
  370. prop: "status",
  371. hidden: true,
  372. width: "130px",
  373. scope: "isOptions",
  374. options: [
  375. {
  376. label: "进行中",
  377. value: 1,
  378. },
  379. {
  380. label: "未启用",
  381. value: 0,
  382. },
  383. {
  384. label: "删除",
  385. value: -1,
  386. },
  387. {
  388. label: "已过期",
  389. value: 2,
  390. },
  391. ],
  392. },
  393. {
  394. label: "符合条件的学员(人次)",
  395. prop: "people",
  396. hidden: true,
  397. width: "180px",
  398. scope: "AjumpPeolpe",
  399. type: 2,
  400. },
  401. ],
  402. optionsApis: [
  403. // {
  404. // label: "内部接口",
  405. // value: 1,
  406. // },
  407. {
  408. label: "外部接口",
  409. value: 2,
  410. },
  411. // {
  412. // label: "关联题库资源",
  413. // value: 3,
  414. // },
  415. ],
  416. tableData: [], //表单数据
  417. total: 0, //一共多少条
  418. pageSize: 10, //每页多少条数据
  419. currentPage: 1, //当前页码
  420. // 弹窗数据
  421. listData: {},
  422. statusPop: -1,
  423. dialogVisible: false,
  424. //表单验证
  425. rules: {
  426. beforeName: [
  427. { required: true, message: "请输入前培标题", trigger: "blur" },
  428. ],
  429. beforeStatus: [
  430. { required: true, message: "请选中关联题卷", trigger: "change" },
  431. ],
  432. beforeUrl: [
  433. { required: true, message: "请选择接口地址", trigger: "change" },
  434. ],
  435. beforeStartTime: [
  436. {
  437. type: "date",
  438. required: true,
  439. message: "请选择学习开放开始时间",
  440. trigger: "change",
  441. },
  442. ],
  443. beforeEndTime: [
  444. {
  445. type: "date",
  446. required: true,
  447. message: "请选择学习开放结束时间",
  448. trigger: "change",
  449. },
  450. ],
  451. },
  452. dialogVisiblenew: false,
  453. options: [
  454. {
  455. label: "视频",
  456. value: 1,
  457. },
  458. {
  459. label: "题库",
  460. value: 2,
  461. },
  462. {
  463. label: "补考",
  464. value: 3,
  465. },
  466. {
  467. label: "前培",
  468. value: 4,
  469. },
  470. ],
  471. //表单验证
  472. rulesnew: {
  473. goodsType: [
  474. { required: true, message: "请选择商品类型", trigger: "change" },
  475. ],
  476. educationTypeId: [
  477. { required: true, message: "请选择教育类型", trigger: "change" },
  478. ],
  479. businessId: [
  480. { required: true, message: "请选择业务层次", trigger: "change" },
  481. ],
  482. goodsId: [
  483. {
  484. type: "array",
  485. required: true,
  486. message: "请至少选择一个商品",
  487. trigger: "change",
  488. },
  489. ],
  490. },
  491. busList: [],
  492. businessList: [],
  493. goodsList: [],
  494. bfListData: {},
  495. listDataGoods: {},
  496. radioApi: [],
  497. dialoginfoWatch: false,
  498. infoData: {},
  499. };
  500. },
  501. mounted() {
  502. this.getDict();
  503. this.search();
  504. },
  505. activated() {
  506. this.getDict();
  507. this.search();
  508. },
  509. watch: {
  510. "listDataGoods.educationTypeId"(value) {
  511. this.businessList = this.busList.filter((item) => {
  512. return item.educationId == value;
  513. });
  514. },
  515. "listDataGoods.businessId"(value) {
  516. if (value) {
  517. if (this.statusPop === 1) {
  518. this.listDataGoods.goodsId = [];
  519. }
  520. this.$api
  521. .inquiresystembeforelistGoods({ businessId: value })
  522. .then((res) => {
  523. this.goodsList = res.rows;
  524. });
  525. }
  526. },
  527. "listData.beforeStatus"(value) {
  528. this.$api.inquiresystembeforelistUrl({ urlStatus: value }).then((res) => {
  529. this.radioApi = res.rows;
  530. });
  531. },
  532. },
  533. computed: { ...mapGetters(["educationType"]) },
  534. methods: {
  535. loadingClose() {
  536. this.disabledBtn = false;
  537. },
  538. //修改适用商品
  539. editGoods(row) {
  540. this.$api
  541. .inquiresystembeforelistGoodsgoodsInfo({ beforeId: row.beforeId })
  542. .then((res) => {
  543. this.$api
  544. .inquiresystembeforelistGoods({ businessId: res.data.businessId })
  545. .then((result) => {
  546. this.goodsList = result.rows;
  547. });
  548. if (res.data.goodsType && res.data.goodsId.length) {
  549. this.statusPop = 0;
  550. this.bfListData = JSON.parse(JSON.stringify(res.data));
  551. this.listDataGoods = JSON.parse(JSON.stringify(res.data));
  552. } else {
  553. this.statusPop = 1;
  554. this.bfListData = {
  555. goodsId: [],
  556. };
  557. this.listDataGoods = {
  558. beforeId: row.beforeId,
  559. goodsType: 1,
  560. businessId: "",
  561. goodsId: [],
  562. };
  563. }
  564. this.$nextTick(() => {
  565. this.$refs.listDataGoods.clearValidate();
  566. });
  567. this.dialogVisiblenew = true;
  568. });
  569. },
  570. //提交验证适用商品表单
  571. submitnew(formName) {
  572. this.$refs[formName].validate((valid) => {
  573. if (valid) {
  574. this.rulesTableSumbitnew();
  575. } else {
  576. return false;
  577. }
  578. });
  579. },
  580. //验证通过
  581. rulesTableSumbitnew() {
  582. var data = JSON.parse(JSON.stringify(this.listDataGoods));
  583. this.busList.map((item) => {
  584. if (item.id === data.businessId) {
  585. data.projectId = item.projectId;
  586. }
  587. });
  588. this.$api.appsystemaddGoods(data).then((res) => {
  589. this.$message.success("适用商品设置成功");
  590. this.dialogVisiblenew = false;
  591. this.search();
  592. });
  593. console.log(data, 321);
  594. },
  595. //获取初始基础参数
  596. getDict() {
  597. this.$api.inquirebusinessList({ status: 1 }).then((res) => {
  598. this.busList = res.rows;
  599. });
  600. },
  601. // 判断选择时间逻辑
  602. changeEndTime(int) {
  603. if (this.listData.beforeStartTime === this.listData.beforeEndTime) {
  604. this.$message.warning("开始时间与结束时间不允许相同");
  605. if (int === 1) {
  606. this.listData.beforeStartTime = "";
  607. }
  608. if (int === 2) {
  609. this.listData.beforeEndTime = "";
  610. }
  611. return;
  612. }
  613. if (
  614. int === 1 &&
  615. this.listData.beforeEndTime &&
  616. this.listData.beforeStartTime > this.listData.beforeEndTime
  617. ) {
  618. this.$message.warning(
  619. "当前选择的开始时间大于结束时间,请重新选择开始时间!"
  620. );
  621. this.listData.beforeStartTime = "";
  622. return;
  623. }
  624. if (
  625. int === 2 &&
  626. this.listData.beforeStartTime &&
  627. this.listData.beforeEndTime < this.listData.beforeStartTime
  628. ) {
  629. this.$message.warning(
  630. "当前选择的结束时间小于开始时间,请重新选择结束时间!"
  631. );
  632. this.listData.beforeEndTime = "";
  633. return;
  634. }
  635. },
  636. editInfo(v) {
  637. this.addClick(v, 0);
  638. },
  639. search(v) {
  640. this.loading = true;
  641. var data = {
  642. status: "0,1,2",
  643. pageSize: this.pageSize,
  644. pageNum: this.currentPage,
  645. };
  646. this.$api
  647. .inquiresystembefore(data)
  648. .then((res) => {
  649. this.tableData = res.rows;
  650. this.total = res.total;
  651. this.navText.index = res.total;
  652. })
  653. .finally(() => {
  654. this.loading = false;
  655. });
  656. },
  657. init() {
  658. this.search();
  659. },
  660. watchs(v) {
  661. this.$api.obtainsystembefore(v.beforeId).then((res) => {
  662. this.infoData = res.data;
  663. this.dialoginfoWatch = true;
  664. });
  665. },
  666. del(v, int) {
  667. this.$alert(
  668. `确定${
  669. int === 1 ? "启用" : int === 2 ? "关闭" : int === 3 ? "删除" : "xxx"
  670. }前培计划【${v.beforeName}】?<br />${
  671. int === 1
  672. ? "启用后,学员端预约考试的入口同步开通,请慎重考虑!"
  673. : int === 2
  674. ? "关闭后,学员端预约考试的入口同步关闭,请慎重考虑!"
  675. : int === 3
  676. ? "内容删除后将无法恢复,请慎重考虑"
  677. : "xxx"
  678. }`,
  679. "操作提示",
  680. {
  681. dangerouslyUseHTMLString: true,
  682. }
  683. )
  684. .then(() => {
  685. var data = {
  686. beforeId: v.beforeId,
  687. };
  688. if (int === 1) {
  689. data.status = 1;
  690. }
  691. if (int === 2) {
  692. data.status = 0;
  693. }
  694. if (int === 3) {
  695. data.status = -1;
  696. }
  697. this.$api.editsystembefore(data).then((res) => {
  698. this.$message.success(
  699. `${
  700. int === 1
  701. ? "启用"
  702. : int === 2
  703. ? "关闭"
  704. : int === 3
  705. ? "删除"
  706. : "xxx"
  707. }成功`
  708. );
  709. this.search();
  710. this.$store.commit("BEFORELIST");
  711. });
  712. })
  713. .catch(() => {
  714. // this.$message({
  715. // type: "info",
  716. // message: "已取消删除",
  717. // });
  718. });
  719. },
  720. addClick(v, int) {
  721. if (v === undefined) {
  722. this.statusPop = 1;
  723. this.listData = {};
  724. this.$nextTick(() => {
  725. this.$refs.listData.clearValidate();
  726. });
  727. this.dialogVisible = true;
  728. } else {
  729. this.statusPop = int;
  730. var res = JSON.parse(JSON.stringify(v));
  731. if (res.beforeStartTime) {
  732. res.beforeStartTime = this.$methodsTools.time10to13(
  733. res.beforeStartTime,
  734. 2
  735. );
  736. }
  737. if (res.beforeEndTime) {
  738. res.beforeEndTime = this.$methodsTools.time10to13(
  739. res.beforeEndTime,
  740. 2
  741. );
  742. }
  743. this.listData = res;
  744. this.$nextTick(() => {
  745. this.$refs.listData.clearValidate();
  746. });
  747. this.dialogVisible = true;
  748. }
  749. },
  750. submit(formName) {
  751. this.$refs[formName].validate((valid) => {
  752. if (valid) {
  753. this.rulesTableSumbit();
  754. } else {
  755. return false;
  756. }
  757. });
  758. },
  759. rulesTableSumbit() {
  760. this.disabledBtn = true;
  761. var data = JSON.parse(JSON.stringify(this.listData));
  762. data.beforeStartTime = this.$methodsTools.time10to13(
  763. data.beforeStartTime,
  764. 1
  765. );
  766. data.beforeEndTime = this.$methodsTools.time10to13(data.beforeEndTime, 1);
  767. if (this.statusPop === 1) {
  768. data.status = 0;
  769. this.$api
  770. .appsystembefore(data)
  771. .then((res) => {
  772. this.$message.success("新增成功");
  773. this.dialogVisible = false;
  774. this.search();
  775. this.$store.commit("BEFORELIST");
  776. })
  777. .catch(() => {
  778. this.disabledBtn = false;
  779. });
  780. }
  781. if (this.statusPop === 0) {
  782. this.$api
  783. .editsystembefore(data)
  784. .then((res) => {
  785. this.$message.success("修改成功");
  786. this.dialogVisible = false;
  787. this.search();
  788. this.$store.commit("BEFORELIST");
  789. })
  790. .catch(() => {
  791. this.disabledBtn = false;
  792. });
  793. }
  794. },
  795. close() {
  796. this.dialogVisible = false;
  797. },
  798. handleSizeChange(v) {
  799. this.pageSize = v;
  800. this.currentPage = 1;
  801. this.search();
  802. },
  803. handleCurrentChange(v) {
  804. this.currentPage = v;
  805. this.search();
  806. },
  807. },
  808. };
  809. </script>
  810. <style lang="less" scoped>
  811. /deep/.el-button {
  812. border-radius: 8px;
  813. }
  814. /deep/.el-dialog {
  815. border-radius: 8px;
  816. .el-dialog__header {
  817. padding: 0;
  818. .hearders {
  819. height: 40px;
  820. display: flex;
  821. align-items: center;
  822. justify-content: space-between;
  823. padding: 0px 18px 0px 20px;
  824. border-bottom: 1px solid #e2e2e2;
  825. .leftTitle {
  826. font-size: 14px;
  827. font-weight: bold;
  828. color: #2f4378;
  829. }
  830. .rightBoxs {
  831. display: flex;
  832. align-items: center;
  833. img {
  834. width: 14px;
  835. height: 14px;
  836. margin-left: 13px;
  837. cursor: pointer;
  838. }
  839. }
  840. }
  841. }
  842. .el-dialog__footer {
  843. padding: 0;
  844. .dialog-footer {
  845. padding: 0px 40px;
  846. height: 70px;
  847. border-top: 1px solid #e2e2e2;
  848. display: flex;
  849. align-items: center;
  850. justify-content: flex-end;
  851. }
  852. }
  853. }
  854. .imgBox {
  855. width: 100%;
  856. // height: 210px;
  857. border: 1px solid #e2e2e2;
  858. border-radius: 8px;
  859. padding: 8px 8px 3px;
  860. display: flex;
  861. flex-direction: column;
  862. align-items: center;
  863. .imgLabel {
  864. flex: 1;
  865. width: 100%;
  866. border: 1px dotted #e2e2e2;
  867. color: #999;
  868. font-size: 14px;
  869. cursor: pointer;
  870. border-radius: 8px;
  871. .msPhoto {
  872. display: flex;
  873. justify-content: center;
  874. align-items: center;
  875. max-width: 100%;
  876. max-height: 270px;
  877. img {
  878. max-width: 100%;
  879. max-height: 270px;
  880. }
  881. }
  882. .imgbbx {
  883. display: flex;
  884. flex-direction: column;
  885. align-items: center;
  886. justify-content: center;
  887. width: 100%;
  888. height: 100%;
  889. i {
  890. font-weight: bold;
  891. margin: 14px 0;
  892. font-size: 24px;
  893. }
  894. }
  895. }
  896. p {
  897. margin: 5px 0px;
  898. }
  899. }
  900. .dis_fs {
  901. display: flex;
  902. align-items: center;
  903. .imgBoxs {
  904. width: 200px;
  905. height: 130px;
  906. border: 1px solid #999;
  907. margin-right: 6px;
  908. }
  909. .btns {
  910. align-self: end;
  911. border: 1px solid #999;
  912. font-size: 12px;
  913. height: 28px;
  914. line-height: 28px;
  915. padding: 0px 10px;
  916. border-radius: 4px;
  917. cursor: pointer;
  918. }
  919. }
  920. .dis_fs {
  921. display: flex;
  922. align-items: center;
  923. }
  924. .jbtw {
  925. justify-content: space-between;
  926. }
  927. .bors {
  928. border: 1px solid #999;
  929. padding: 0px 8px;
  930. height: 30px;
  931. line-height: 30px;
  932. border-radius: 4px;
  933. }
  934. .mar_bgc {
  935. width: 90%;
  936. padding: 12px;
  937. margin-top: 12px;
  938. background-color: #eee;
  939. }
  940. </style>