index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999
  1. <template>
  2. <div class="Modal">
  3. <div class="colLeft">
  4. <div class="Nav">
  5. <!-- <div class="input">
  6. <Input
  7. search
  8. enter-button
  9. placeholder="请输入分类名称"
  10. v-model="uploadName.name"
  11. style="width: 90%"
  12. @on-search="changePage"
  13. />
  14. </div> -->
  15. <div class="trees-coadd">
  16. <div class="scollhide">
  17. <div class="tree">
  18. <!-- <Tree :data="treeData" :render="renderContent" :load-data="loadData" class="treeBox" ref="tree"></Tree> -->
  19. <el-tree
  20. :data="treeData"
  21. node-key="id"
  22. default-expand-all
  23. :expand-on-click-node="false"
  24. @node-click="appendBtn"
  25. :current-node-key="treeId"
  26. >
  27. <span class="custom-tree-node" slot-scope="{ data }">
  28. <span class="file-name">
  29. <i class="icon el-icon-folder-remove"></i>
  30. {{ data.title }}</span
  31. >
  32. <span>
  33. <el-dropdown @command="(command) => clickMenu(data, command)">
  34. <Icon class="add" type="ios-more" />
  35. <template slot="dropdown">
  36. <el-dropdown-menu>
  37. <el-dropdown-item command="1">新增分类</el-dropdown-item>
  38. <el-dropdown-item v-if="data.id" command="2">编辑分类</el-dropdown-item>
  39. <el-dropdown-item v-if="data.id" command="3">删除</el-dropdown-item>
  40. </el-dropdown-menu>
  41. </template>
  42. </el-dropdown>
  43. </span>
  44. </span>
  45. </el-tree>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="conter">
  51. <div class="bnt acea-row row-middle df-jcsb">
  52. <div class="">
  53. <el-button
  54. type="primary"
  55. :disabled="checkPicList.length === 0"
  56. @click="checkPics"
  57. size="small"
  58. v-if="isShow !== 0"
  59. >使用选中图片</el-button
  60. >
  61. <el-button size="small" type="primary" @click="uploadModal">上传图片</el-button>
  62. <el-button
  63. type="error"
  64. class="mr10"
  65. size="small"
  66. :disabled="!checkPicList.length && !ids.length"
  67. @click.stop="editPicList()"
  68. >删除图片</el-button
  69. >
  70. <el-cascader
  71. v-model="pids"
  72. placeholder="图片移动至"
  73. style="width: 150px"
  74. class="treeSel"
  75. :options="treeData2"
  76. :props="{ checkStrictly: true, emitPath: false, label: 'title', value: 'id' }"
  77. clearable
  78. size="small"
  79. @visible-change="moveImg"
  80. ></el-cascader>
  81. </div>
  82. <div v-if="isPage">
  83. <el-input
  84. class="mr10"
  85. v-model="fileData.real_name"
  86. placeholder="请输入图片名"
  87. size="small"
  88. style="width: 150px"
  89. >
  90. <i slot="suffix" class="el-icon-search el-input__icon" @click="getFileList"></i>
  91. </el-input>
  92. <el-radio-group v-model="lietStyle" size="small" @change="radioChange">
  93. <el-radio-button label="list">
  94. <i class="el-icon-menu"></i>
  95. </el-radio-button>
  96. <el-radio-button label="table">
  97. <i class="el-icon-files"></i>
  98. </el-radio-button>
  99. </el-radio-group>
  100. </div>
  101. </div>
  102. <div class="pictrueList acea-row" :class="{ 'is-modal': !isPage }">
  103. <div v-if="lietStyle == 'list'" style="width: 100%">
  104. <div v-show="isShowPic" class="imagesNo">
  105. <Icon type="ios-images" size="60" color="#dbdbdb" />
  106. <span class="imagesNo_sp">图片库为空</span>
  107. </div>
  108. <div class="acea-row mb10">
  109. <div
  110. class="pictrueList_pic mr10 mb10"
  111. v-for="(item, index) in pictrueList"
  112. :key="index"
  113. @mouseenter="enterMouse(item)"
  114. @mouseleave="enterMouse(item)"
  115. >
  116. <p class="number" v-if="item.num > 0">
  117. <Badge :count="item.num" type="error" :offset="[11, 12]">
  118. <a href="#" class="demo-badge"></a>
  119. </Badge>
  120. </p>
  121. <img
  122. :class="item.isSelect ? 'on' : ''"
  123. v-lazy="item.satt_dir"
  124. @click.stop="changImage(item, index, pictrueList)"
  125. />
  126. <div style="operate-item " @mouseenter="enterLeave(item)" @mouseleave="enterLeave(item)">
  127. <p v-if="!item.isEdit">
  128. {{ item.editName }}
  129. </p>
  130. <el-input size="small" type="text" v-model="item.real_name" v-else @blur="bindTxt(item)" />
  131. <div class="operate-item operate-height">
  132. <span class="operate mr10" @click="editPicList(item.att_id)" v-if="item.isShowEdit">删除</span>
  133. <span class="operate mr10" @click="item.isEdit = !item.isEdit" v-if="item.isShowEdit">改名</span>
  134. <span class="operate" @click="lookImg(item)" v-if="item.isShowEdit">查看</span>
  135. </div>
  136. </div>
  137. <!-- <div class="nameStyle" v-show="item.realName && item.real_name">
  138. {{ item.real_name }}
  139. </div> -->
  140. </div>
  141. </div>
  142. <!--<Col class="mb20" v-bind="gridPic"-->
  143. <!--v-for="(item, index) in pictrueList" :key="index" >-->
  144. <!--<div class="pictrueList_pic">-->
  145. <!--<img :class="item.isSelect ? 'on': '' " v-lazy="item.satt_dir"-->
  146. <!--@click.stop="changImage(item, index, pictrueList)"/>-->
  147. <!--</div>-->
  148. <!--</Col>-->
  149. </div>
  150. <el-table
  151. v-if="lietStyle == 'table'"
  152. ref="table"
  153. :data="pictrueList"
  154. v-loading="loading"
  155. highlight-row
  156. :row-key="getRowKey"
  157. @selection-change="handleSelectRow"
  158. no-data-text="暂无数据"
  159. no-filtered-data-text="暂无筛选结果"
  160. >
  161. <el-table-column type="selection" width="60" :reserve-selection="true"> </el-table-column>
  162. <el-table-column label="图片名称" min-width="190">
  163. <template slot-scope="scope">
  164. <div class="df-aic">
  165. <div class="tabBox_img mr10" v-viewer>
  166. <img v-lazy="scope.row.att_dir" />
  167. </div>
  168. <span v-if="!scope.row.isEdit" class="line2 real-name">{{ scope.row.real_name }}</span>
  169. <el-input
  170. size="small"
  171. type="text"
  172. style="width: 90%"
  173. v-model="scope.row.real_name"
  174. v-else
  175. @blur="bindTxt(scope.row)"
  176. />
  177. </div>
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="上传时间" min-width="100">
  181. <template slot-scope="scope">
  182. <span>{{ scope.row.time }}</span>
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="操作" fixed="right" width="170">
  186. <template slot-scope="scope">
  187. <a @click="editPicList(scope.row)">删除</a>
  188. <el-divider direction="vertical"></el-divider>
  189. <a @click="scope.row.isEdit = !scope.row.isEdit">{{ scope.row.isEdit ? '确定' : '重名命' }}</a>
  190. <el-divider direction="vertical"></el-divider>
  191. <a @click="lookImg(scope.row)">查看</a>
  192. </template>
  193. </el-table-column>
  194. </el-table>
  195. </div>
  196. <div class="footer acea-row row-right">
  197. <Page :total="total" show-elevator show-total @on-change="pageChange" :page-size="fileData.limit" />
  198. </div>
  199. </div>
  200. </div>
  201. <uploadImg ref="upload" :isPage="isPage" :isIframe='isIframe' :categoryId="treeId" :categoryList="treeData" @uploadSuccess="uploadSuccess"></uploadImg>
  202. <div class="images" v-show="false" v-viewer="{ movable: false }">
  203. <img v-for="src in pictrueList" :src="src.att_dir" :key="src.att_id" />
  204. </div>
  205. </div>
  206. </template>
  207. <script>
  208. import {
  209. getCategoryListApi,
  210. createApi,
  211. fileListApi,
  212. categoryEditApi,
  213. moveApi,
  214. fileUpdateApi,
  215. } from '@/api/uploadPictures';
  216. import Setting from '@/setting';
  217. import { getCookies } from '@/libs/util';
  218. import uploadImg from '@/components/uploadImg';
  219. import { VueTreeList, Tree, TreeNode } from 'vue-tree-list';
  220. export default {
  221. name: 'uploadPictures',
  222. components: { uploadImg, VueTreeList },
  223. props: {
  224. isChoice: {
  225. type: String,
  226. default: '',
  227. },
  228. isPage: {
  229. type: Boolean,
  230. default: false,
  231. },
  232. isIframe: {
  233. type: Boolean,
  234. default: false,
  235. },
  236. gridBtn: {
  237. type: Object,
  238. default: null,
  239. },
  240. gridPic: {
  241. type: Object,
  242. default: null,
  243. },
  244. isShow: {
  245. type: Number,
  246. default: 1,
  247. },
  248. pageLimit: {
  249. type: Number,
  250. default: 0,
  251. },
  252. },
  253. data() {
  254. return {
  255. spinShow: false,
  256. fileUrl: Setting.apiBaseURL + '/file/upload',
  257. modalPic: false,
  258. treeData: [],
  259. treeData2: [],
  260. pictrueList: [],
  261. uploadData: {}, // 上传参数
  262. checkPicList: [],
  263. uploadName: {
  264. name: '',
  265. all: 1,
  266. },
  267. formValidate: { id: 0 },
  268. FromData: null,
  269. treeId: 0,
  270. isJudge: false,
  271. buttonProps: {
  272. type: 'default',
  273. size: 'small',
  274. },
  275. fileData: {
  276. pid: 0,
  277. real_name: '',
  278. page: 1,
  279. limit: this.pageLimit || 18,
  280. },
  281. total: 0,
  282. pids: 0,
  283. list: [],
  284. modalTitleSs: '',
  285. isShowPic: false,
  286. header: {},
  287. ids: [], // 选中附件的id集合
  288. lietStyle: 'list',
  289. imageUrl: '',
  290. loading: false,
  291. multipleSelection: [],
  292. };
  293. },
  294. mounted() {
  295. this.getToken();
  296. this.getList();
  297. this.getFileList();
  298. },
  299. methods: {
  300. radioChange() {
  301. this.initData();
  302. },
  303. lookImg(item) {
  304. this.imageUrl = item.att_dir;
  305. const viewer = this.$el.querySelector('.images').$viewer;
  306. viewer.show();
  307. this.$nextTick(() => {
  308. let i = this.pictrueList.findIndex((e) => e.att_dir === item.att_dir);
  309. viewer.update().view(i);
  310. });
  311. },
  312. onDel(node) {
  313. let method = node.cate_id ? routeDel : routeCateDel;
  314. this.$Modal.confirm({
  315. title: '警告',
  316. content: '<p>删除后无法恢复,请确认后删除!</p>',
  317. onOk: () => {
  318. method(node.id)
  319. .then((res) => {
  320. this.$Message.success(res.msg);
  321. node.remove();
  322. })
  323. .catch((err) => {
  324. this.$Message.error(err);
  325. });
  326. },
  327. onCancel: () => {},
  328. });
  329. },
  330. onChangeName(params) {
  331. if (params.eventType == 'blur') {
  332. let data = {
  333. name: params.newName,
  334. id: params.id,
  335. };
  336. interfaceEditName(data)
  337. .then((res) => {
  338. this.$Message.success(res.msg);
  339. })
  340. .catch((err) => {
  341. this.$Message.error(err);
  342. });
  343. }
  344. },
  345. // 点击菜单
  346. clickMenu(data, name) {
  347. console.log(name, data);
  348. if (name == 1) {
  349. this.append(data);
  350. } else if (name == 2) {
  351. this.editPic(data);
  352. } else if (name == 3) {
  353. this.remove(data, '分类');
  354. }
  355. },
  356. uploadSuccess() {
  357. this.fileData.page = 1;
  358. this.getFileList();
  359. },
  360. uploadModal() {
  361. this.$refs.upload.uploadModal = true;
  362. },
  363. enterMouse(item) {
  364. item.realName = !item.realName;
  365. },
  366. enterLeave(item) {
  367. item.isShowEdit = !item.isShowEdit;
  368. },
  369. // 上传头部token
  370. getToken() {
  371. this.header['Authori-zation'] = 'Bearer ' + getCookies('token');
  372. },
  373. moveImg(status) {
  374. if (!status) {
  375. this.getMove();
  376. } else {
  377. if (!this.ids.toString()) {
  378. this.$Message.warning('请先选择图片');
  379. return;
  380. }
  381. }
  382. },
  383. searchImg() {},
  384. // 移动分类
  385. getMove() {
  386. let data = {
  387. pid: this.pids,
  388. images: this.ids.toString(),
  389. };
  390. moveApi(data)
  391. .then(async (res) => {
  392. this.$Message.success(res.msg);
  393. this.getFileList();
  394. this.pids = 0;
  395. this.checkPicList = [];
  396. this.ids = [];
  397. })
  398. .catch((res) => {
  399. this.$Message.error(res.msg);
  400. });
  401. },
  402. delImg(id) {
  403. let ids = {
  404. ids: id,
  405. };
  406. let delfromData = {
  407. title: '删除选中图片',
  408. url: `file/file/delete`,
  409. method: 'POST',
  410. ids: ids,
  411. };
  412. this.$modalSure(delfromData)
  413. .then((res) => {
  414. this.$Message.success(res.msg);
  415. this.getFileList();
  416. this.checkPicList = [];
  417. })
  418. .catch((res) => {
  419. this.$Message.error(res.msg);
  420. });
  421. },
  422. // 删除图片
  423. editPicList(id) {
  424. let ids = {
  425. ids: id || this.ids.toString(),
  426. };
  427. let delfromData = {
  428. title: '删除选中图片',
  429. url: `file/file/delete`,
  430. method: 'POST',
  431. ids: ids,
  432. };
  433. this.$modalSure(delfromData)
  434. .then((res) => {
  435. this.$Message.success(res.msg);
  436. this.getFileList();
  437. this.initData();
  438. })
  439. .catch((res) => {
  440. this.$Message.error(res.msg);
  441. });
  442. },
  443. initData() {
  444. this.checkPicList = [];
  445. this.ids = [];
  446. this.multipleSelection = [];
  447. },
  448. // 鼠标移入 移出
  449. onMouseOver(root, node, data) {
  450. event.preventDefault();
  451. data.flag = !data.flag;
  452. if (data.flag2) {
  453. data.flag2 = false;
  454. }
  455. },
  456. // onClick(root, node, data, e) {
  457. // e.preventDefault();
  458. // data.flag2 = !data.flag2;
  459. // },
  460. // 点击树
  461. appendBtn(data) {
  462. this.treeId = data.id;
  463. this.fileData.page = 1;
  464. this.getFileList();
  465. },
  466. // 点击添加
  467. append(data) {
  468. this.treeId = data.id;
  469. this.getFrom();
  470. },
  471. // 删除分类
  472. remove(data, tit) {
  473. this.tits = tit;
  474. let delfromData = {
  475. title: '删除 [ ' + data.title + ' ] ' + '分类',
  476. url: `file/category/${data.id}`,
  477. method: 'DELETE',
  478. ids: '',
  479. };
  480. this.$modalSure(delfromData)
  481. .then((res) => {
  482. this.$Message.success(res.msg);
  483. this.getList();
  484. this.checkPicList = [];
  485. })
  486. .catch((res) => {
  487. this.$Message.error(res.msg);
  488. });
  489. },
  490. // 确认删除树
  491. // submitModel () {
  492. // if (this.tits === '图片') {
  493. // this.getFileList();
  494. // this.checkPicList = [];
  495. // } else {
  496. // this.getList();
  497. // this.checkPicList = [];
  498. // }
  499. // },
  500. // 编辑树表单
  501. editPic(data) {
  502. this.$modalForm(categoryEditApi(data.id)).then(() => this.getList());
  503. },
  504. // 搜索分类
  505. changePage() {
  506. this.getList('search');
  507. },
  508. // 分类列表树
  509. getList(type) {
  510. let data = {
  511. title: '全部图片',
  512. id: '',
  513. pid: 0,
  514. };
  515. getCategoryListApi(this.uploadName)
  516. .then(async (res) => {
  517. if (type !== 'search') {
  518. this.treeData2 = JSON.parse(JSON.stringify([...res.data.list]));
  519. }
  520. res.data.list.unshift(data);
  521. this.treeData = res.data.list;
  522. console.log(this.treeData);
  523. // this.addFlag(this.treeData);
  524. })
  525. .catch((res) => {
  526. this.$Message.error(res.msg);
  527. });
  528. },
  529. loadData(item, callback) {
  530. getCategoryListApi({
  531. pid: item.id,
  532. })
  533. .then(async (res) => {
  534. const data = res.data.list;
  535. callback(data);
  536. })
  537. .catch((res) => {});
  538. },
  539. addFlag(treedata) {
  540. treedata.map((item) => {
  541. this.$set(item, 'flag', false);
  542. this.$set(item, 'flag2', false);
  543. item.children && this.addFlag(item.children);
  544. });
  545. },
  546. // 新建分类
  547. add() {
  548. this.treeId = 0;
  549. this.getFrom();
  550. },
  551. // 文件列表
  552. getFileList() {
  553. this.fileData.pid = this.treeId;
  554. fileListApi(this.fileData)
  555. .then(async (res) => {
  556. res.data.list.forEach((el) => {
  557. el.isSelect = false;
  558. el.isEdit = false;
  559. el.isShowEdit = false;
  560. el.realName = false;
  561. el.num = 0;
  562. this.editName(el);
  563. });
  564. this.pictrueList = res.data.list;
  565. if (this.pictrueList.length) {
  566. this.isShowPic = false;
  567. } else {
  568. this.isShowPic = true;
  569. }
  570. this.total = res.data.count;
  571. this.$nextTick(() => {
  572. //确保dom加载完毕
  573. // this.showSelectData();
  574. });
  575. })
  576. .catch((res) => {
  577. this.$Message.error(res.msg);
  578. });
  579. },
  580. showSelectData() {
  581. if (this.multipleSelection.length > 0) {
  582. // 判断是否存在勾选过的数据
  583. this.pictrueList.forEach((row) => {
  584. // 获取数据列表接口请求到的数据
  585. this.multipleSelection.forEach((item) => {
  586. // 勾选到的数据
  587. if (row.att_id === item.att_id) {
  588. // this.$refs.table.toggleRowSelection(item, true); // 若有重合,则回显该条数据
  589. }
  590. });
  591. });
  592. }
  593. },
  594. getRowKey(row) {
  595. return row.att_id;
  596. },
  597. //对象数组去重;
  598. unique(arr) {
  599. let result = arr.reduce((acc, curr) => {
  600. const x = acc.find((item) => item.att_id === curr.att_id);
  601. if (!x) {
  602. return acc.concat([curr]);
  603. } else {
  604. return acc;
  605. }
  606. }, []);
  607. return result;
  608. },
  609. // 选中某一行
  610. handleSelectRow(selection) {
  611. let arr = this.unique(selection);
  612. console.log(selection, arr);
  613. const uniqueArr = [];
  614. const ids = [];
  615. for (let i = 0; i < arr.length; i++) {
  616. const item = arr[i];
  617. if (!ids.includes(item.att_id)) {
  618. uniqueArr.push(item);
  619. ids.push(item.att_id);
  620. }
  621. }
  622. this.ids = ids;
  623. this.multipleSelection = uniqueArr;
  624. },
  625. pageChange(index) {
  626. this.fileData.page = index;
  627. this.getFileList();
  628. this.checkPicList = [];
  629. },
  630. // 新建分类表单
  631. getFrom() {
  632. this.$modalForm(createApi({ id: this.treeId })).then((res) => {
  633. this.getList();
  634. });
  635. },
  636. // 上传之前
  637. beforeUpload(file) {
  638. // if (file.size > 2097152) {
  639. // this.$Message.error(file.name + "大小超过2M!");
  640. // } else
  641. if (!/image\/\w+/.test(file.type)) {
  642. this.$Message.error('请上传以jpg、jpeg、png等结尾的图片文件'); //FileExt.toLowerCase()
  643. return false;
  644. }
  645. this.uploadData = {
  646. pid: this.treeId,
  647. };
  648. let promise = new Promise((resolve) => {
  649. this.$nextTick(function () {
  650. resolve(true);
  651. });
  652. });
  653. return promise;
  654. },
  655. // 上传成功
  656. handleSuccess(res, file, fileList) {
  657. if (res.status === 200) {
  658. this.$Message.success(res.msg);
  659. this.fileData.page = 1;
  660. this.getFileList();
  661. } else {
  662. this.$Message.error(res.msg);
  663. }
  664. },
  665. // 关闭
  666. cancel() {
  667. this.$emit('changeCancel');
  668. },
  669. // 选中图片
  670. changImage(item, index, row) {
  671. let activeIndex = 0;
  672. if (!item.isSelect) {
  673. item.isSelect = true;
  674. this.checkPicList.push(item);
  675. } else {
  676. item.isSelect = false;
  677. this.checkPicList.map((el, index) => {
  678. if (el.att_id == item.att_id) {
  679. activeIndex = index;
  680. }
  681. });
  682. this.checkPicList.splice(activeIndex, 1);
  683. }
  684. this.ids = [];
  685. this.checkPicList.map((item, i) => {
  686. this.ids.push(item.att_id);
  687. });
  688. this.pictrueList.map((el, i) => {
  689. if (el.isSelect) {
  690. this.checkPicList.filter((el2, j) => {
  691. if (el.att_id == el2.att_id) {
  692. el.num = j + 1;
  693. }
  694. });
  695. } else {
  696. el.num = 0;
  697. }
  698. });
  699. },
  700. // 点击使用选中图片
  701. checkPics() {
  702. if (this.isChoice === '单选') {
  703. if (this.checkPicList.length > 1) return this.$Message.warning('最多只能选一张图片');
  704. this.$emit('getPic', this.checkPicList[0]);
  705. } else {
  706. let maxLength = this.$route.query.maxLength;
  707. if (maxLength != undefined && this.checkPicList.length > Number(maxLength))
  708. return this.$Message.warning('最多只能选' + maxLength + '张图片');
  709. this.$emit('getPicD', this.checkPicList);
  710. }
  711. },
  712. editName(item) {
  713. let it = item.real_name.split('.');
  714. let it1 = it[1] == undefined ? [] : it[1];
  715. let len = it[0].length + it1.length;
  716. item.editName = len < 10 ? item.real_name : item.real_name.substr(0, 2) + '...' + item.real_name.substr(-5, 5);
  717. },
  718. // 修改图片文字上传
  719. bindTxt(item) {
  720. if (item.real_name == '') {
  721. this.$Message.error('请填写内容');
  722. }
  723. fileUpdateApi(item.att_id, {
  724. real_name: item.real_name,
  725. })
  726. .then((res) => {
  727. this.editName(item);
  728. item.isEdit = false;
  729. this.$Message.success(res.msg);
  730. })
  731. .catch((error) => {
  732. this.$Message.error(error.msg);
  733. });
  734. },
  735. },
  736. };
  737. </script>
  738. <style scoped lang="scss">
  739. .nameStyle {
  740. position: absolute;
  741. white-space: nowrap;
  742. z-index: 9;
  743. background: #eee;
  744. height: 20px;
  745. line-height: 20px;
  746. color: #555;
  747. border: 1px solid #ebebeb;
  748. padding: 0 5px;
  749. left: 56px;
  750. bottom: -18px;
  751. }
  752. .iconbianji1 {
  753. font-size: 13px;
  754. }
  755. .selectTreeClass {
  756. background: #d5e8fc;
  757. }
  758. .treeBox {
  759. width: 100%;
  760. height: 100%;
  761. max-width: 180px;
  762. }
  763. .is-modal .pictrueList_pic {
  764. width: 100px;
  765. margin-right: 10px !important;
  766. img {
  767. width: 100%;
  768. height: 100px;
  769. }
  770. }
  771. .pictrueList_pic {
  772. position: relative;
  773. width: 146px;
  774. cursor: pointer;
  775. margin-right: 19px !important;
  776. img {
  777. width: 146px;
  778. height: 146px;
  779. object-fit: cover;
  780. }
  781. p {
  782. overflow: hidden;
  783. text-overflow: ellipsis;
  784. white-space: nowrap;
  785. height: 20px;
  786. font-size: 12px;
  787. color: #515a6d;
  788. text-align: center;
  789. }
  790. .number {
  791. height: 33px;
  792. }
  793. .number {
  794. position: absolute;
  795. right: 0;
  796. top: 0;
  797. }
  798. }
  799. .Nav {
  800. width: 100%;
  801. border-right: 1px solid #eee;
  802. min-width: 220px;
  803. max-width: 220px;
  804. }
  805. .trees-coadd {
  806. width: 100%;
  807. border-radius: 4px;
  808. overflow: hidden;
  809. position: relative;
  810. .scollhide {
  811. overflow-x: hidden;
  812. overflow-y: scroll;
  813. padding: 0px 0 10px 0;
  814. box-sizing: border-box;
  815. .tree {
  816. min-height: 374px;
  817. /deep/ .file-name {
  818. display: flex;
  819. align-items: center;
  820. .icon {
  821. width: 12px;
  822. height: 12px;
  823. margin-right: 8px;
  824. }
  825. }
  826. /deep/ .el-tree-node {
  827. margin-right: 16px;
  828. }
  829. /deep/ .el-tree-node__children .el-tree-node {
  830. margin-right: 0;
  831. }
  832. /deep/ .el-tree-node__content {
  833. width: 100%;
  834. height: 36px;
  835. }
  836. /deep/ .custom-tree-node {
  837. flex: 1;
  838. display: flex;
  839. align-items: center;
  840. justify-content: space-between;
  841. padding-right: 17px;
  842. font-size: 13px;
  843. font-weight: 400;
  844. color: rgba(0, 0, 0, 0.6);
  845. line-height: 13px;
  846. }
  847. /deep/ .is-current {
  848. background: #f1f9ff !important;
  849. color: #1890ff !important;
  850. }
  851. /deep/ .is-current .custom-tree-node {
  852. color: #1890ff !important;
  853. }
  854. }
  855. }
  856. .scollhide::-webkit-scrollbar {
  857. display: none;
  858. }
  859. }
  860. .treeSel >>> .ivu-select-dropdown-list {
  861. padding: 0 5px !important;
  862. box-sizing: border-box;
  863. width: 200px;
  864. }
  865. .imagesNo {
  866. display: flex;
  867. justify-content: center;
  868. flex-direction: column;
  869. align-items: center;
  870. margin: 65px 0;
  871. .imagesNo_sp {
  872. font-size: 13px;
  873. color: #dbdbdb;
  874. line-height: 3;
  875. }
  876. }
  877. .Modal {
  878. width: 100%;
  879. height: 100%;
  880. background: #fff !important;
  881. }
  882. .fill-window {
  883. height: 100vh;
  884. }
  885. .colLeft {
  886. padding-right: 0 !important;
  887. height: 100%;
  888. display: flex;
  889. flex-wrap: nowrap;
  890. }
  891. .conter {
  892. width: 100%;
  893. height: 100%;
  894. margin-left: 20px !important;
  895. }
  896. .conter .bnt {
  897. width: 100%;
  898. padding: 0 13px 20px 0px;
  899. box-sizing: border-box;
  900. }
  901. .conter .pictrueList {
  902. // width: 100%;
  903. overflow-x: hidden;
  904. overflow-y: auto;
  905. // height: 300px;
  906. }
  907. .right-col {
  908. // flex: 1;
  909. }
  910. .conter .pictrueList img {
  911. width: 100%;
  912. }
  913. .conter .pictrueList img.on {
  914. border: 2px solid #5fb878;
  915. }
  916. .conter .footer {
  917. padding: 0 20px 10px 20px;
  918. }
  919. .tabBox_img {
  920. display: flex;
  921. align-items: center;
  922. }
  923. .real-name {
  924. flex: 1;
  925. }
  926. .df-aic {
  927. display: flex;
  928. align-items: center;
  929. }
  930. .demo-badge {
  931. width: 42px;
  932. height: 42px;
  933. background: transparent;
  934. border-radius: 6px;
  935. display: inline-block;
  936. }
  937. .bnt /deep/ .ivu-tree-children {
  938. padding: 5px 0;
  939. }
  940. .card-tree {
  941. background: #fff;
  942. height: 72px;
  943. box-sizing: border-box;
  944. overflow-x: scroll; /* 设置溢出滚动 */
  945. white-space: nowrap;
  946. overflow-y: hidden;
  947. /* 隐藏滚动条 */
  948. border-radius: 4px;
  949. scrollbar-width: none; /* firefox */
  950. -ms-overflow-style: none; /* IE 10+ */
  951. }
  952. .card-tree::-webkit-scrollbar {
  953. display: none; /* Chrome Safari */
  954. }
  955. .tabs {
  956. background: #fff;
  957. padding-top: 10px;
  958. border-radius: 5px 5px 0 0;
  959. }
  960. .operate-item {
  961. display: flex;
  962. align-items: center;
  963. justify-content: center;
  964. }
  965. .operate-height {
  966. height: 16px;
  967. }
  968. .operate {
  969. color: #1890ff;
  970. font-size: 12px;
  971. white-space: nowrap;
  972. }
  973. </style>