materialList.vue 37 KB

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