materialList.vue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224
  1. <style>
  2. #material-card .ant-tabs-tab {
  3. border: 1px solid gainsboro !important;
  4. }
  5. #material-card .ant-tabs-top-bar {
  6. position: relative;
  7. z-index: 100;
  8. }
  9. #material-card .ant-badge-count {
  10. top: -10px;
  11. }
  12. .detail .ant-form-item {
  13. margin-bottom: 10px !important;
  14. }
  15. .add-image-material .draggable-list {
  16. display: block !important;
  17. }
  18. </style>
  19. <style lang="scss" scoped>
  20. @media (min-width: 1024px) {
  21. .home-item {
  22. border-style: solid;
  23. border-width: 1px;
  24. border-color: #e4e4e4;
  25. width: calc(50% - 10px);
  26. padding: 10px;
  27. margin-right: 10px;
  28. margin-bottom: 10px;
  29. display: flex;
  30. align-items: center;
  31. background: #fff;
  32. position: relative;
  33. z-index: 99;
  34. }
  35. } /*>=1024的设备*/
  36. // @media (min-width: 1100px) {
  37. // .checkbox_item_container {
  38. // width:70%
  39. // }
  40. // } /*>=1100的设备*/
  41. @media (min-width: 1280px) {
  42. .home-item {
  43. border-style: solid;
  44. border-width: 1px;
  45. border-color: #e4e4e4;
  46. width: calc(25% - 10px);
  47. padding: 10px;
  48. margin-right: 10px;
  49. margin-bottom: 10px;
  50. display: flex;
  51. align-items: center;
  52. background: #fff;
  53. position: relative;
  54. z-index: 99;
  55. }
  56. }
  57. /*>=1280的设备*/
  58. // @media (min-width: 1366px) {
  59. // }
  60. // @media (min-width: 1440px) {
  61. // }
  62. // @media (min-width: 1680px) {
  63. // }
  64. @media (min-width: 1920px) {
  65. .home-item {
  66. border-style: solid;
  67. border-width: 1px;
  68. border-color: #e4e4e4;
  69. width: calc(25% - 10px);
  70. padding: 10px;
  71. margin-right: 10px;
  72. margin-bottom: 10px;
  73. display: flex;
  74. align-items: center;
  75. background: #fff;
  76. position: relative;
  77. z-index: 99;
  78. cursor: pointer;
  79. }
  80. }
  81. .actor-photo-list {
  82. display: flex;
  83. padding-left: 0;
  84. li {
  85. width: 25%;
  86. margin: 10px;
  87. position: relative;
  88. height: 250px;
  89. border: 1px solid #f2f2f2;
  90. img,
  91. video {
  92. width: 100%;
  93. margin-top: auto;
  94. margin-bottom: auto;
  95. top: 0;
  96. bottom: 0;
  97. position: absolute;
  98. max-height: 250px;
  99. }
  100. }
  101. }
  102. .home-card {
  103. width: 100%;
  104. overflow: hidden;
  105. padding: 10px 0px;
  106. display: flex;
  107. flex-wrap: wrap;
  108. margin-right: -10px;
  109. .home-right {
  110. width: 100%;
  111. }
  112. .bg:after {
  113. content: '';
  114. width: 110%;
  115. height: 110%;
  116. position: absolute;
  117. left: -5%;
  118. top: -5%;
  119. background: inherit;
  120. filter: blur(10px);
  121. z-index: 2;
  122. }
  123. }
  124. .bh {
  125. height: 60px;
  126. line-height: 30px;
  127. overflow: hidden;
  128. text-overflow: ellipsis;
  129. -webkit-line-clamp: 2;
  130. display: -webkit-box;
  131. -webkit-box-orient: vertical;
  132. }
  133. a {
  134. font-size: 14px;
  135. }
  136. </style>
  137. <template>
  138. <a-card :bordered="false">
  139. <!-- 查询区域 -->
  140. <div class="table-page-search-wrapper">
  141. <a-form layout="inline">
  142. <a-row :gutter="24">
  143. <a-col :md="6" :sm="8">
  144. <a-form-item label="项目名称">
  145. <a-select
  146. placeholder="请输入项目名称"
  147. showSearch
  148. optionFilterProp="children"
  149. :filterOption="filterOption"
  150. v-model="queryParam.projectId"
  151. @change="getList"
  152. >
  153. <a-select-option :value="item.projectId" v-for="item of dataElse" :key="item.id">
  154. {{ item.projectName }}
  155. </a-select-option>
  156. </a-select>
  157. </a-form-item>
  158. </a-col>
  159. <!-- <a-col :md="6" :sm="8">
  160. <a-form-item label="剪辑">
  161. <a-input placeholder="请输入剪辑者名称" v-model="queryParam.advertiserId"></a-input>
  162. </a-form-item>
  163. </a-col>
  164. <a-col :md="6" :sm="8">
  165. <a-form-item label="编导">
  166. <a-input placeholder="请输入编导" v-model="queryParam.responsible"></a-input>
  167. </a-form-item>
  168. </a-col>
  169. <a-col :md="6" :sm="8">
  170. <a-form-item label="拍摄">
  171. <a-input placeholder="请输入拍摄" v-model="queryParam.responsible"></a-input>
  172. </a-form-item>
  173. </a-col> -->
  174. <a-col :md="6" :sm="8">
  175. <a-form-item label="时间选择">
  176. <a-date-picker v-model="queryParam.createTime" format="YYYY-MM-DD" style="width:100%" />
  177. </a-form-item>
  178. </a-col>
  179. <a-col :md="6" :sm="8">
  180. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  181. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  182. <a-button type="primary" @click="searchRe" icon="reload" style="margin-left: 8px">重置</a-button>
  183. </span>
  184. </a-col>
  185. </a-row>
  186. </a-form>
  187. </div>
  188. <!-- table区域-begin -->
  189. <!-- <div> -->
  190. <div class="table-operator" style="position:relative;z-index:100">
  191. <a-button @click="visible = true" type="primary" icon="plus">新增</a-button>
  192. <a-button @click="onCheckAllChange" v-if="queryParam.projectId && active == '1'">{{
  193. checkAll ? '取消 ( ' + checkArr.length + ' )' : '全选'
  194. }}</a-button>
  195. <a-button v-if="queryParam.projectId && active == '1'" :disabled="checkArr.length == 0" @click="tongbu"
  196. >一键下载</a-button
  197. >
  198. <a-button
  199. v-if="
  200. queryParam.projectId &&
  201. active == '1' &&
  202. (role.roleCode == 'operator' ||
  203. role.roleCode == 'kuaishouOperationManager' ||
  204. role.roleCode == 'admin' ||
  205. role.roleCode == 'operationAssistant' ||
  206. role.roleCode == 'touTiaoOperationManager')
  207. "
  208. :disabled="checkArr.length == 0"
  209. @click="tongbuImage"
  210. >一键同步</a-button
  211. >
  212. </div>
  213. <a-tabs @change="callbackTwo" v-model="active" id="material-card" type="card">
  214. <a-tab-pane :tab="item.tab" v-for="item of examinelList" :key="item.value">
  215. <div v-if="dataSource.length > 0">
  216. <a-checkbox-group @change="onChangeCheck" v-model="checkArr" class="home-card">
  217. <div class="home-item" v-for="(items, index) in dataSource" :key="index" @click="showDetail(items)">
  218. <div class="home-right">
  219. <a-badge
  220. :count="checkArr.indexOf(items.url) > -1 ? checkArr.indexOf(items.url) + 1 : 0"
  221. :numberStyle="{ backgroundColor: '#52c41a' }"
  222. style="width:100%"
  223. >
  224. <span
  225. style="color: #999; fontSize: 16px;padding-bottom:10px;display:block;width:100%;overflow: hidden;text-overflow: ellipsis;"
  226. >
  227. {{ items.materialName }}
  228. </span>
  229. </a-badge>
  230. <div style="display:flex;justify-content:center;width:100%;height:200px;position:relative">
  231. <div
  232. class="home-num bg"
  233. v-if="activeKey == 'image'"
  234. :style="{
  235. backgroundImage: 'url(' + items.url + ')',
  236. backgroundSize: 'cover',
  237. backgroundRepeat: 'no-repeat',
  238. backgroundPosition: 'center center',
  239. overflow: 'hidden',
  240. position: 'relative',
  241. width: '100%',
  242. height: '100%'
  243. }"
  244. ></div>
  245. <img
  246. v-if="activeKey == 'image'"
  247. :src="items.url"
  248. style="height:200px;max-width:100%;position:absolute;z-index:10;"
  249. />
  250. </div>
  251. <div v-if="active == '2'" class="bh">驳回原因:{{ items.refuseReason }}</div>
  252. <span style="color: black; fontSize: 16px;padding-top:10px;display:block;width:100%" @click.stop>
  253. {{ items.createTime | getDate }}
  254. <a
  255. href="javascript:;"
  256. style="margin-left:20px"
  257. @click="edit(items, '2')"
  258. v-show="active == '2'"
  259. v-if="items.userId == userInfo().id"
  260. >
  261. 修改</a
  262. >
  263. <a-popconfirm
  264. @confirm="okEditShow(items, '2')"
  265. v-show="active != '2'"
  266. v-if="
  267. role.roleCode == 'operator' ||
  268. role.roleCode == 'kuaishouOperationManager' ||
  269. role.roleCode == 'admin' ||
  270. role.roleCode == 'touTiaoOperationManager'
  271. "
  272. >
  273. <div slot="title">
  274. <div>
  275. 驳回原因:
  276. <a-textarea
  277. placeholder="请输入原因"
  278. v-model="refuseReason"
  279. :autosize="{ minRows: 3, maxRows: 10 }"
  280. />
  281. </div>
  282. <div>
  283. 截图:
  284. <upload-to-ali
  285. v-model="refuseFile"
  286. :customDomain="customDomain"
  287. multiple
  288. preview
  289. :region="region"
  290. :bucket="bucket"
  291. :accept="acceptImage"
  292. :max="10"
  293. :size="1024000"
  294. :accessKeyId="accessKeyId"
  295. :accessKeySecret="accessKeySecret"
  296. :dir="dirImg"
  297. ></upload-to-ali>
  298. </div>
  299. </div>
  300. <a href="javascript:;" style="margin-left:20px">驳回</a>
  301. </a-popconfirm>
  302. <a-popconfirm
  303. @confirm="okEditShow(items, '1')"
  304. v-show="active != '1'"
  305. v-if="
  306. role.roleCode == 'operator' ||
  307. role.roleCode == 'kuaishouOperationManager' ||
  308. role.roleCode == 'admin' ||
  309. role.roleCode == 'touTiaoOperationManager'
  310. "
  311. >
  312. <div slot="title">
  313. <div>
  314. 广告语:
  315. <a-textarea
  316. placeholder="请输入"
  317. v-model="refuseReason"
  318. :autosize="{ minRows: 3, maxRows: 10 }"
  319. />
  320. </div>
  321. </div>
  322. <a
  323. href="javascript:;"
  324. style="margin-left:20px"
  325. v-show="active != '1'"
  326. v-if="
  327. role.roleCode == 'operator' ||
  328. role.roleCode == 'kuaishouOperationManager' ||
  329. role.roleCode == 'admin' ||
  330. role.roleCode == 'touTiaoOperationManager'
  331. "
  332. >
  333. 通过审核</a
  334. >
  335. </a-popconfirm>
  336. <a-checkbox :value="items.url" v-show="active == '1'" style="float:right"></a-checkbox
  337. ></span>
  338. </div>
  339. </div>
  340. </a-checkbox-group>
  341. <a-pagination
  342. size="small"
  343. :showTotal="ipagination.showTotal"
  344. style="float:right"
  345. v-if="dataSource.length > 0"
  346. showQuickJumper
  347. :pageSize.sync="ipagination.pageSize"
  348. :total="ipagination.total"
  349. v-model="ipagination.current"
  350. @change="getDataSource"
  351. />
  352. </div>
  353. <div v-else style="width:100%;height:400px;display:flex;justify-content: center;align-items: center;">
  354. <img
  355. src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575627350102&di=02972956f2243933bffc0d85099adbfe&imgtype=jpg&src=http%3A%2F%2Fimg0.imgtn.bdimg.com%2Fit%2Fu%3D1095310825%2C1528244349%26fm%3D214%26gp%3D0.jpg"
  356. alt=""
  357. />
  358. </div>
  359. </a-tab-pane>
  360. </a-tabs>
  361. <a-modal title="添加素材" v-model="visible" @ok="handleOk" @cancel="close" :maskClosable="false">
  362. <a-form :form="form">
  363. <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="项目选择">
  364. <a-select
  365. v-decorator="[
  366. 'projectId', // 给表单赋值或拉取表单时,该input对应的key
  367. { rules: [{ required: true, message: '请选择项目!' }] }
  368. ]"
  369. @change="getProjectId"
  370. >
  371. <a-select-option :value="item.projectId" v-for="item of dataElse" :key="item.id">
  372. {{ item.projectName }}
  373. </a-select-option>
  374. </a-select>
  375. </a-form-item>
  376. <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="图片素材上传" class="add-image-material">
  377. <upload-to-ali
  378. style="width:160%"
  379. v-model="urlList.url"
  380. :customDomain="customDomain"
  381. :multiple="add"
  382. preview
  383. :region="region"
  384. :bucket="bucket"
  385. :accept="activeKey == 'image' ? acceptImage : acceptVideo"
  386. :max="10"
  387. :size="1024000"
  388. :accessKeyId="accessKeyId"
  389. :accessKeySecret="accessKeySecret"
  390. :before-upload="file"
  391. :dir="activeKey == 'image' ? dirImg : dirVideo"
  392. @loaded="overUpload"
  393. ></upload-to-ali>
  394. </a-form-item>
  395. <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" :label="role.roleName">
  396. <span>{{ userInfo().realname }}</span>
  397. </a-form-item>
  398. <a-form-item
  399. :label-col="labelCol"
  400. :wrapper-col="{
  401. xs: { span: 24 },
  402. sm: { span: 18 }
  403. }"
  404. label="标签"
  405. >
  406. <template v-for="(tag, index) in tags">
  407. <a-tooltip v-if="tag.length > 20" :key="tag" :title="tag">
  408. <a-tag :key="tag" :closable="index !== 0" :afterClose="() => handleClose(tag)">
  409. {{ `${tag.slice(0, 20)}...` }}
  410. </a-tag>
  411. </a-tooltip>
  412. <a-tag v-else :key="tag" :closable="true" :afterClose="() => handleClose(tag)">
  413. {{ tag }}
  414. </a-tag>
  415. </template>
  416. <a-input
  417. v-if="inputVisible"
  418. ref="input"
  419. type="text"
  420. size="small"
  421. :style="{ width: '78px' }"
  422. :value="inputValue"
  423. @change="handleInputChange"
  424. @blur="handleInputConfirm"
  425. @keyup.enter="handleInputConfirm"
  426. />
  427. <a-tag v-else @click="showInput" style="background: #fff; borderStyle: dashed;">
  428. <a-icon type="plus" /> New Tag
  429. </a-tag>
  430. </a-form-item>
  431. <a-form-item
  432. :label-col="labelCol"
  433. :wrapper-col="{
  434. xs: { span: 24 },
  435. sm: { span: 18 }
  436. }"
  437. label="描述"
  438. >
  439. <a-textarea
  440. placeholder="请输入描述"
  441. v-decorator="[
  442. 'materialDescribe' // 给表单赋值或拉取表单时,该input对应的key
  443. ]"
  444. :autosize="{ minRows: 3, maxRows: 10 }"
  445. />
  446. </a-form-item>
  447. </a-form>
  448. </a-modal>
  449. <a-modal title="素材详情" v-model="visibleDetail" width="70%">
  450. <div style="display:flex;height:700px">
  451. <div
  452. style="width:50%;padding:10px;box-sizing:border-box;display:flex;justify-content:center;border-right:1px solid #f2f2f2"
  453. >
  454. <img :src="showUrl" alt="" v-if="activeKey == 'image'" style="height:100%" />
  455. </div>
  456. <div style="flex:3;padding:10px;box-sizing:border-box;">
  457. <a-form v-if="detail" class="detail">
  458. <div v-if="detail.parameter">
  459. <a-form-item
  460. label="尺寸"
  461. :label-col="{ span: 6 }"
  462. :wrapper-col="{ span: 18 }"
  463. v-if="detail.parameter.width"
  464. >
  465. {{ detail.parameter.width }}*{{ detail.parameter.height }}
  466. </a-form-item>
  467. <a-form-item
  468. label="大小"
  469. :label-col="{ span: 6 }"
  470. :wrapper-col="{ span: 18 }"
  471. v-if="detail.parameter.size"
  472. >
  473. {{ detail.parameter.size }}
  474. </a-form-item>
  475. </div>
  476. <div v-if="detail.ascription">
  477. <a-form-item
  478. label="剪辑"
  479. :label-col="{ span: 6 }"
  480. :wrapper-col="{ span: 18 }"
  481. v-if="detail.ascription.clipName"
  482. >
  483. {{ detail.ascription.clipName }}
  484. </a-form-item>
  485. <a-form-item
  486. label="平面"
  487. :label-col="{ span: 6 }"
  488. :wrapper-col="{ span: 18 }"
  489. v-if="detail.ascription.planeName"
  490. >
  491. {{ detail.ascription.planeName }}
  492. </a-form-item>
  493. </div>
  494. <a-form-item label="标签" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }" v-if="detail.tag">
  495. <a-tag v-for="(item, index) of detail.tag" :key="index">{{ item }}</a-tag>
  496. </a-form-item>
  497. <a-form-item label="水印素材下载" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }" v-if="showUrlWater">
  498. <a-button type="primary" @click="downloadByBlob">下载</a-button>
  499. </a-form-item>
  500. <a-form-item label="审核人" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }" v-if="active == '2'">
  501. {{ detail.auditorName }}
  502. </a-form-item>
  503. <a-form-item label="广告语" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }" v-if="active == '1'">
  504. {{ creativeCopywriter ? creativeCopywriter : '无广告语' }}
  505. </a-form-item>
  506. <a-form-item label="驳回原因" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }" v-if="active == '2'">
  507. {{ refuseReason ? refuseReason : '无原因' }}
  508. </a-form-item>
  509. <a-form-item label="截图" :label-col="{ span: 6 }" :wrapper-col="{ span: 18 }" v-if="active == '2'">
  510. <upload-to-ali
  511. v-if="refuseFile"
  512. disabled
  513. v-model="refuseFile"
  514. :customDomain="customDomain"
  515. multiple
  516. preview
  517. :region="region"
  518. :bucket="bucket"
  519. :accept="acceptImage"
  520. :max="10"
  521. :size="1024000"
  522. :accessKeyId="accessKeyId"
  523. :accessKeySecret="accessKeySecret"
  524. :dir="dirImg"
  525. ></upload-to-ali>
  526. <div v-else>无截图</div>
  527. </a-form-item>
  528. <a-form-item
  529. label="审核"
  530. :label-col="{ span: 6 }"
  531. :wrapper-col="{ span: 18 }"
  532. v-if="
  533. active != '2' &&
  534. (role.roleCode == 'operator' ||
  535. role.roleCode == 'kuaishouOperationManager' ||
  536. role.roleCode == 'admin' ||
  537. role.roleCode == 'touTiaoOperationManager')
  538. "
  539. >
  540. <a-button type="primary" @click="edit(null, '0', '1')" v-if="active == '0'" style="margin-right:10px"
  541. >通过审核</a-button
  542. >
  543. <a-popconfirm @confirm="okEdit">
  544. <div slot="title">
  545. <div>
  546. 驳回原因:
  547. <a-textarea
  548. placeholder="请输入原因"
  549. v-model="refuseReason"
  550. :autosize="{ minRows: 3, maxRows: 10 }"
  551. />
  552. </div>
  553. <div>
  554. 截图:
  555. <upload-to-ali
  556. v-model="refuseFile"
  557. :customDomain="customDomain"
  558. multiple
  559. preview
  560. :region="region"
  561. :bucket="bucket"
  562. :accept="acceptImage"
  563. :max="10"
  564. :size="1024000"
  565. :accessKeyId="accessKeyId"
  566. :accessKeySecret="accessKeySecret"
  567. :dir="dirImg"
  568. ></upload-to-ali>
  569. </div>
  570. </div>
  571. <a-button type="primary">驳回</a-button>
  572. <!-- @click="edit(null, '0', '2')" -->
  573. </a-popconfirm>
  574. </a-form-item>
  575. </a-form>
  576. </div>
  577. </div>
  578. </a-modal>
  579. <account-check ref="check" @synchro="implement"></account-check>
  580. </a-card>
  581. </template>
  582. <script>
  583. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  584. import JEllipsis from '@/components/jeecg/JEllipsis'
  585. import UploadToAli from '@femessage/upload-to-ali'
  586. import { fileCheck, fileInsert, fileEdit } from '@/api/actor'
  587. import { getAction, postAction, postFile, downFile, downFilePost } from '@/api/manage'
  588. import { mapGetters } from 'vuex'
  589. import moment from 'moment'
  590. import BMF from 'browser-md5-file'
  591. import accountCheck from './accountCheck'
  592. export default {
  593. name: 'YardList',
  594. mixins: [JeecgListMixin],
  595. components: {
  596. JEllipsis,
  597. UploadToAli,
  598. accountCheck
  599. },
  600. data() {
  601. return {
  602. inputVisible: false,
  603. inputValue: '',
  604. labelCol: {
  605. xs: { span: 24 },
  606. sm: { span: 5 }
  607. },
  608. wrapperCol: {
  609. xs: { span: 24 },
  610. sm: { span: 12 }
  611. },
  612. noImgUrl: require('@/assets/img/noImg.png'),
  613. queryParam: {},
  614. dataElse: [],
  615. ascription: {
  616. clipId: [], //剪辑人id
  617. shotId: [], //拍摄人id
  618. planId: [], //策划id
  619. planeId: [] //平面id
  620. },
  621. show: true,
  622. visible: false,
  623. visibleDetail: false,
  624. activeKey: 'image',
  625. active: '0',
  626. examinelList: [
  627. { value: '0', tab: '未审核' },
  628. { value: '1', tab: '已批准' },
  629. { value: '2', tab: '已驳回' }
  630. ],
  631. // 表头
  632. columns: [],
  633. urlList: { url: [], md5: [], name: [] },
  634. imageArr: [],
  635. watermarkUrl: { url: '', md5: '', name: '' },
  636. url: {
  637. list: '/ctop/materialInfo/list'
  638. },
  639. detail: false,
  640. form: this.$form.createForm(this),
  641. tags: [],
  642. refuseFile: [],
  643. refuseReason: '',
  644. creativeCopywriter: '',
  645. customDomain: '',
  646. region: 'oss-cn-beijing',
  647. bucket: 'ctop-media',
  648. acceptVideo: 'video/mpeg,video/mp4',
  649. acceptImage: 'image/jpeg,image/jpg,image/png',
  650. accessKeyId: 'LTAIbNbqWzSOklQV',
  651. accessKeySecret: '1rkPz7JNoXk8sJevPaeYHWqfkQXBGh',
  652. checkArr: [],
  653. checkAll: false,
  654. showUrl: '',
  655. showUrlWater: '',
  656. materialDescribe: '',
  657. name: '',
  658. detail: null,
  659. add: true,
  660. id: '',
  661. role: { roleCode: '', roleName: '' },
  662. key: '0',
  663. mediaId: null,
  664. repeat: false,
  665. noList: []
  666. }
  667. },
  668. filters: {
  669. getDate(value) {
  670. let date = new Date(value)
  671. let y = date.getFullYear()
  672. let MM = date.getMonth() + 1
  673. MM = MM < 10 ? '0' + MM : MM
  674. let d = date.getDate()
  675. d = d < 10 ? '0' + d : d
  676. return y + '-' + MM + '-' + d
  677. }
  678. },
  679. computed: {
  680. dirImg() {
  681. let date = new Date()
  682. let y = date.getFullYear()
  683. let MM = date.getMonth() + 1
  684. MM = MM < 10 ? '0' + MM : MM
  685. let d = date.getDate()
  686. d = d < 10 ? '0' + d : d
  687. return 'image/' + y + '-' + MM + '-' + d + '/'
  688. },
  689. dirVideo() {
  690. let date = new Date()
  691. let y = date.getFullYear()
  692. let MM = date.getMonth() + 1
  693. MM = MM < 10 ? '0' + MM : MM
  694. let d = date.getDate()
  695. d = d < 10 ? '0' + d : d
  696. return 'video/' + y + '-' + MM + '-' + d + '/'
  697. }
  698. },
  699. created() {
  700. this.queryParam.type = 'IMAGE'
  701. this.queryParam.userId = this.userInfo().id
  702. this.queryParam.status = localStorage.getItem('key') ? localStorage.getItem('key') : '0'
  703. this.active = localStorage.getItem('key') ? localStorage.getItem('key') : '0'
  704. // this.queryParam.status = key
  705. this.ipagination.pageSize = 8
  706. this.getParticipateList()
  707. // /sys/user/getRoleInfo
  708. getAction('/sys/user/getRoleInfo', { userId: this.userInfo().id }).then(res => {
  709. this.role = res
  710. })
  711. },
  712. watch: {
  713. $route: function(n, o) {
  714. if (n.path == '/modules/material/materialList') {
  715. this.queryParam.userId = this.userInfo().id
  716. this.queryParam.status = localStorage.getItem('key') ? localStorage.getItem('key') : '0'
  717. this.active = localStorage.getItem('key') ? localStorage.getItem('key') : '0'
  718. this.loadData()
  719. }
  720. }
  721. },
  722. methods: {
  723. moment,
  724. filterOption(input, option) {
  725. return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  726. },
  727. a(item) {
  728. item.showVideo = true
  729. },
  730. tongbuImage() {
  731. this.$refs.check.getData('/ctop/userAllocation/getAccountList', {
  732. userId: this.userInfo().id,
  733. projectId: this.queryParam.projectId
  734. })
  735. },
  736. tongbu() {
  737. if (this.checkArr.length > 1) {
  738. downFilePost('/download/zip', { urls: this.checkArr }).then(res => {
  739. let blob = new Blob([res], {
  740. type: 'application/zip'
  741. })
  742. let downloadElement = document.createElement('a')
  743. let href = window.URL.createObjectURL(blob) //创建下载的链接
  744. downloadElement.href = href
  745. downloadElement.download = '批量下载' //下载后文件名
  746. document.body.appendChild(downloadElement)
  747. downloadElement.click() //点击下载
  748. document.body.removeChild(downloadElement) //下载完成移除元素
  749. window.URL.revokeObjectURL(href) //释放掉blob对象
  750. })
  751. } else {
  752. let image = new Image()
  753. image.setAttribute('crossOrigin', 'anonymous')
  754. image.src = this.checkArr[0]
  755. image.onload = () => {
  756. let canvas = document.createElement('canvas')
  757. canvas.width = image.width
  758. canvas.height = image.height
  759. let ctx = canvas.getContext('2d')
  760. ctx.drawImage(image, 0, 0, image.width, image.height)
  761. canvas.toBlob(blob => {
  762. let url = URL.createObjectURL(blob)
  763. let eleLink = document.createElement('a')
  764. eleLink.download = '封面下载'
  765. eleLink.href = url
  766. eleLink.click()
  767. eleLink.remove()
  768. // 用完释放URL对象
  769. URL.revokeObjectURL(url)
  770. })
  771. }
  772. }
  773. // for (var i = 0; i < this.checkArr.length; i++) {
  774. // let image = new Image()
  775. // image.setAttribute('crossOrigin', 'anonymous')
  776. // image.src = this.checkArr[i]
  777. // image.onload = () => {
  778. // let canvas = document.createElement('canvas')
  779. // canvas.width = image.width
  780. // canvas.height = image.height
  781. // let ctx = canvas.getContext('2d')
  782. // ctx.drawImage(image, 0, 0, image.width, image.height)
  783. // canvas.toBlob(blob => {
  784. // let url = URL.createObjectURL(blob)
  785. // let eleLink = document.createElement('a')
  786. // eleLink.download = '封面下载'
  787. // eleLink.href = url
  788. // eleLink.click()
  789. // eleLink.remove()
  790. // // 用完释放URL对象
  791. // URL.revokeObjectURL(url)
  792. // })
  793. // }
  794. // }
  795. },
  796. implement(data) {
  797. var params = {}
  798. var dataJson = []
  799. for (let i = 0; i < this.dataSource.length; i++) {
  800. for (let j = 0; j < this.checkArr.length; j++) {
  801. if (this.dataSource[i].url == this.checkArr[j]) {
  802. dataJson.push(this.dataSource[i].id)
  803. }
  804. }
  805. }
  806. params.mediaId = this.mediaId
  807. params.materialArray = JSON.stringify(dataJson)
  808. params.accountArray = JSON.stringify(data)
  809. postAction('/ctop/materialUpload/uploadAccount', params).then(res => {
  810. if (res.code == 0) {
  811. this.checkArr = []
  812. this.checkAll = false
  813. }
  814. })
  815. // /ctop/materialUpload/uploadAccount
  816. },
  817. downloadByBlob() {
  818. if (this.activeKey == 'image') {
  819. let image = new Image()
  820. image.setAttribute('crossOrigin', 'anonymous')
  821. image.src = this.showUrlWater
  822. image.onload = () => {
  823. let canvas = document.createElement('canvas')
  824. canvas.width = image.width
  825. canvas.height = image.height
  826. let ctx = canvas.getContext('2d')
  827. ctx.drawImage(image, 0, 0, image.width, image.height)
  828. canvas.toBlob(blob => {
  829. let url = URL.createObjectURL(blob)
  830. this.download(url, this.name)
  831. // 用完释放URL对象
  832. URL.revokeObjectURL(url)
  833. })
  834. }
  835. } else {
  836. fetch(this.showUrlWater)
  837. .then(res => res.blob())
  838. .then(blob => {
  839. const a = document.createElement('a')
  840. document.body.appendChild(a)
  841. a.style.display = 'none'
  842. // 使用获取到的blob对象创建的url
  843. const url = window.URL.createObjectURL(blob)
  844. a.href = url
  845. // 指定下载的文件名
  846. a.download = this.name
  847. a.click()
  848. document.body.removeChild(a)
  849. // 移除blob对象的url
  850. window.URL.revokeObjectURL(url)
  851. })
  852. }
  853. },
  854. download(href, name) {
  855. let eleLink = document.createElement('a')
  856. eleLink.download = name
  857. eleLink.href = href
  858. eleLink.click()
  859. eleLink.remove()
  860. },
  861. ...mapGetters(['nickname', 'avatar', 'userInfo']),
  862. onCheckAllChange() {
  863. if (this.checkAll) {
  864. this.checkArr = []
  865. } else {
  866. var data = this.dataSource.map(item => {
  867. return item.url
  868. })
  869. this.checkArr.push(...data)
  870. }
  871. this.checkAll = !this.checkAll
  872. },
  873. searchRe() {
  874. this.queryParam.projectId = ''
  875. this.queryParam.createTime = ''
  876. this.loadData()
  877. },
  878. getList(value) {
  879. this.mediaId = this.dataElse.filter(item => {
  880. if (value == item.projectId) {
  881. return item
  882. }
  883. })[0].mediaId
  884. this.loadData()
  885. },
  886. onChangeCheck(checkedList) {
  887. if (checkedList.length == 0) {
  888. this.checkAll = false
  889. }
  890. },
  891. handleClose(removedTag) {
  892. const tags = this.tags.filter(tag => tag !== removedTag)
  893. this.tags = tags
  894. },
  895. showInput() {
  896. this.inputVisible = true
  897. this.$nextTick(function() {
  898. this.$refs.input.focus()
  899. })
  900. },
  901. handleInputChange(e) {
  902. this.inputValue = e.target.value
  903. },
  904. handleInputConfirm() {
  905. const inputValue = this.inputValue
  906. let tags = this.tags
  907. if (inputValue && tags.indexOf(inputValue) === -1) {
  908. tags = [...tags, inputValue]
  909. }
  910. Object.assign(this, {
  911. tags,
  912. inputVisible: false,
  913. inputValue: ''
  914. })
  915. },
  916. showDetail(item) {
  917. this.visibleDetail = true
  918. this.showUrl = item.url
  919. this.showUrlWater = item.watermarkUrl ? item.watermarkUrl : null
  920. this.name = item.watermarkMaterialName ? item.watermarkMaterialName : null
  921. this.id = item.id
  922. if (this.active == '2') {
  923. this.refuseReason = item.refuseReason
  924. this.refuseFile = item.refuseFile ? JSON.parse(item.refuseFile) : null
  925. } else if (this.active == '1') {
  926. this.creativeCopywriter = item.creativeCopywriter
  927. this.refuseReason = ''
  928. this.refuseFile = []
  929. } else {
  930. this.refuseReason = ''
  931. this.refuseFile = []
  932. }
  933. getAction('/ctop/materialInfo/getDetail', { materialId: item.id }).then(res => {
  934. this.detail = res
  935. })
  936. },
  937. okEditShow(item, editStatus) {
  938. if (editStatus == '2') {
  939. var params = {}
  940. params.id = item.id
  941. params.auditorId = this.userInfo().id
  942. params.refuseReason = this.refuseReason
  943. var data = this.refuseFile.map(item => {
  944. return 'https:' + item
  945. })
  946. params.refuseFile = JSON.stringify(data)
  947. params.status = editStatus
  948. fileEdit(params).then(res => {
  949. this.refuseFile = []
  950. this.refuseReason = ''
  951. this.loadData()
  952. })
  953. } else if (editStatus == '1') {
  954. var params = {}
  955. params.id = item.id
  956. params.auditorId = this.userInfo().id
  957. params.creativeCopywriter = this.refuseReason
  958. params.status = editStatus
  959. fileEdit(params).then(res => {
  960. this.refuseReason = ''
  961. this.loadData()
  962. })
  963. }
  964. },
  965. okEdit(e) {
  966. this.edit(null, this.active, '2')
  967. },
  968. edit(item, status, editStatus) {
  969. if (status == '0' || status == '1') {
  970. if (editStatus == '2') {
  971. var params = {}
  972. params.id = this.id
  973. params.auditorId = this.userInfo().id
  974. params.refuseReason = this.refuseReason
  975. var data = this.refuseFile.map(item => {
  976. return 'https:' + item
  977. })
  978. params.refuseFile = JSON.stringify(data)
  979. params.status = editStatus
  980. fileEdit(params).then(res => {
  981. this.refuseFile = []
  982. this.refuseReason = ''
  983. this.loadData()
  984. this.visibleDetail = false
  985. })
  986. } else {
  987. fileEdit({ id: this.id, status: editStatus, auditorId: this.userInfo().id }).then(res => {
  988. this.refuseFile = []
  989. this.refuseReason = ''
  990. this.loadData()
  991. this.visibleDetail = false
  992. })
  993. }
  994. } else {
  995. this.add = false
  996. this.visible = true
  997. this.getProjectId(item.projectId)
  998. getAction('/ctop/materialInfo/getDetail', { materialId: item.id }).then(res => {
  999. if (this.activeKey == 'image') {
  1000. this.form.setFieldsValue({
  1001. projectId: item.projectId,
  1002. clipId: res.ascription.clipId,
  1003. planeId: res.ascription.planeId,
  1004. materialDescribe: item.materialDescribe
  1005. })
  1006. } else {
  1007. this.form.setFieldsValue({
  1008. projectId: item.projectId,
  1009. clipId: res.ascription.clipId,
  1010. planId: res.ascription.planId,
  1011. shotId: res.ascription.shotId,
  1012. materialDescribe: item.materialDescribe
  1013. })
  1014. }
  1015. this.tags = res.tag
  1016. this.urlList.url = item.url
  1017. this.urlList.md5 = item.code
  1018. this.urlList.name = item.materialName
  1019. this.watermarkUrl.url = item.watermarkUrl
  1020. this.watermarkUrl.md5 = item.watermarkCode
  1021. this.watermarkUrl.name = item.watermarkMaterialName
  1022. this.id = item.id
  1023. })
  1024. }
  1025. },
  1026. handleOk() {
  1027. this.form.validateFieldsAndScroll((err, values) => {
  1028. if (err) {
  1029. // 这里做逻辑处理
  1030. } else {
  1031. var params = {}
  1032. var roleCode = {}
  1033. for (const key in this.role) {
  1034. if (key == 'roleCode') {
  1035. this.role[key] = this.role[key] + 'Id'
  1036. roleCode[this.role[key]] = this.userInfo().id
  1037. }
  1038. }
  1039. params.id = this.add ? null : this.id
  1040. // params.code = this.urlList.md5
  1041. params.url = this.add ? null : this.urlList.url[0]
  1042. // params.materialName = this.urlList.name
  1043. params.imageArr = this.add ? this.urlList.url : null
  1044. // params.watermarkCode = this.watermarkUrl.md5
  1045. // params.watermarkUrl = this.watermarkUrl.url
  1046. // params.watermarkMaterialName = this.watermarkUrl.name
  1047. params.userId = this.userInfo().id
  1048. params.projectId = values.projectId
  1049. params.materialDescribe = values.materialDescribe
  1050. params.type = 'IMAGE'
  1051. params.ascription =
  1052. this.activeKey == 'image'
  1053. ? roleCode
  1054. : { planId: values.planId, shotId: values.shotId, clipId: values.clipId }
  1055. params.tag = this.tags
  1056. if (this.add) {
  1057. fileInsert(params).then(res => {
  1058. this.form.resetFields()
  1059. this.urlList = { url: '', md5: '', name: '' }
  1060. this.watermarkUrl = { url: '', md5: '', name: '' }
  1061. this.tags = []
  1062. this.loadData()
  1063. this.visible = false
  1064. this.add = true
  1065. for (const key in this.role) {
  1066. if (key == 'roleCode') {
  1067. this.role[key] = this.role[key].substr(0, this.role[key].length - 2)
  1068. }
  1069. }
  1070. this.$message.success('素材上传成功')
  1071. })
  1072. } else {
  1073. fileEdit({ ...params, status: '0' }).then(res => {
  1074. this.form.resetFields()
  1075. this.urlList = { url: [], md5: '', name: '' }
  1076. this.watermarkUrl = { url: '', md5: '', name: '' }
  1077. this.tags = []
  1078. this.loadData()
  1079. this.visible = false
  1080. this.add = true
  1081. for (const key in this.role) {
  1082. if (key == 'roleCode') {
  1083. this.role[key] = this.role[key].substr(0, this.role[key].length - 2)
  1084. }
  1085. }
  1086. this.$message.success('素材修改成功')
  1087. })
  1088. }
  1089. }
  1090. })
  1091. },
  1092. close() {
  1093. // this.form.resetFields()
  1094. // this.urlList = { url: '', md5: '', name: '' }
  1095. // this.watermarkUrl = { url: '', md5: '', name: '' }
  1096. // this.tags = []
  1097. },
  1098. onChange(date, dateString) {},
  1099. callbackTwo(key) {
  1100. this.checkAll = false
  1101. this.checkArr = []
  1102. if (this.form.getFieldValue('projectId')) {
  1103. this.form.setFieldsValue({ projectId: '' })
  1104. }
  1105. this.queryParam.status = key
  1106. this.loadData()
  1107. },
  1108. overUpload(urlAll) {
  1109. console.log(urlAll, this.urlList)
  1110. var index = this.urlList.url.findIndex(item => item === urlAll[0])
  1111. var data = { url: urlAll[0], code: this.urlList.md5[index], name: this.urlList.name[index] }
  1112. this.imageArr.push(data)
  1113. console.log(this.imageArr)
  1114. },
  1115. file(file) {
  1116. console.log(file)
  1117. var bmf = new BMF()
  1118. var that = this
  1119. return new Promise(function(resolve, reject) {
  1120. for (let i = 0; i < file.length; i++) {
  1121. bmf.md5(file[i], (err, md5) => {
  1122. // that.urlList.name.push(file[0].name)
  1123. // that.urlList.md5.push(md5)
  1124. fileCheck({ code: md5 }).then(res => {
  1125. if (res.code == 0) {
  1126. that.$message.error('此素材已经上传')
  1127. reject()
  1128. } else {
  1129. resolve()
  1130. // reject()
  1131. }
  1132. })
  1133. })
  1134. }
  1135. })
  1136. },
  1137. fileWater(file) {
  1138. var bmf = new BMF()
  1139. var that = this
  1140. return new Promise(function(resolve, reject) {
  1141. bmf.md5(file[0], (err, md5) => {
  1142. that.watermarkUrl.name = file[0].name
  1143. that.watermarkUrl.md5 = md5
  1144. fileCheck({ code: md5 }).then(res => {
  1145. if (res.code == 0) {
  1146. that.$message.error('此素材已经上传')
  1147. reject()
  1148. } else {
  1149. resolve()
  1150. }
  1151. })
  1152. })
  1153. })
  1154. },
  1155. getParticipateList() {
  1156. getAction('/ctop/projectMember/participateList', { userId: this.userInfo().id }).then(res => {
  1157. if (res.code == 0) {
  1158. this.dataElse = res.result
  1159. }
  1160. })
  1161. },
  1162. getProjectId(items) {
  1163. getAction('/ctop/projectMember/getMemberList', { projectId: items }).then(res => {
  1164. if (res.code == 0) {
  1165. this.ascription.clipId = res.result.filter(item => {
  1166. if (item.roleCode == 'clip') {
  1167. return { userId: item.userId, userName: item.userName }
  1168. }
  1169. })
  1170. this.ascription.shotId = res.result.filter(item => {
  1171. if (item.roleCode == 'shot') {
  1172. return { userId: item.userId, userName: item.userName }
  1173. }
  1174. })
  1175. this.ascription.planId = res.result.filter(item => {
  1176. if (item.roleCode == 'plan') {
  1177. return { userId: item.userId, userName: item.userName }
  1178. }
  1179. })
  1180. this.ascription.planeId = res.result.filter(item => {
  1181. if (item.roleCode == 'plane') {
  1182. return { userId: item.userId, userName: item.userName }
  1183. }
  1184. })
  1185. }
  1186. })
  1187. },
  1188. getDataSource(page, pageSize) {
  1189. this.ipagination.current = page
  1190. // this.checkArr = []
  1191. this.checkAll = false
  1192. this.loadData()
  1193. }
  1194. }
  1195. }
  1196. </script>
  1197. <style scoped>
  1198. @import '~@assets/less/common.less';
  1199. </style>