targetedPopulation.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232
  1. <style>
  2. #table_time_selected1 tr {
  3. border: 1px solid rgb(102, 162, 243);
  4. }
  5. .plug-timer-grid th {
  6. line-height: 25px;
  7. }
  8. .module-form .ant-form-item-required::before {
  9. display: inline-block;
  10. margin-right: 4px;
  11. color: #f5222d;
  12. font-size: 14px;
  13. font-family: SimSun, sans-serif;
  14. line-height: 1;
  15. content: '';
  16. }
  17. .else-label .ant-form-item-label label::after {
  18. content: '';
  19. position: relative;
  20. top: -0.5px;
  21. margin: 0 8px 0 2px;
  22. }
  23. </style>
  24. <style scoped>
  25. ul {
  26. padding-left: 0;
  27. }
  28. li {
  29. list-style: none;
  30. }
  31. li:hover {
  32. background: #f2f2f2;
  33. }
  34. </style>
  35. <template>
  36. <a-form :form="formAll" class="module-form" @submit="handleSubmit">
  37. <a-form-item
  38. label="自定义人群"
  39. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  40. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  41. >
  42. <a-radio-group buttonStyle="solid" v-model="people" @change="getPeople">
  43. <a-radio-button value="2">不限</a-radio-button>
  44. <a-radio-button value="3">定向人群</a-radio-button>
  45. <!-- <a-radio-button value="4">付费人群</a-radio-button> -->
  46. </a-radio-group>
  47. </a-form-item>
  48. <a-form-item
  49. v-if="people == '3'"
  50. label="定向逻辑"
  51. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  52. :wrapperCol="{ lg: { span: 17 }, sm: { span: 17 } }"
  53. >
  54. <a-radio-group buttonStyle="solid" v-model="targeted" @change="radioChange">
  55. <a-radio-button value="2">定向</a-radio-button>
  56. <a-radio-button value="3">排除</a-radio-button>
  57. <a-radio-button value="4">同时定向排除</a-radio-button>
  58. </a-radio-group>
  59. <div
  60. :style="{
  61. border: targeted == '4' ? '1px solid #f2f2f2' : '0',
  62. padding: targeted == '4' ? '20px' : '0'
  63. }"
  64. >
  65. <div style="display:flex;margin-top:15px" v-if="targeted == '4' || targeted == '2'">
  66. <span style="white-space:nowrap;width:10%" v-if="targeted == '4'">定向池:</span>
  67. <a-input
  68. placeholder="请至少选择一个自定义人群"
  69. @focus="
  70. topMiddle = true
  71. topMiddleNo = false
  72. "
  73. v-model="keyValue"
  74. />
  75. </div>
  76. <div
  77. style="background:white;padding:10px;box-shadow: 0 2px 8px 0 rgba(0,0,0,.15);"
  78. :style="{ width: targeted == '4' ? '90%' : '100%', marginLeft: targeted == '4' ? '10%' : '0' }"
  79. v-show="topMiddle"
  80. >
  81. <a-table
  82. :columns="columns"
  83. :dataSource="dataList"
  84. bordered
  85. :pagination="false"
  86. :scroll="{ y: 300 ,x:true }"
  87. :rowSelection="{
  88. selectedRowKeys: selectedRowKeys,
  89. onChange: onSelectChange,
  90. getCheckboxProps: getCheckboxProps
  91. }"
  92. >
  93. <span slot="orientationName" slot-scope="text, record">{{ text }}({{ record.orientationId }})</span>
  94. <span slot="populationType" slot-scope="text">{{ text | population_type }}</span>
  95. <span slot="putTime" slot-scope="text">{{ text | getDate }}</span>
  96. </a-table>
  97. <div style="text-align:right">
  98. <a-button style="margin-right:5px" @click="topMiddle = false">取消</a-button>
  99. <a-button type="primary" @click="okSelect">确定</a-button>
  100. </div>
  101. </div>
  102. <div style="display:flex;margin-top:15px" v-if="targeted == '4' || targeted == '3'">
  103. <span style="white-space:nowrap;width:10%" v-if="targeted == '4'">排除池:</span>
  104. <a-input
  105. placeholder="请至少选择一个自定义人群"
  106. @focus="
  107. topMiddleNo = true
  108. topMiddle = false
  109. "
  110. v-model="keyValueNo"
  111. />
  112. </div>
  113. <div
  114. style="background:white;padding:10px;box-shadow: 0 2px 8px 0 rgba(0,0,0,.15);"
  115. :style="{ width: targeted == '4' ? '90%' : '100%', marginLeft: targeted == '4' ? '10%' : '0' }"
  116. v-show="topMiddleNo"
  117. >
  118. <a-table
  119. :columns="columns"
  120. :dataSource="dataList"
  121. bordered
  122. :pagination="false"
  123. :scroll="{ y: 300 ,x:true}"
  124. :rowSelection="{
  125. selectedRowKeys: selectedRowKeysNo,
  126. onChange: onSelectChangeNo,
  127. getCheckboxProps: getCheckboxPropsNo
  128. }"
  129. >
  130. <span slot="orientationName" slot-scope="text, record">{{ text }}({{ record.orientationId }})</span>
  131. <span slot="populationType" slot-scope="text">{{ text | population_type }}</span>
  132. <span slot="putTime" slot-scope="text">{{ text | getDate }}</span>
  133. </a-table>
  134. <div style="text-align:right">
  135. <a-button style="margin-right:5px" @click="topMiddleNo = false">取消</a-button>
  136. <a-button type="primary" @click="okSelectNo">确定</a-button>
  137. </div>
  138. </div>
  139. </div>
  140. </a-form-item>
  141. <a-form-item
  142. label="地区"
  143. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  144. :wrapperCol="{ lg: { span: 17 }, sm: { span: 17 } }"
  145. >
  146. <a-radio-group @change="regionChange" v-model="allForm.regionType" buttonStyle="solid">
  147. <a-radio-button value="noLimit">不限</a-radio-button>
  148. <a-radio-button value="limit">指定地区</a-radio-button>
  149. </a-radio-group>
  150. <div v-if="allForm.regionType == 'limit'" style="margin-top:10px">
  151. <select-region :checkData.sync="allForm.region" :dataValue="allForm.region" />
  152. </div>
  153. </a-form-item>
  154. <a-form-item
  155. label="年龄"
  156. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  157. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  158. >
  159. <a-radio-group v-model="allForm.ageType" buttonStyle="solid">
  160. <a-radio-button value="noLimit">不限</a-radio-button>
  161. <a-radio-button value="ageLimit">限定年龄段</a-radio-button>
  162. <a-radio-button value="ageCustom">自定义年龄段</a-radio-button>
  163. </a-radio-group>
  164. <div v-if="allForm.ageType == 'ageLimit'">
  165. <a-checkbox-group v-decorator="['agesRange', { rules: [{ required: true, message: '请选择年龄段' }] }]">
  166. <!-- <a-checkbox :value="0">0-11岁</a-checkbox>
  167. <a-checkbox :value="12">12-17岁</a-checkbox> -->
  168. <a-checkbox :value="18">18-23岁</a-checkbox>
  169. <a-checkbox :value="24">24-30岁</a-checkbox>
  170. <a-checkbox :value="31">31-40岁</a-checkbox>
  171. <a-checkbox :value="41">41-49岁</a-checkbox>
  172. <a-checkbox :value="50">50+</a-checkbox>
  173. </a-checkbox-group>
  174. </div>
  175. <div v-if="allForm.ageType == 'ageCustom'">
  176. <a-slider
  177. range
  178. :marks="marks"
  179. :min="5"
  180. :max="55"
  181. v-decorator="[
  182. 'age',
  183. {
  184. rules: [{ required: true, message: '请选择年龄段' }, { validator: handleConfirmValue }],
  185. initialValue: [10, 50]
  186. }
  187. ]"
  188. />
  189. </div>
  190. </a-form-item>
  191. <a-form-item
  192. label="性别"
  193. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  194. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  195. >
  196. <a-radio-group
  197. buttonStyle="solid"
  198. v-decorator="[
  199. 'gender',
  200. {
  201. initialValue: 0
  202. }
  203. ]"
  204. >
  205. <a-radio-button :value="0">不限</a-radio-button>
  206. <a-radio-button :value="1">女性</a-radio-button>
  207. <a-radio-button :value="2">男性</a-radio-button>
  208. </a-radio-group>
  209. </a-form-item>
  210. <a-form-item
  211. label="最低版本"
  212. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  213. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  214. >
  215. <a-radio-group buttonStyle="solid" v-model="allForm.platform_os">
  216. <a-radio-button :value="0" v-if="getApp == '0'">不限</a-radio-button>
  217. <a-radio-button :value="1" v-if="getApp == '0' || getApp == '1'">Android系统</a-radio-button>
  218. <a-radio-button :value="2" v-if="getApp == '0' || getApp == '2'">IOS系统</a-radio-button>
  219. </a-radio-group>
  220. </a-form-item>
  221. <a-form-item
  222. label=" "
  223. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  224. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  225. v-if="allForm.platform_os == 1"
  226. class="else-label"
  227. >
  228. <a-radio-group
  229. v-decorator="[
  230. 'androidOsv',
  231. {
  232. initialValue: 3
  233. }
  234. ]"
  235. >
  236. <a-radio :value="3">不限</a-radio>
  237. <a-radio :value="4">4X+</a-radio>
  238. <a-radio :value="5">5x+</a-radio>
  239. <a-radio :value="6">6x+</a-radio>
  240. <a-radio :value="7">7x+</a-radio>
  241. </a-radio-group>
  242. </a-form-item>
  243. <a-form-item
  244. label=" "
  245. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  246. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  247. v-if="allForm.platform_os == 2"
  248. class="else-label"
  249. >
  250. <a-radio-group
  251. v-decorator="[
  252. 'iosOsv',
  253. {
  254. initialValue: 6
  255. }
  256. ]"
  257. >
  258. <a-radio :value="6">不限</a-radio>
  259. <a-radio :value="7">7X+</a-radio>
  260. <a-radio :value="8">8x+</a-radio>
  261. <a-radio :value="9">9x+</a-radio>
  262. <a-radio :value="10">10x+</a-radio>
  263. </a-radio-group>
  264. </a-form-item>
  265. <a-form-item
  266. v-if="allForm.platform_os != 2"
  267. label="设备品牌"
  268. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  269. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  270. >
  271. <a-radio-group buttonStyle="solid" v-model="allForm.device">
  272. <a-radio-button value="0">不限</a-radio-button>
  273. <a-radio-button value="1">选择品牌</a-radio-button>
  274. </a-radio-group>
  275. <div v-if="allForm.device == '1'" style="width:120%">
  276. <a-checkbox-group
  277. v-decorator="['deviceBrand', { rules: [{ required: true, message: '请选择设备品牌' }] }]"
  278. style="width:120%"
  279. >
  280. <a-checkbox :value="1">OPPO</a-checkbox>
  281. <a-checkbox :value="2">VIVO</a-checkbox>
  282. <a-checkbox :value="3">华为</a-checkbox>
  283. <a-checkbox :value="4">小米</a-checkbox>
  284. <a-checkbox :value="5">荣耀</a-checkbox>
  285. <a-checkbox :value="6">三星</a-checkbox>
  286. <a-checkbox :value="7">金立</a-checkbox>
  287. <a-checkbox :value="8">魅族</a-checkbox>
  288. <a-checkbox :value="9">乐视</a-checkbox>
  289. <a-checkbox :value="10">其他</a-checkbox>
  290. <a-checkbox :value="11" v-if="allForm.platform_os == 0">苹果</a-checkbox>
  291. </a-checkbox-group>
  292. </div>
  293. </a-form-item>
  294. <a-form-item
  295. label="设备价格"
  296. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  297. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  298. >
  299. <a-radio-group buttonStyle="solid" v-model="allForm.price">
  300. <a-radio-button value="0">不限</a-radio-button>
  301. <a-radio-button value="1">选择价格</a-radio-button>
  302. </a-radio-group>
  303. <div v-if="allForm.price == '1'" style="width:120%">
  304. <a-checkbox-group
  305. v-decorator="['devicePrice', { rules: [{ required: true, message: '请选择设备价格' }] }]"
  306. style="width:120%"
  307. >
  308. <a-checkbox :value="1">1500以下</a-checkbox>
  309. <a-checkbox :value="2">1501~2000</a-checkbox>
  310. <a-checkbox :value="3">2001~2500</a-checkbox>
  311. <a-checkbox :value="4">2501~3000</a-checkbox>
  312. <a-checkbox :value="5">3001~3500</a-checkbox>
  313. <a-checkbox :value="6">3501~4000</a-checkbox>
  314. <a-checkbox :value="7">4001~4500</a-checkbox>
  315. <a-checkbox :value="8">4501~5000</a-checkbox>
  316. <a-checkbox :value="9">5001~5500</a-checkbox>
  317. <a-checkbox :value="10">5500以上</a-checkbox>
  318. </a-checkbox-group>
  319. </div>
  320. </a-form-item>
  321. <a-form-item
  322. label="APP行为"
  323. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  324. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  325. v-if="allForm.platform_os == 1"
  326. >
  327. <a-radio-group buttonStyle="solid" v-model="allForm.appType" @change="getAppType">
  328. <a-radio-button value="0">不限</a-radio-button>
  329. <a-radio-button value="1">按分类</a-radio-button>
  330. <a-radio-button value="2">按APP名称</a-radio-button>
  331. </a-radio-group>
  332. </a-form-item>
  333. <a-form-item
  334. label=" "
  335. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  336. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  337. v-if="allForm.platform_os == 1 && allForm.appType == '1'"
  338. class="else-label"
  339. >
  340. <a-select
  341. mode="multiple"
  342. style="width: 100%"
  343. optionFilterProp="children"
  344. showSearch
  345. :filterOption="filterOption"
  346. v-decorator="['appInterest', { rules: [{ required: true, message: '请选择APP行为' }] }]"
  347. >
  348. <a-select-option v-for="item in optionsAppActive" :key="item.tagId" :value="item.tagId">{{
  349. item.tagName
  350. }}</a-select-option>
  351. </a-select>
  352. </a-form-item>
  353. <a-form-item
  354. label=" "
  355. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  356. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  357. v-if="allForm.platform_os == 1 && allForm.appType == '2'"
  358. class="else-label"
  359. >
  360. <div style="position:relative;" v-clickoutside="handleClose">
  361. <a-input
  362. placeholder="请输入搜索内容"
  363. @change="getAppAll"
  364. @focus="getAppAll"
  365. style="width:100%;position:relative;"
  366. />
  367. <div
  368. style="width:100%;position:absolute;z-index:10;height:200px;background:white;overflow:auto;box-shadow: 0 2px 8px 0 rgba(0,0,0,.15);"
  369. v-if="closeDialog"
  370. >
  371. <ul>
  372. <li style="padding:0 10px">
  373. <a-checkbox
  374. style="float:left;margin:0 5px"
  375. @change="onCheckAllChange"
  376. :indeterminate="indeterminate"
  377. :checked="checkAll"
  378. ></a-checkbox
  379. >全选
  380. </li>
  381. <a-checkbox-group @change="onChange" v-model="checkArr" class="home-card" style="width:100%">
  382. <li style="padding:0 10px;width:100%;" v-for="item of optionsApp" :key="item.appId">
  383. <a-checkbox :value="item.appId" style="float:left;margin:0 5px"></a-checkbox>{{ item.appName }}
  384. </li>
  385. </a-checkbox-group>
  386. </ul>
  387. </div>
  388. <div style="width:100%" v-if="checkArr.length > 0">
  389. <a-button @click="clearAll">清空</a-button>
  390. <br />
  391. <a-tag v-for="item of checkArr" :key="item" closable :afterClose="() => log(item)">
  392. {{ showAppName(item) }}
  393. </a-tag>
  394. </div>
  395. </div>
  396. </a-form-item>
  397. <a-form-item
  398. label="商业兴趣"
  399. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  400. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  401. >
  402. <a-radio-group buttonStyle="solid" @change="businessInterest" v-model="allForm.businessInterestType">
  403. <a-radio-button :value="0">不限</a-radio-button>
  404. <a-radio-button :value="2">兴趣标签</a-radio-button>
  405. </a-radio-group>
  406. </a-form-item>
  407. <a-form-item
  408. label=" "
  409. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  410. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  411. class="else-label"
  412. v-if="allForm.businessInterestType == 2"
  413. >
  414. <a-select
  415. mode="multiple"
  416. style="width: 100%"
  417. optionFilterProp="children"
  418. showSearch
  419. :filterOption="filterOption"
  420. v-decorator="['businessInterest', { rules: [{ required: true, message: '请选择商业兴趣' }] }]"
  421. >
  422. <a-select-option v-for="item in businessOptions" :key="item.tagId" :value="item.tagId">{{
  423. item.tagName
  424. }}</a-select-option>
  425. </a-select>
  426. </a-form-item>
  427. <a-form-item
  428. label="网络环境"
  429. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  430. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  431. >
  432. <a-radio-group
  433. buttonStyle="solid"
  434. v-decorator="[
  435. 'network',
  436. {
  437. initialValue: 0
  438. }
  439. ]"
  440. >
  441. <a-radio-button :value="0">不限</a-radio-button>
  442. <a-radio-button :value="1">Wi-Fi</a-radio-button>
  443. <a-radio-button :value="2">移动网络</a-radio-button>
  444. </a-radio-group>
  445. </a-form-item>
  446. <a-form-item
  447. label="网红粉丝"
  448. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  449. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  450. >
  451. <a-radio-group buttonStyle="solid" v-model="allForm.fansStar" @change="fansStar">
  452. <a-radio-button value="0">不限</a-radio-button>
  453. <a-radio-button value="1">网红类别</a-radio-button>
  454. </a-radio-group>
  455. </a-form-item>
  456. <a-form-item
  457. label=" "
  458. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  459. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  460. class="else-label"
  461. v-if="allForm.fansStar == '1'"
  462. >
  463. <a-select
  464. mode="multiple"
  465. style="width: 100%"
  466. optionFilterProp="children"
  467. showSearch
  468. :filterOption="filterOption"
  469. v-decorator="['fansStar', { rules: [{ required: true, message: '请选择网红类别' }] }]"
  470. >
  471. <a-select-option v-for="item in fansStarOptions" :key="item.tagId" :value="item.tagId">{{
  472. item.tagName
  473. }}</a-select-option>
  474. </a-select>
  475. </a-form-item>
  476. <a-form-item
  477. label="兴趣视频用户"
  478. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  479. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  480. >
  481. <a-radio-group buttonStyle="solid" v-model="allForm.interestVideo" @change="interestVideo">
  482. <a-radio-button value="0">不限</a-radio-button>
  483. <a-radio-button value="1">视频标签</a-radio-button>
  484. </a-radio-group>
  485. </a-form-item>
  486. <a-form-item
  487. label=" "
  488. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  489. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  490. class="else-label"
  491. v-if="allForm.interestVideo == '1'"
  492. >
  493. <a-select
  494. mode="multiple"
  495. style="width: 100%"
  496. optionFilterProp="children"
  497. showSearch
  498. showArrow
  499. :filterOption="filterOption"
  500. v-decorator="['interestVideo', { rules: [{ required: true, message: '请选择视频标签' }] }]"
  501. >
  502. <a-select-option v-for="item in interestVideoOptions" :key="item.tagId" :value="item.tagId">{{
  503. item.tagName
  504. }}</a-select-option>
  505. </a-select>
  506. </a-form-item>
  507. <a-form-item
  508. label="智能扩量"
  509. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  510. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  511. >
  512. <!-- v-decorator="[
  513. 'isOpen',
  514. {
  515. initialValue: '0'
  516. }
  517. ]" -->
  518. <a-radio-group buttonStyle="solid" v-model="allForm.isOpen">
  519. <a-radio-button :value="0">关闭</a-radio-button>
  520. <a-radio-button :value="1">开启</a-radio-button>
  521. </a-radio-group>
  522. </a-form-item>
  523. <a-form-item
  524. label=" "
  525. :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
  526. :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
  527. class="else-label"
  528. v-if="allForm.isOpen == 1"
  529. >
  530. <a-checkbox :disabled="allForm.ageType == 'noLimit'" :checked="allForm.noAgeBreak" @change="getAge"
  531. >不可突破年龄</a-checkbox
  532. >
  533. <a-checkbox :disabled="getData('gender') == '0'" :checked="allForm.noGenderBreak" @change="getGender"
  534. >不可突破性别</a-checkbox
  535. >
  536. <a-checkbox :disabled="allForm.regionType != 'limit'||allForm.region.length==0" :checked="allForm.noAreaBreak" @change="getArea"
  537. >不可突破地域</a-checkbox
  538. >
  539. </a-form-item>
  540. </a-form>
  541. </template>
  542. <script>
  543. import { getAction, postAction } from '@/api/manage'
  544. import moment from 'moment'
  545. import { mapGetters } from 'vuex'
  546. import jq from 'jquery'
  547. import selectRegion from './selectRegion'
  548. import pick from 'lodash.pick'
  549. let dateQuantumRangeConst = ''
  550. const clickoutside = {
  551. // 初始化指令
  552. bind(el, binding, vnode) {
  553. function documentHandler(e) {
  554. // 这里判断点击的元素是否是本身,是本身,则返回
  555. if (el.contains(e.target)) {
  556. return false
  557. }
  558. // 判断指令中是否绑定了函数
  559. if (binding.expression) {
  560. // 如果绑定了函数 则调用那个函数,此处binding.value就是handleClose方法
  561. binding.value(e)
  562. }
  563. }
  564. // 给当前元素绑定个私有变量,方便在unbind中可以解除事件监听
  565. el.__vueClickOutside__ = documentHandler
  566. document.addEventListener('click', documentHandler)
  567. },
  568. update() {},
  569. unbind(el, binding) {
  570. // 解除事件监听
  571. document.removeEventListener('click', el.__vueClickOutside__)
  572. delete el.__vueClickOutside__
  573. }
  574. }
  575. const columns = [
  576. {
  577. title: '人群',
  578. dataIndex: 'orientationName',
  579. scopedSlots: { customRender: 'orientationName' },
  580. width: 150
  581. },
  582. {
  583. title: '属性',
  584. dataIndex: 'populationType',
  585. filters: [
  586. { text: '上传人群', value: '1' },
  587. { text: '广告人群', value: '2' },
  588. { text: '主题专区', value: '3' },
  589. { text: '逻辑规则', value: '4' },
  590. { text: '人群扩展', value: '5' },
  591. { text: '平台定制', value: '6' },
  592. { text: '定制付费', value: '7' },
  593. { text: '网红粉丝类别', value: '8' },
  594. { text: '内容付费行为', value: '9' },
  595. { text: '移动应用安装', value: '10' },
  596. { text: '快手使用活跃度', value: '11' },
  597. { text: '行业分类', value: '12' },
  598. { text: '商业兴趣', value: '13' },
  599. { text: '固化标签', value: '14' },
  600. { text: '行业偏好', value: '15' },
  601. { text: '第三方标签', value: '16' },
  602. { text: '产品关键词', value: '17' }
  603. ],
  604. onFilter: (value, record) =>
  605. record.populationType
  606. .toString()
  607. .toLowerCase()
  608. .includes(value.toLowerCase()),
  609. scopedSlots: { customRender: 'populationType' },
  610. width: 150
  611. },
  612. {
  613. title: '创建时间',
  614. dataIndex: 'putTime',
  615. scopedSlots: { customRender: 'putTime' },
  616. sorter: (a, b) => a.putTime - b.putTime
  617. }
  618. ]
  619. export default {
  620. name: 'BaseForm',
  621. components: { selectRegion },
  622. props: {
  623. campaignId: {
  624. type: String,
  625. default() {
  626. return null
  627. }
  628. },
  629. platform: {
  630. default() {
  631. return null
  632. }
  633. },
  634. populationData: {}
  635. },
  636. filters: {
  637. getDate(value) {
  638. let date = new Date(value)
  639. let y = date.getFullYear()
  640. let MM = date.getMonth() + 1
  641. MM = MM < 10 ? '0' + MM : MM
  642. let d = date.getDate()
  643. d = d < 10 ? '0' + d : d
  644. return y + '-' + MM + '-' + d
  645. },
  646. platform(str) {
  647. var data = {
  648. 1: 'Android应用下载',
  649. 2: 'Android网页游戏',
  650. 3: 'iOS应用下载',
  651. 4: 'iOS网页游戏'
  652. }
  653. return data[str]
  654. },
  655. population_type(str) {
  656. var data = {
  657. 1: '上传人群',
  658. 2: '广告人群',
  659. 3: '主题专区',
  660. 4: '逻辑规则',
  661. 5: '人群扩展',
  662. 6: '平台定制',
  663. 7: '定制付费',
  664. 8: '网红粉丝类别',
  665. 9: '内容付费行为',
  666. 10: '移动应用安装',
  667. 11: '快手使用活跃度',
  668. 12: '行业分类',
  669. 13: '商业兴趣',
  670. 14: '固化标签',
  671. 15: '行业偏好',
  672. 16: '第三方标签',
  673. 17: '产品关键词'
  674. }
  675. return data[str]
  676. }
  677. },
  678. watch: {
  679. platform(n, o) {
  680. if (n == 1 || n == 2) {
  681. // platform_os
  682. this.allForm.platform_os = 1
  683. // this.form.setFieldsValue({ platform_os: '1' })
  684. } else if (n == 3 || n == 4) {
  685. this.allForm.platform_os = 2
  686. // this.form.setFieldsValue({ platform_os: '2' })
  687. } else {
  688. this.allForm.platform_os = 0
  689. // this.form.setFieldsValue({ platform_os: '0' })
  690. }
  691. },
  692. populationData: {
  693. immediate: true, // immediate选项可以开启首次赋值监听
  694. handler(n, oldVal) {
  695. if (n.allForm) {
  696. this.allForm = n.allForm
  697. this.allForm.noAgeBreak = n.noAgeBreak == '0' ? false : true
  698. this.allForm.noGenderBreak = n.noGenderBreak == '0' ? false : true
  699. this.allForm.noAreaBreak = n.noAreaBreak == '0' ? false : true
  700. this.selectedRowKeys = n.population ? n.population : []
  701. this.selectedRowKeysNo = n.excludePopulation ? n.excludePopulation : []
  702. this.targeted = n.excludePopulation ? (n.population ? '4' : '3') : '2'
  703. this.people = n.excludePopulation ? '3' : n.population ? '3' : '2'
  704. this.getPeople().then(res => {
  705. if (n.excludePopulation) {
  706. this.keyValueNo = ''
  707. this.selectedRowKeysValueNo = []
  708. for (let i = 0; i < res.length; i++) {
  709. for (let j = 0; j < n.excludePopulation.length; j++) {
  710. if (res[i].orientationId == n.excludePopulation[j]) {
  711. this.keyValueNo += res[i].orientationName + ' '
  712. this.selectedRowKeysValueNo.push({
  713. orientationId: res[i].orientationId,
  714. orientationName: res[i].orientationName
  715. })
  716. this.selectedRowKeysNo.push()
  717. }
  718. }
  719. }
  720. }
  721. if (n.population) {
  722. this.keyValue = ''
  723. this.selectedRowKeysValue = []
  724. for (let i = 0; i < res.length; i++) {
  725. for (let j = 0; j < n.population.length; j++) {
  726. if (res[i].orientationId == n.population[j]) {
  727. this.keyValue += res[i].orientationName + ' '
  728. this.selectedRowKeysValue.push({
  729. orientationId: res[i].orientationId,
  730. orientationName: res[i].orientationName
  731. })
  732. }
  733. }
  734. }
  735. }
  736. })
  737. this.$nextTick(() => {
  738. this.formAll.setFieldsValue(
  739. pick(n, [
  740. 'fansStar',
  741. 'interestVideo',
  742. 'appInterest',
  743. 'gender',
  744. 'network',
  745. 'agesRange',
  746. 'age',
  747. 'androidOsv',
  748. 'iosOsv',
  749. 'deviceBrand',
  750. 'devicePrice',
  751. 'businessInterest'
  752. ])
  753. )
  754. })
  755. } else {
  756. this.formAll.resetFields()
  757. this.selectedRowKeys = []
  758. this.selectedRowKeysNo = []
  759. this.selectedRowKeysValueNo = []
  760. this.selectedRowKeysValue = []
  761. this.targeted = '2'
  762. this.people = '2'
  763. this.allForm = {
  764. regionType: 'noLimit',
  765. region: [],
  766. ageType: 'noLimit',
  767. age: [],
  768. device: '0',
  769. price: '0',
  770. appType: '0',
  771. fansStar: '0',
  772. interestVideo: '0',
  773. platform_os: 0,
  774. businessInterestType: 0,
  775. isOpen: 0,
  776. noAgeBreak: false,
  777. noGenderBreak: false,
  778. noAreaBreak: false
  779. }
  780. }
  781. }
  782. }
  783. },
  784. directives: { clickoutside },
  785. data() {
  786. return {
  787. formAll: this.$form.createForm(this),
  788. marks: {
  789. 5: '5岁',
  790. 10: '10岁',
  791. 15: '15岁',
  792. 20: '20岁',
  793. 25: '25岁',
  794. 30: '30岁',
  795. 35: '35岁',
  796. 40: '40岁',
  797. 45: '45岁',
  798. 50: '50岁',
  799. 55: '55岁'
  800. },
  801. step: 0,
  802. loading: false,
  803. checkArr: [],
  804. checkAll: false,
  805. allForm: {
  806. regionType: 'noLimit',
  807. region: [],
  808. ageType: 'noLimit',
  809. age: [],
  810. device: '0',
  811. price: '0',
  812. appType: '0',
  813. fansStar: '0',
  814. interestVideo: '0',
  815. platform_os: 0,
  816. businessInterestType: 0,
  817. isOpen: 0,
  818. noAgeBreak: false,
  819. noGenderBreak: false,
  820. noAreaBreak: false,
  821. people: '2',
  822. targeted: '2',
  823. topMiddle: false,
  824. topMiddleNo: false,
  825. keyValue: '',
  826. keyValueNo: ''
  827. },
  828. options: [],
  829. optionsAll: [],
  830. optionProps: {
  831. value: 'regionId',
  832. label: 'name',
  833. children: 'children',
  834. multiple: true,
  835. emitPath: false
  836. // checkStrictly: true
  837. },
  838. optionsApp: [],
  839. optionsAppActive: [],
  840. checkOptions: [],
  841. businessOptions: [],
  842. fansStarOptions: [],
  843. interestVideoOptions: [],
  844. optionPropsApp: {
  845. value: 'tagId',
  846. label: 'tagName',
  847. children: 'children',
  848. multiple: true,
  849. emitPath: false
  850. },
  851. getApp: '0',
  852. closeDialog: false,
  853. indeterminate: false,
  854. checkAll: false,
  855. people: '2',
  856. targeted: '2',
  857. topMiddle: false,
  858. topMiddleNo: false,
  859. keyValue: '',
  860. keyValueNo: '',
  861. columns,
  862. selectedRowKeys: [],
  863. selectedRowKeysValue: [],
  864. selectedRowKeysNo: [],
  865. selectedRowKeysValueNo: [],
  866. dataList: []
  867. }
  868. },
  869. computed: {},
  870. methods: {
  871. getPeople() {
  872. return new Promise((resolve, reject) => {
  873. getAction('/kuaishou/batch/getPopulationList', { accountId: localStorage.getItem('accountId') }).then(res => {
  874. if (res.success) {
  875. if (res.result) {
  876. this.dataList = res.result.map((item, index) => {
  877. return {
  878. ...item,
  879. key: index
  880. }
  881. })
  882. resolve(res.result)
  883. }
  884. }
  885. })
  886. })
  887. },
  888. radioChange() {
  889. this.selectedRowKeys = []
  890. this.selectedRowKeysValue = []
  891. this.selectedRowKeysNo = []
  892. this.selectedRowKeysValueNo = []
  893. this.keyValue = ''
  894. this.keyValueNo = ''
  895. },
  896. onSelectChange(selectedRowKeys, selectionRows) {
  897. this.selectedRowKeys = selectedRowKeys
  898. this.selectedRowKeysValue = selectionRows.map(item => {
  899. return { orientationId: item.orientationId, orientationName: item.orientationName }
  900. })
  901. },
  902. getCheckboxProps(record) {
  903. return {
  904. props: {
  905. disabled: this.selectedRowKeysValueNo.some(item => item.orientationId === record.orientationId)
  906. }
  907. }
  908. },
  909. onSelectChangeNo(selectedRowKeys, selectionRows) {
  910. this.selectedRowKeysNo = selectedRowKeys
  911. this.selectedRowKeysValueNo = selectionRows.map(item => {
  912. return { orientationId: item.orientationId, orientationName: item.orientationName }
  913. })
  914. },
  915. getCheckboxPropsNo(record) {
  916. return {
  917. props: {
  918. disabled: this.selectedRowKeysValue.some(item => item.orientationId === record.orientationId)
  919. }
  920. }
  921. },
  922. okSelect() {
  923. this.keyValue = ''
  924. this.topMiddle = false
  925. for (let i = 0; i < this.selectedRowKeysValue.length; i++) {
  926. this.keyValue += this.selectedRowKeysValue[i].orientationName + ' '
  927. }
  928. },
  929. okSelectNo() {
  930. this.keyValueNo = ''
  931. this.topMiddleNo = false
  932. for (let i = 0; i < this.selectedRowKeysValueNo.length; i++) {
  933. this.keyValueNo += this.selectedRowKeysValueNo[i].orientationName + ' '
  934. }
  935. },
  936. getAge(e) {
  937. this.allForm.noAgeBreak = e.target.checked
  938. },
  939. getGender(e) {
  940. this.allForm.noGenderBreak = e.target.checked
  941. },
  942. getArea(e) {
  943. this.allForm.noAreaBreak = e.target.checked
  944. },
  945. getRegion(data) {
  946. this.$refs.cascaderRegion.getCheckedNodes()
  947. var dataName = this.$refs.cascaderRegion.getCheckedNodes()
  948. var jsonArr = data
  949. for (let i = 0; i < dataName.length; i++) {
  950. for (let j = 0; j < data.length; j++) {
  951. if (dataName[i].children.length > 0) {
  952. if (data[j].substring(0, 2) == dataName[i].value) {
  953. jsonArr.splice(j, 1)
  954. }
  955. }
  956. }
  957. }
  958. },
  959. showAppName(appId) {
  960. var data = this.checkOptions.filter(item => {
  961. return item.appId == appId
  962. })
  963. return data[0].appName
  964. },
  965. log(appId) {
  966. var index = this.checkArr.findIndex(item => item === appId)
  967. this.checkArr.splice(index, 1)
  968. if (this.checkArr.length == 0) {
  969. this.indeterminate = false
  970. this.checkAll = false
  971. }
  972. },
  973. handleClose(e) {
  974. this.closeDialog = false
  975. },
  976. clearAll() {
  977. this.checkArr = []
  978. this.indeterminate = false
  979. this.checkAll = false
  980. },
  981. onChange(checkedList) {
  982. this.indeterminate =
  983. !!checkedList.length &&
  984. checkedList.length <
  985. this.optionsApp.map(item => {
  986. return item.appId
  987. }).length
  988. this.checkAll =
  989. checkedList.length ===
  990. this.optionsApp.map(item => {
  991. return item.appId
  992. }).length
  993. },
  994. onCheckAllChange(e) {
  995. Object.assign(this, {
  996. checkArr: e.target.checked
  997. ? this.optionsApp.map(item => {
  998. return item.appId
  999. })
  1000. : [],
  1001. indeterminate: false,
  1002. checkAll: e.target.checked
  1003. })
  1004. if (this.checkArr.length > 20) {
  1005. this.$message.error('最多选择20个APP行为')
  1006. this.checkArr = []
  1007. this.indeterminate = false
  1008. this.checkAll = false
  1009. }
  1010. // if (this.checkAll) {
  1011. // this.checkArr = []
  1012. // } else {
  1013. // this.checkArr = this.optionsApp.map(item => {
  1014. // return item.app_id
  1015. // })
  1016. // }
  1017. // this.checkAll = !this.checkAll
  1018. },
  1019. handleSubmit() {
  1020. // e.preventDefault()
  1021. this.formAll.validateFields((err, values) => {
  1022. if (!err) {
  1023. // this.checkArr
  1024. var json = {}
  1025. if (this.allForm.appType == '2') {
  1026. json.appIds = this.checkArr
  1027. }
  1028. if (this.allForm.regionType == 'limit') {
  1029. json.region = this.allForm.region.map(item => {
  1030. return item.value
  1031. })
  1032. }
  1033. var jsonData = {}
  1034. if(this.people == '3'){
  1035. if (this.targeted == '2') {
  1036. jsonData.population = this.selectedRowKeysValue.map(item => {
  1037. return item.orientationId
  1038. })
  1039. } else if (this.targeted == '3') {
  1040. jsonData.excludePopulation = this.selectedRowKeysValueNo.map(item => {
  1041. return item.orientationId
  1042. })
  1043. } else if (this.targeted == '4') {
  1044. jsonData.population = this.selectedRowKeysValue.map(item => {
  1045. return item.orientationId
  1046. })
  1047. jsonData.excludePopulation = this.selectedRowKeysValueNo.map(item => {
  1048. return item.orientationId
  1049. })
  1050. } else {
  1051. jsonData = {}
  1052. }
  1053. }
  1054. var dataJson = {
  1055. ...values,
  1056. platformOs: this.allForm.platform_os,
  1057. businessInterestType: this.allForm.businessInterestType,
  1058. isOpen: this.allForm.isOpen,
  1059. ...json,
  1060. noAgeBreak: this.allForm.noAgeBreak ? 1 : 0,
  1061. noGenderBreak: this.allForm.noGenderBreak ? 1 : 0,
  1062. noAreaBreak: this.allForm.noAreaBreak ? 1 : 0,
  1063. allForm: this.allForm,
  1064. ...jsonData
  1065. }
  1066. this.$emit('update:populationData', dataJson)
  1067. }
  1068. })
  1069. },
  1070. handleConfirmValue(rule, value, callback) {
  1071. if (Math.abs(value[0] - value[1]) < 5) {
  1072. callback('自定义年龄段需要间隔大于5岁')
  1073. }
  1074. callback()
  1075. },
  1076. manyValidator(rule, value, callback) {
  1077. if (value.length > 20) {
  1078. callback('最多只能选择20个选项')
  1079. }
  1080. callback()
  1081. },
  1082. regionChange() {
  1083. this.allForm.region = []
  1084. },
  1085. search(e) {},
  1086. put() {
  1087. var data = this.allForm.region.map(item => {
  1088. return item[1] + ''
  1089. })
  1090. var dataElse = data.map(item => {
  1091. return [item.substring(0, 2), item]
  1092. })
  1093. },
  1094. getAppAll(e) {
  1095. if (e.target.value !== '') {
  1096. getAction('/kuaishou/batch/getAppSearch', {
  1097. accountId: localStorage.getItem('accountId'),
  1098. appName: e.target.value
  1099. }).then(res => {
  1100. if (res.result) {
  1101. this.optionsApp = res.result
  1102. this.checkOptions.push(...res.result)
  1103. this.closeDialog = true
  1104. } else {
  1105. this.optionsApp = []
  1106. this.closeDialog = false
  1107. }
  1108. })
  1109. } else {
  1110. this.optionsApp = []
  1111. this.closeDialog = false
  1112. }
  1113. },
  1114. getAppType(e) {
  1115. this.optionsApp = []
  1116. this.formAll.setFieldsValue({ appInterest: [] })
  1117. this.checkArr = []
  1118. if (e.target.value == '1') {
  1119. getAction('/kuaishou/batch/getTargetList', { tagType: 'APP_INTEREST' }).then(res => {
  1120. if (res.success) {
  1121. this.optionsApp = res.result
  1122. }
  1123. })
  1124. }
  1125. },
  1126. businessInterest(e) {
  1127. this.formAll.setFieldsValue({ businessInterest: [] })
  1128. if (e.target.value == '2') {
  1129. this.getDataType('BUSINESS_INTEREST', 'businessOptions')
  1130. }
  1131. },
  1132. fansStar(e) {
  1133. if (e.target.value == '1') {
  1134. this.getDataType('FANS_STAR', 'fansStarOptions')
  1135. }
  1136. },
  1137. interestVideo(e) {
  1138. if (e.target.value == '1') {
  1139. this.getDataType('INTEREST_VIDEO', 'interestVideoOptions')
  1140. }
  1141. },
  1142. filterOption(input, option) {
  1143. return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  1144. },
  1145. getDataType(type, dataList) {
  1146. getAction('/kuaishou/batch/getTargetList', { tagType: type }).then(res => {
  1147. if (res.success) {
  1148. this[dataList] = res.result
  1149. }
  1150. })
  1151. },
  1152. getData(className) {
  1153. return this.formAll.getFieldValue(className)
  1154. }
  1155. },
  1156. mounted: function() {
  1157. this.getDataType('APP_INTEREST', 'optionsAppActive')
  1158. this.getDataType('BUSINESS_INTEREST', 'businessOptions')
  1159. this.getDataType('FANS_STAR', 'fansStarOptions')
  1160. this.getDataType('INTEREST_VIDEO', 'interestVideoOptions')
  1161. }
  1162. }
  1163. </script>
  1164. <style type="text/css">
  1165. .plug-timer-grid {
  1166. width: 100%;
  1167. }
  1168. .plug-timer-grid td,
  1169. .plug-timer-grid th {
  1170. border: 1px solid #97b4d1;
  1171. text-align: center; /*cursor:pointer;*/
  1172. font-size: 10px;
  1173. line-height: 10px;
  1174. }
  1175. .Selected {
  1176. background-color: rgb(102, 162, 243);
  1177. opacity: 0.5;
  1178. }
  1179. .plug-timer-grid {
  1180. border-collapse: collapse;
  1181. z-index: 4;
  1182. }
  1183. .plug-timer-grid thead tr {
  1184. display: table-row;
  1185. vertical-align: inherit;
  1186. border-color: inherit;
  1187. }
  1188. .group-creat table td {
  1189. height: 20px;
  1190. max-width: 5px;
  1191. border: 1px solid #dfe6ec;
  1192. font-size: 12px;
  1193. text-align: center;
  1194. vertical-align: middle;
  1195. overflow: hidden;
  1196. transition: background 0.5s;
  1197. -webkit-transition: background 0.5s;
  1198. }
  1199. .plug-timer-grid tbody th {
  1200. width: 4%;
  1201. }
  1202. .plug-timer-grid tbody tr td {
  1203. width: 2%;
  1204. }
  1205. /*.clear{*/
  1206. /* margin:20px 0px 20px 0px;*/
  1207. /*}*/
  1208. </style>