login_setting.vue 16 KB

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