index.vue 26 KB

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