login_setting.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. <template>
  2. <div class="app-container">
  3. <div class="page-header">
  4. 轮播图管理
  5. </div>
  6. <el-divider></el-divider>
  7. <div class="btn-group">
  8. <el-button
  9. type="primary"
  10. size="small"
  11. @click="(dialogVisible = true), (type = 1)"
  12. >新增</el-button>
  13. <el-button size="small" type="danger" @click="batchDelete()">删除</el-button>
  14. </div>
  15. <div class="mymain-container">
  16. <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
  17. <el-table-column align="center" label="轮播图名称" prop="imgCarouselName" min-width="120" show-overflow-tooltip></el-table-column>
  18. <el-table-column align="center" label="轮播图" prop="imgCarouselUrl" min-width="120" show-overflow-tooltip>
  19. <template slot-scope="scope">
  20. <a :href="scope.row.imgCarouselUrl" >
  21. <img :src="scope.row.imgCarouselUrl" alt="轮播图" class="el-image__inner el-image__preview"/>
  22. </a>
  23. </template>
  24. </el-table-column>
  25. <el-table-column align="center" label="排序" prop="imgCarouselOrder" min-width="160" show-overflow-tooltip></el-table-column>
  26. <el-table-column align="center" label="创建时间" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  27. <el-table-column align="center" label="状态" prop="status" min-width="160" show-overflow-tooltip>
  28. <template slot-scope="scope">
  29. <div style="z-index: 99">
  30. <el-tag type="success" v-if="scope.row.status == '1'" >显示</el-tag>
  31. <el-tag type="danger" v-else-if="scope.row.status == '0'">隐藏 </el-tag>
  32. </div>
  33. </template>
  34. </el-table-column>
  35. <el-table-column
  36. align="center"
  37. fixed="right"
  38. label="操作"
  39. min-width="160"
  40. >
  41. <template slot-scope="scope">
  42. <el-button type="text" size="small" @click="hanleEdit(scope.row)"
  43. >编辑</el-button
  44. >
  45. <el-button type="text" size="small" @click="hanleStatus(scope.row.id)" v-if="scope.row.status === '1'">隐藏</el-button>
  46. <el-button type="text" size="small" @click="hanleStatus(scope.row.id)" v-if="scope.row.status === '0'">显示</el-button>
  47. <el-popconfirm
  48. title="确定要删除这张轮播图吗?"
  49. style="margin-left: 10px"
  50. @onConfirm="hanleDelete(scope.row.id)"
  51. >
  52. <el-button slot="reference" type="text" size="small"
  53. >删除</el-button
  54. >
  55. </el-popconfirm>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <!-- 分页 -->
  60. <!-- <div style="margin: 20px 0">-->
  61. <!-- <el-pagination-->
  62. <!-- @size-change="handleSizeChange"-->
  63. <!-- @current-change="handleCurrentChange"-->
  64. <!-- :current-page="currentPage"-->
  65. <!-- :page-sizes="[10, 20, 30, 50]"-->
  66. <!-- :page-size="10"-->
  67. <!-- layout="total, sizes, prev, pager, next, jumper"-->
  68. <!-- :total="listTotal"-->
  69. <!-- >-->
  70. <!-- </el-pagination>-->
  71. <!-- </div>-->
  72. </div>
  73. <!-- 添加公司备案信息 -->
  74. <div>
  75. <div class="setting_title">备案管理</div>
  76. <el-divider></el-divider>
  77. <el-card shadow="never" class="my-card">
  78. <el-form
  79. class="my-form"
  80. ref="mainForm"
  81. :model="comPanyDialogForm"
  82. label-width="120px"
  83. label-position="right"
  84. >
  85. <el-form-item label="ICP备案:" prop="nickName">
  86. <el-input
  87. autocomplete="off"
  88. placeholder="请输入"
  89. v-model="comPanyDialogForm.icpRecord"
  90. ></el-input
  91. >
  92. </el-form-item>
  93. <el-form-item label="ICP备案链接:" prop="nickName">
  94. <el-input
  95. autocomplete="off"
  96. placeholder="请输入"
  97. v-model="comPanyDialogForm.icpRecordLink"
  98. ></el-input
  99. > (填写链接,可跳转至链接页面)
  100. </el-form-item>
  101. <el-form-item label="公网安备案:" prop="nickName">
  102. <el-input
  103. autocomplete="off"
  104. placeholder="请输入"
  105. v-model="comPanyDialogForm.pubSecurityRecord"
  106. ></el-input
  107. >
  108. </el-form-item>
  109. <el-form-item label="公网安备案链接:" prop="nickName">
  110. <el-input
  111. autocomplete="off"
  112. placeholder="请输入"
  113. v-model="comPanyDialogForm.pubSecurityRecordLink"
  114. ></el-input
  115. > (填写链接,可跳转至链接页面)
  116. </el-form-item>
  117. <div class="setting_title">公司名称管理</div>
  118. <el-divider></el-divider>
  119. <el-form-item label="公司名称:" prop="nickName">
  120. <el-input
  121. autocomplete="off"
  122. placeholder="单行输入"
  123. v-model="comPanyDialogForm.companyName"
  124. ></el-input
  125. >
  126. </el-form-item>
  127. </el-form>
  128. </el-card>
  129. </div>
  130. <div class="page-footer">
  131. <div class="footer">
  132. <!-- <el-button type="primary" @click="editFn">修改</el-button>-->
  133. <el-button type="primary" @click="addComPany">确定</el-button>
  134. </div>
  135. </div>
  136. <div>
  137. <el-dialog
  138. :visible.sync="dialogVisible"
  139. width="50%"
  140. @close="resetForm"
  141. :close-on-click-modal="false"
  142. >
  143. <el-form
  144. ref="dialogForm"
  145. :model="dialogForm"
  146. :rules="type == 1 ? rules : ''"
  147. label-width="120px"
  148. size="normal"
  149. >
  150. <el-form-item label="轮播图名称" prop="saleCode">
  151. <el-input v-model="dialogForm.imgCarouselName"></el-input>
  152. </el-form-item>
  153. <el-form-item label="轮播图" prop="fileUrl">
  154. <ImageUpload :fileList="fileList" :multiple="true" />
  155. </el-form-item>
  156. <el-form-item label="排序" prop="mainId">
  157. <el-input v-model="dialogForm.imgCarouselOrder"></el-input>
  158. </el-form-item>
  159. </el-form>
  160. <span slot="footer" class="dialog-footer">
  161. <el-button @click="(dialogVisible = false), resetForm()"
  162. >取 消</el-button
  163. >
  164. <el-button type="primary" @click="addImgCarousel">确 定</el-button>
  165. </span>
  166. </el-dialog>
  167. </div>
  168. </div>
  169. </template>
  170. <script>
  171. import Mixin from "@/mixin/index";
  172. import Pagination from "@/components/Pagination";
  173. import ImageUpload from '@/components/Common/image-upload.vue';
  174. import {
  175. getProductList,
  176. getImgCarouseList,
  177. handleImgIsShow,
  178. addImgCarousel,
  179. delImgData,
  180. addCompany,
  181. editImgCarousel,
  182. } from "@/api/policy_list";
  183. export default {
  184. mixins: [Mixin],
  185. data() {
  186. return {
  187. type: 0, // 0,1
  188. screenForm: {
  189. companyRecordManageId: "",
  190. imgCarouselName: "",
  191. imgCarouselUrl: "",
  192. imgCarouselOrder: "",
  193. status: "",
  194. },
  195. dialogForm: {
  196. id: "",
  197. companyRecordManageId: "",
  198. imgCarouselName: "",
  199. imgCarouselUrl: "",
  200. imgCarouselOrder: "",
  201. status: "1",
  202. },
  203. comPanyDialogForm: {
  204. id: "",
  205. icpRecord: "",
  206. icpRecordLink: "",
  207. pubSecurityRecord: "",
  208. pubSecurityRecordLink: "",
  209. companyName: "",
  210. },
  211. dataList: [
  212. {
  213. date: "2016-05-02",
  214. name: "王小虎",
  215. label: "姓名",
  216. address: "上海市普陀区金沙江路 1518 弄",
  217. },
  218. ],
  219. columns: [
  220. {
  221. prop: "imgCarouselName",
  222. lable: "轮播图名称",
  223. widht: 160,
  224. },
  225. {
  226. prop: "imgCarouselUrl",
  227. lable: "轮播图",
  228. widht: 200,
  229. },
  230. {
  231. prop: "imgCarouselOrder",
  232. lable: "排序",
  233. widht: 160,
  234. },
  235. {
  236. prop: "createTime",
  237. lable: "创建时间",
  238. widht: 160,
  239. },
  240. {
  241. prop: "status",
  242. lable: "状态",
  243. widht: 120,
  244. },
  245. ],
  246. rules: {
  247. imgCarouselName: [
  248. { required: true, message: "请输入轮播图名称", trigger: "blur" },
  249. ],
  250. // saleName: [
  251. // { required: true, message: "请输入销售类型名称", trigger: "blur" },
  252. // ],
  253. // mainName: [
  254. // { required: true, message: "请输入品类名称", trigger: "blur" },
  255. // ],
  256. },
  257. productList: [],
  258. fileList: [],
  259. multipleSelection: [],
  260. };
  261. },
  262. methods: {
  263. getList() {
  264. this.listLoading = true;
  265. const params = {
  266. pageNum: this.currentPage,
  267. pageSize: this.pageSize,
  268. saleCode: this.screenForm.saleCode,
  269. saleName: this.screenForm.saleName,
  270. mainId: "",
  271. status: this.screenForm.status,
  272. };
  273. // getTypeList(params).then((res) => {
  274. // this.dataList = res.data.records;
  275. // this.listTotal = res.data.total;
  276. // this.listLoading = false;
  277. // });
  278. getImgCarouseList(params).then((res) => {
  279. this.dataList = res.data;
  280. this.listLoading = false;
  281. });
  282. },
  283. handleChange(e) {
  284. this.productList.find((k) => {
  285. if (k.productCategoryNumber == e) {
  286. this.dialogForm.mainId = k.productCategoryNumber;
  287. this.dialogForm.mainName = k.productCategoryName;
  288. this.screenForm.mainId = k.productCategoryNumber;
  289. this.screenForm.mainName = k.productCategoryName;
  290. }
  291. });
  292. },
  293. hanleDelete(id) {
  294. this.hanleDeleteAllPromise(id).then((ids) => {
  295. delImgData({
  296. ids: ids[0],
  297. }).then((res) => {
  298. this.$successMsg("删除成功");
  299. this.hanleReset();
  300. });
  301. });
  302. },
  303. hanleEdit(item) {
  304. this.dialogForm = {
  305. id: item.id,
  306. companyRecordManageId: item.companyRecordManageId,
  307. imgCarouselName: item.imgCarouselName,
  308. imgCarouselUrl: item.imgCarouselUrl,
  309. imgCarouselOrder: item.imgCarouselOrder,
  310. status: item.status,
  311. };
  312. this.type = 0;
  313. this.dialogVisible = true;
  314. },
  315. hanleDateil(item) {
  316. this.dialogVisible = true;
  317. this.dialogForm = {
  318. ...item,
  319. };
  320. this.type = 3;
  321. },
  322. hanleStatus(id){
  323. handleImgIsShow({
  324. id:id
  325. }).then((res) => {
  326. this.$successMsg("状态已更改");
  327. this.hanleReset();
  328. });
  329. },
  330. addImgCarousel(){
  331. if (this.type == 1) {
  332. this.$refs.dialogForm.validate((valid) => {
  333. //console.log(...this.dialogForm)
  334. if (valid) {
  335. this.dialogForm.imgCarouselUrl = "http://hg.zfire.top/api/img/get?key=" + this.fileList[0].url
  336. const params = {
  337. ...this.dialogForm,
  338. };
  339. addImgCarousel(params).then((res) => {
  340. this.$successMsg("添加成功");
  341. this.hanleReset();
  342. });
  343. } else {
  344. console.log("error submit!!");
  345. return false;
  346. }
  347. });
  348. } else if (this.type == 0) {
  349. const upParams = {
  350. ...this.dialogForm,
  351. };
  352. editImgCarousel(upParams).then((res) => {
  353. this.$successMsg("修改成功");
  354. this.hanleReset();
  355. });
  356. } else {
  357. this.dialogVisible = false;
  358. }
  359. },
  360. // 表格选择
  361. handleSelectionChange(val) {
  362. this.multipleSelection = val;
  363. },
  364. //添加公司信息
  365. addComPany(){
  366. const params = {
  367. ...this.comPanyDialogForm,
  368. };
  369. addCompany(params).then((res) => {
  370. this.$successMsg("添加成功");
  371. this.hanleReset();
  372. });
  373. },
  374. resetForm(formName) {
  375. this.$refs.dialogForm.resetFields();
  376. },
  377. hanleReset() {
  378. this.dialogForm = {
  379. companyRecordManageId: "",
  380. imgCarouselName: "",
  381. imgCarouselUrl: "",
  382. imgCarouselOrder: "",
  383. status: "1"
  384. };
  385. // this.$refs.dialogForm.resetFields()
  386. this.dialogVisible = false;
  387. this.getList();
  388. },
  389. batchDelete() {
  390. if(this.multipleSelection.length < 1) {
  391. return this.$errorMsg('请选择信息');
  392. }
  393. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  394. confirmButtonText: '确定',
  395. cancelButtonText: '取消',
  396. type: 'warning'
  397. }).then(() => {
  398. let ids = [];
  399. this.multipleSelection.forEach(item => {
  400. ids.push(item.id);
  401. });
  402. delImgData({ids: ids.join(',')}).then(res => {
  403. this.$successMsg('删除成功');
  404. this.hanleReset();
  405. })
  406. }).catch(() => {});
  407. },
  408. },
  409. created() {
  410. this.getList();
  411. },
  412. components: {
  413. Pagination,
  414. ImageUpload
  415. },
  416. };
  417. </script>
  418. <style scoped>
  419. .el-switch.is-disabled {
  420. opacity: inherit;
  421. }
  422. .page-header{
  423. font-size: 18px;
  424. padding-bottom: 10px;
  425. font-weight: 600;
  426. }
  427. .cname-footer{
  428. margin-top: 15px;
  429. }
  430. .my-form{
  431. width :60%
  432. }
  433. </style>